@editora/plugins 1.0.9 → 1.0.10

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.
Files changed (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=[{label:"1.0",value:"1.0"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"2.0",value:"2.0"},{label:"2.5",value:"2.5"},{label:"3.0",value:"3.0"}],m=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"]),u=e=>m.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let n=e.getRangeAt(0).startContainer;for(;n&&n!==document.body;){if(n.nodeType===Node.ELEMENT_NODE){const o=n;if(o.getAttribute("contenteditable")==="true")return o}n=n.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');if(n)return n}return document.querySelector('[contenteditable="true"]')},d=e=>{let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(u(n))return n;if(n.getAttribute("contenteditable")==="true")break}t=t.parentNode}return null},H=(e,t)=>{const n=[],o=new Set,r=i=>{!i||o.has(i)||t.contains(i)&&u(i)&&(o.add(i),n.push(i))};if(e.collapsed)return r(d(e.startContainer)),n;const s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i;if(!u(c))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(c)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const l=document.createRange();return l.selectNodeContents(c),e.compareBoundaryPoints(Range.END_TO_START,l)>0&&e.compareBoundaryPoints(Range.START_TO_END,l)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=s.nextNode();for(;a;)r(a),a=s.nextNode();return n.length===0&&r(d(e.commonAncestorContainer)),n},b=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},L=(e,t)=>{if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}},h=e=>{if(!e)return!1;try{const t=E();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const o=n.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const r=H(o,t);if(r.length===0)return!1;const s=t.innerHTML;return r.forEach(a=>{a.style.lineHeight=e}),L(t,s),b(t),!0}catch(t){return console.error("Failed to set line height:",t),!1}},T=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},f=()=>{T("setLineHeight",h)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const p=()=>({name:"lineHeight",marks:{lineHeight:{attrs:{height:{default:null}},parseDOM:[{tag:'span[style*="line-height"]',getAttrs:e=>{const n=e.style.lineHeight;return n?{height:n}:!1}}],toDOM:e=>["span",{style:`line-height: ${e.attrs?.height}`},0]}},toolbar:[{label:"Line Height",command:"setLineHeight",type:"inline-menu",options:g,icon:'<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'}],commands:{setLineHeight:h}});exports.LineHeightPlugin=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=[{label:"1.0",value:"1.0"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"2.0",value:"2.0"},{label:"2.5",value:"2.5"},{label:"3.0",value:"3.0"}],m=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"]),u=e=>m.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let n=e.getRangeAt(0).startContainer;for(;n&&n!==document.body;){if(n.nodeType===Node.ELEMENT_NODE){const o=n;if(o.getAttribute("contenteditable")==="true")return o}n=n.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');if(n)return n}return document.querySelector('[contenteditable="true"]')},d=e=>{let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(u(n))return n;if(n.getAttribute("contenteditable")==="true")break}t=t.parentNode}return null},H=(e,t)=>{const n=[],o=new Set,r=i=>{!i||o.has(i)||t.contains(i)&&u(i)&&(o.add(i),n.push(i))};if(e.collapsed)return r(d(e.startContainer)),n;const s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i;if(!u(c))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(c)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const l=document.createRange();return l.selectNodeContents(c),e.compareBoundaryPoints(Range.END_TO_START,l)>0&&e.compareBoundaryPoints(Range.START_TO_END,l)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=s.nextNode();for(;a;)r(a),a=s.nextNode();return n.length===0&&r(d(e.commonAncestorContainer)),n},b=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},L=(e,t)=>{if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}},h=e=>{if(!e)return!1;try{const t=E();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const o=n.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const r=H(o,t);if(r.length===0)return!1;const s=t.innerHTML;return r.forEach(a=>{a.style.lineHeight=e}),L(t,s),b(t),!0}catch(t){return console.error("Failed to set line height:",t),!1}},T=(e,t)=>{var n;typeof window<"u"&&((n=window.registerEditorCommand)==null||n.call(window,e,t))},f=()=>{T("setLineHeight",h)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const p=()=>({name:"lineHeight",marks:{lineHeight:{attrs:{height:{default:null}},parseDOM:[{tag:'span[style*="line-height"]',getAttrs:e=>{const n=e.style.lineHeight;return n?{height:n}:!1}}],toDOM:e=>{var t;return["span",{style:`line-height: ${(t=e.attrs)==null?void 0:t.height}`},0]}}},toolbar:[{label:"Line Height",command:"setLineHeight",type:"inline-menu",options:g,icon:'<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'}],commands:{setLineHeight:h}});exports.LineHeightPlugin=p;
@@ -35,7 +35,8 @@ const g = [
35
35
  if (t.getAttribute("contenteditable") === "true")
36
36
  return t;
37
37
  const n = t.closest('[contenteditable="true"]');
38
- if (n) return n;
38
+ if (n)
39
+ return n;
39
40
  }
40
41
  return document.querySelector('[contenteditable="true"]');
41
42
  }, u = (e) => {
@@ -45,7 +46,8 @@ const g = [
45
46
  const n = t;
46
47
  if (d(n))
47
48
  return n;
48
- if (n.getAttribute("contenteditable") === "true") break;
49
+ if (n.getAttribute("contenteditable") === "true")
50
+ break;
49
51
  }
50
52
  t = t.parentNode;
51
53
  }
