(props: TArgs)
| 15 | }; |
| 16 | |
| 17 | export const CoreEditorProps = (props: TArgs): EditorProps => { |
| 18 | const { editorClassName } = props; |
| 19 | |
| 20 | return { |
| 21 | attributes: { |
| 22 | class: cn( |
| 23 | "prose-brand prose-headings:font-display font-default max-w-full prose focus:outline-none", |
| 24 | editorClassName |
| 25 | ), |
| 26 | }, |
| 27 | handleDOMEvents: { |
| 28 | keydown: (_view, event) => { |
| 29 | // prevent default event listeners from firing when slash command is active |
| 30 | if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) { |
| 31 | const slashCommand = document.querySelector("#slash-command"); |
| 32 | if (slashCommand) { |
| 33 | return true; |
| 34 | } |
| 35 | } |
| 36 | }, |
| 37 | }, |
| 38 | handlePaste: (view, event) => { |
| 39 | if (!event.clipboardData) return false; |
| 40 | |
| 41 | const htmlContent = event.clipboardData.getData("text/plane-editor-html"); |
| 42 | if (!htmlContent) return false; |
| 43 | |
| 44 | const { processedHtml } = processAssetDuplication(htmlContent); |
| 45 | view.pasteHTML(processedHtml); |
| 46 | return true; |
| 47 | }, |
| 48 | }; |
| 49 | }; |
no test coverage detected