Skip to content

Commit

Permalink
chore: removed commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Palanikannan1437 committed Apr 16, 2024
1 parent bca46ea commit 0fcaec6
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions packages/editor/core/src/ui/extensions/code/code-block.ts
Original file line number Diff line number Diff line change
@@ -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 {
/**
Expand Down Expand Up @@ -333,37 +331,7 @@ export const CodeBlock = Node.create<CodeBlockOptions>({

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 = `<div>${text.replace(/\r?\n/g, "<br>")}</div>`;
// 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) {
Expand All @@ -376,12 +344,3 @@ export const CodeBlock = Node.create<CodeBlockOptions>({
];
},
});

// 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;
// }

0 comments on commit 0fcaec6

Please sign in to comment.