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

โ† Root | โ†‘ Up

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

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

title: ๅŠ ็ฒ— docs:

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

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

ๅŠŸ่ƒฝ็‰นๆ€ง

  • ๅบ”็”จๅŠ ็ฒ—ๆ ผๅผไปฅๅผบ่ฐƒ้‡่ฆๆ–‡ๆœฌ
  • ๆ”ฏๆŒๅฟซๆท้”ฎๅฟซ้€Ÿๆ ผๅผๅŒ– (Cmd + B)
  • ้ป˜่ฎคๆธฒๆŸ“ไธบ <strong> HTML ๅ…ƒ็ด 
</PackageInfo>

ๅฅ—ไปถไฝฟ็”จ

<Steps>

ๅฎ‰่ฃ…

ๆœ€ๅฟซๆท็š„ๆทปๅŠ ๅŠ ็ฒ—ๆ’ไปถๆ–นๅผๆ˜ฏไฝฟ็”จ BasicMarksKit๏ผŒ่ฏฅๅฅ—ไปถๅŒ…ๅซ้ข„้…็ฝฎ็š„ BoldPlugin ไปฅๅŠๅ…ถไป–ๅŸบ็ก€ๆ ‡่ฎฐๅŠๅ…ถ 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

ๆทปๅŠ ๆ’ไปถ

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

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

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

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

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

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

const editor = createPlateEditor({
  plugins: [
    // ...ๅ…ถไป–ๆ’ไปถ,
    BoldPlugin.configure({
      shortcuts: { toggle: 'mod+b' },
    }),
  ],
});
  • shortcuts.toggle: ๅฎšไน‰ๅˆ‡ๆขๅŠ ็ฒ—ๆ ผๅผ็š„้”ฎ็›˜ๅฟซๆท้”ฎ

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

ไฝ ๅฏไปฅๅฐ† MarkToolbarButton ๆทปๅŠ ๅˆฐๅทฅๅ…ทๆ ๆฅๅˆ‡ๆขๅŠ ็ฒ—ๆ ผๅผใ€‚

</Steps>

ๆ’ไปถ

BoldPlugin

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

่ฝฌๆขๆ–นๆณ•

tf.bold.toggle

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

้ป˜่ฎคๅฟซๆท้”ฎ: Cmd + B

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

โ† Root | โ†‘ Up