@editora/plugins 1.0.7 → 1.0.9
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/LICENSE +21 -0
- package/README.md +72 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1317 -0
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1457 -0
- package/dist/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1360 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1093 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +913 -0
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1310 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +111 -75
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +85 -77
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1377 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +29 -29
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +752 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1388 -0
- package/dist/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +755 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1718 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +768 -0
- package/index.d.ts +849 -1
- package/package.json +105 -6
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=".rte-content, .editora-content",ee="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",se="__editoraCommandEditorRoot",le="rte-smart-paste-styles",u="rte-smart-paste-panel",h="smart-paste",S="smartPaste",E=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Ee=typeof NodeFilter<"u"?NodeFilter.SHOW_COMMENT:128,ie="__editoraSmartPasteHandled",ke=new Set(["script","style","meta","link","object","embed","iframe","svg","canvas","math","form","input","button","textarea","select","option"]),Ce=new Set(["table","thead","tbody","tfoot","tr","td","th","colgroup","col"]),Te=new Set(["span","font"]),Pe=/^(https?:|mailto:|tel:|#|\/)/i,Ae=/^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,we=new Set(["color","background-color","font-weight","font-style","text-decoration","text-align","font-size","font-family","line-height","letter-spacing","word-spacing","white-space","vertical-align","margin-left","margin-right","margin-top","margin-bottom","padding-left","padding-right","padding-top","padding-bottom","text-indent","border","border-top","border-right","border-bottom","border-left","border-color","border-width","border-style","list-style-type"]),Le={panelTitle:"Smart Paste",panelAriaLabel:"Smart paste panel",enabledText:"Smart paste is enabled",disabledText:"Smart paste is disabled",toggleOnText:"Disable Smart Paste",toggleOffText:"Enable Smart Paste",cycleProfileText:"Cycle Profile",profileLabel:"Profile",fidelityText:"Fidelity",balancedText:"Balanced",plainText:"Plain Text",lastPasteHeading:"Last Paste Result",lastPasteEmptyText:"Paste content to see cleanup metrics.",lastPasteSourceLabel:"Source",lastPasteProfileLabel:"Profile",lastPasteRemovedLabel:"Removed",lastPasteCharsLabel:"Output Chars",closeText:"Close",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",readonlyMessage:"Editor is read-only. Smart paste was skipped."},Y={fidelity:{keepStyles:!0,keepClasses:!1,keepDataAttributes:!1,preserveTables:!0},balanced:{keepStyles:!1,keepClasses:!1,keepDataAttributes:!1,preserveTables:!0},plain:{keepStyles:!1,keepClasses:!1,keepDataAttributes:!1,preserveTables:!1}},d=new WeakMap,L=new WeakMap,g=new Map,q=new WeakMap,j=new WeakMap,_=new Set;let I=0,$e=0,$=null,m=null,P=null,A=null,T=null,w=null;function X(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Me(e){return e.replace(/\u00A0/g," ").replace(/\r\n?/g,`
|
|
2
|
+
`)}function z(e){return e==="balanced"||e==="plain"?e:"fidelity"}function Z(e,t){return{keepStyles:e?.keepStyles??t.keepStyles,keepClasses:e?.keepClasses??t.keepClasses,keepDataAttributes:e?.keepDataAttributes??t.keepDataAttributes,preserveTables:e?.preserveTables??t.preserveTables}}function K(e={}){const t=e.profileOptions||{};return{enabled:e.enabled!==!1,defaultProfile:z(e.defaultProfile),maxHtmlLength:Math.max(8e3,Math.min(8e5,Number(e.maxHtmlLength??22e4))),removeComments:e.removeComments!==!1,normalizeWhitespace:e.normalizeWhitespace!==!1,labels:{...Le,...e.labels||{}},normalizeText:e.normalizeText||Me,profileOptions:{fidelity:Z(t.fidelity,Y.fidelity),balanced:Z(t.balanced,Y.balanced),plain:Z(t.plain,Y.plain)}}}function ce(e){return{enabled:e.enabled,defaultProfile:e.defaultProfile,maxHtmlLength:e.maxHtmlLength,removeComments:e.removeComments,normalizeWhitespace:e.normalizeWhitespace,labels:{...e.labels},normalizeText:e.normalizeText,profileOptions:{fidelity:{...e.profileOptions.fidelity},balanced:{...e.profileOptions.balanced},plain:{...e.profileOptions.plain}}}}function te(e){return e.closest(ee)||e}function H(e){if(!e)return null;if(e.matches(y))return e;const t=e.querySelector(y);return t instanceof HTMLElement?t:null}function Oe(){if(typeof window>"u")return null;const e=window[se];if(!(e instanceof HTMLElement))return null;window[se]=null;const t=H(e);if(t)return t;const a=e.closest(ee);if(a){const n=H(a);if(n)return n}const r=e.closest(y);return r instanceof HTMLElement?r:null}function Re(e){const t=e.closest("[data-editora-editor]");if(t&&H(t)===e)return t;let a=e;for(;a;){if(a.matches(ee)&&(a===e||H(a)===e))return a;a=a.parentElement}return te(e)}function pe(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function C(e,t=!0,a=!0){if(V(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const s=H(e.editorElement);if(s)return s}const r=Oe();if(r)return r;const n=window.getSelection();if(n&&n.rangeCount>0){const l=pe(n.getRangeAt(0).startContainer)?.closest(y);if(l)return l}const o=document.activeElement;if(o){if(o.matches(y))return o;const s=o.closest(y);if(s)return s}if(a){if(m&&m.isConnected)return m;m&&!m.isConnected&&(m=null)}return t?document.querySelector(y):null}function _e(e){const t=e.target;if(t){const r=t.closest(y);if(r)return r}const a=window.getSelection();if(a&&a.rangeCount>0){const n=pe(a.getRangeAt(0).startContainer)?.closest(y);if(n)return n}return null}function B(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function ze(e){const t=te(e);if(B(t))return!0;const a=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return B(a)?!0:B(document.documentElement)||B(document.body)}function F(e,t){e.classList.remove("rte-smart-paste-theme-dark"),ze(t)&&e.classList.add("rte-smart-paste-theme-dark")}function de(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function D(e,t,a){const r=Re(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",a),o.setAttribute("data-active",a?"true":"false"),o.setAttribute("aria-pressed",a?"true":"false")})}function p(e,t){d.has(e)||d.set(e,t);let a=L.get(e);return a||(a={enabled:t.enabled,profile:t.defaultProfile,lastReport:null},L.set(e,a)),Qe(e),_.add(e),a}function me(e){const t=j.get(e);t&&(e.removeEventListener("paste",t,!0),j.delete(e))}function be(e){me(e),g.get(e)?.remove(),g.delete(e),q.delete(e),d.delete(e),L.delete(e),_.delete(e),m===e&&(m=null)}function V(){Array.from(_).forEach(t=>{t.isConnected||be(t)})}function He(e){for(let t=0;t<e.length;t+=1){const a=e[t];if(!(a.type!=="childList"||a.removedNodes.length===0))for(let r=0;r<a.removedNodes.length;r+=1){const n=a.removedNodes[r];if(n.nodeType!==Node.ELEMENT_NODE)continue;const o=n;if(o.matches?.(y)||o.matches?.(`.${u}`)||o.querySelector?.(y)||o.querySelector?.(`.${u}`))return!0}}return!1}function re(e){return q.get(e)===!0}function O(e,t){const a=e.querySelector(".rte-smart-paste-live");a&&(a.textContent=t)}function J(e,t){const a=t.normalizeText(e);return t.normalizeWhitespace?a.split(`
|
|
3
|
+
`).map(n=>n.replace(/[\t ]+/g," ").trimEnd()).join(`
|
|
4
|
+
`).replace(/\n{3,}/g,`
|
|
5
|
+
|
|
6
|
+
`).trim():a}function De(e){return/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e)}function Ne(e){return/id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e)}function qe(e,t){return e?De(e)?"word":Ne(e)?"google-docs":"html":t?"plain":"html"}function Ie(e){return e.split(/\s+/).map(a=>a.trim()).filter(Boolean).filter(a=>!/^mso/i.test(a)).filter(a=>!/^docs-/i.test(a)).filter(a=>!/^c\d+$/i.test(a)).join(" ")}function Be(e){if(!e)return{value:"",changed:!1};const t=e.split(";"),a=[];let r=!1;return t.forEach(n=>{const o=n.indexOf(":");if(o<=0){n.trim()&&(r=!0);return}const s=n.slice(0,o).trim().toLowerCase(),l=n.slice(o+1).trim();if(!s||!l){r=!0;return}if(!we.has(s)){r=!0;return}if(/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)){r=!0;return}a.push(`${s}: ${l}`)}),{value:a.join("; "),changed:r}}function ue(e){const t=e.trim();return t&&(Pe.test(t)||Ae.test(t))?t:""}function fe(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function We(e,t,a,r){const n=e.tagName.toLowerCase();if(ke.has(n)){r.removedElements+=1,e.remove();return}if(!t.preserveTables&&Ce.has(n)){const s=e.textContent||"",l=document.createTextNode(s);e.replaceWith(l),r.removedElements+=1;return}if(Array.from(e.attributes).forEach(s=>{const l=s.name.toLowerCase(),i=s.value;if(l.startsWith("on")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="style"){if(!t.keepStyles){e.removeAttribute(s.name),r.removedAttributes+=1;return}const c=Be(i);if(!c.value){e.removeAttribute(s.name),r.removedAttributes+=1,c.changed&&(r.normalizedStyles+=1);return}(c.changed||c.value!==i)&&(e.setAttribute("style",c.value),r.normalizedStyles+=1);return}if(l==="class"){if(!t.keepClasses){e.removeAttribute(s.name),r.removedAttributes+=1;return}const c=Ie(i);if(!c){e.removeAttribute(s.name),r.removedAttributes+=1;return}c!==i&&(e.setAttribute("class",c),r.removedAttributes+=1);return}if(l.startsWith("data-")&&!t.keepDataAttributes){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="id"||l==="xmlns"||l.startsWith("xml")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if((a==="word"||a==="google-docs")&&(l==="lang"||l==="dir")){e.removeAttribute(s.name),r.removedAttributes+=1;return}if(l==="href"||l==="src"||l==="xlink:href"){const c=ue(i);if(!c){e.removeAttribute(s.name),r.removedAttributes+=1;return}c!==i&&e.setAttribute(s.name,c)}}),n==="a"){if(!e.getAttribute("href")){fe(e),r.removedElements+=1;return}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}if(n==="img"){const s=e.getAttribute("src");if(!s||!ue(s)){r.removedElements+=1,e.remove();return}}if(Te.has(n)&&!e.attributes.length&&!e.className&&!e.style.cssText){const s=e.children.length>0,l=(e.textContent||"").trim().length>0;if(!s&&!l){e.remove(),r.removedElements+=1;return}!s&&l&&(fe(e),r.removedElements+=1)}}function Ke(e,t,a,r,n){const o=document.createElement("template");o.innerHTML=e;const s={removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0};if(r.removeComments)try{const f=document.createTreeWalker(o.content,Ee,null),b=[];let k=f.nextNode();for(;k;)b.push(k),k=f.nextNode();b.forEach(v=>{v.remove(),s.removedComments+=1})}catch{}Array.from(o.content.querySelectorAll("*")).forEach(f=>{f.isConnected&&We(f,t,a,s)});let i=o.innerHTML;r.normalizeWhitespace&&n!=="fidelity"?i=i.replace(/\s{2,}/g," ").replace(/>\s+</g,"><").trim():r.normalizeWhitespace&&(i=i.trim());const c=(o.content.textContent||"").trim().length;return{html:i,textLength:c,counters:s}}function ge(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);return e.contains(a.commonAncestorContainer)?a:null}function he(e,t){if(!e.isConnected)return;const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(t))}function Ve(e,t){e.focus({preventScroll:!0});try{if(document.execCommand("insertHTML",!1,t))return!0}catch{}const a=ge(e);if(!a)return!1;a.deleteContents();const r=document.createElement("template");r.innerHTML=t;const n=r.content,o=n.lastChild;if(a.insertNode(n),o){const s=document.createRange();s.setStartAfter(o),s.collapse(!0),he(e,s)}return!0}function je(e,t){e.focus({preventScroll:!0});try{if(document.execCommand("insertText",!1,t))return!0}catch{}const a=ge(e);if(!a)return!1;a.deleteContents();const r=document.createTextNode(t);a.insertNode(r);const n=document.createRange();return n.setStart(r,r.length),n.collapse(!0),he(e,n),!0}function Fe(e,t){if(t===e.innerHTML)return;const a=window.execEditorCommand||window.executeEditorCommand;if(typeof a=="function")try{a("recordDomTransaction",e,t,e.innerHTML)}catch{}}function Ge(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function W(e,t,a,r,n,o){return{source:e,profile:t,inputHtmlLength:a,outputHtmlLength:r,outputTextLength:n,removedElements:o.removedElements,removedAttributes:o.removedAttributes,removedComments:o.removedComments,normalizedStyles:o.normalizedStyles,createdAt:new Date().toISOString()}}function Ue(e,t,a,r){const n=qe(e,t);if(a==="plain"){const l=t||e.replace(/<[^>]*>/g," "),i=J(l,r);return{mode:"text",value:i,report:W(n,a,e.length,0,i.length,{removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0})}}if(!e||e.length>r.maxHtmlLength){const l=J(t||e.replace(/<[^>]*>/g," "),r);return{mode:"text",value:l,report:W(n,a,e.length,0,l.length,{removedElements:0,removedAttributes:0,removedComments:0,normalizedStyles:0})}}const o=r.profileOptions[a],s=Ke(e,o,n,r,a);if(!s.html){const l=J(t||e.replace(/<[^>]*>/g," "),r);return{mode:"text",value:l,report:W(n,a,e.length,0,l.length,s.counters)}}return{mode:"html",value:s.html,report:W(n,a,e.length,s.html.length,s.textLength,s.counters)}}function G(e,t){return e==="balanced"?t.balancedText:e==="plain"?t.plainText:t.fidelityText}function ae(e){return e==="fidelity"?"balanced":e==="balanced"?"plain":"fidelity"}function Ye(e,t){e.setAttribute("aria-label",t.labels.panelAriaLabel);const a=e.querySelector(".rte-smart-paste-title");a&&(a.textContent=t.labels.panelTitle);const r=e.querySelector('[data-action="close"]');r&&r.setAttribute("aria-label",t.labels.closeText);const n=e.querySelector('[data-action="toggle-enabled"]');if(n){const Se=n.getAttribute("data-enabled")==="true";n.textContent=Se?t.labels.toggleOnText:t.labels.toggleOffText}const o=e.querySelector('[data-action="cycle-profile"]');o&&(o.textContent=t.labels.cycleProfileText);const s=e.querySelector(".rte-smart-paste-profile-heading");s&&(s.textContent=t.labels.profileLabel);const l=e.querySelector('.rte-smart-paste-profile[role="group"]');l&&l.setAttribute("aria-label",t.labels.profileLabel);const i=e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');i&&(i.textContent=t.labels.fidelityText);const c=e.querySelector('[data-action="set-profile"][data-profile="balanced"]');c&&(c.textContent=t.labels.balancedText);const f=e.querySelector('[data-action="set-profile"][data-profile="plain"]');f&&(f.textContent=t.labels.plainText);const b=e.querySelector(".rte-smart-paste-report-title");b&&(b.textContent=t.labels.lastPasteHeading);const k=e.querySelector(".rte-smart-paste-empty");k&&(k.textContent=t.labels.lastPasteEmptyText);const v=e.querySelector('[data-key="source-label"]');v&&(v.textContent=t.labels.lastPasteSourceLabel);const U=e.querySelector('[data-key="profile-label"]');U&&(U.textContent=t.labels.lastPasteProfileLabel);const M=e.querySelector('[data-key="removed-label"]');M&&(M.textContent=t.labels.lastPasteRemovedLabel);const oe=e.querySelector('[data-key="chars-label"]');oe&&(oe.textContent=t.labels.lastPasteCharsLabel);const ne=e.querySelector(".rte-smart-paste-shortcut");ne&&(ne.textContent=t.labels.shortcutText)}function x(e){const t=g.get(e),a=d.get(e)||$,r=L.get(e);if(!t||!a||!r)return;Ye(t,a);const n=t.querySelector(".rte-smart-paste-status");n&&(n.textContent=r.enabled?a.labels.enabledText:a.labels.disabledText);const o=t.querySelector('[data-action="toggle-enabled"]');o&&(o.setAttribute("data-enabled",r.enabled?"true":"false"),o.textContent=r.enabled?a.labels.toggleOnText:a.labels.toggleOffText,o.setAttribute("aria-pressed",r.enabled?"true":"false")),Array.from(t.querySelectorAll('[data-action="set-profile"][data-profile]')).forEach(v=>{const M=z(v.getAttribute("data-profile"))===r.profile;v.classList.toggle("active",M),v.setAttribute("aria-pressed",M?"true":"false")});const l=t.querySelector(".rte-smart-paste-empty"),i=t.querySelector(".rte-smart-paste-report"),c=t.querySelector('[data-key="source-value"]'),f=t.querySelector('[data-key="profile-value"]'),b=t.querySelector('[data-key="removed-value"]'),k=t.querySelector('[data-key="chars-value"]');if(!r.lastReport){l&&(l.hidden=!1),i&&(i.hidden=!0);return}if(l&&(l.hidden=!0),i&&(i.hidden=!1),c&&(c.textContent=r.lastReport.source),f&&(f.textContent=G(r.lastReport.profile,a.labels)),b){const v=r.lastReport.removedElements+r.lastReport.removedAttributes+r.lastReport.removedComments+r.lastReport.normalizedStyles;b.textContent=String(v)}k&&(k.textContent=String(r.lastReport.outputTextLength))}function Q(e,t){if(!t.classList.contains("show"))return;const a=te(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,360),n=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,a.right-r),n),s=Math.max(10,Math.min(window.innerHeight-10,a.top+12));t.style.width=`${r}px`,t.style.left=`${o}px`,t.style.top=`${s}px`,t.style.maxHeight=`${Math.max(240,window.innerHeight-20)}px`}function N(e,t=!1){const a=g.get(e);a&&(a.classList.remove("show"),q.set(e,!1),D(e,"toggleSmartPastePanel",!1),t&&e.focus({preventScroll:!0}))}function Xe(e){const t=g.get(e);if(t)return t;const a=d.get(e)||$||K(),r=`rte-smart-paste-panel-${$e++}`,n=document.createElement("section");return n.className=u,n.id=r,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","false"),n.setAttribute("aria-label",a.labels.panelAriaLabel),n.innerHTML=`
|
|
7
|
+
<header class="rte-smart-paste-header">
|
|
8
|
+
<h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
|
|
9
|
+
<button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
|
|
10
|
+
</header>
|
|
11
|
+
<div class="rte-smart-paste-body">
|
|
12
|
+
<p class="rte-smart-paste-status"></p>
|
|
13
|
+
<div class="rte-smart-paste-controls">
|
|
14
|
+
<button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
|
|
15
|
+
<button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
|
|
18
|
+
<p class="rte-smart-paste-profile-heading"></p>
|
|
19
|
+
<div class="rte-smart-paste-profile-grid">
|
|
20
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
|
|
21
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
|
|
22
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<section class="rte-smart-paste-metrics" aria-live="polite">
|
|
26
|
+
<h3 class="rte-smart-paste-report-title"></h3>
|
|
27
|
+
<p class="rte-smart-paste-empty"></p>
|
|
28
|
+
<dl class="rte-smart-paste-report" hidden>
|
|
29
|
+
<div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
|
|
30
|
+
<div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
|
|
31
|
+
<div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
|
|
32
|
+
<div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
|
|
33
|
+
</dl>
|
|
34
|
+
</section>
|
|
35
|
+
<p class="rte-smart-paste-shortcut"></p>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
|
|
38
|
+
`,n.addEventListener("click",o=>{const l=o.target?.closest("[data-action]");if(!l)return;const i=l.getAttribute("data-action");if(i){if(i==="close"){N(e,!0);return}if(i==="toggle-enabled"){const c=p(e,d.get(e)||a);c.enabled=!c.enabled,D(e,"toggleSmartPasteEnabled",c.enabled),x(e),O(n,c.enabled?a.labels.enabledText:a.labels.disabledText);return}if(i==="cycle-profile"){const c=p(e,d.get(e)||a);c.profile=ae(c.profile),x(e),O(n,`${a.labels.profileLabel}: ${G(c.profile,a.labels)}`);return}if(i==="set-profile"){const c=p(e,d.get(e)||a);c.profile=z(l.getAttribute("data-profile")),x(e),O(n,`${a.labels.profileLabel}: ${G(c.profile,a.labels)}`)}}}),n.addEventListener("keydown",o=>{if(o.key==="Escape"){o.preventDefault(),N(e,!0);return}if(o.key!=="ArrowRight"&&o.key!=="ArrowLeft")return;const s=Array.from(n.querySelectorAll('[data-action="set-profile"][data-profile]'));if(s.length===0)return;const l=s.findIndex(f=>f===document.activeElement);if(l<0)return;const i=o.key==="ArrowRight"?1:-1,c=(l+i+s.length)%s.length;o.preventDefault(),s[c].focus()}),F(n,e),document.body.appendChild(n),g.set(e,n),q.set(e,!1),x(e),n}function ye(e){const t=Xe(e);g.forEach((r,n)=>{n!==e&&N(n,!1)}),t.classList.add("show"),q.set(e,!0),D(e,"toggleSmartPastePanel",!0),F(t,e),Q(e,t),t.querySelector('[data-action="toggle-enabled"]')?.focus()}function xe(e,t){const a=re(e);return(typeof t=="boolean"?t:!a)?ye(e):N(e,!1),!0}function ve(e){return{enabled:e.enabled,profile:e.profile,lastReport:e.lastReport?{...e.lastReport}:null}}function Ze(e,t){const a=d.get(e)||$;if(!a)return!1;const r=p(e,a);if(!r.enabled||de(e)){const b=g.get(e);return b&&de(e)&&O(b,a.labels.readonlyMessage),!1}const n=t.clipboardData;if(!n)return!1;const o=n.getData("text/html")||"",s=n.getData("text/plain")||"";if(!o&&!s)return!1;const l=Ue(o,s,r.profile,a);if(!l.value)return!1;const i=e.innerHTML;if(!(l.mode==="html"?Ve(e,l.value):je(e,l.value)))return!1;r.lastReport={...l.report},L.set(e,r),Fe(e,i),Ge(e),e.dispatchEvent(new CustomEvent("editora:smart-paste",{bubbles:!0,detail:ve(r)})),x(e);const f=g.get(e);if(f){const b=l.report.removedElements+l.report.removedAttributes+l.report.removedComments+l.report.normalizedStyles;O(f,`${a.labels.panelTitle}: ${G(r.profile,a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${b}.`)}return!0}function Je(e){return t=>{t.defaultPrevented||t[ie]===!0||(m=e,!Ze(e,t))||(t[ie]=!0,t.preventDefault(),typeof t.stopImmediatePropagation=="function"?t.stopImmediatePropagation():t.stopPropagation())}}function Qe(e){if(j.has(e))return;const t=Je(e);e.addEventListener("paste",t,!0),j.set(e,t)}function R(e){const t=L.get(e);D(e,"toggleSmartPastePanel",re(e)),D(e,"toggleSmartPasteEnabled",t?.enabled===!0)}function et(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="s"}function tt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="v"}function rt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="g"}function at(e){$=e,P||(P=t=>{V();const r=t.target?.closest(y);if(!r)return;const n=d.get(r)||e;p(r,n),d.set(r,n),m=r,R(r);const o=g.get(r);o&&(F(o,r),Q(r,o),x(r))},document.addEventListener("focusin",P,!0)),A||(A=t=>{if(t.defaultPrevented||t.target?.closest(`.${u} input, .${u} textarea, .${u} select`))return;const r=_e(t);if(!r)return;const n=d.get(r)||$||e;if(p(r,n),d.set(r,n),m=r,t.key==="Escape"&&re(r)){t.preventDefault(),N(r,!0);return}if(et(t)){t.preventDefault(),t.stopPropagation(),xe(r);return}if(tt(t)){t.preventDefault(),t.stopPropagation();const o=p(r,n);o.profile=ae(o.profile),x(r);return}if(rt(t)){t.preventDefault(),t.stopPropagation();const o=p(r,n);o.enabled=!o.enabled,R(r),x(r)}},document.addEventListener("keydown",A,!0)),T||(T=()=>{V(),g.forEach((t,a)=>{!a.isConnected||!t.isConnected||(F(t,a),Q(a,t))})},window.addEventListener("scroll",T,!0),window.addEventListener("resize",T)),!w&&typeof MutationObserver<"u"&&document.body&&(w=new MutationObserver(t=>{He(t)&&V()}),w.observe(document.body,{childList:!0,subtree:!0}))}function ot(){P&&(document.removeEventListener("focusin",P,!0),P=null),A&&(document.removeEventListener("keydown",A,!0),A=null),T&&(window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T),T=null),w&&(w.disconnect(),w=null),g.forEach(e=>e.remove()),g.clear(),_.forEach(e=>me(e)),_.clear(),$=null,m=null}function nt(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=`
|
|
39
|
+
.rte-toolbar-group-items.${h},
|
|
40
|
+
.editora-toolbar-group-items.${h},
|
|
41
|
+
.rte-toolbar-group-items.${S},
|
|
42
|
+
.editora-toolbar-group-items.${S} {
|
|
43
|
+
display: flex;
|
|
44
|
+
border: 1px solid #ccc;
|
|
45
|
+
border-radius: 3px;
|
|
46
|
+
background: #fff;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
50
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-button,
|
|
51
|
+
.rte-toolbar-group-items.${S} .rte-toolbar-button,
|
|
52
|
+
.editora-toolbar-group-items.${S} .editora-toolbar-button {
|
|
53
|
+
border: none;
|
|
54
|
+
border-right: 1px solid #ccc;
|
|
55
|
+
border-radius: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
59
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
60
|
+
.rte-toolbar-group-items.${S} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
61
|
+
.editora-toolbar-group-items.${S} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
62
|
+
border-right: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
|
|
66
|
+
.editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
|
|
67
|
+
background-color: #ccc;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
${E} .rte-toolbar-group-items.${h},
|
|
71
|
+
${E} .editora-toolbar-group-items.${h},
|
|
72
|
+
${E} .rte-toolbar-group-items.${S},
|
|
73
|
+
${E} .editora-toolbar-group-items.${S},
|
|
74
|
+
.${u}.rte-smart-paste-theme-dark {
|
|
75
|
+
border-color: #566275;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
${E} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
|
|
79
|
+
${E} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
|
|
80
|
+
${E} .rte-toolbar-group-items.${S} .rte-toolbar-button svg,
|
|
81
|
+
${E} .editora-toolbar-group-items.${S} .editora-toolbar-button svg {
|
|
82
|
+
fill: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
${E} .rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
86
|
+
${E} .editora-toolbar-group-items.${h} .editora-toolbar-button
|
|
87
|
+
{
|
|
88
|
+
border-color: #566275;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.${u} {
|
|
92
|
+
position: fixed;
|
|
93
|
+
z-index: 12000;
|
|
94
|
+
display: none;
|
|
95
|
+
width: min(360px, calc(100vw - 20px));
|
|
96
|
+
max-height: calc(100vh - 20px);
|
|
97
|
+
border: 1px solid #d1d5db;
|
|
98
|
+
border-radius: 14px;
|
|
99
|
+
background: #ffffff;
|
|
100
|
+
color: #111827;
|
|
101
|
+
box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.${u}.show {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.${u}.rte-smart-paste-theme-dark {
|
|
111
|
+
border-color: #334155;
|
|
112
|
+
background: #0f172a;
|
|
113
|
+
color: #e2e8f0;
|
|
114
|
+
box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.rte-smart-paste-header {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: space-between;
|
|
121
|
+
gap: 8px;
|
|
122
|
+
padding: 12px 14px;
|
|
123
|
+
border-bottom: 1px solid #e5e7eb;
|
|
124
|
+
background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
|
|
128
|
+
border-color: #1e293b;
|
|
129
|
+
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.rte-smart-paste-title {
|
|
133
|
+
margin: 0;
|
|
134
|
+
font-size: 15px;
|
|
135
|
+
line-height: 1.2;
|
|
136
|
+
font-weight: 700;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.rte-smart-paste-icon-btn {
|
|
140
|
+
width: 34px;
|
|
141
|
+
height: 34px;
|
|
142
|
+
border: 1px solid #cbd5e1;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
background: #ffffff;
|
|
145
|
+
color: #0f172a;
|
|
146
|
+
font-size: 16px;
|
|
147
|
+
line-height: 1;
|
|
148
|
+
font-weight: 600;
|
|
149
|
+
padding: 0;
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.rte-smart-paste-icon-btn:hover,
|
|
157
|
+
.rte-smart-paste-icon-btn:focus-visible {
|
|
158
|
+
outline: none;
|
|
159
|
+
border-color: #3b82f6;
|
|
160
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
|
|
164
|
+
background: #0f172a;
|
|
165
|
+
border-color: #475569;
|
|
166
|
+
color: #e2e8f0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
|
|
170
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
|
|
171
|
+
border-color: #60a5fa;
|
|
172
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.rte-smart-paste-body {
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
gap: 10px;
|
|
179
|
+
padding: 12px;
|
|
180
|
+
overflow: auto;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.rte-smart-paste-status {
|
|
184
|
+
margin: 0;
|
|
185
|
+
font-size: 12px;
|
|
186
|
+
line-height: 1.35;
|
|
187
|
+
color: #475569;
|
|
188
|
+
font-weight: 600;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
|
|
192
|
+
color: #94a3b8;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.rte-smart-paste-controls {
|
|
196
|
+
display: flex;
|
|
197
|
+
gap: 8px;
|
|
198
|
+
flex-wrap: wrap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.rte-smart-paste-btn {
|
|
202
|
+
border: 1px solid #cbd5e1;
|
|
203
|
+
border-radius: 8px;
|
|
204
|
+
height: 34px;
|
|
205
|
+
padding: 0 10px;
|
|
206
|
+
background: #ffffff;
|
|
207
|
+
color: inherit;
|
|
208
|
+
font-size: 12px;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.rte-smart-paste-btn:hover,
|
|
214
|
+
.rte-smart-paste-btn:focus-visible {
|
|
215
|
+
border-color: #94a3b8;
|
|
216
|
+
background: #f8fafc;
|
|
217
|
+
outline: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.rte-smart-paste-btn-primary {
|
|
221
|
+
border-color: #0284c7;
|
|
222
|
+
background: #0ea5e9;
|
|
223
|
+
color: #f8fafc;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.rte-smart-paste-btn-primary:hover,
|
|
227
|
+
.rte-smart-paste-btn-primary:focus-visible {
|
|
228
|
+
border-color: #0369a1;
|
|
229
|
+
background: #0284c7;
|
|
230
|
+
color: #ffffff;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
|
|
234
|
+
border-color: #334155;
|
|
235
|
+
background: #111827;
|
|
236
|
+
color: #e2e8f0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
|
|
240
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
|
|
241
|
+
border-color: #475569;
|
|
242
|
+
background: #1e293b;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.rte-smart-paste-profile {
|
|
246
|
+
display: grid;
|
|
247
|
+
gap: 6px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.rte-smart-paste-profile-heading {
|
|
251
|
+
margin: 0;
|
|
252
|
+
font-size: 12px;
|
|
253
|
+
line-height: 1.35;
|
|
254
|
+
font-weight: 700;
|
|
255
|
+
color: #334155;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
|
|
259
|
+
color: #cbd5e1;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.rte-smart-paste-profile-grid {
|
|
263
|
+
display: grid;
|
|
264
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
265
|
+
gap: 8px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.rte-smart-paste-chip {
|
|
269
|
+
height: 34px;
|
|
270
|
+
border-radius: 9px;
|
|
271
|
+
border: 1px solid #cbd5e1;
|
|
272
|
+
background: #ffffff;
|
|
273
|
+
color: inherit;
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
font-weight: 600;
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.rte-smart-paste-chip:hover,
|
|
280
|
+
.rte-smart-paste-chip:focus-visible {
|
|
281
|
+
border-color: #0284c7;
|
|
282
|
+
outline: none;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.rte-smart-paste-chip.active {
|
|
286
|
+
border-color: #0284c7;
|
|
287
|
+
background: rgba(14, 165, 233, 0.14);
|
|
288
|
+
color: #0c4a6e;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
|
|
292
|
+
border-color: #334155;
|
|
293
|
+
background: #0b1220;
|
|
294
|
+
color: #e2e8f0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
|
|
298
|
+
border-color: #38bdf8;
|
|
299
|
+
background: rgba(14, 165, 233, 0.2);
|
|
300
|
+
color: #e0f2fe;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.rte-smart-paste-metrics {
|
|
304
|
+
border: 1px solid #e2e8f0;
|
|
305
|
+
border-radius: 10px;
|
|
306
|
+
padding: 10px;
|
|
307
|
+
background: #f8fafc;
|
|
308
|
+
display: grid;
|
|
309
|
+
gap: 8px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
|
|
313
|
+
border-color: #334155;
|
|
314
|
+
background: #0b1220;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.rte-smart-paste-report-title {
|
|
318
|
+
margin: 0;
|
|
319
|
+
font-size: 12px;
|
|
320
|
+
line-height: 1.3;
|
|
321
|
+
font-weight: 700;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.rte-smart-paste-empty {
|
|
325
|
+
margin: 0;
|
|
326
|
+
font-size: 12px;
|
|
327
|
+
line-height: 1.35;
|
|
328
|
+
color: #475569;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
|
|
332
|
+
color: #94a3b8;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.rte-smart-paste-report {
|
|
336
|
+
margin: 0;
|
|
337
|
+
display: grid;
|
|
338
|
+
gap: 6px;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.rte-smart-paste-line {
|
|
342
|
+
display: flex;
|
|
343
|
+
justify-content: space-between;
|
|
344
|
+
gap: 10px;
|
|
345
|
+
font-size: 12px;
|
|
346
|
+
line-height: 1.3;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.rte-smart-paste-line dt {
|
|
350
|
+
margin: 0;
|
|
351
|
+
color: #475569;
|
|
352
|
+
font-weight: 600;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.rte-smart-paste-line dd {
|
|
356
|
+
margin: 0;
|
|
357
|
+
font-weight: 700;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
|
|
361
|
+
color: #94a3b8;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.rte-smart-paste-shortcut {
|
|
365
|
+
margin: 2px 0 0;
|
|
366
|
+
font-size: 11px;
|
|
367
|
+
color: #64748b;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
|
|
371
|
+
color: #94a3b8;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.rte-smart-paste-live {
|
|
375
|
+
position: absolute;
|
|
376
|
+
width: 1px;
|
|
377
|
+
height: 1px;
|
|
378
|
+
margin: -1px;
|
|
379
|
+
padding: 0;
|
|
380
|
+
overflow: hidden;
|
|
381
|
+
clip: rect(0 0 0 0);
|
|
382
|
+
border: 0;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@media (max-width: 768px) {
|
|
386
|
+
.${u} {
|
|
387
|
+
left: 10px !important;
|
|
388
|
+
right: 10px;
|
|
389
|
+
top: 10px !important;
|
|
390
|
+
width: auto !important;
|
|
391
|
+
max-height: calc(100vh - 20px);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.rte-smart-paste-profile-grid {
|
|
395
|
+
grid-template-columns: 1fr;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
`,document.head.appendChild(e)}const st=(e={})=>{const t=K(e),a=new Set;return nt(),{name:"smartPaste",toolbar:[{id:"smartPasteGroup",label:"Smart Paste",type:"group",command:"smartPaste",items:[{id:"smartPaste",label:"Smart Paste Panel",command:"toggleSmartPastePanel",shortcut:"Mod-Alt-Shift-s",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"smartPasteProfile",label:"Cycle Smart Paste Profile",command:"cycleSmartPasteProfile",shortcut:"Mod-Alt-Shift-v",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'},{id:"smartPasteToggle",label:"Toggle Smart Paste",command:"toggleSmartPasteEnabled",shortcut:"Mod-Alt-Shift-g",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'}]}],commands:{smartPaste:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t;return p(o,s),d.set(o,s),m=o,ye(o),!0},toggleSmartPastePanel:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t;return p(o,s),d.set(o,s),m=o,xe(o,typeof r=="boolean"?r:void 0)},cycleSmartPasteProfile:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=p(o,s);return d.set(o,s),l.profile=ae(l.profile),x(o),!0},setSmartPasteProfile:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=p(o,s);return d.set(o,s),l.profile=z(r),x(o),!0},toggleSmartPasteEnabled:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=p(o,s);return d.set(o,s),l.enabled=typeof r=="boolean"?r:!l.enabled,R(o),x(o),!0},setSmartPasteOptions:(r,n)=>{const o=C(n,!1,!1);if(!o||!r||typeof r!="object")return!1;const s=d.get(o)||t,l=ce(s),i=K({...l,...r,labels:{...s.labels,...r.labels||{}},profileOptions:{...l.profileOptions,...r.profileOptions||{},fidelity:{...l.profileOptions?.fidelity||{},...r.profileOptions?.fidelity||{}},balanced:{...l.profileOptions?.balanced||{},...r.profileOptions?.balanced||{}},plain:{...l.profileOptions?.plain||{},...r.profileOptions?.plain||{}}},normalizeText:r.normalizeText||s.normalizeText});d.set(o,i);const c=p(o,i);return typeof r.enabled=="boolean"&&(c.enabled=r.enabled),r.defaultProfile&&(c.profile=z(r.defaultProfile)),x(o),R(o),!0},getSmartPasteState:(r,n)=>{const o=C(n,!1,!1);if(!o)return!1;const s=d.get(o)||t,l=p(o,s),i=ve(l);if(typeof r=="function")try{r(i)}catch{}return o.__smartPasteState=i,o.dispatchEvent(new CustomEvent("editora:smart-paste-state",{bubbles:!0,detail:i})),!0}},keymap:{"Mod-Alt-Shift-s":"toggleSmartPastePanel","Mod-Alt-Shift-S":"toggleSmartPastePanel","Mod-Alt-Shift-v":"cycleSmartPasteProfile","Mod-Alt-Shift-V":"cycleSmartPasteProfile","Mod-Alt-Shift-g":"toggleSmartPasteEnabled","Mod-Alt-Shift-G":"toggleSmartPasteEnabled"},init:function(n){I+=1;const o=this&&typeof this.__pluginConfig=="object"?K({...ce(t),...this.__pluginConfig}):t;at(o);const s=C(n?.editorElement?{editorElement:n.editorElement}:void 0,!1,!1);if(!s)return;m=s,a.add(s);const l=p(s,o);l.enabled=o.enabled,l.profile=o.defaultProfile,d.set(s,o),R(s)},destroy:()=>{a.forEach(r=>be(r)),a.clear(),I=Math.max(0,I-1),!(I>0)&&ot()}}};exports.SmartPastePlugin=st;
|