@editora/plugins 1.0.11 → 1.0.13

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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/approval-workflow.cjs.js +14 -14
  3. package/dist/approval-workflow.esm.js +265 -262
  4. package/dist/blockquote.cjs.js +1 -1
  5. package/dist/blockquote.esm.js +177 -15
  6. package/dist/blocks-library.cjs.js +6 -6
  7. package/dist/blocks-library.esm.js +95 -92
  8. package/dist/bold.cjs.js +1 -1
  9. package/dist/bold.esm.js +10 -6
  10. package/dist/capitalization.cjs.js +1 -1
  11. package/dist/capitalization.esm.js +124 -44
  12. package/dist/checklist.cjs.js +1 -1
  13. package/dist/checklist.esm.js +251 -191
  14. package/dist/citations.cjs.js +4 -4
  15. package/dist/citations.esm.js +131 -128
  16. package/dist/clear-formatting.cjs.js +1 -1
  17. package/dist/clear-formatting.esm.js +68 -36
  18. package/dist/code.cjs.js +121 -44
  19. package/dist/code.esm.js +2694 -889
  20. package/dist/content-rules.cjs.js +5 -5
  21. package/dist/content-rules.esm.js +104 -101
  22. package/dist/data-binding.cjs.js +3 -3
  23. package/dist/data-binding.esm.js +51 -48
  24. package/dist/direction.cjs.js +1 -1
  25. package/dist/direction.esm.js +97 -74
  26. package/dist/doc-schema.cjs.js +4 -4
  27. package/dist/doc-schema.esm.js +104 -101
  28. package/dist/embed-iframe.cjs.js +21 -4
  29. package/dist/embed-iframe.esm.js +279 -116
  30. package/dist/heading.cjs.js +1 -1
  31. package/dist/heading.esm.js +239 -56
  32. package/dist/history.cjs.js +1 -1
  33. package/dist/history.esm.js +74 -89
  34. package/dist/inlineFormatting-DOYOJdnD.js +1 -0
  35. package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
  36. package/dist/italic.cjs.js +1 -1
  37. package/dist/italic.esm.js +12 -8
  38. package/dist/math.cjs.js +27 -21
  39. package/dist/math.esm.js +218 -146
  40. package/dist/merge-tag.cjs.js +8 -2
  41. package/dist/merge-tag.esm.js +130 -111
  42. package/dist/pii-redaction.cjs.js +6 -6
  43. package/dist/pii-redaction.esm.js +169 -166
  44. package/dist/smart-paste.cjs.js +5 -5
  45. package/dist/smart-paste.esm.js +120 -117
  46. package/dist/special-characters.cjs.js +6 -10
  47. package/dist/special-characters.esm.js +97 -75
  48. package/dist/strikethrough.cjs.js +1 -1
  49. package/dist/strikethrough.esm.js +11 -25
  50. package/dist/translation-workflow.cjs.js +7 -7
  51. package/dist/translation-workflow.esm.js +103 -100
  52. package/dist/underline.cjs.js +1 -1
  53. package/dist/underline.esm.js +7 -3
  54. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=f();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const o=e.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const n=o.cloneRange();return t.focus({preventScroll:!0}),document.execCommand("unlink",!1),document.execCommand("removeFormat",!1),h(t,n),m(t,n),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),l=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),u=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),d=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function f(){const t=window.getSelection();if(t&&t.rangeCount>0){const o=t.getRangeAt(0).startContainer,r=(o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(r)return r}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const o=document.createRange();return e.nodeType===Node.ELEMENT_NODE?o.selectNodeContents(e):o.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,o)>0&&t.compareBoundaryPoints(Range.START_TO_END,o)<0}function a(t){let e=0,o=t;for(;o&&o.parentNode;)e+=1,o=o.parentNode;return e}function g(t){d.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.length===0&&t.removeAttribute("class")}function i(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function h(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(!c(e,n)||!u.has(n.tagName))return;const r=document.createElement("p");for(;n.firstChild;)r.appendChild(n.firstChild);n.parentNode?.replaceChild(r,n)})}function m(t,e){const o=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));o.sort((n,r)=>a(r)-a(n)),o.forEach(n=>{if(n.isConnected&&c(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(g(n),l.has(n.tagName)){i(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&i(n)}})}exports.ClearFormattingPlugin=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=m();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const n=e.getRangeAt(0);if(!t.contains(n.commonAncestorContainer))return!1;const r=n.cloneRange();return t.focus({preventScroll:!0}),A(t,r),C(t,r),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),d=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),g=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),h=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function m(){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0).startContainer,o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(o)return o}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const n=document.createRange();return e.nodeType===Node.ELEMENT_NODE?n.selectNodeContents(e):n.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,n)>0&&t.compareBoundaryPoints(Range.START_TO_END,n)<0}function i(t){let e=0,n=t;for(;n&&n.parentNode;)e+=1,n=n.parentNode;return e}function p(t){h.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.length===0&&t.removeAttribute("class")}function a(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function E(t){return t.tagName!=="P"||t.attributes.length>0||(t.textContent||"").trim()!==""?!1:!t.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function l(t){Array.from(t.children).forEach(e=>{E(e)&&e.remove()})}function s(t){l(t),a(t)}function f(t){const e=document.createElement("p");for(Array.from(t.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});t.firstChild;)e.appendChild(t.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),t.parentNode?.replaceChild(e,t)}function N(t){if(l(t),t.parentElement instanceof HTMLLIElement){s(t);return}if(Array.from(t.childNodes).filter(o=>o.nodeType!==Node.TEXT_NODE||(o.textContent||"").trim()!=="").some(o=>o instanceof HTMLElement&&/^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(o.tagName))){s(t);return}f(t)}function C(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(r=>{if(c(e,r)&&g.has(r.tagName)){if(r.tagName==="BLOCKQUOTE"){N(r);return}f(r)}})}function A(t,e){const n=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));n.sort((r,o)=>i(o)-i(r)),n.forEach(r=>{if(r.isConnected&&c(e,r)&&!(r.getAttribute("contenteditable")==="false"||r.closest('[contenteditable="false"]'))){if(p(r),d.has(r.tagName)){a(r);return}r.tagName==="SPAN"&&r.attributes.length===0&&a(r)}})}exports.ClearFormattingPlugin=u;
