From bb9b59f7f56867fd54ec264a8c2c6f3cc9d9c227 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Fri, 8 Jul 2022 11:58:24 -0400 Subject: [PATCH 1/7] start work moving tag-link rendering to schema --- src/rich-text/editor.ts | 4 ++-- src/rich-text/node-views/tag-link.ts | 1 + src/rich-text/schema.ts | 6 ++++++ src/shared/markdown-it/tag-link.ts | 22 ++++++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/rich-text/editor.ts b/src/rich-text/editor.ts index 3b02da00..343c6d8f 100644 --- a/src/rich-text/editor.ts +++ b/src/rich-text/editor.ts @@ -158,8 +158,8 @@ export class RichTextEditor extends BaseView { ) { return new ImageView(node, view, getPos); }, - tagLink(node: ProseMirrorNode) { - return new TagLink(node, tagLinkOptions); + tagLink: (node, view, getPos) => { + return new TagLink(node, view, getPos, tagLinkOptions); }, html_block: function (node: ProseMirrorNode) { return new HtmlBlock(node); diff --git a/src/rich-text/node-views/tag-link.ts b/src/rich-text/node-views/tag-link.ts index 07f8866a..f46a6b1c 100644 --- a/src/rich-text/node-views/tag-link.ts +++ b/src/rich-text/node-views/tag-link.ts @@ -3,6 +3,7 @@ import { NodeView } from "prosemirror-view"; import { error } from "../../shared/logger"; import { TagLinkOptions } from "../../shared/view"; +// TODO REMOVE // TODO instead of a NodeView, should we use marks and an editor like `link-tooltip`? export class TagLink implements NodeView { dom: HTMLElement | null; diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index 635c53a4..b71b2ae6 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -433,6 +433,12 @@ const nodes: { attrs: { tagName: { default: null }, tagType: { default: "tag" }, + href: { default: null }, + title: { default: null }, + additionalClasses: { default: null }, + }, + toDOM(node) { + // TODO }, }, }; diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index a2e73b92..fcafcd2f 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -53,6 +53,28 @@ function parse_tag_link( let token = state.push("tag_link_open", "a", 1); token.attrSet("tagName", tagName); token.attrSet("tagType", isMeta ? "meta-tag" : "tag"); + + // call the renderer as if it exists + if (options.renderer) { + const rendered = options.renderer(tagName, isMeta); + + // the renderer failed to return the bare minimum necessary to link the tag + // log an error to the console, but don't crash the user input + // if (!rendered || !rendered?.link) { + // error( + // "TagLink NodeView", + // "Unable to render taglink due to invalid response from options.renderer: ", + // rendered + // ); + // return; + // } + + const additionalClasses = rendered.additionalClasses || []; + token.attrSet("href", rendered.link); + token.attrSet("title", rendered.linkTitle); + token.attrSet("additionalClasses", additionalClasses.join(" ")); + } + token.content = totalContent; token = state.push("text", "", 0); From 8ff7d1de8715c044dde8aa1fc51b959b93e193b7 Mon Sep 17 00:00:00 2001 From: Adam Lear Date: Fri, 8 Jul 2022 14:54:48 -0400 Subject: [PATCH 2/7] wire up the rest of the switch from NodeView to ToDOM() --- src/rich-text/editor.ts | 5 ---- src/rich-text/node-views/tag-link.ts | 41 ---------------------------- src/rich-text/schema.ts | 19 +++++++++---- src/shared/markdown-it/tag-link.ts | 4 +-- src/shared/markdown-parser.ts | 5 +++- 5 files changed, 18 insertions(+), 56 deletions(-) delete mode 100644 src/rich-text/node-views/tag-link.ts diff --git a/src/rich-text/editor.ts b/src/rich-text/editor.ts index 343c6d8f..a93489a7 100644 --- a/src/rich-text/editor.ts +++ b/src/rich-text/editor.ts @@ -29,7 +29,6 @@ import { stackOverflowMarkdownSerializer } from "../shared/markdown-serializer"; import { CodeBlockView } from "./node-views/code-block"; import { HtmlBlock, HtmlBlockContainer } from "./node-views/html-block"; import { ImageView } from "./node-views/image"; -import { TagLink } from "./node-views/tag-link"; import { richTextCodePasteHandler } from "../shared/prosemirror-plugins/code-paste-handler"; import { linkPasteHandler } from "./plugins/link-paste-handler"; import { linkPreviewPlugin, LinkPreviewProvider } from "./plugins/link-preview"; @@ -97,7 +96,6 @@ export class RichTextEditor extends BaseView { this.options.menuParentContainer ); - const tagLinkOptions = this.options.parserFeatures.tagLinks; this.editorView = new EditorView( (node: HTMLElement) => { node.classList.add(...(this.options.classList || [])); @@ -158,9 +156,6 @@ export class RichTextEditor extends BaseView { ) { return new ImageView(node, view, getPos); }, - tagLink: (node, view, getPos) => { - return new TagLink(node, view, getPos, tagLinkOptions); - }, html_block: function (node: ProseMirrorNode) { return new HtmlBlock(node); }, diff --git a/src/rich-text/node-views/tag-link.ts b/src/rich-text/node-views/tag-link.ts deleted file mode 100644 index f46a6b1c..00000000 --- a/src/rich-text/node-views/tag-link.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Node as ProsemirrorNode } from "prosemirror-model"; -import { NodeView } from "prosemirror-view"; -import { error } from "../../shared/logger"; -import { TagLinkOptions } from "../../shared/view"; - -// TODO REMOVE -// TODO instead of a NodeView, should we use marks and an editor like `link-tooltip`? -export class TagLink implements NodeView { - dom: HTMLElement | null; - - constructor(node: ProsemirrorNode, options: TagLinkOptions) { - this.dom = document.createElement("a"); - this.dom.setAttribute("href", "#"); - this.dom.setAttribute("rel", "tag"); - this.dom.classList.add("s-tag"); - this.dom.innerText = node.attrs.tagName as string; - - if (options?.renderer) { - const rendered = options.renderer( - node.attrs.tagName, - node.attrs.tagType === "meta-tag" - ); - - // the renderer failed to return the bare minimum necessary to link the tag - // log an error to the console, but don't crash the user input - if (!rendered || !rendered?.link) { - error( - "TagLink NodeView", - "Unable to render taglink due to invalid response from options.renderer: ", - rendered - ); - return; - } - - const additionalClasses = rendered.additionalClasses || []; - additionalClasses.forEach((c) => this.dom.classList.add(c)); - this.dom.setAttribute("href", rendered.link); - this.dom.setAttribute("title", rendered.linkTitle); - } - } -} diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index b71b2ae6..0bb67896 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -423,22 +423,29 @@ const nodes: { }, }, - // TODO should this be a mark instead? tagLink: { content: "text*", - marks: "", // TODO should it accept marks? + marks: "", atom: true, // TODO allow this to be editable inline: true, group: "inline", attrs: { - tagName: { default: null }, - tagType: { default: "tag" }, + tagName: { default: null }, // TODO: remove? + tagType: { default: "tag" }, // TODO: remove? href: { default: null }, title: { default: null }, - additionalClasses: { default: null }, + additionalClasses: { default: "" }, }, toDOM(node) { - // TODO + return [ + "a", + { + href: node.attrs.href as string, + title: node.attrs.title as string, + class: "s-tag " + node.attrs.additionalClasses + }, + node.attrs.tagName + ]; }, }, }; diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index fcafcd2f..bedcaf86 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -38,7 +38,7 @@ function parse_tag_link( return false; } - const tagName = totalContent.slice(isMeta ? 10 : 5, -1); + const tagName = totalContent.slice(isMeta ? 10 : 5, -1).trim(); // check that the tag name follows specific rules TODO better docs const validationRegex = options.allowNonAscii @@ -75,8 +75,6 @@ function parse_tag_link( token.attrSet("additionalClasses", additionalClasses.join(" ")); } - token.content = totalContent; - token = state.push("text", "", 0); token.content = tagName; diff --git a/src/shared/markdown-parser.ts b/src/shared/markdown-parser.ts index 62843865..72b3b617 100644 --- a/src/shared/markdown-parser.ts +++ b/src/shared/markdown-parser.ts @@ -113,10 +113,13 @@ const customMarkdownParserTokens: MarkdownParser["tokens"] = { }, tag_link: { - block: "tagLink", + block: "tagLink", // TODO: rename to "tag_link" to match others? getAttrs: (tok: Token) => ({ tagName: tok.attrGet("tagName"), tagType: tok.attrGet("tagType"), + href: tok.attrGet("href"), + additionalClasses: tok.attrGet("additionalClasses"), + title: tok.attrGet("title") }), }, From 5f8f4c9614b4b16ec49ed4db93066fc097b5bddc Mon Sep 17 00:00:00 2001 From: Adam Lear Date: Wed, 13 Jul 2022 16:48:46 -0400 Subject: [PATCH 3/7] implement parseDOM for tag links --- src/rich-text/schema.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index 0bb67896..77f505f4 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -430,16 +430,32 @@ const nodes: { inline: true, group: "inline", attrs: { - tagName: { default: null }, // TODO: remove? - tagType: { default: "tag" }, // TODO: remove? + tagName: { default: null }, + tagType: { default: "tag" }, href: { default: null }, title: { default: null }, additionalClasses: { default: "" }, }, + parseDOM: [ + { + tag: "a.s-tag", + getAttrs(dom: HTMLElement) { + dom.classList.remove("s-tag"); + return { + href: dom.getAttribute("href"), + title: dom.getAttribute("title"), + additionalClasses: Array.from(dom.classList).join(" "), + tagType: dom.getAttribute("tagtype"), + tagName: dom.textContent, + } + }, + }, + ], toDOM(node) { return [ "a", { + tagType: node.attrs.tagType, href: node.attrs.href as string, title: node.attrs.title as string, class: "s-tag " + node.attrs.additionalClasses @@ -492,7 +508,7 @@ const marks: { }, parseDOM: [ { - tag: "a[href]", + tag: "a[href]:not(.s-tag)", getAttrs(dom: HTMLElement) { return { href: dom.getAttribute("href"), From 41e81265756886aaf5ad9578cfabf1ec9cbbaf5e Mon Sep 17 00:00:00 2001 From: Adam Lear Date: Wed, 13 Jul 2022 17:14:21 -0400 Subject: [PATCH 4/7] log an error in case of rendering issues --- src/shared/markdown-it/tag-link.ts | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index bedcaf86..13d822d3 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -58,21 +58,17 @@ function parse_tag_link( if (options.renderer) { const rendered = options.renderer(tagName, isMeta); - // the renderer failed to return the bare minimum necessary to link the tag - // log an error to the console, but don't crash the user input - // if (!rendered || !rendered?.link) { - // error( - // "TagLink NodeView", - // "Unable to render taglink due to invalid response from options.renderer: ", - // rendered - // ); - // return; - // } - - const additionalClasses = rendered.additionalClasses || []; - token.attrSet("href", rendered.link); - token.attrSet("title", rendered.linkTitle); - token.attrSet("additionalClasses", additionalClasses.join(" ")); + if (rendered && rendered.link) { + const additionalClasses = rendered.additionalClasses || []; + token.attrSet("href", rendered.link); + token.attrSet("title", rendered.linkTitle); + token.attrSet("additionalClasses", additionalClasses.join(" ")); + } + else { + // We don't want to crash the parsing process here since we can still display a passable version of the tag link. + // However, we should at least log a console error. + console.error(`Unable to fully render taglink for [${tagName}] due to invalid response from options.renderer.`); + } } token = state.push("text", "", 0); From 3879b30d7bcbf49f7fcccc6c27da7ec29feb037d Mon Sep 17 00:00:00 2001 From: Adam Lear Date: Wed, 13 Jul 2022 17:24:03 -0400 Subject: [PATCH 5/7] make the linter happy --- src/rich-text/schema.ts | 4 ++-- src/shared/markdown-it/tag-link.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index 77f505f4..a652ec38 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -455,10 +455,10 @@ const nodes: { return [ "a", { - tagType: node.attrs.tagType, + tagType: node.attrs.tagType as string, href: node.attrs.href as string, title: node.attrs.title as string, - class: "s-tag " + node.attrs.additionalClasses + class: `s-tag ${node.attrs.additionalClasses as string}` }, node.attrs.tagName ]; diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index 13d822d3..06cfcb13 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -67,6 +67,7 @@ function parse_tag_link( else { // We don't want to crash the parsing process here since we can still display a passable version of the tag link. // However, we should at least log a console error. + // eslint-disable-next-line no-console console.error(`Unable to fully render taglink for [${tagName}] due to invalid response from options.renderer.`); } } From cf4b733a2a83bd306d2540849037407637871302 Mon Sep 17 00:00:00 2001 From: Adam Lear Date: Wed, 13 Jul 2022 17:29:03 -0400 Subject: [PATCH 6/7] make prettier happy --- src/rich-text/schema.ts | 8 ++++---- src/shared/markdown-it/tag-link.ts | 7 ++++--- src/shared/markdown-parser.ts | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index a652ec38..0b338900 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -436,7 +436,7 @@ const nodes: { title: { default: null }, additionalClasses: { default: "" }, }, - parseDOM: [ + parseDOM: [ { tag: "a.s-tag", getAttrs(dom: HTMLElement) { @@ -447,7 +447,7 @@ const nodes: { additionalClasses: Array.from(dom.classList).join(" "), tagType: dom.getAttribute("tagtype"), tagName: dom.textContent, - } + }; }, }, ], @@ -458,9 +458,9 @@ const nodes: { tagType: node.attrs.tagType as string, href: node.attrs.href as string, title: node.attrs.title as string, - class: `s-tag ${node.attrs.additionalClasses as string}` + class: `s-tag ${node.attrs.additionalClasses as string}`, }, - node.attrs.tagName + node.attrs.tagName, ]; }, }, diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index 06cfcb13..6c83b5fd 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -63,12 +63,13 @@ function parse_tag_link( token.attrSet("href", rendered.link); token.attrSet("title", rendered.linkTitle); token.attrSet("additionalClasses", additionalClasses.join(" ")); - } - else { + } else { // We don't want to crash the parsing process here since we can still display a passable version of the tag link. // However, we should at least log a console error. // eslint-disable-next-line no-console - console.error(`Unable to fully render taglink for [${tagName}] due to invalid response from options.renderer.`); + console.error( + `Unable to fully render taglink for [${tagName}] due to invalid response from options.renderer.` + ); } } diff --git a/src/shared/markdown-parser.ts b/src/shared/markdown-parser.ts index 72b3b617..bde0fa34 100644 --- a/src/shared/markdown-parser.ts +++ b/src/shared/markdown-parser.ts @@ -119,7 +119,7 @@ const customMarkdownParserTokens: MarkdownParser["tokens"] = { tagType: tok.attrGet("tagType"), href: tok.attrGet("href"), additionalClasses: tok.attrGet("additionalClasses"), - title: tok.attrGet("title") + title: tok.attrGet("title"), }), }, From 0601f85945bf214e74f883bab107cdd070812e42 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Tue, 30 Aug 2022 13:30:46 -0400 Subject: [PATCH 7/7] rename tagLink block to tag_link --- src/commonmark/commands.ts | 4 ++-- src/rich-text/commands/index.ts | 6 +++--- src/rich-text/schema.ts | 2 +- src/shared/markdown-it/tag-link.ts | 4 ++-- src/shared/markdown-parser.ts | 2 +- src/shared/markdown-serializer.ts | 2 +- src/shared/menu/entries.ts | 4 ++-- test/rich-text/commands/index.test.ts | 14 +++++++------- test/shared/markdown-parser.test.ts | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/commonmark/commands.ts b/src/commonmark/commands.ts index 25b3acf6..b1950bca 100644 --- a/src/commonmark/commands.ts +++ b/src/commonmark/commands.ts @@ -620,9 +620,9 @@ export function insertCommonmarkLinkCommand( } /** - * Inserts a tagLink at the cursor, optionally placing it around the currently selected text if able + * Inserts a tag_link at the cursor, optionally placing it around the currently selected text if able * @param validate The validation method that will be used to validate the selected text - * @param isMetaTag Whether or not the inserted tagLink is for a meta tag + * @param isMetaTag Whether or not the inserted tag_link is for a meta tag */ export function insertTagLinkCommand( validate: TagLinkOptions["validate"], diff --git a/src/rich-text/commands/index.ts b/src/rich-text/commands/index.ts index 741da2dd..a3d7c869 100644 --- a/src/rich-text/commands/index.ts +++ b/src/rich-text/commands/index.ts @@ -272,7 +272,7 @@ function getHeadingLevel(state: EditorState): number { } /** - * Creates a command that toggles tagLink formatting for a node + * Creates a command that toggles tag_link formatting for a node * @param validate The function to validate the tagName with * @param isMetaTag Whether the tag to be created is a meta tag or not */ @@ -294,7 +294,7 @@ export function toggleTagLinkCommand( } let tr = state.tr; - const nodeCheck = nodeTypeActive(state.schema.nodes.tagLink); + const nodeCheck = nodeTypeActive(state.schema.nodes.tag_link); if (nodeCheck(state)) { const selectedText = state.selection.content().content.firstChild .attrs["tagName"] as string; @@ -314,7 +314,7 @@ export function toggleTagLinkCommand( return false; } - const newTagNode = state.schema.nodes.tagLink.create({ + const newTagNode = state.schema.nodes.tag_link.create({ tagName: selectedText.trim(), tagType: isMetaTag ? "meta-tag" : "tag", }); diff --git a/src/rich-text/schema.ts b/src/rich-text/schema.ts index 3086ba82..208f61a9 100644 --- a/src/rich-text/schema.ts +++ b/src/rich-text/schema.ts @@ -425,7 +425,7 @@ const nodes: { }, }, - tagLink: { + tag_link: { content: "text*", marks: "", atom: true, // TODO allow this to be editable diff --git a/src/shared/markdown-it/tag-link.ts b/src/shared/markdown-it/tag-link.ts index 09b0fbde..8037e719 100644 --- a/src/shared/markdown-it/tag-link.ts +++ b/src/shared/markdown-it/tag-link.ts @@ -1,5 +1,6 @@ import MarkdownIt from "markdown-it/lib"; import StateInline from "markdown-it/lib/rules_inline/state_inline"; +import { error } from "../logger"; import type { TagLinkOptions } from "../view"; function parse_tag_link( @@ -56,8 +57,7 @@ function parse_tag_link( } else { // We don't want to crash the parsing process here since we can still display a passable version of the tag link. // However, we should at least log a console error. - // eslint-disable-next-line no-console - console.error( + error( `Unable to fully render taglink for [${tagName}] due to invalid response from options.renderer.` ); } diff --git a/src/shared/markdown-parser.ts b/src/shared/markdown-parser.ts index 2034cee4..9223ee66 100644 --- a/src/shared/markdown-parser.ts +++ b/src/shared/markdown-parser.ts @@ -136,7 +136,7 @@ const customMarkdownParserTokens: MarkdownParser["tokens"] = { }, tag_link: { - block: "tagLink", // TODO: rename to "tag_link" to match others? + block: "tag_link", getAttrs: (tok: Token) => ({ tagName: tok.attrGet("tagName"), tagType: tok.attrGet("tagType"), diff --git a/src/shared/markdown-serializer.ts b/src/shared/markdown-serializer.ts index e2d76e1c..4f27dbb3 100644 --- a/src/shared/markdown-serializer.ts +++ b/src/shared/markdown-serializer.ts @@ -462,7 +462,7 @@ const customMarkdownSerializerNodes: MarkdownSerializerNodes = { state.closeBlock(node); }, - tagLink(state, node) { + tag_link(state, node) { const isMeta = node.attrs.tagType === "meta-tag"; const prefix = isMeta ? "meta-tag" : "tag"; const tag = node.attrs.tagName as string; diff --git a/src/shared/menu/entries.ts b/src/shared/menu/entries.ts index adb27037..afd22bce 100644 --- a/src/shared/menu/entries.ts +++ b/src/shared/menu/entries.ts @@ -171,7 +171,7 @@ const moreFormattingDropdown = (schema: Schema, options: CommonViewOptions) => options.parserFeatures?.tagLinks?.validate, false ), - active: nodeTypeActive(schema.nodes.tagLink), + active: nodeTypeActive(schema.nodes.tag_link), }, commonmark: insertTagLinkCommand( options.parserFeatures?.tagLinks?.validate, @@ -188,7 +188,7 @@ const moreFormattingDropdown = (schema: Schema, options: CommonViewOptions) => options.parserFeatures?.tagLinks?.validate, true ), - active: nodeTypeActive(schema.nodes.tagLink), + active: nodeTypeActive(schema.nodes.tag_link), }, commonmark: insertTagLinkCommand( options.parserFeatures?.tagLinks?.validate, diff --git a/test/rich-text/commands/index.test.ts b/test/rich-text/commands/index.test.ts index eb6b9438..c8a07a6f 100644 --- a/test/rich-text/commands/index.test.ts +++ b/test/rich-text/commands/index.test.ts @@ -475,7 +475,7 @@ describe("commands", () => { let containsTagLink = false; newState.doc.nodesBetween(0, newState.doc.content.size, (node) => { - containsTagLink = node.type.name === "tagLink"; + containsTagLink = node.type.name === "tag_link"; return !containsTagLink; }); @@ -497,7 +497,7 @@ describe("commands", () => { let containsTagLink = false; newState.doc.nodesBetween(0, newState.doc.content.size, (node) => { - containsTagLink = node.type.name === "tagLink"; + containsTagLink = node.type.name === "tag_link"; return !containsTagLink; }); @@ -533,7 +533,7 @@ describe("commands", () => { 0, tagLinkResult.newState.doc.content.size, (node) => { - containsTagLink = node.type.name === "tagLink"; + containsTagLink = node.type.name === "tag_link"; return !containsTagLink; } @@ -543,7 +543,7 @@ describe("commands", () => { } ); - it("should replace selected text with tagLink", () => { + it("should replace selected text with tag_link", () => { let state = createState("this is my state", []); state = applySelection(state, 5, 7); //"is" @@ -566,7 +566,7 @@ describe("commands", () => { text: "this ", }, { - "type.name": "tagLink", + "type.name": "tag_link", }, { isText: true, @@ -578,7 +578,7 @@ describe("commands", () => { }); }); - it("should untoggle tagLink when selected", () => { + it("should untoggle tag_link when selected", () => { let state = createState("someText", []); state = applySelection(state, 0, 8); // cursor is inside the tag @@ -597,7 +597,7 @@ describe("commands", () => { "type.name": "paragraph", "content": [ { - "type.name": "tagLink", + "type.name": "tag_link", }, ], }, diff --git a/test/shared/markdown-parser.test.ts b/test/shared/markdown-parser.test.ts index e192584c..8db137ec 100644 --- a/test/shared/markdown-parser.test.ts +++ b/test/shared/markdown-parser.test.ts @@ -198,7 +198,7 @@ console.log("test"); "childCount": 1, "content": [ { - "type.name": "tagLink", + "type.name": "tag_link", "childCount": 1, "content": [{ text: "python" }], },