mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 11:32:37 +10:00
feat: mermaid diagram integration (#202)
This commit is contained in:
@ -10,3 +10,5 @@ export * from "./lib/callout";
|
||||
export * from "./lib/media-utils";
|
||||
export * from "./lib/link";
|
||||
export * from "./lib/selection";
|
||||
export * from "./lib/custom-code-block"
|
||||
|
||||
|
||||
25
packages/editor-ext/src/lib/custom-code-block.ts
Normal file
25
packages/editor-ext/src/lib/custom-code-block.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import CodeBlockLowlight, {
|
||||
CodeBlockLowlightOptions,
|
||||
} from "@tiptap/extension-code-block-lowlight";
|
||||
import { ReactNodeViewRenderer } from "@tiptap/react";
|
||||
|
||||
export interface CustomCodeBlockOptions extends CodeBlockLowlightOptions {
|
||||
view: any;
|
||||
}
|
||||
|
||||
export const CustomCodeBlock = CodeBlockLowlight.extend<CustomCodeBlockOptions>(
|
||||
{
|
||||
selectable: true,
|
||||
|
||||
addOptions() {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
view: null,
|
||||
};
|
||||
},
|
||||
|
||||
addNodeView() {
|
||||
return ReactNodeViewRenderer(this.options.view);
|
||||
},
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user