]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/ui/framework/blocks/link-field.ts
Merge pull request #5725 from BookStackApp/md_plaintext
[bookstack] / resources / js / wysiwyg / ui / framework / blocks / link-field.ts
index 5a64cdc30fcbcf2ce2a1d33b85ab2b059f314624..880238a9a4cf4cdabedf3f0ebda329c7427845d5 100644 (file)
@@ -1,14 +1,13 @@
 import {EditorContainerUiElement} from "../core";
 import {el} from "../../../utils/dom";
 import {EditorFormField} from "../forms";
-import {CustomHeadingNode} from "../../../nodes/custom-heading";
 import {$getAllNodesOfType} from "../../../utils/nodes";
-import {$isHeadingNode} from "@lexical/rich-text";
 import {uniqueIdSmall} from "../../../../services/util";
+import {$isHeadingNode, HeadingNode} from "@lexical/rich-text/LexicalHeadingNode";
 
 export class LinkField extends EditorContainerUiElement {
     protected input: EditorFormField;
-    protected headerMap = new Map<string, CustomHeadingNode>();
+    protected headerMap = new Map<string, HeadingNode>();
 
     constructor(input: EditorFormField) {
         super([input]);
@@ -43,9 +42,8 @@ export class LinkField extends EditorContainerUiElement {
         return container;
     }
 
-    updateFormFromHeader(header: CustomHeadingNode) {
+    updateFormFromHeader(header: HeadingNode) {
         this.getHeaderIdAndText(header).then(({id, text}) => {
-            console.log('updating form', id, text);
             const modal =  this.getContext().manager.getActiveModal('link');
             if (modal) {
                 modal.getForm().setValues({
@@ -57,11 +55,10 @@ export class LinkField extends EditorContainerUiElement {
         });
     }
 
-    getHeaderIdAndText(header: CustomHeadingNode): Promise<{id: string, text: string}> {
+    getHeaderIdAndText(header: HeadingNode): Promise<{id: string, text: string}> {
         return new Promise((res) => {
             this.getContext().editor.update(() => {
                 let id = header.getId();
-                console.log('header', id, header.__id);
                 if (!id) {
                     id = 'header-' + uniqueIdSmall();
                     header.setId(id);
@@ -75,7 +72,7 @@ export class LinkField extends EditorContainerUiElement {
 
     updateDataList(listEl: HTMLElement) {
         this.getContext().editor.getEditorState().read(() => {
-            const headers = $getAllNodesOfType($isHeadingNode) as CustomHeadingNode[];
+            const headers = $getAllNodesOfType($isHeadingNode) as HeadingNode[];
 
             this.headerMap.clear();
             const listEls: HTMLElement[] = [];