๐Ÿ“ Sign Up | ๐Ÿ” Log In

โ† Root | โ†‘ Up

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ ๐Ÿ“„ shadcn/directory/udecode/plate/(plugins)/(marks)/superscript.cn โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘

title: ไธŠๆ ‡ docs:

  • route: /docs/components/mark-toolbar-button title: ๆ ‡่ฎฐๅทฅๅ…ทๆ ๆŒ‰้’ฎ

<ComponentPreview name="basic-marks-demo" /> <PackageInfo>

็‰นๆ€ง

  • ๅฐ†ๆ–‡ๆœฌๆ ผๅผๅŒ–ไธบไธŠๆ ‡๏ผŒ้€‚็”จไบŽๆ•ฐๅญฆ่กจ่พพๅผๆˆ–่„šๆณจ
  • ๆ”ฏๆŒ้”ฎ็›˜ๅฟซๆท้”ฎๅฟซ้€Ÿๆ ผๅผๅŒ–
  • ้ป˜่ฎคๆธฒๆŸ“ไธบ <sup> HTML ๅ…ƒ็ด 
</PackageInfo>

ๅฅ—ไปถไฝฟ็”จๆ–นๅผ

<Steps>

ๅฎ‰่ฃ…

ๆœ€ๅฟซๆทๆทปๅŠ ไธŠๆ ‡ๆ’ไปถ็š„ๆ–นๅผๆ˜ฏไฝฟ็”จ BasicMarksKit๏ผŒๅฎƒๅŒ…ๅซ้ข„้…็ฝฎ็š„ SuperscriptPlugin ไปฅๅŠๅ…ถไป–ๅŸบ็ก€ๆ ‡่ฎฐๅ’Œๅฎƒไปฌ็š„ Plate UI ็ป„ไปถใ€‚

<ComponentSource name="basic-marks-kit" />

ๆทปๅŠ ๅฅ—ไปถ

ๅฐ†ๅฅ—ไปถๆทปๅŠ ๅˆฐไฝ ็š„ๆ’ไปถไธญ๏ผš

import { createPlateEditor } from 'platejs/react';
import { BasicMarksKit } from '@/components/editor/plugins/basic-marks-kit';

const editor = createPlateEditor({
  plugins: [
    // ...ๅ…ถไป–ๆ’ไปถ,
    ...BasicMarksKit,
  ],
});
</Steps>

ๆ‰‹ๅŠจไฝฟ็”จๆ–นๅผ

<Steps>

ๅฎ‰่ฃ…

npm install @platejs/basic-nodes

ๆทปๅŠ ๆ’ไปถ

ๅœจๅˆ›ๅปบ็ผ–่พ‘ๅ™จๆ—ถ๏ผŒๅฐ† SuperscriptPlugin ๅŒ…ๅซๅˆฐ Plate ๆ’ไปถๆ•ฐ็ป„ไธญใ€‚

import { SuperscriptPlugin } from '@platejs/basic-nodes/react';
import { createPlateEditor } from 'platejs/react';

const editor = createPlateEditor({
  plugins: [
    // ...ๅ…ถไป–ๆ’ไปถ,
    SuperscriptPlugin,
  ],
});

้…็ฝฎๆ’ไปถ

ไฝ ๅฏไปฅไธบ SuperscriptPlugin ้…็ฝฎ่‡ชๅฎšไน‰้”ฎ็›˜ๅฟซๆท้”ฎใ€‚

import { SuperscriptPlugin } from '@platejs/basic-nodes/react';
import { createPlateEditor } from 'platejs/react';

const editor = createPlateEditor({
  plugins: [
    // ...ๅ…ถไป–ๆ’ไปถ,
    SuperscriptPlugin.configure({
      shortcuts: { toggle: { keys: 'mod+period' } },
    }),
  ],
});
  • shortcuts.toggle: ๅฎšไน‰็”จไบŽๅˆ‡ๆขไธŠๆ ‡ๆ ผๅผ็š„้”ฎ็›˜ๅฟซๆท้”ฎใ€‚

ๆทปๅŠ ๅทฅๅ…ทๆ ๆŒ‰้’ฎ

ไฝ ๅฏไปฅๅ‘ๅทฅๅ…ทๆ ๆทปๅŠ  MarkToolbarButton ๆฅๅˆ‡ๆขไธŠๆ ‡ๆ ผๅผใ€‚

</Steps>

ๆ’ไปถ

SuperscriptPlugin

็”จไบŽไธŠๆ ‡ๆ–‡ๆœฌๆ ผๅผๅŒ–็š„ๆ’ไปถใ€‚้ป˜่ฎคๆธฒๆŸ“ไธบ <sup> HTML ๅ…ƒ็ด ใ€‚

่ฝฌๆขๆ“ไฝœ

tf.superscript.toggle

ไธบ้€‰ไธญ็š„ๆ–‡ๆœฌๅˆ‡ๆขไธŠๆ ‡ๆ ผๅผใ€‚

โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ† Root | โ†‘ Up