@@ -62,7 +64,8 @@ const g = [
62
64
  {
63
65
  acceptNode: (i) => {
64
66
  const c = i;
65
- if (!d(c)) return NodeFilter.FILTER_SKIP;
67
+ if (!d(c))
68
+ return NodeFilter.FILTER_SKIP;
66
69
  if (typeof e.intersectsNode == "function")
67
70
  return e.intersectsNode(c) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
68
71
  const l = document.createRange();
@@ -77,7 +80,8 @@ const g = [
77
80
  }, L = (e) => {
78
81
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
79
82
  }, b = (e, t) => {
80
- if (t === e.innerHTML) return;
83
+ if (t === e.innerHTML)
84
+ return;
81
85
  const n = window.execEditorCommand || window.executeEditorCommand;
82
86
  if (typeof n == "function")
83
87
  try {
@@ -85,16 +89,21 @@ const g = [
85
89
  } catch {
86
90
  }
87
91
  }, h = (e) => {
88
- if (!e) return !1;
92
+ if (!e)
93
+ return !1;
89
94
  try {
90
95
  const t = E();
91
- if (!t) return !1;
96
+ if (!t)
97
+ return !1;
92
98
  const n = window.getSelection();
93
- if (!n || n.rangeCount === 0) return !1;
99
+ if (!n || n.rangeCount === 0)
100
+ return !1;
94
101
  const o = n.getRangeAt(0);
95
- if (!t.contains(o.commonAncestorContainer)) return !1;
102
+ if (!t.contains(o.commonAncestorContainer))
103
+ return !1;
96
104
  const r = H(o, t);
97
- if (r.length === 0) return !1;
105
+ if (r.length === 0)
106
+ return !1;
98
107
  const s = t.innerHTML;
99
108
  return r.forEach((a) => {
100
109
  a.style.lineHeight = e;
@@ -103,7 +112,8 @@ const g = [
103
112
  return console.error("Failed to set line height:", t), !1;
104
113
  }
105
114
  }, p = (e, t) => {
106
- typeof window < "u" && window.registerEditorCommand?.(e, t);
115
+ var n;
116
+ typeof window < "u" && ((n = window.registerEditorCommand) == null || n.call(window, e, t));
107
117
  }, f = () => {
108
118
  p("setLineHeight", h);
109
119
  };
@@ -124,7 +134,10 @@ const N = () => ({
124
134
  }
125
135
  }
126
136
  ],
127
- toDOM: (e) => ["span", { style: `line-height: ${e.attrs?.height}` }, 0]
137
+ toDOM: (e) => {
138
+ var t;
139
+ return ["span", { style: `line-height: ${(t = e.attrs) == null ? void 0 : t.height}` }, 0];
140
+ }
128
141
  }
129
142
  },
130
143
  toolbar: [
package/dist/link.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let a=null,u=!1,l=null;const p='[data-theme="dark"], .dark, .editora-theme-dark',w=e=>{if(!e)return null;let t=e;for(;t;){if(t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="true"||t.hasAttribute("data-editora-content"))return t;t=t.parentElement}return null},C=e=>{if(e){const n=e.startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(p))return!0}return document.activeElement?.closest(p)?!0:document.body.matches(p)||document.documentElement.matches(p)},T=()=>{if(document.getElementById("rte-link-dialog-theme-styles"))return;const e=document.createElement("style");e.id="rte-link-dialog-theme-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let a=null,u=!1,l=null;const p='[data-theme="dark"], .dark, .editora-theme-dark',w=e=>{if(!e)return null;let t=e;for(;t;){if(t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="true"||t.hasAttribute("data-editora-content"))return t;t=t.parentElement}return null},C=e=>{if(e){const o=e.startContainer,n=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;if(n!=null&&n.closest(p))return!0}const t=document.activeElement;return t!=null&&t.closest(p)?!0:document.body.matches(p)||document.documentElement.matches(p)},T=()=>{if(document.getElementById("rte-link-dialog-theme-styles"))return;const e=document.createElement("style");e.id="rte-link-dialog-theme-styles",e.textContent=`
2
2
  .link-dialog-overlay.rte-theme-dark .link-dialog {
3
3
  background: #1f2937 !important;
4
4
  border: 1px solid #4b5563 !important;
@@ -61,7 +61,7 @@
61
61
  .link-dialog-overlay.rte-theme-dark .btn-submit:hover {
62
62
  background: #2563eb !important;
63
63
  }
64
- `,document.head.appendChild(e)},A=e=>{if(!a){console.warn("No selection range stored");return}const t=a.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=w(n);if(o){if(u&&l){l.href=e.url,l.textContent=e.text,l.target=e.target,e.target==="_blank"?l.setAttribute("rel","noopener noreferrer"):l.removeAttribute("rel"),e.title?l.title=e.title:l.removeAttribute("title");const r=document.createRange();r.selectNodeContents(l);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}else{const r=document.createElement("a");r.href=e.url,r.textContent=e.text,r.target=e.target,e.target==="_blank"&&r.setAttribute("rel","noopener noreferrer"),e.title&&(r.title=e.title),a.deleteContents(),a.insertNode(r),a.setStartAfter(r),a.setEndAfter(r);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(a))}o.focus(),a=null,u=!1,l=null}},k=(e,t)=>{T();const n=document.createElement("div");n.className="link-dialog-overlay",t&&n.classList.add("rte-theme-dark"),n.style.cssText=`
64
+ `,document.head.appendChild(e)},A=e=>{if(!a){console.warn("No selection range stored");return}const t=a.startContainer,o=t.nodeType===Node.TEXT_NODE?t.parentElement:t,n=w(o);if(n){if(u&&l){l.href=e.url,l.textContent=e.text,l.target=e.target,e.target==="_blank"?l.setAttribute("rel","noopener noreferrer"):l.removeAttribute("rel"),e.title?l.title=e.title:l.removeAttribute("title");const r=document.createRange();r.selectNodeContents(l);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}else{const r=document.createElement("a");r.href=e.url,r.textContent=e.text,r.target=e.target,e.target==="_blank"&&r.setAttribute("rel","noopener noreferrer"),e.title&&(r.title=e.title),a.deleteContents(),a.insertNode(r),a.setStartAfter(r),a.setEndAfter(r);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(a))}n.focus(),a=null,u=!1,l=null}},k=(e,t)=>{T();const o=document.createElement("div");o.className="link-dialog-overlay",t&&o.classList.add("rte-theme-dark"),o.style.cssText=`
65
65
  position: fixed;
66
66
  top: 0;
67
67
  left: 0;
@@ -72,13 +72,13 @@
72
72
  align-items: center;
73
73
  justify-content: center;
74
74
  z-index: 10000;
75
- `;const o=document.createElement("div");o.className="link-dialog",o.style.cssText=`
75
+ `;const n=document.createElement("div");n.className="link-dialog",n.style.cssText=`
76
76
  background: white;
77
77
  border-radius: 8px;
78
78
  width: 500px;
79
79
  max-width: 90%;
80
80
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
81
- `,o.innerHTML=`
81
+ `,n.innerHTML=`
82
82
  <div class="link-dialog-header" style="padding: 16px 20px; border-bottom: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center;">
83
83
  <h3 style="margin: 0; font-size: 18px;">${e.isEditing?"Edit Link":"Insert Link"}</h3>
84
84
  <button class="link-dialog-close" style="background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px;">×</button>
@@ -135,4 +135,4 @@
135
135
  </button>
136
136
  </div>
137
137
  </form>
138
- `,n.appendChild(o),document.body.appendChild(n);const r=o.querySelector("#link-form"),i=o.querySelector("#link-text"),d=o.querySelector("#link-url"),y=o.querySelector("#link-title"),v=o.querySelector("#link-target"),E=o.querySelector(".link-dialog-close"),L=o.querySelector(".btn-cancel"),b=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),c())},c=()=>{document.removeEventListener("keydown",b,!0),n.remove()};E.addEventListener("click",c),L.addEventListener("click",c),n.addEventListener("click",s=>{s.target===n&&c()}),document.addEventListener("keydown",b,!0),r.addEventListener("submit",s=>{s.preventDefault();const g=d.value.trim();g&&(A({text:i.value.trim()||g,url:g,target:v.checked?"_blank":"_self",title:y.value.trim()||void 0}),c())}),setTimeout(()=>i.focus(),100)},x=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).cloneRange();a=t;const n=C(t),o=e.toString()||"",r=t.startContainer,d=(r.nodeType===Node.TEXT_NODE?r.parentElement:r)?.closest("a");return d?(u=!0,l=d,k({text:d.textContent||"",url:d.href,target:d.target||"_self",title:d.title||"",isEditing:!0},n)):(u=!1,l=null,k({text:o,url:"",target:"_self",isEditing:!1},n)),!0},h=()=>(document.execCommand("unlink",!1),!0),m=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},f=()=>{m("openLinkDialog",x),m("removeLink",h),m("createLink",e=>{e&&document.execCommand("createLink",!1,e)})};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const S=()=>({name:"link",marks:{link:{attrs:{href:{},title:{default:null},target:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),title:e.getAttribute("title"),target:e.getAttribute("target")})}],toDOM:e=>["a",{href:e.attrs.href,title:e.attrs.title,target:e.attrs.target,rel:e.attrs.target==="_blank"?"noopener noreferrer":null},0]}},toolbar:[{label:"Link",command:"openLinkDialog",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-k"}],commands:{openLinkDialog:x,removeLink:h},keymap:{"Mod-k":"openLinkDialog"}});exports.LinkPlugin=S;
138
+ `,o.appendChild(n),document.body.appendChild(o);const r=n.querySelector("#link-form"),i=n.querySelector("#link-text"),d=n.querySelector("#link-url"),y=n.querySelector("#link-title"),v=n.querySelector("#link-target"),E=n.querySelector(".link-dialog-close"),L=n.querySelector(".btn-cancel"),b=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),c())},c=()=>{document.removeEventListener("keydown",b,!0),o.remove()};E.addEventListener("click",c),L.addEventListener("click",c),o.addEventListener("click",s=>{s.target===o&&c()}),document.addEventListener("keydown",b,!0),r.addEventListener("submit",s=>{s.preventDefault();const g=d.value.trim();g&&(A({text:i.value.trim()||g,url:g,target:v.checked?"_blank":"_self",title:y.value.trim()||void 0}),c())}),setTimeout(()=>i.focus(),100)},x=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).cloneRange();a=t;const o=C(t),n=e.toString()||"",r=t.startContainer,i=r.nodeType===Node.TEXT_NODE?r.parentElement:r,d=i==null?void 0:i.closest("a");return d?(u=!0,l=d,k({text:d.textContent||"",url:d.href,target:d.target||"_self",title:d.title||"",isEditing:!0},o)):(u=!1,l=null,k({text:n,url:"",target:"_self",isEditing:!1},o)),!0},h=()=>(document.execCommand("unlink",!1),!0),m=(e,t)=>{var o;typeof window<"u"&&((o=window.registerEditorCommand)==null||o.call(window,e,t))},f=()=>{m("openLinkDialog",x),m("removeLink",h),m("createLink",e=>{e&&document.execCommand("createLink",!1,e)})};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const S=()=>({name:"link",marks:{link:{attrs:{href:{},title:{default:null},target:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),title:e.getAttribute("title"),target:e.getAttribute("target")})}],toDOM:e=>["a",{href:e.attrs.href,title:e.attrs.title,target:e.attrs.target,rel:e.attrs.target==="_blank"?"noopener noreferrer":null},0]}},toolbar:[{label:"Link",command:"openLinkDialog",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-k"}],commands:{openLinkDialog:x,removeLink:h},keymap:{"Mod-k":"openLinkDialog"}});exports.LinkPlugin=S;
package/dist/link.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  let a = null, u = !1, l = null;
2
2
  const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
3
- if (!e) return null;
3
+ if (!e)
4
+ return null;
4
5
  let t = e;
5
6
  for (; t; ) {
6
7
  if (t.hasAttribute("contenteditable") && t.getAttribute("contenteditable") === "true" || t.hasAttribute("data-editora-content"))
@@ -10,12 +11,15 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
10
11
  return null;
11
12
  }, C = (e) => {
12
13
  if (e) {
13
- const n = e.startContainer;
14
- if ((n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(p)) return !0;
14
+ const o = e.startContainer, n = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement;
15
+ if (n != null && n.closest(p))
16
+ return !0;
15
17
  }
16
- return document.activeElement?.closest(p) ? !0 : document.body.matches(p) || document.documentElement.matches(p);
18
+ const t = document.activeElement;
19
+ return t != null && t.closest(p) ? !0 : document.body.matches(p) || document.documentElement.matches(p);
17
20
  }, T = () => {
18
- if (document.getElementById("rte-link-dialog-theme-styles")) return;
21
+ if (document.getElementById("rte-link-dialog-theme-styles"))
22
+ return;
19
23
  const e = document.createElement("style");
20
24
  e.id = "rte-link-dialog-theme-styles", e.textContent = `
21
25
  .link-dialog-overlay.rte-theme-dark .link-dialog {
@@ -86,8 +90,8 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
86
90
  console.warn("No selection range stored");
87
91
  return;
88
92
  }
89
- const t = a.startContainer, n = t.nodeType === Node.TEXT_NODE ? t.parentElement : t, o = w(n);
90
- if (o) {
93
+ const t = a.startContainer, o = t.nodeType === Node.TEXT_NODE ? t.parentElement : t, n = w(o);
94
+ if (n) {
91
95
  if (u && l) {
92
96
  l.href = e.url, l.textContent = e.text, l.target = e.target, e.target === "_blank" ? l.setAttribute("rel", "noopener noreferrer") : l.removeAttribute("rel"), e.title ? l.title = e.title : l.removeAttribute("title");
93
97
  const r = document.createRange();
@@ -100,12 +104,12 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
100
104
  const i = window.getSelection();
101
105
  i && (i.removeAllRanges(), i.addRange(a));
102
106
  }
103
- o.focus(), a = null, u = !1, l = null;
107
+ n.focus(), a = null, u = !1, l = null;
104
108
  }
105
109
  }, k = (e, t) => {
106
110
  T();
107
- const n = document.createElement("div");
108
- n.className = "link-dialog-overlay", t && n.classList.add("rte-theme-dark"), n.style.cssText = `
111
+ const o = document.createElement("div");
112
+ o.className = "link-dialog-overlay", t && o.classList.add("rte-theme-dark"), o.style.cssText = `
109
113
  position: fixed;
110
114
  top: 0;
111
115
  left: 0;
@@ -117,14 +121,14 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
117
121
  justify-content: center;
118
122
  z-index: 10000;
119
123
  `;
120
- const o = document.createElement("div");
121
- o.className = "link-dialog", o.style.cssText = `
124
+ const n = document.createElement("div");
125
+ n.className = "link-dialog", n.style.cssText = `
122
126
  background: white;
123
127
  border-radius: 8px;
124
128
  width: 500px;
125
129
  max-width: 90%;
126
130
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
127
- `, o.innerHTML = `
131
+ `, n.innerHTML = `
128
132
  <div class="link-dialog-header" style="padding: 16px 20px; border-bottom: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center;">
129
133
  <h3 style="margin: 0; font-size: 18px;">${e.isEditing ? "Edit Link" : "Insert Link"}</h3>
130
134
  <button class="link-dialog-close" style="background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px;">×</button>
@@ -181,14 +185,14 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
181
185
  </button>
182
186
  </div>
183
187
  </form>
184
- `, n.appendChild(o), document.body.appendChild(n);
185
- const r = o.querySelector("#link-form"), i = o.querySelector("#link-text"), d = o.querySelector("#link-url"), y = o.querySelector("#link-title"), v = o.querySelector("#link-target"), E = o.querySelector(".link-dialog-close"), L = o.querySelector(".btn-cancel"), b = (s) => {
188
+ `, o.appendChild(n), document.body.appendChild(o);
189
+ const r = n.querySelector("#link-form"), i = n.querySelector("#link-text"), d = n.querySelector("#link-url"), y = n.querySelector("#link-title"), v = n.querySelector("#link-target"), E = n.querySelector(".link-dialog-close"), L = n.querySelector(".btn-cancel"), b = (s) => {
186
190
  s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), c());
187
191
  }, c = () => {
188
- document.removeEventListener("keydown", b, !0), n.remove();
192
+ document.removeEventListener("keydown", b, !0), o.remove();
189
193
  };
190
- E.addEventListener("click", c), L.addEventListener("click", c), n.addEventListener("click", (s) => {
191
- s.target === n && c();
194
+ E.addEventListener("click", c), L.addEventListener("click", c), o.addEventListener("click", (s) => {
195
+ s.target === o && c();
192
196
  }), document.addEventListener("keydown", b, !0), r.addEventListener("submit", (s) => {
193
197
  s.preventDefault();
194
198
  const g = d.value.trim();
@@ -201,24 +205,26 @@ const p = '[data-theme="dark"], .dark, .editora-theme-dark', w = (e) => {
201
205
  }), setTimeout(() => i.focus(), 100);
202
206
  }, x = () => {
203
207
  const e = window.getSelection();
204
- if (!e || e.rangeCount === 0) return !1;
208
+ if (!e || e.rangeCount === 0)
209
+ return !1;
205
210
  const t = e.getRangeAt(0).cloneRange();
206
211
  a = t;
207
- const n = C(t), o = e.toString() || "", r = t.startContainer, d = (r.nodeType === Node.TEXT_NODE ? r.parentElement : r)?.closest("a");
212
+ const o = C(t), n = e.toString() || "", r = t.startContainer, i = r.nodeType === Node.TEXT_NODE ? r.parentElement : r, d = i == null ? void 0 : i.closest("a");
208
213
  return d ? (u = !0, l = d, k({
209
214
  text: d.textContent || "",
210
215
  url: d.href,
211
216
  target: d.target || "_self",
212
217
  title: d.title || "",
213
218
  isEditing: !0
214
- }, n)) : (u = !1, l = null, k({
215
- text: o,
219
+ }, o)) : (u = !1, l = null, k({
220
+ text: n,
216
221
  url: "",
217
222
  target: "_self",
218
223
  isEditing: !1
219
- }, n)), !0;
224
+ }, o)), !0;
220
225
  }, h = () => (document.execCommand("unlink", !1), !0), m = (e, t) => {
221
- typeof window < "u" && window.registerEditorCommand?.(e, t);
226
+ var o;
227
+ typeof window < "u" && ((o = window.registerEditorCommand) == null || o.call(window, e, t));
222
228
  }, f = () => {
223
229
  m("openLinkDialog", x), m("removeLink", h), m("createLink", (e) => {
224
230
  e && document.execCommand("createLink", !1, e);
package/dist/list.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=()=>m("insertUnorderedList"),u=()=>m("insertOrderedList");function g(){const o=window.getSelection();if(o&&o.rangeCount>0){const n=o.getRangeAt(0).startContainer,e=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(e)return e}const t=document.activeElement;return t?t.getAttribute("contenteditable")==="true"?t:t.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function f(o){o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach(n=>{Array.from(n.childNodes).forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const l=(e.textContent||"").trim();if(!l){n.removeChild(e);return}const s=document.createElement("li");s.textContent=l,n.replaceChild(s,e);return}if(!(e instanceof HTMLElement)){n.removeChild(e);return}if(e.tagName==="LI")return;const i=document.createElement("li");for(;e.firstChild;)i.appendChild(e.firstChild);n.replaceChild(i,e)})})}function m(o){const t=g();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return!1;t.focus({preventScroll:!0});const e=document.execCommand(o,!1);return f(t),t.dispatchEvent(new Event("input",{bubbles:!0})),e!==!1}const c=(o,t)=>{typeof window<"u"&&window.registerEditorCommand?.(o,t)},a=()=>{c("toggleBulletList",d),c("toggleOrderedList",u)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a());const h=()=>({name:"list",nodes:{bulletList:{content:"listItem+",group:"block",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},orderedList:{content:"listItem+",group:"block",parseDOM:[{tag:"ol"}],toDOM:()=>["ol",0]},listItem:{content:"paragraph",parseDOM:[{tag:"li"}],toDOM:()=>["li",0]}},toolbar:[{label:"Bullet List",command:"toggleBulletList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-8"},{label:"Numbered List",command:"toggleOrderedList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0 0-.2l-.7.3a.5.5 0 0 1-.7-.3.5.5 0 0 1 .3-.6l.7-.4c.5-.2 1.1 0 1.4.4.3.5.3 1.1-.1 1.5l-1.2.7Zm0 3.7v.5c0 .3.2.5.5.5h1c.3 0 .5.2.5.5s-.2.5-.5.5h-1a1.5 1.5 0 0 1-1.5-1.5v-.5c0-.3.1-.6.3-.8l1.3-1.4c.3-.4.1-.9-.2-1-.1 0-.2 0-.3.2l-.4.5a.5.5 0 0 1-.7.1.5.5 0 0 1-.1-.7l.4-.5c.5-.5 1.2-.6 1.8-.4.6.3 1 .9 1 1.6 0 .4-.2.8-.5 1.1l-1.3 1.4-.3.4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-7"}],commands:{toggleBulletList:d,toggleOrderedList:u},keymap:{"Mod-Shift-8":"toggleBulletList","Mod-Shift-7":"toggleOrderedList"}});exports.ListPlugin=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=()=>m("insertUnorderedList"),u=()=>m("insertOrderedList");function g(){const o=window.getSelection();if(o&&o.rangeCount>0){const e=o.getRangeAt(0).startContainer,r=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement,t=r==null?void 0:r.closest('[contenteditable="true"], .rte-content, .editora-content');if(t)return t}const n=document.activeElement;return n?n.getAttribute("contenteditable")==="true"?n:n.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function f(o){o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach(e=>{Array.from(e.childNodes).forEach(t=>{if(t.nodeType===Node.TEXT_NODE){const l=(t.textContent||"").trim();if(!l){e.removeChild(t);return}const s=document.createElement("li");s.textContent=l,e.replaceChild(s,t);return}if(!(t instanceof HTMLElement)){e.removeChild(t);return}if(t.tagName==="LI")return;const i=document.createElement("li");for(;t.firstChild;)i.appendChild(t.firstChild);e.replaceChild(i,t)})})}function m(o){const n=g();if(!n)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const r=e.getRangeAt(0);if(!n.contains(r.commonAncestorContainer))return!1;n.focus({preventScroll:!0});const t=document.execCommand(o,!1);return f(n),n.dispatchEvent(new Event("input",{bubbles:!0})),t!==!1}const c=(o,n)=>{var e;typeof window<"u"&&((e=window.registerEditorCommand)==null||e.call(window,o,n))},a=()=>{c("toggleBulletList",d),c("toggleOrderedList",u)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a());const h=()=>({name:"list",nodes:{bulletList:{content:"listItem+",group:"block",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},orderedList:{content:"listItem+",group:"block",parseDOM:[{tag:"ol"}],toDOM:()=>["ol",0]},listItem:{content:"paragraph",parseDOM:[{tag:"li"}],toDOM:()=>["li",0]}},toolbar:[{label:"Bullet List",command:"toggleBulletList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-8"},{label:"Numbered List",command:"toggleOrderedList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0 0-.2l-.7.3a.5.5 0 0 1-.7-.3.5.5 0 0 1 .3-.6l.7-.4c.5-.2 1.1 0 1.4.4.3.5.3 1.1-.1 1.5l-1.2.7Zm0 3.7v.5c0 .3.2.5.5.5h1c.3 0 .5.2.5.5s-.2.5-.5.5h-1a1.5 1.5 0 0 1-1.5-1.5v-.5c0-.3.1-.6.3-.8l1.3-1.4c.3-.4.1-.9-.2-1-.1 0-.2 0-.3.2l-.4.5a.5.5 0 0 1-.7.1.5.5 0 0 1-.1-.7l.4-.5c.5-.5 1.2-.6 1.8-.4.6.3 1 .9 1 1.6 0 .4-.2.8-.5 1.1l-1.3 1.4-.3.4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-7"}],commands:{toggleBulletList:d,toggleOrderedList:u},keymap:{"Mod-Shift-8":"toggleBulletList","Mod-Shift-7":"toggleOrderedList"}});exports.ListPlugin=h;
package/dist/list.esm.js CHANGED
@@ -2,27 +2,28 @@ const d = () => m("insertUnorderedList"), u = () => m("insertOrderedList");
2
2
  function g() {
3
3
  const o = window.getSelection();
4
4
  if (o && o.rangeCount > 0) {
5
- const n = o.getRangeAt(0).startContainer, e = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
6
- if (e) return e;
5
+ const t = o.getRangeAt(0).startContainer, r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement, e = r == null ? void 0 : r.closest('[contenteditable="true"], .rte-content, .editora-content');
6
+ if (e)
7
+ return e;
7
8
  }
8
- const t = document.activeElement;
9
- return t ? t.getAttribute("contenteditable") === "true" ? t : t.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
9
+ const n = document.activeElement;
10
+ return n ? n.getAttribute("contenteditable") === "true" ? n : n.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
10
11
  }
11
12
  function f(o) {
12
- o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach((n) => {
13
- Array.from(n.childNodes).forEach((e) => {
13
+ o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach((t) => {
14
+ Array.from(t.childNodes).forEach((e) => {
14
15
  if (e.nodeType === Node.TEXT_NODE) {
15
16
  const l = (e.textContent || "").trim();
16
17
  if (!l) {
17
- n.removeChild(e);
18
+ t.removeChild(e);
18
19
  return;
19
20
  }
20
21
  const s = document.createElement("li");
21
- s.textContent = l, n.replaceChild(s, e);
22
+ s.textContent = l, t.replaceChild(s, e);
22
23
  return;
23
24
  }
24
25
  if (!(e instanceof HTMLElement)) {
25
- n.removeChild(e);
26
+ t.removeChild(e);
26
27
  return;
27
28
  }
28
29
  if (e.tagName === "LI")
@@ -30,23 +31,27 @@ function f(o) {
30
31
  const i = document.createElement("li");
31
32
  for (; e.firstChild; )
32
33
  i.appendChild(e.firstChild);
33
- n.replaceChild(i, e);
34
+ t.replaceChild(i, e);
34
35
  });
35
36
  });
36
37
  }
37
38
  function m(o) {
38
- const t = g();
39
- if (!t) return !1;
40
- const n = window.getSelection();
41
- if (!n || n.rangeCount === 0) return !1;
42
- const r = n.getRangeAt(0);
43
- if (!t.contains(r.commonAncestorContainer)) return !1;
44
- t.focus({ preventScroll: !0 });
39
+ const n = g();
40
+ if (!n)
41
+ return !1;
42
+ const t = window.getSelection();
43
+ if (!t || t.rangeCount === 0)
44
+ return !1;
45
+ const r = t.getRangeAt(0);
46
+ if (!n.contains(r.commonAncestorContainer))
47
+ return !1;
48
+ n.focus({ preventScroll: !0 });
45
49
  const e = document.execCommand(o, !1);
46
- return f(t), t.dispatchEvent(new Event("input", { bubbles: !0 })), e !== !1;
50
+ return f(n), n.dispatchEvent(new Event("input", { bubbles: !0 })), e !== !1;
47
51
  }
48
- const c = (o, t) => {
49
- typeof window < "u" && window.registerEditorCommand?.(o, t);
52
+ const c = (o, n) => {
53
+ var t;
54
+ typeof window < "u" && ((t = window.registerEditorCommand) == null || t.call(window, o, n));
50
55
  }, a = () => {
51
56
  c("toggleBulletList", d), c("toggleOrderedList", u);
52
57
  };
package/dist/lite.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./heading.cjs.js"),n=require("./bold.cjs.js"),l=require("./italic.cjs.js"),r=require("./underline.cjs.js"),t=require("./strikethrough.cjs.js"),u=require("./list.cjs.js"),o=require("./checklist.cjs.js"),g=require("./history.cjs.js"),P=require("./link.cjs.js"),c=require("./blockquote.cjs.js"),s=require("./clear-formatting.cjs.js"),a=require("./table.cjs.js"),q=require("./font-size.cjs.js"),d=require("./font-family.cjs.js"),h=require("./text-alignment.cjs.js"),k=require("./text-color.cjs.js"),C=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),p=require("./indent.cjs.js"),F=require("./direction.cjs.js"),A=require("./capitalization.cjs.js"),f=require("./anchor.cjs.js"),m=require("./page-break.cjs.js"),B=require("./footnote.cjs.js"),H=require("./fullscreen.cjs.js"),y=require("./preview.cjs.js"),S=require("./print.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=e.HeadingPlugin;exports.BoldPlugin=n.BoldPlugin;exports.ItalicPlugin=l.ItalicPlugin;exports.UnderlinePlugin=r.UnderlinePlugin;exports.StrikethroughPlugin=t.StrikethroughPlugin;exports.ListPlugin=u.ListPlugin;exports.ChecklistPlugin=o.ChecklistPlugin;exports.HistoryPlugin=g.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=c.BlockquotePlugin;exports.ClearFormattingPlugin=s.ClearFormattingPlugin;exports.TablePlugin=a.TablePlugin;exports.FontSizePlugin=q.FontSizePlugin;exports.FontFamilyPlugin=d.FontFamilyPlugin;exports.TextAlignmentPlugin=h.TextAlignmentPlugin;exports.TextColorPlugin=k.TextColorPlugin;exports.BackgroundColorPlugin=C.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=p.IndentPlugin;exports.DirectionPlugin=F.DirectionPlugin;exports.CapitalizationPlugin=A.CapitalizationPlugin;exports.AnchorPlugin=f.AnchorPlugin;exports.PageBreakPlugin=m.PageBreakPlugin;exports.FootnotePlugin=B.FootnotePlugin;exports.FullscreenPlugin=H.FullscreenPlugin;exports.PreviewPlugin=y.PreviewPlugin;exports.PrintPlugin=S.PrintPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./heading.cjs.js"),n=require("./bold.cjs.js"),l=require("./italic.cjs.js"),r=require("./underline.cjs.js"),t=require("./strikethrough.cjs.js"),u=require("./list.cjs.js"),o=require("./checklist.cjs.js"),g=require("./history.cjs.js"),P=require("./link.cjs.js"),c=require("./blockquote.cjs.js"),s=require("./clear-formatting.cjs.js"),a=require("./table.cjs.js"),q=require("./font-size.cjs.js"),d=require("./font-family.cjs.js"),h=require("./text-alignment.cjs.js"),k=require("./text-color.cjs.js"),C=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),p=require("./indent.cjs.js"),F=require("./direction.cjs.js"),A=require("./capitalization.cjs.js"),f=require("./anchor.cjs.js"),m=require("./page-break.cjs.js"),B=require("./footnote.cjs.js"),H=require("./fullscreen.cjs.js"),y=require("./preview.cjs.js"),S=require("./print.cjs.js"),i=require("./shared-config.cjs.js");require("./editorContainerHelpers-36b8ddf3.js");require("./anchoredPopover-8151d535.js");exports.HeadingPlugin=e.HeadingPlugin;exports.BoldPlugin=n.BoldPlugin;exports.ItalicPlugin=l.ItalicPlugin;exports.UnderlinePlugin=r.UnderlinePlugin;exports.StrikethroughPlugin=t.StrikethroughPlugin;exports.ListPlugin=u.ListPlugin;exports.ChecklistPlugin=o.ChecklistPlugin;exports.HistoryPlugin=g.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=c.BlockquotePlugin;exports.ClearFormattingPlugin=s.ClearFormattingPlugin;exports.TablePlugin=a.TablePlugin;exports.FontSizePlugin=q.FontSizePlugin;exports.FontFamilyPlugin=d.FontFamilyPlugin;exports.TextAlignmentPlugin=h.TextAlignmentPlugin;exports.TextColorPlugin=k.TextColorPlugin;exports.BackgroundColorPlugin=C.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=p.IndentPlugin;exports.DirectionPlugin=F.DirectionPlugin;exports.CapitalizationPlugin=A.CapitalizationPlugin;exports.AnchorPlugin=f.AnchorPlugin;exports.PageBreakPlugin=m.PageBreakPlugin;exports.FootnotePlugin=B.FootnotePlugin;exports.FullscreenPlugin=H.FullscreenPlugin;exports.PreviewPlugin=y.PreviewPlugin;exports.PrintPlugin=S.PrintPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
package/dist/lite.esm.js CHANGED
@@ -1,61 +1,63 @@
1
- import { HeadingPlugin as e } from "./heading.esm.js";
2
- import { BoldPlugin as t } from "./bold.esm.js";
3
- import { ItalicPlugin as n } from "./italic.esm.js";
4
- import { UnderlinePlugin as p } from "./underline.esm.js";
5
- import { StrikethroughPlugin as m } from "./strikethrough.esm.js";
6
- import { ListPlugin as x } from "./list.esm.js";
7
- import { ChecklistPlugin as a } from "./checklist.esm.js";
8
- import { HistoryPlugin as d } from "./history.esm.js";
9
- import { LinkPlugin as k } from "./link.esm.js";
10
- import { BlockquotePlugin as A } from "./blockquote.esm.js";
11
- import { ClearFormattingPlugin as b } from "./clear-formatting.esm.js";
12
- import { TablePlugin as B } from "./table.esm.js";
13
- import { FontSizePlugin as G } from "./font-size.esm.js";
14
- import { FontFamilyPlugin as T } from "./font-family.esm.js";
15
- import { TextAlignmentPlugin as z } from "./text-alignment.esm.js";
16
- import { TextColorPlugin as S } from "./text-color.esm.js";
17
- import { BackgroundColorPlugin as q } from "./background-color.esm.js";
18
- import { LineHeightPlugin as w } from "./line-height.esm.js";
19
- import { IndentPlugin as j } from "./indent.esm.js";
20
- import { DirectionPlugin as J } from "./direction.esm.js";
21
- import { CapitalizationPlugin as M } from "./capitalization.esm.js";
22
- import { AnchorPlugin as O } from "./anchor.esm.js";
23
- import { PageBreakPlugin as R } from "./page-break.esm.js";
24
- import { FootnotePlugin as W } from "./footnote.esm.js";
25
- import { FullscreenPlugin as Y } from "./fullscreen.esm.js";
26
- import { PreviewPlugin as _ } from "./preview.esm.js";
27
- import { PrintPlugin as oo } from "./print.esm.js";
28
- import { buildApiUrl as eo, getGlobalApiConfig as io, getGlobalApiHeaders as to, setGlobalApiConfig as lo } from "./shared-config.esm.js";
1
+ import { HeadingPlugin as t } from "./heading.esm.js";
2
+ import { BoldPlugin as n } from "./bold.esm.js";
3
+ import { ItalicPlugin as p } from "./italic.esm.js";
4
+ import { UnderlinePlugin as u } from "./underline.esm.js";
5
+ import { StrikethroughPlugin as x } from "./strikethrough.esm.js";
6
+ import { ListPlugin as a } from "./list.esm.js";
7
+ import { ChecklistPlugin as d } from "./checklist.esm.js";
8
+ import { HistoryPlugin as k } from "./history.esm.js";
9
+ import { LinkPlugin as A } from "./link.esm.js";
10
+ import { BlockquotePlugin as b } from "./blockquote.esm.js";
11
+ import { ClearFormattingPlugin as B } from "./clear-formatting.esm.js";
12
+ import { TablePlugin as G } from "./table.esm.js";
13
+ import { FontSizePlugin as T } from "./font-size.esm.js";
14
+ import { FontFamilyPlugin as z } from "./font-family.esm.js";
15
+ import { TextAlignmentPlugin as S } from "./text-alignment.esm.js";
16
+ import { TextColorPlugin as q } from "./text-color.esm.js";
17
+ import { BackgroundColorPlugin as w } from "./background-color.esm.js";
18
+ import { LineHeightPlugin as j } from "./line-height.esm.js";
19
+ import { IndentPlugin as J } from "./indent.esm.js";
20
+ import { DirectionPlugin as M } from "./direction.esm.js";
21
+ import { CapitalizationPlugin as O } from "./capitalization.esm.js";
22
+ import { AnchorPlugin as R } from "./anchor.esm.js";
23
+ import { PageBreakPlugin as W } from "./page-break.esm.js";
24
+ import { FootnotePlugin as Y } from "./footnote.esm.js";
25
+ import { FullscreenPlugin as _ } from "./fullscreen.esm.js";
26
+ import { PreviewPlugin as oo } from "./preview.esm.js";
27
+ import { PrintPlugin as io } from "./print.esm.js";
28
+ import { buildApiUrl as to, getGlobalApiConfig as lo, getGlobalApiHeaders as no, setGlobalApiConfig as go } from "./shared-config.esm.js";
29
+ import "./editorContainerHelpers-69585c07.mjs";
30
+ import "./anchoredPopover-33f1358d.mjs";
29
31
  export {
30
- O as AnchorPlugin,
31
- q as BackgroundColorPlugin,
32
- A as BlockquotePlugin,
33
- t as BoldPlugin,
34
- M as CapitalizationPlugin,
35
- a as ChecklistPlugin,
36
- b as ClearFormattingPlugin,
37
- J as DirectionPlugin,
38
- T as FontFamilyPlugin,
39
- G as FontSizePlugin,
40
- W as FootnotePlugin,
41
- Y as FullscreenPlugin,
42
- e as HeadingPlugin,
43
- d as HistoryPlugin,
44
- j as IndentPlugin,
45
- n as ItalicPlugin,
46
- w as LineHeightPlugin,
47
- k as LinkPlugin,
48
- x as ListPlugin,
49
- R as PageBreakPlugin,
50
- _ as PreviewPlugin,
51
- oo as PrintPlugin,
52
- m as StrikethroughPlugin,
53
- B as TablePlugin,
54
- z as TextAlignmentPlugin,
55
- S as TextColorPlugin,
56
- p as UnderlinePlugin,
57
- eo as buildApiUrl,
58
- io as getGlobalApiConfig,
59
- to as getGlobalApiHeaders,
60
- lo as setGlobalApiConfig
32
+ R as AnchorPlugin,
33
+ w as BackgroundColorPlugin,
34
+ b as BlockquotePlugin,
35
+ n as BoldPlugin,
36
+ O as CapitalizationPlugin,
37
+ d as ChecklistPlugin,
38
+ B as ClearFormattingPlugin,
39
+ M as DirectionPlugin,
40
+ z as FontFamilyPlugin,
41
+ T as FontSizePlugin,
42
+ Y as FootnotePlugin,
43
+ _ as FullscreenPlugin,
44
+ t as HeadingPlugin,
45
+ k as HistoryPlugin,
46
+ J as IndentPlugin,
47
+ p as ItalicPlugin,
48
+ j as LineHeightPlugin,
49
+ A as LinkPlugin,
50
+ a as ListPlugin,
51
+ W as PageBreakPlugin,
52
+ oo as PreviewPlugin,
53
+ io as PrintPlugin,
54
+ x as StrikethroughPlugin,
55
+ G as TablePlugin,
56
+ S as TextAlignmentPlugin,
57
+ q as TextColorPlugin,
58
+ u as UnderlinePlugin,
59
+ to as buildApiUrl,
60
+ lo as getGlobalApiConfig,
61
+ no as getGlobalApiHeaders,
62
+ go as setGlobalApiConfig
61
63
  };