feat(editor): add diffsourcePlugin

This commit is contained in:
enes 2025-01-15 17:05:12 +01:00
parent 3f80f9e0ce
commit 094b7349b3

View File

@ -4,6 +4,8 @@ import {
codeBlockPlugin, codeBlockPlugin,
CodeToggle, CodeToggle,
CreateLink, CreateLink,
diffSourcePlugin,
DiffSourceToggleWrapper,
directivesPlugin, directivesPlugin,
headingsPlugin, headingsPlugin,
imagePlugin, imagePlugin,
@ -68,34 +70,42 @@ export const Editor = React.memo(
() => [ () => [
toolbarPlugin({ toolbarPlugin({
toolbarContents: () => ( toolbarContents: () => (
<> <DiffSourceToggleWrapper
<UndoRedo /> children={
<Separator /> <>
<BoldItalicUnderlineToggles /> <UndoRedo />
<CodeToggle /> <Separator />
<Separator /> <BoldItalicUnderlineToggles />
<StrikeThroughSupSubToggles /> <CodeToggle />
<Separator /> <Separator />
<ListsToggle /> <StrikeThroughSupSubToggles />
<Separator /> <Separator />
<BlockTypeSelect /> <ListsToggle />
<Separator /> <Separator />
<BlockTypeSelect />
<Separator />
<CreateLink /> <CreateLink />
<InsertImage /> <InsertImage />
<YouTubeButton /> <YouTubeButton />
<Separator /> <Separator />
<InsertTable /> <InsertTable />
<InsertThematicBreak /> <InsertThematicBreak />
<Separator /> <Separator />
<InsertCodeBlock /> <InsertCodeBlock />
</> </>
}
/>
) )
}), }),
headingsPlugin(), headingsPlugin(),
diffSourcePlugin({
viewMode: 'rich-text',
diffMarkdown: markdown
}),
quotePlugin(), quotePlugin(),
imagePlugin({ imagePlugin({
ImageDialog: ImageDialog ImageDialog: ImageDialog
@ -118,6 +128,7 @@ export const Editor = React.memo(
codeBlockEditorDescriptors: [PlainTextCodeEditorDescriptor] codeBlockEditorDescriptors: [PlainTextCodeEditorDescriptor]
}) })
], ],
// eslint-disable-next-line react-hooks/exhaustive-deps
[] []
) )