From 14d27bb2777cd0e9e69e145dd962952421a32004 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 8 Jun 2023 15:59:24 +0500 Subject: [PATCH] editor: remove duplicate ordered-list methods --- .../extensions/ordered-list/ordered-list.ts | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/packages/editor/src/extensions/ordered-list/ordered-list.ts b/packages/editor/src/extensions/ordered-list/ordered-list.ts index 19f4444e7..7a45a1f39 100644 --- a/packages/editor/src/extensions/ordered-list/ordered-list.ts +++ b/packages/editor/src/extensions/ordered-list/ordered-list.ts @@ -17,9 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { mergeAttributes, wrappingInputRule } from "@tiptap/core"; import TiptapOrderedList from "@tiptap/extension-ordered-list"; -const inputRegex = /^(\d+)\.\s$/; export const OrderedList = TiptapOrderedList.extend({ addAttributes() { @@ -39,44 +37,5 @@ export const OrderedList = TiptapOrderedList.extend({ } } }; - }, - - renderHTML({ HTMLAttributes }) { - const { start, ...attributesWithoutStart } = HTMLAttributes; - console.log("render!", HTMLAttributes); - return start === 1 - ? [ - "ol", - mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), - 0 - ] - : ["ol", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]; - }, - - addInputRules() { - const inputRule = wrappingInputRule({ - find: inputRegex, - type: this.type, - getAttributes: (match) => ({ start: +match[1] }), - joinPredicate: (match, node) => - node.childCount + node.attrs.start === +match[1] - }); - - // if (this.options.keepMarks || this.options.keepAttributes) { - // inputRule = wrappingInputRule({ - // find: inputRegex, - // type: this.type, - // keepMarks: this.options.keepMarks, - // keepAttributes: this.options.keepAttributes, - // getAttributes: (match) => ({ - // start: +match[1], - // ...this.editor.getAttributes(TextStyle.name) - // }), - // joinPredicate: (match, node) => - // node.childCount + node.attrs.start === +match[1], - // editor: this.editor - // }); - // } - return [inputRule]; } });