From 0fcaec6093adf8c69d15ca4c1d42c9085b0130e5 Mon Sep 17 00:00:00 2001 From: Palanikannan1437 <73993394+Palanikannan1437@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:54:02 +0530 Subject: [PATCH] chore: removed commented out code --- .../core/src/ui/extensions/code/code-block.ts | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/packages/editor/core/src/ui/extensions/code/code-block.ts b/packages/editor/core/src/ui/extensions/code/code-block.ts index abb67b45b23..b2218ee45ce 100644 --- a/packages/editor/core/src/ui/extensions/code/code-block.ts +++ b/packages/editor/core/src/ui/extensions/code/code-block.ts @@ -1,7 +1,5 @@ import { mergeAttributes, Node, textblockTypeInputRule } from "@tiptap/core"; import { Plugin, PluginKey } from "@tiptap/pm/state"; -// import { DOMParser } from "@tiptap/pm/model"; -// import { EditorView } from "@tiptap/pm/view"; export interface CodeBlockOptions { /** @@ -333,37 +331,7 @@ export const CodeBlock = Node.create({ return false; } else { - // // complicated paste logic, to be handled later - // const containsNewline = text.includes("\n"); - // const isCurrentLineEmptyNode = isCurrentLineEmpty(view); - // if (!containsNewline) { - // console.log("run contians n"); - // return false; - // } - // - // // Wrap the text in a div - // const html = `
${text.replace(/\r?\n/g, "
")}
`; - // let insertPos = view.state.selection.from; - // - // // Parse the HTML string to a ProseMirror document fragment - // const div = document.createElement("div"); - // div.innerHTML = html; - // const domNode = div.firstChild; - // if (!domNode) { - // return false; - // } - // const fragment = DOMParser.fromSchema(view.state.schema).parse(domNode); - // - // if (isCurrentLineEmptyNode) { - // // If the current line is empty, use the current position - // insertPos = view.state.selection.from - 1; - // } - // - // // Insert the fragment into the document - // const transaction = view.state.tr.insert(insertPos, fragment); - // view.dispatch(transaction); - // - // return true; + // TODO: complicated paste logic, to be handled later return false; } } catch (error) { @@ -376,12 +344,3 @@ export const CodeBlock = Node.create({ ]; }, }); - -// function isCurrentLineEmpty(view: EditorView) { -// const { $from } = view.state.selection; -// const blockNode = $from.node($from.depth); // Get the block node at the current selection depth -// -// const isEmpty = !blockNode.textContent.trim(); -// -// return isEmpty; -// }