From 56e53fb291e23d1681fc7ad7f7fc3906179920fc Mon Sep 17 00:00:00 2001 From: Sergey Makhnatkin Date: Tue, 22 Oct 2024 13:47:50 +0200 Subject: [PATCH] feat(deps)!: updated transform version 4.32.2 (#417) --- package-lock.json | 207 +++++++++++++++--- package.json | 7 +- .../plugins/YfmNoteTooltipPlugin/index.scss | 8 +- .../plugins/YfmNoteTooltipPlugin/index.tsx | 4 +- src/extensions/yfm/YfmTabs/YfmTabs.test.ts | 22 +- .../yfm/YfmTabs/YfmTabsSpecs/md-plugin.ts | 28 --- tests/dispatch-event.ts | 2 + tests/setup.ts | 8 + 8 files changed, 203 insertions(+), 83 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f453432..5a0adfdb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "@diplodoc/html-extension": "2.3.2", "@diplodoc/latex-extension": "1.0.3", "@diplodoc/mermaid-extension": "1.2.1", - "@diplodoc/transform": "4.26.0", + "@diplodoc/transform": "^4.32.2", "@gravity-ui/components": "3.0.0", "@gravity-ui/eslint-config": "3.1.1", "@gravity-ui/prettier-config": "1.1.0", @@ -104,14 +104,15 @@ "sass-loader": "^13.3.2", "stylelint": "15.11.0", "ts-jest": "^27.0.7", - "typescript": "^4.5.2" + "typescript": "^4.5.2", + "web-streams-polyfill": "4.0.0" }, "peerDependencies": { "@diplodoc/folding-headings-extension": "^0.1.0", "@diplodoc/html-extension": "2.3.2", "@diplodoc/latex-extension": "^1.0.3", "@diplodoc/mermaid-extension": "^1.0.0", - "@diplodoc/transform": ">=4.5.0 <=4.26.0", + "@diplodoc/transform": "^4.32.2", "@gravity-ui/components": "^3.0.0", "@gravity-ui/uikit": "^6.11.0", "highlight.js": "^11.8.0", @@ -2622,6 +2623,16 @@ "postcss-selector-parser": "^6.0.13" } }, + "node_modules/@diplodoc/cut-extension": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@diplodoc/cut-extension/-/cut-extension-0.3.0.tgz", + "integrity": "sha512-1hSwZMxNFrDl5pvve13XkKMNOaREOXSZhEI3PDXIdTxQJAO4fLzYLizQRCq6jU5WrFRzqsPVQ28fwIEpSUQ0mA==", + "dev": true, + "peerDependencies": { + "@diplodoc/utils": "1.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/@diplodoc/folding-headings-extension": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@diplodoc/folding-headings-extension/-/folding-headings-extension-0.1.0.tgz", @@ -2686,9 +2697,9 @@ } }, "node_modules/@diplodoc/tabs-extension": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@diplodoc/tabs-extension/-/tabs-extension-3.1.1.tgz", - "integrity": "sha512-FWywClCNtMUQGZAsd6Hr/Cs1TX9aOJ4t9SOR9pIuOVsJwVWXNihdUW7x2yaAT0WwP4bBqXg7GSUQ/DIVIde9Ww==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@diplodoc/tabs-extension/-/tabs-extension-3.4.0.tgz", + "integrity": "sha512-5xeTq9xrFSGd8XIhmSGzG5upYz/I2Fxqn0j6nrsmKlLW3YGoa5JtkCGfvxkQ43yVIrCMYDi9XQe3snQIW5eb1Q==", "dev": true, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -2700,14 +2711,15 @@ } }, "node_modules/@diplodoc/transform": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/@diplodoc/transform/-/transform-4.26.0.tgz", - "integrity": "sha512-k6TxF3DzWkAdfPnjzfUBR4mNGiE4dQC5Cvk9flGazhX2aNOXetSYU1/Y1voSNNnG8EmTJqXOsTptGMLBxAz/hw==", + "version": "4.32.2", + "resolved": "https://registry.npmjs.org/@diplodoc/transform/-/transform-4.32.2.tgz", + "integrity": "sha512-1UOlViyXD2nBYDbpocQFPmWn6notEbHI1Pww9aIARKwGuKwWskGZxaAeMuO+Bhuicc669MpQUdQaaa7Bjm17bQ==", "dev": true, "dependencies": { - "@diplodoc/tabs-extension": "^3.0.0", + "@diplodoc/cut-extension": "^0.3.0", + "@diplodoc/tabs-extension": "^3.4.0", "chalk": "^4.1.2", - "cheerio": "^1.0.0-rc.12", + "cheerio": "^1.0.0", "css": "^3.0.0", "cssfilter": "0.0.10", "get-root-node-polyfill": "1.0.0", @@ -2715,7 +2727,7 @@ "js-yaml": "^4.1.0", "lodash": "4.17.21", "markdown-it": "^13.0.2", - "markdown-it-attrs": "4.1.4", + "markdown-it-attrs": "^4.2.0", "markdown-it-deflist": "2.1.0", "markdown-it-meta": "0.0.1", "markdown-it-sup": "1.0.0", @@ -2746,6 +2758,25 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/@diplodoc/transform/node_modules/markdown-it-attrs": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.2.0.tgz", + "integrity": "sha512-m7svtUBythvcGFFZAv9VjMEvs8UbHri2sojJ3juJumoOzv8sdkx9a7W3KxiHbXxAbvL3Xauak8TMwCnvigVPKw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "markdown-it": ">= 9.0.0" + } + }, + "node_modules/@diplodoc/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@diplodoc/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-rGDVyqZyJ4GUjuUIYeMG7w6w5mb1dLF/nkloWEyxqZWy/POO4GiHAG83d4wK6U3gTFGTe+BXabQzdIKZwNVCTw==", + "dev": true, + "peer": true + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -10664,21 +10695,25 @@ } }, "node_modules/cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", "dev": true, "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=18.17" }, "funding": { "url": "https://github.com/cheeriojs/cheerio?sponsor=1" @@ -10828,9 +10863,9 @@ } }, "node_modules/cheerio/node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", "dev": true, "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", @@ -10842,22 +10877,31 @@ "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" + "domutils": "^3.1.0", + "entities": "^4.5.0" } }, "node_modules/cheerio/node_modules/parse5": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.0.tgz", + "integrity": "sha512-ZkDsAOcxsUMZ4Lz5fVciOehNcJ+Gb8gTzcA4yl3wnc273BAybYWrQ+Ks/OjCjSEpjvQkDSeZbybK9qj2VHHdGA==", "dev": true, "dependencies": { - "entities": "^4.4.0" + "entities": "^4.5.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/cheerio/node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "engines": { + "node": ">=18" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -13195,6 +13239,43 @@ "node": ">= 0.8" } }, + "node_modules/encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "dev": true, + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/encoding-sniffer/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/encoding-sniffer/node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -22951,12 +23032,12 @@ "dev": true }, "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", - "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", "dev": true, "dependencies": { - "domhandler": "^5.0.2", + "domhandler": "^5.0.3", "parse5": "^7.0.0" }, "funding": { @@ -22991,12 +23072,48 @@ } }, "node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.0.tgz", + "integrity": "sha512-ZkDsAOcxsUMZ4Lz5fVciOehNcJ+Gb8gTzcA4yl3wnc273BAybYWrQ+Ks/OjCjSEpjvQkDSeZbybK9qj2VHHdGA==", + "dev": true, + "dependencies": { + "entities": "^4.5.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", "dev": true, "dependencies": { - "entities": "^4.4.0" + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/parse5-parser-stream/node_modules/parse5": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.0.tgz", + "integrity": "sha512-ZkDsAOcxsUMZ4Lz5fVciOehNcJ+Gb8gTzcA4yl3wnc273BAybYWrQ+Ks/OjCjSEpjvQkDSeZbybK9qj2VHHdGA==", + "dev": true, + "dependencies": { + "entities": "^4.5.0" }, "funding": { "url": "https://github.com/inikulin/parse5?sponsor=1" @@ -27810,6 +27927,15 @@ "integrity": "sha512-Ia0sQNrMPXXkqVFt6w6M1n1oKo3NfKs+mvaV811Jwir7vAk9a6PVV9VPYf6X3BU97QiLEmuW3uXH9u87zDFfdw==", "dev": true }, + "node_modules/undici": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.0.tgz", + "integrity": "sha512-AITZfPuxubm31Sx0vr8bteSalEbs9wQb/BOBi9FPlD9Qpd6HxZ4Q0+hI742jBhkPb4RT2v5MQzaW5VhRVyj+9A==", + "dev": true, + "engines": { + "node": ">=18.17" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -28457,6 +28583,15 @@ "defaults": "^1.0.3" } }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz", + "integrity": "sha512-0zJXHRAYEjM2tUfZ2DiSOHAa2aw1tisnnhU3ufD57R8iefL+DcdJyRBRyJpG+NUimDgbTI/lH+gAE1PAvV3Cgw==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/web-worker": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", diff --git a/package.json b/package.json index 9f968bcb..6afc81e2 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ "@diplodoc/html-extension": "2.3.2", "@diplodoc/latex-extension": "1.0.3", "@diplodoc/mermaid-extension": "1.2.1", - "@diplodoc/transform": "4.26.0", + "@diplodoc/transform": "^4.32.2", "@gravity-ui/components": "3.0.0", "@gravity-ui/eslint-config": "3.1.1", "@gravity-ui/prettier-config": "1.1.0", @@ -252,7 +252,8 @@ "sass-loader": "^13.3.2", "stylelint": "15.11.0", "ts-jest": "^27.0.7", - "typescript": "^4.5.2" + "typescript": "^4.5.2", + "web-streams-polyfill": "4.0.0" }, "peerDependenciesMeta": { "@diplodoc/folding-headings-extension": { @@ -279,7 +280,7 @@ "@diplodoc/html-extension": "2.3.2", "@diplodoc/latex-extension": "^1.0.3", "@diplodoc/mermaid-extension": "^1.0.0", - "@diplodoc/transform": ">=4.5.0 <=4.26.0", + "@diplodoc/transform": "^4.32.2", "@gravity-ui/components": "^3.0.0", "@gravity-ui/uikit": "^6.11.0", "highlight.js": "^11.8.0", diff --git a/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.scss b/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.scss index 8adff9da..17398b07 100644 --- a/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.scss +++ b/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.scss @@ -6,15 +6,15 @@ .g-md-toolbar-group__s-button_id_ { ¬e-type-tip { - color: $tipColor; + color: var(--yfm-color-note-tip); } ¬e-type-info { - color: $infoColor; + color: var(--yfm-color-note-info); } ¬e-type-alert { - color: $importantColor; + color: var(--yfm-color-note-important); } ¬e-type-warning { - color: $warningColor; + color: var(--yfm-color-note-warning); } } diff --git a/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.tsx b/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.tsx index 71e648ff..a3d1c473 100644 --- a/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.tsx +++ b/src/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.tsx @@ -55,7 +55,9 @@ export const yfmNoteTooltipPlugin = ({actions, schema}: ExtensionDeps) => view.focus()} - className="g-md-yfm-note-toolbar" + // the yfm class allows to access css variables + // https://github.com/diplodoc-platform/transform/blob/master/src/scss/_common.scss#L17 + className="yfm g-md-yfm-note-toolbar" data={[ [ YfmNoteType.info, diff --git a/src/extensions/yfm/YfmTabs/YfmTabs.test.ts b/src/extensions/yfm/YfmTabs/YfmTabs.test.ts index 77c7fb91..d7a3e5d1 100644 --- a/src/extensions/yfm/YfmTabs/YfmTabs.test.ts +++ b/src/extensions/yfm/YfmTabs/YfmTabs.test.ts @@ -142,9 +142,9 @@ describe('YfmTabs extension', () => { it('should correct parse and serialize yfm-tabs inside blockqute', () => { const markup = ` > {% list tabs %} -> +>${' '} > - Tab -> +>${' '} > Content > > {% endlist %}`.trim(); @@ -205,13 +205,13 @@ describe('YfmTabs extension', () => { You can paste nested radio tabs {% list tabs radio %} - +${' '} - Nested radio button 1 - +${' '} Text of nested radio button 1 - Nested radio button 2 - +${' '} Text of nested radio button 2 {% endlist %} @@ -239,21 +239,21 @@ describe('YfmTabs extension', () => { 'aria-controls': generatedId, 'aria-selected': 'false', tabindex: '0', - 'data-diplodoc-is-active': 'true', + 'data-diplodoc-is-active': 'false', 'data-diplodoc-id': 'radio-button-1', 'data-diplodoc-key': 'radio%20button%201', }, rtabInput({ class: 'radio', type: 'radio', - checked: 'true', + checked: null, }), rtabLabel('Radio button 1'), ), tabPanel( { id: generatedId, - class: 'yfm-tab-panel active', + class: 'yfm-tab-panel', role: 'tabpanel', 'data-title': 'Radio button 1', 'aria-labelledby': 'radio-button-1', @@ -273,21 +273,21 @@ describe('YfmTabs extension', () => { 'aria-controls': generatedId, 'aria-selected': 'false', tabindex: '0', - 'data-diplodoc-is-active': 'true', + 'data-diplodoc-is-active': 'false', 'data-diplodoc-id': 'nested-radio-button-1', 'data-diplodoc-key': 'nested%20radio%20button%201', }, rtabInput({ class: 'radio', type: 'radio', - checked: 'true', + checked: null, }), rtabLabel('Nested radio button 1'), ), tabPanel( { id: generatedId, - class: 'yfm-tab-panel active', + class: 'yfm-tab-panel', role: 'tabpanel', 'data-title': 'Nested radio button 1', 'aria-labelledby': 'nested-radio-button-1', diff --git a/src/extensions/yfm/YfmTabs/YfmTabsSpecs/md-plugin.ts b/src/extensions/yfm/YfmTabs/YfmTabsSpecs/md-plugin.ts index 21b791eb..6f8c0edb 100644 --- a/src/extensions/yfm/YfmTabs/YfmTabsSpecs/md-plugin.ts +++ b/src/extensions/yfm/YfmTabs/YfmTabsSpecs/md-plugin.ts @@ -6,7 +6,6 @@ const prefix = 'r-'; export const tabsPostPlugin: MarkdownIt.PluginSimple = (md) => { md.core.ruler.push('me_tabs_after', (state) => { const stack: {vertical?: boolean}[] = []; - const tabCloseIndexes: number[] = []; for (const token of state.tokens) { switch (token.type) { @@ -27,10 +26,6 @@ export const tabsPostPlugin: MarkdownIt.PluginSimple = (md) => { case 'tab_open': { const item = stack.at(-1); if (item?.vertical) { - // --> TODO: remove after updating to tabs-extension v^3.4.0 - const isInput = token.tag === 'input'; - if (isInput) token.type = 'tab-input'; - // <-- token.type = prefix + token.type; } break; @@ -39,9 +34,6 @@ export const tabsPostPlugin: MarkdownIt.PluginSimple = (md) => { const item = stack.at(-1); if (item?.vertical) { token.type = prefix + token.type; - // --> TODO: remove after updating to tabs-extension v^3.4.0 - tabCloseIndexes.push(state.tokens.indexOf(token)); - // <-- } break; } @@ -56,27 +48,7 @@ export const tabsPostPlugin: MarkdownIt.PluginSimple = (md) => { break; } - - // --> TODO: remove after updating to tabs-extension v^3.4.0 - case 'label_open': { - const tokenIndex = state.tokens.indexOf(token); - const prevToken = tokenIndex > 0 && state.tokens.at(tokenIndex - 1); - if (prevToken && prevToken.type === 'r-tab-input') { - token.type = prefix + 'tab-' + token.type; - } - break; - } - // <-- } } - - // --> TODO: remove after updating to tabs-extension v^3.4.0 - for (const index of tabCloseIndexes.reverse()) { - if (index === -1) continue; - - const labelCloseToken = new state.Token(prefix + 'tab-label_close', 'label', -1); - state.tokens.splice(index, 0, labelCloseToken); - } - // <-- }); }; diff --git a/tests/dispatch-event.ts b/tests/dispatch-event.ts index fb8b8b2d..ae83d7af 100644 --- a/tests/dispatch-event.ts +++ b/tests/dispatch-event.ts @@ -1,6 +1,8 @@ /* eslint-disable no-implicit-globals */ import type {EditorView} from 'prosemirror-view'; + import {DataTransferType as DTType} from '../src/extensions/behavior/Clipboard/utils'; + import {ClipboardEventMock, DataTransferMock} from './event-mock'; export function dispatchPasteEvent(view: EditorView, data: {[K in DTType]?: string}): void; diff --git a/tests/setup.ts b/tests/setup.ts index 41c1a3d4..444f4df3 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -1,5 +1,13 @@ +import {TextDecoder as TextDecoderUtil, TextEncoder as TextEncoderUtil} from 'util'; + +import {ReadableStream as ReadableStreamPolyfill} from 'web-streams-polyfill'; + import './toMatchNode'; +global.TextDecoder = TextDecoderUtil as any; // TS error in global.TextDecoder +global.TextEncoder = TextEncoderUtil; +global.ReadableStream = ReadableStreamPolyfill; + // fix from https://github.com/jsdom/jsdom/issues/3002 document.createRange = () => { const range = new Range();