@@ -1,4 +1,4 @@
1
- const m = () => ({
1
+ const C = () => ({
2
2
  name: "clearFormatting",
3
3
  // Toolbar button configuration
4
4
  toolbar: [
@@ -15,21 +15,21 @@ const m = () => ({
15
15
  * Remove all formatting from current selection
16
16
  */
17
17
  clearFormatting: () => {
18
- const t = d();
18
+ const t = h();
19
19
  if (!t) return !1;
20
20
  const e = window.getSelection();
21
21
  if (!e || e.rangeCount === 0) return !1;
22
- const o = e.getRangeAt(0);
23
- if (!t.contains(o.commonAncestorContainer)) return !1;
24
- const n = o.cloneRange();
25
- return t.focus({ preventScroll: !0 }), document.execCommand("unlink", !1), document.execCommand("removeFormat", !1), g(t, n), h(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
22
+ const n = e.getRangeAt(0);
23
+ if (!t.contains(n.commonAncestorContainer)) return !1;
24
+ const r = n.cloneRange();
25
+ return t.focus({ preventScroll: !0 }), A(t, r), N(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
26
26
  }
27
27
  },
28
28
  // Keyboard shortcuts
29
29
  keymap: {
30
30
  "Mod-\\": "clearFormatting"
31
31
  }
32
- }), s = /* @__PURE__ */ new Set([
32
+ }), u = /* @__PURE__ */ new Set([
33
33
  "A",
34
34
  "B",
35
35
  "STRONG",
@@ -44,7 +44,7 @@ const m = () => ({
44
44
  "CODE",
45
45
  "SUB",
46
46
  "SUP"
47
- ]), l = /* @__PURE__ */ new Set([
47
+ ]), d = /* @__PURE__ */ new Set([
48
48
  "H1",
49
49
  "H2",
50
50
  "H3",
@@ -53,7 +53,7 @@ const m = () => ({
53
53
  "H6",
54
54
  "BLOCKQUOTE",
55
55
  "PRE"
56
- ]), u = [
56
+ ]), g = [
57
57
  "color",
58
58
  "background-color",
59
59
  "font-size",
@@ -69,11 +69,11 @@ const m = () => ({
69
69
  "text-align",
70
70
  "padding-left"
71
71
  ];
72
- function d() {
72
+ function h() {
73
73
  const t = window.getSelection();
74
74
  if (t && t.rangeCount > 0) {
75
- const o = t.getRangeAt(0).startContainer, r = (o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
76
- if (r) return r;
75
+ const n = t.getRangeAt(0).startContainer, o = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
76
+ if (o) return o;
77
77
  }
78
78
  const e = document.activeElement;
79
79
  return e ? e.getAttribute("contenteditable") === "true" ? e : e.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
@@ -84,21 +84,21 @@ function c(t, e) {
84
84
  return t.intersectsNode(e);
85
85
  } catch {
86
86
  }
87
- const o = document.createRange();
88
- return e.nodeType === Node.ELEMENT_NODE ? o.selectNodeContents(e) : o.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, o) > 0 && t.compareBoundaryPoints(Range.START_TO_END, o) < 0;
87
+ const n = document.createRange();
88
+ return e.nodeType === Node.ELEMENT_NODE ? n.selectNodeContents(e) : n.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, n) > 0 && t.compareBoundaryPoints(Range.START_TO_END, n) < 0;
89
89
  }
90
- function a(t) {
91
- let e = 0, o = t;
92
- for (; o && o.parentNode; )
93
- e += 1, o = o.parentNode;
90
+ function i(t) {
91
+ let e = 0, n = t;
92
+ for (; n && n.parentNode; )
93
+ e += 1, n = n.parentNode;
94
94
  return e;
95
95
  }
96
- function f(t) {
97
- u.forEach((e) => {
96
+ function m(t) {
97
+ g.forEach((e) => {
98
98
  t.style.removeProperty(e);
99
99
  }), (!t.getAttribute("style") || t.style.length === 0) && t.removeAttribute("style"), t.classList.contains("rte-text-color") && t.classList.remove("rte-text-color"), t.classList.contains("rte-bg-color") && t.classList.remove("rte-bg-color"), t.classList.length === 0 && t.removeAttribute("class");
100
100
  }
101
- function i(t) {
101
+ function a(t) {
102
102
  const e = t.parentNode;
103
103
  if (e) {
104
104
  for (; t.firstChild; )
@@ -106,33 +106,65 @@ function i(t) {
106
106
  e.removeChild(t);
107
107
  }
108
108
  }
109
- function g(t, e) {
109
+ function p(t) {
110
+ return t.tagName !== "P" || t.attributes.length > 0 || (t.textContent || "").trim() !== "" ? !1 : !t.querySelector("img, video, table, iframe, hr, pre, ul, ol");
111
+ }
112
+ function l(t) {
113
+ Array.from(t.children).forEach((e) => {
114
+ p(e) && e.remove();
115
+ });
116
+ }
117
+ function s(t) {
118
+ l(t), a(t);
119
+ }
120
+ function f(t) {
121
+ const e = document.createElement("p");
122
+ for (Array.from(t.attributes).forEach((n) => {
123
+ e.setAttribute(n.name, n.value);
124
+ }); t.firstChild; )
125
+ e.appendChild(t.firstChild);
126
+ e.innerHTML.trim() || (e.innerHTML = "<br>"), t.parentNode?.replaceChild(e, t);
127
+ }
128
+ function E(t) {
129
+ if (l(t), t.parentElement instanceof HTMLLIElement) {
130
+ s(t);
131
+ return;
132
+ }
133
+ if (Array.from(t.childNodes).filter((o) => o.nodeType !== Node.TEXT_NODE || (o.textContent || "").trim() !== "").some((o) => o instanceof HTMLElement && /^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(o.tagName))) {
134
+ s(t);
135
+ return;
136
+ }
137
+ f(t);
138
+ }
139
+ function N(t, e) {
110
140
  Array.from(
111
141
  t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
112
- ).forEach((n) => {
113
- if (!c(e, n) || !l.has(n.tagName)) return;
114
- const r = document.createElement("p");
115
- for (; n.firstChild; )
116
- r.appendChild(n.firstChild);
117
- n.parentNode?.replaceChild(r, n);
142
+ ).forEach((r) => {
143
+ if (c(e, r) && d.has(r.tagName)) {
144
+ if (r.tagName === "BLOCKQUOTE") {
145
+ E(r);
146
+ return;
147
+ }
148
+ f(r);
149
+ }
118
150
  });
119
151
  }
120
- function h(t, e) {
121
- const o = Array.from(
152
+ function A(t, e) {
153
+ const n = Array.from(
122
154
  t.querySelectorAll(
123
155
  "a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"
124
156
  )
125
157
  );
126
- o.sort((n, r) => a(r) - a(n)), o.forEach((n) => {
127
- if (n.isConnected && c(e, n) && !(n.getAttribute("contenteditable") === "false" || n.closest('[contenteditable="false"]'))) {
128
- if (f(n), s.has(n.tagName)) {
129
- i(n);
158
+ n.sort((r, o) => i(o) - i(r)), n.forEach((r) => {
159
+ if (r.isConnected && c(e, r) && !(r.getAttribute("contenteditable") === "false" || r.closest('[contenteditable="false"]'))) {
160
+ if (m(r), u.has(r.tagName)) {
161
+ a(r);
130
162
  return;
131
163
  }
132
- n.tagName === "SPAN" && n.attributes.length === 0 && i(n);
164
+ r.tagName === "SPAN" && r.attributes.length === 0 && a(r);
133
165
  }
134
166
  });
135
167
  }
136
168
  export {
137
- m as ClearFormattingPlugin
169
+ C as ClearFormattingPlugin
138
170
  };