@bigbinary/neeto-editor 1.45.26 → 1.45.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor.js +268 -41
- package/dist/Editor.js.map +1 -1
- package/dist/EditorContent.js +3 -0
- package/dist/EditorContent.js.map +1 -1
- package/dist/FormikEditor.js +1 -1
- package/dist/Menu.js +1 -1
- package/dist/{chunk-B_ypvaUL.js → chunk-C0xZGEez.js} +53 -2
- package/dist/{chunk-B_ypvaUL.js.map → chunk-C0xZGEez.js.map} +1 -1
- package/dist/cjs/Editor.cjs.js +268 -41
- package/dist/cjs/Editor.cjs.js.map +1 -1
- package/dist/cjs/EditorContent.cjs.js +3 -0
- package/dist/cjs/EditorContent.cjs.js.map +1 -1
- package/dist/cjs/FormikEditor.cjs.js +1 -1
- package/dist/cjs/Menu.cjs.js +1 -1
- package/dist/cjs/{chunk-DZ7EK7nf.cjs.js → chunk-C-KwpuWA.cjs.js} +57 -2
- package/dist/cjs/{chunk-DZ7EK7nf.cjs.js.map → chunk-C-KwpuWA.cjs.js.map} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/editor-stats.html +19 -1
- package/dist/headerLinks.js +3 -0
- package/dist/headerLinks.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/dist/headerLinks.js
CHANGED
|
@@ -22,6 +22,9 @@ var buildHeaderLinks = function buildHeaderLinks(editorContentNode) {
|
|
|
22
22
|
var headerTags = editorContentNode.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
|
23
23
|
var usedIds = new Map();
|
|
24
24
|
headerTags.forEach(function (heading) {
|
|
25
|
+
if (heading.getAttribute('data-link') === 'false') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
25
28
|
var headingId = convertTextToId(heading.textContent);
|
|
26
29
|
if (usedIds.has(headingId)) {
|
|
27
30
|
var count = usedIds.get(headingId);
|
package/dist/headerLinks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headerLinks.js","sources":["../src/components/EditorContent/utils/headers.js","../src/components/EditorContent/headerLinks.js"],"sourcesContent":["const buildLinkSVG = () => {\n const svgNS = \"http://www.w3.org/2000/svg\";\n\n const svgWrapper = document.createElement(\"span\");\n svgWrapper.classList.add(\"header-link-icon-wrapper\");\n const svg = document.createElementNS(svgNS, \"svg\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.setAttribute(\"height\", \"20\");\n svg.setAttribute(\"viewBox\", \"0 0 16 16\");\n svg.setAttribute(\"width\", \"20\");\n\n const path = document.createElementNS(svgNS, \"path\");\n path.setAttribute(\n \"d\",\n \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n );\n\n svg.appendChild(path);\n svgWrapper.appendChild(svg);\n\n return svgWrapper;\n};\n\nconst convertTextToId = text =>\n text\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, \"\")\n .replace(/\\s+/g, \"-\");\n\nexport const buildHeaderLinks = editorContentNode => {\n const headerTags = editorContentNode.querySelectorAll(\n \"h1, h2, h3, h4, h5, h6\"\n );\n const usedIds = new Map();\n\n headerTags.forEach(heading => {\n let headingId = convertTextToId(heading.textContent);\n if (usedIds.has(headingId)) {\n const count = usedIds.get(headingId);\n usedIds.set(headingId, count + 1);\n headingId = `${headingId}-${count}`;\n } else usedIds.set(headingId, 1);\n\n heading.setAttribute(\"id\", headingId);\n\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"href\", `#${headingId}`);\n anchor.classList.add(\"header-wrapper-link\");\n anchor.appendChild(buildLinkSVG());\n anchor.appendChild(heading.cloneNode(true));\n\n heading.replaceWith(anchor);\n });\n};\n","// eslint-disable-next-line @bigbinary/neeto/file-name-and-export-name-standards\nimport { buildHeaderLinks } from \"./utils/headers\";\n\nconst applyDecorations = () => {\n const editorContent = document.querySelector(\".neeto-editor-content\");\n\n if (editorContent) buildHeaderLinks(editorContent);\n};\n\n(() => {\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", applyDecorations);\n } else applyDecorations();\n\n window.neetoEditor = window.neetoEditor ?? {};\n window.neetoEditor.applyHeaderDecorations = applyDecorations;\n})();\n"],"names":["buildLinkSVG","svgNS","svgWrapper","document","createElement","classList","add","svg","createElementNS","setAttribute","path","appendChild","convertTextToId","text","trim","toLowerCase","replace","buildHeaderLinks","editorContentNode","headerTags","querySelectorAll","usedIds","Map","forEach","heading","headingId","textContent","has","count","get","set","concat","anchor","cloneNode","replaceWith","applyDecorations","editorContent","querySelector","_window$neetoEditor","readyState","addEventListener","window","neetoEditor","applyHeaderDecorations"],"mappings":";;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,GAAS;EACzB,IAAMC,KAAK,GAAG,4BAA4B,CAAA;AAE1C,EAAA,IAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC,CAAA;AACjDF,EAAAA,UAAU,CAACG,SAAS,CAACC,GAAG,CAAC,0BAA0B,CAAC,CAAA;EACpD,IAAMC,GAAG,GAAGJ,QAAQ,CAACK,eAAe,CAACP,KAAK,EAAE,KAAK,CAAC,CAAA;AAClDM,EAAAA,GAAG,CAACE,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;AACvCF,EAAAA,GAAG,CAACE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAChCF,EAAAA,GAAG,CAACE,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AACxCF,EAAAA,GAAG,CAACE,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;EAE/B,IAAMC,IAAI,GAAGP,QAAQ,CAACK,eAAe,CAACP,KAAK,EAAE,MAAM,CAAC,CAAA;AACpDS,EAAAA,IAAI,CAACD,YAAY,CACf,GAAG,EACH,+UACF,CAAC,CAAA;AAEDF,EAAAA,GAAG,CAACI,WAAW,CAACD,IAAI,CAAC,CAAA;AACrBR,EAAAA,UAAU,CAACS,WAAW,CAACJ,GAAG,CAAC,CAAA;AAE3B,EAAA,OAAOL,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,IAAMU,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,IAAI,EAAA;EAAA,OAC1BA,IAAI,CACDC,IAAI,EAAE,CACNC,WAAW,EAAE,CACbC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAC3BA,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAAA,CAAA,CAAA;AAElB,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,iBAAiB,EAAI;AACnD,EAAA,IAAMC,UAAU,GAAGD,iBAAiB,CAACE,gBAAgB,CACnD,wBACF,CAAC,CAAA;AACD,EAAA,IAAMC,OAAO,GAAG,IAAIC,GAAG,EAAE,CAAA;AAEzBH,EAAAA,UAAU,CAACI,OAAO,CAAC,UAAAC,OAAO,EAAI;
|
|
1
|
+
{"version":3,"file":"headerLinks.js","sources":["../src/components/EditorContent/utils/headers.js","../src/components/EditorContent/headerLinks.js"],"sourcesContent":["const buildLinkSVG = () => {\n const svgNS = \"http://www.w3.org/2000/svg\";\n\n const svgWrapper = document.createElement(\"span\");\n svgWrapper.classList.add(\"header-link-icon-wrapper\");\n const svg = document.createElementNS(svgNS, \"svg\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.setAttribute(\"height\", \"20\");\n svg.setAttribute(\"viewBox\", \"0 0 16 16\");\n svg.setAttribute(\"width\", \"20\");\n\n const path = document.createElementNS(svgNS, \"path\");\n path.setAttribute(\n \"d\",\n \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n );\n\n svg.appendChild(path);\n svgWrapper.appendChild(svg);\n\n return svgWrapper;\n};\n\nconst convertTextToId = text =>\n text\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, \"\")\n .replace(/\\s+/g, \"-\");\n\nexport const buildHeaderLinks = editorContentNode => {\n const headerTags = editorContentNode.querySelectorAll(\n \"h1, h2, h3, h4, h5, h6\"\n );\n const usedIds = new Map();\n\n headerTags.forEach(heading => {\n if (heading.getAttribute('data-link') === 'false') {\n return;\n }\n\n let headingId = convertTextToId(heading.textContent);\n if (usedIds.has(headingId)) {\n const count = usedIds.get(headingId);\n usedIds.set(headingId, count + 1);\n headingId = `${headingId}-${count}`;\n } else usedIds.set(headingId, 1);\n\n heading.setAttribute(\"id\", headingId);\n\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"href\", `#${headingId}`);\n anchor.classList.add(\"header-wrapper-link\");\n anchor.appendChild(buildLinkSVG());\n anchor.appendChild(heading.cloneNode(true));\n\n heading.replaceWith(anchor);\n });\n};\n","// eslint-disable-next-line @bigbinary/neeto/file-name-and-export-name-standards\nimport { buildHeaderLinks } from \"./utils/headers\";\n\nconst applyDecorations = () => {\n const editorContent = document.querySelector(\".neeto-editor-content\");\n\n if (editorContent) buildHeaderLinks(editorContent);\n};\n\n(() => {\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", applyDecorations);\n } else applyDecorations();\n\n window.neetoEditor = window.neetoEditor ?? {};\n window.neetoEditor.applyHeaderDecorations = applyDecorations;\n})();\n"],"names":["buildLinkSVG","svgNS","svgWrapper","document","createElement","classList","add","svg","createElementNS","setAttribute","path","appendChild","convertTextToId","text","trim","toLowerCase","replace","buildHeaderLinks","editorContentNode","headerTags","querySelectorAll","usedIds","Map","forEach","heading","getAttribute","headingId","textContent","has","count","get","set","concat","anchor","cloneNode","replaceWith","applyDecorations","editorContent","querySelector","_window$neetoEditor","readyState","addEventListener","window","neetoEditor","applyHeaderDecorations"],"mappings":";;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,GAAS;EACzB,IAAMC,KAAK,GAAG,4BAA4B,CAAA;AAE1C,EAAA,IAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC,CAAA;AACjDF,EAAAA,UAAU,CAACG,SAAS,CAACC,GAAG,CAAC,0BAA0B,CAAC,CAAA;EACpD,IAAMC,GAAG,GAAGJ,QAAQ,CAACK,eAAe,CAACP,KAAK,EAAE,KAAK,CAAC,CAAA;AAClDM,EAAAA,GAAG,CAACE,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;AACvCF,EAAAA,GAAG,CAACE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAChCF,EAAAA,GAAG,CAACE,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AACxCF,EAAAA,GAAG,CAACE,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;EAE/B,IAAMC,IAAI,GAAGP,QAAQ,CAACK,eAAe,CAACP,KAAK,EAAE,MAAM,CAAC,CAAA;AACpDS,EAAAA,IAAI,CAACD,YAAY,CACf,GAAG,EACH,+UACF,CAAC,CAAA;AAEDF,EAAAA,GAAG,CAACI,WAAW,CAACD,IAAI,CAAC,CAAA;AACrBR,EAAAA,UAAU,CAACS,WA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a,CAAC,GAAG,CAAC,CAAA;IAC1C6B,MAAM,CAACxB,YAAY,CAAC,MAAM,MAAAuB,MAAA,CAAMN,SAAS,CAAE,CAAC,CAAA;AAC5CO,IAAAA,MAAM,CAAC5B,SAAS,CAACC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AAC3C2B,IAAAA,MAAM,CAACtB,WAAW,CAACX,YAAY,EAAE,CAAC,CAAA;IAClCiC,MAAM,CAACtB,WAAW,CAACa,OAAO,CAACU,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AAE3CV,IAAAA,OAAO,CAACW,WAAW,CAACF,MAAM,CAAC,CAAA;AAC7B,GAAC,CAAC,CAAA;AACJ,CAAC;;AC1DD;AAGA,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAgBA,GAAS;AAC7B,EAAA,IAAMC,aAAa,GAAGlC,QAAQ,CAACmC,aAAa,CAAC,uBAAuB,CAAC,CAAA;AAErE,EAAA,IAAID,aAAa,EAAEpB,gBAAgB,CAACoB,aAAa,CAAC,CAAA;AACpD,CAAC,CAAA;AAED,CAAC,UAAAE,mBAAA,EAAM;AACL,EAAA,IAAIpC,QAAQ,CAACqC,UAAU,KAAK,SAAS,EAAE;AACrCrC,IAAAA,QAAQ,CAACsC,gBAAgB,CAAC,kBAAkB,EAAEL,gBAAgB,CAAC,CAAA;GAChE,MAAMA,gBAAgB,EAAE,CAAA;AAEzBM,EAAAA,MAAM,CAACC,WAAW,GAAAJ,CAAAA,mBAAA,GAAGG,MAAM,CAACC,WAAW,MAAA,IAAA,IAAAJ,mBAAA,KAAA,KAAA,CAAA,GAAAA,mBAAA,GAAI,EAAE,CAAA;AAC7CG,EAAAA,MAAM,CAACC,WAAW,CAACC,sBAAsB,GAAGR,gBAAgB,CAAA;AAC9D,CAAC,GAAG;;"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { a as isEditorContentWithinLimit, i as isEditorEmpty, r as removeEmptyTa
|
|
|
6
6
|
export { A as Attachments } from './chunk-Cn_AKHSx.js';
|
|
7
7
|
export { default as Editor } from './Editor.js';
|
|
8
8
|
export { default as FormikEditor } from './FormikEditor.js';
|
|
9
|
-
export { M as Menu } from './chunk-
|
|
9
|
+
export { M as Menu } from './chunk-C0xZGEez.js';
|
|
10
10
|
export { default as EditorContent } from './EditorContent.js';
|
|
11
11
|
import { n } from './chunk-DmrvuTKK.js';
|
|
12
12
|
import 'ramda';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-editor",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.28",
|
|
4
4
|
"types": "./types.d.ts",
|
|
5
5
|
"description": "neetoEditor is the library that drives the rich text experience in all neeto products built at BigBinary",
|
|
6
6
|
"keywords": [
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"@tiptap/extension-highlight": "2.6.6",
|
|
91
91
|
"@tiptap/extension-image": "2.6.6",
|
|
92
92
|
"@tiptap/extension-link": "2.6.6",
|
|
93
|
+
"@tiptap/extension-list-keymap": "2.11.7",
|
|
93
94
|
"@tiptap/extension-mention": "2.6.6",
|
|
94
95
|
"@tiptap/extension-placeholder": "2.6.6",
|
|
95
96
|
"@tiptap/extension-table": "2.6.6",
|