@ncino/web-components 7.0.0-preview.8 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/input-rich-text/ckeditor-config.js +1 -1
- package/dist/components/input-rich-text/input-rich-text.slds.js +2 -2
- package/dist/components/progress-ring/gator/progress-ring.gator.js +36 -0
- package/dist/components/progress-ring/index.js +1 -0
- package/dist/index.gator.js +1 -1
- package/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-alignment@45.2.1 → @ckeditor_ckeditor5-alignment@45.2.2}/node_modules/@ckeditor/ckeditor5-alignment/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autoformat@45.2.1 → @ckeditor_ckeditor5-autoformat@45.2.2}/node_modules/@ckeditor/ckeditor5-autoformat/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-autosave@45.2.1 → @ckeditor_ckeditor5-autosave@45.2.2}/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-basic-styles@45.2.1 → @ckeditor_ckeditor5-basic-styles@45.2.2}/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-block-quote@45.2.1 → @ckeditor_ckeditor5-block-quote@45.2.2}/node_modules/@ckeditor/ckeditor5-block-quote/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-clipboard@45.2.1 → @ckeditor_ckeditor5-clipboard@45.2.2}/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-cloud-services@45.2.1 → @ckeditor_ckeditor5-cloud-services@45.2.2}/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-code-block@45.2.1 → @ckeditor_ckeditor5-code-block@45.2.2}/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-core@45.2.1 → @ckeditor_ckeditor5-core@45.2.2}/node_modules/@ckeditor/ckeditor5-core/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-editor-classic@45.2.1 → @ckeditor_ckeditor5-editor-classic@45.2.2}/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-engine@45.2.1 → @ckeditor_ckeditor5-engine@45.2.2}/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-enter@45.2.1 → @ckeditor_ckeditor5-enter@45.2.2}/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-essentials@45.2.1 → @ckeditor_ckeditor5-essentials@45.2.2}/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-find-and-replace@45.2.1 → @ckeditor_ckeditor5-find-and-replace@45.2.2}/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-font@45.2.1 → @ckeditor_ckeditor5-font@45.2.2}/node_modules/@ckeditor/ckeditor5-font/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-heading@45.2.1 → @ckeditor_ckeditor5-heading@45.2.2}/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-highlight@45.2.1 → @ckeditor_ckeditor5-highlight@45.2.2}/node_modules/@ckeditor/ckeditor5-highlight/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-horizontal-line@45.2.1 → @ckeditor_ckeditor5-horizontal-line@45.2.2}/node_modules/@ckeditor/ckeditor5-horizontal-line/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-embed@45.2.1 → @ckeditor_ckeditor5-html-embed@45.2.2}/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-html-support@45.2.1 → @ckeditor_ckeditor5-html-support@45.2.2}/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-image@45.2.1 → @ckeditor_ckeditor5-image@45.2.2}/node_modules/@ckeditor/ckeditor5-image/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-indent@45.2.1 → @ckeditor_ckeditor5-indent@45.2.2}/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-language@45.2.1 → @ckeditor_ckeditor5-language@45.2.2}/node_modules/@ckeditor/ckeditor5-language/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-link@45.2.1 → @ckeditor_ckeditor5-link@45.2.2}/node_modules/@ckeditor/ckeditor5-link/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-list@45.2.1 → @ckeditor_ckeditor5-list@45.2.2}/node_modules/@ckeditor/ckeditor5-list/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-markdown-gfm@45.2.1 → @ckeditor_ckeditor5-markdown-gfm@45.2.2}/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-media-embed@45.2.1 → @ckeditor_ckeditor5-media-embed@45.2.2}/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-mention@45.2.1 → @ckeditor_ckeditor5-mention@45.2.2}/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-page-break@45.2.1 → @ckeditor_ckeditor5-page-break@45.2.2}/node_modules/@ckeditor/ckeditor5-page-break/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paragraph@45.2.1 → @ckeditor_ckeditor5-paragraph@45.2.2}/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-paste-from-office@45.2.1 → @ckeditor_ckeditor5-paste-from-office@45.2.2}/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-remove-format@45.2.1 → @ckeditor_ckeditor5-remove-format@45.2.2}/node_modules/@ckeditor/ckeditor5-remove-format/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-select-all@45.2.1 → @ckeditor_ckeditor5-select-all@45.2.2}/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-show-blocks@45.2.1 → @ckeditor_ckeditor5-show-blocks@45.2.2}/node_modules/@ckeditor/ckeditor5-show-blocks/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-source-editing@45.2.1 → @ckeditor_ckeditor5-source-editing@45.2.2}/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-special-characters@45.2.1 → @ckeditor_ckeditor5-special-characters@45.2.2}/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-style@45.2.1 → @ckeditor_ckeditor5-style@45.2.2}/node_modules/@ckeditor/ckeditor5-style/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-table@45.2.1 → @ckeditor_ckeditor5-table@45.2.2}/node_modules/@ckeditor/ckeditor5-table/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-typing@45.2.1 → @ckeditor_ckeditor5-typing@45.2.2}/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-ui@45.2.1 → @ckeditor_ckeditor5-ui@45.2.2}/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-undo@45.2.1 → @ckeditor_ckeditor5-undo@45.2.2}/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-upload@45.2.1 → @ckeditor_ckeditor5-upload@45.2.2}/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-utils@45.2.1 → @ckeditor_ckeditor5-utils@45.2.2}/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-widget@45.2.1 → @ckeditor_ckeditor5-widget@45.2.2}/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1 -1
- package/dist/packages/web-components/public/styles/gator/gator-global-styles.css.js +1 -1
- package/dist/packages/web-components/src/components/progress-ring/gator/progress-ring.gator.scss.js +1 -0
- package/dist/packages/web-components/src/tokens/primitive.tokens.scss.js +1 -1
- package/dist/styles/gator/_gator-typography.css +186 -0
- package/dist/styles/gator/gator-global-styles.css +2 -5
- package/dist/types/components/progress-ring/gator/progress-ring.gator.d.ts +37 -0
- package/dist/types/components/progress-ring/gator/progress-ring.gator.test.d.ts +0 -0
- package/dist/types/components/progress-ring/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.gator.d.ts +1 -0
- package/package.json +2 -2
- package/web-types.json +55 -1
- package/dist/assets/nCino_AvenirHv.woff2 +0 -0
- package/dist/assets/nCino_AvenirMd.woff2 +0 -0
- /package/dist/assets/node_modules/.pnpm/{ckeditor5@45.2.1 → ckeditor5@45.2.2}/node_modules/ckeditor5/dist/ckeditor5.css +0 -0
- /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-icons@45.2.1 → @ckeditor_ckeditor5-icons@45.2.2}/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@ckeditor_ckeditor5-watchdog@45.2.1 → @ckeditor_ckeditor5-watchdog@45.2.2}/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{EventInfo as q,uid as z,delay as j,DomEmitterMixin as A,env as f,global as m,createElement as x,Rect as _,getRangeFromMouseEvent as ee,ResizeObserver as te,toUnit as re}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{MouseObserver as ne,LiveRange as T,DomEventObserver as ie,DataTransfer as oe,Range as se}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ae,isWidget as k}from"../../../../../@ckeditor_ckeditor5-widget@45.2.2/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{View as le}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{mapValues as ce}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mapValues.js";import{throttle as V}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/throttle.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class v extends ie{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;this.listenTo(t,"paste",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",r("dragging"),{priority:"low"});function r(
|
|
4
|
+
*/class v extends ie{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;this.listenTo(t,"paste",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",r("dragging"),{priority:"low"});function r(i){return(s,o)=>{o.preventDefault();const n=o.dropRange?[o.dropRange]:null,l=new q(t,i);t.fire(l,{dataTransfer:o.dataTransfer,method:s.name,targetRanges:n,target:o.target,domEvent:o.domEvent}),l.stop.called&&o.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,r=e.type=="drop"||e.type=="paste",i={dataTransfer:new oe(t,{cacheFiles:r})};if(e.type=="drop"||e.type=="dragover"){const s=ee(e);i.dropRange=s&&this.view.domConverter.domRangeToView(s)}this.fire(e.type,e,i)}}/**
|
|
5
5
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
6
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
7
|
*/function de(a){return a=a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," "),(a.includes("</p><p>")||a.includes("<br>"))&&(a=`<p>${a}</p>`),a}/**
|
|
@@ -11,10 +11,10 @@ import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modu
|
|
|
11
11
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
12
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
13
13
|
*/const B=["figcaption","li"],L=["ol","ul"];function H(a,e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return`
|
|
14
|
-
`;let t="",r=null;for(const
|
|
14
|
+
`;let t="",r=null;for(const i of e.getChildren())t+=pe(i,r)+H(a,i),r=i;if(e.is("rawElement")){const s=document.implementation.createHTMLDocument("").createElement("div");e.render(s,a),t+=K(s)}return t}function K(a){let e="";if(a.nodeType===Node.TEXT_NODE)return a.textContent;if(a.tagName==="BR")return`
|
|
15
15
|
`;for(const t of a.childNodes)e+=K(t);return e}function pe(a,e){return e?a.is("element","li")&&!a.isEmpty&&a.getChild(0).is("containerElement")||L.includes(a.name)&&L.includes(e.name)?`
|
|
16
16
|
|
|
17
17
|
`:!a.is("containerElement")&&!e.is("containerElement")?"":B.includes(a.name)||B.includes(e.name)?`
|
|
18
18
|
`:a.is("element")&&a.getCustomProperty("dataPipeline:transparentRendering")||e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")?"":`
|
|
19
19
|
|
|
20
|
-
`:""}class G extends b{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,r=n=>n.model.getSelectedContent(n.model.document.selection)){return this.editor.model.change(n=>{const s=n.model.document.selection;n.setSelection(t);const o=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),i=r(n),l=this._removeFakeMarkersInsideElement(n,i);for(const[c,d]of Object.entries(o)){l[c]||=n.createRangeIn(i);for(const g of d)n.remove(g)}i.markers.clear();for(const[c,d]of Object.entries(l))i.markers.set(c,d);return n.setSelection(s),i})}_pasteMarkersIntoTransformedElement(e,t){const r=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(n=>{const s=this._insertFakeMarkersElements(n,r),o=t(n),i=this._removeFakeMarkersInsideElement(n,o);for(const l of Object.values(s).flat())n.remove(l);for(const[l,c]of Object.entries(i))n.model.markers.has(l)||n.addMarker(l,{usingOperation:!0,affectsData:!0,range:c});return o})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const r of t)e.markers.set(r.name,r.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,r={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,r),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const r=this._getMarkerClipboardConfig(e);if(!r)return!1;if(!t)return!0;const{allowedActions:n}=r;return n==="all"||n.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,r){const n=this._getCopyableMarkersFromSelection(e,t,r);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,r){const n=Array.from(t.getRanges()),s=new Set(n.flatMap(i=>Array.from(e.model.markers.getMarkersIntersectingRange(i)))),o=i=>{if(!this._isMarkerCopyable(i.name,r))return!1;const{copyPartiallySelected:c}=this._getMarkerClipboardConfig(i.name);if(!c){const d=i.getRange();return n.some(g=>g.containsRange(d,!0))}return!0};return Array.from(s).filter(o).map(i=>({name:r==="dragstart"?this._getUniqueMarkerName(i.name):i.name,range:i.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:r}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([s,o])=>{if(!this._hasMarkerConfiguration(s))return[{name:s,range:o}];if(this._isMarkerCopyable(s,t)){const i=this._getMarkerClipboardConfig(s),l=r.markers.has(s)&&r.markers.get(s).getRange().root.rootName==="$graveyard";return(i.duplicateOnPaste||l)&&(s=this._getUniqueMarkerName(s)),[{name:s,range:o}]}return[]})}_insertFakeMarkersElements(e,t){const r={},n=t.flatMap(s=>{const{start:o,end:i}=s.range;return[{position:o,marker:s,type:"start"},{position:i,marker:s,type:"end"}]}).sort(({position:s},{position:o})=>s.isBefore(o)?1:-1);for(const{position:s,marker:o,type:i}of n){const l=e.createElement("$marker",{"data-name":o.name,"data-type":i});r[o.name]||(r[o.name]=[]),r[o.name].push(l),e.insert(l,s)}return r}_removeFakeMarkersInsideElement(e,t){const n=this._getAllFakeMarkersFromElement(e,t).reduce((s,o)=>{const i=o.markerElement&&e.createPositionBefore(o.markerElement);let l=s[o.name],c=!1;return l?.start&&l?.end&&(this._getMarkerClipboardConfig(o.name).duplicateOnPaste?s[this._getUniqueMarkerName(o.name)]=s[o.name]:c=!0,l=null),c||(s[o.name]={...l,[o.type]:i}),o.markerElement&&e.remove(o.markerElement),s},{});return ce(n,s=>new se(s.start||e.createPositionFromPath(t,[0]),s.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const r=Array.from(e.createRangeIn(t)).flatMap(({item:o})=>{if(!o.is("element","$marker"))return[];const i=o.getAttribute("data-name"),l=o.getAttribute("data-type");return[{markerElement:o,name:i,type:l}]}),n=[],s=[];for(const o of r)o.type==="end"&&(r.some(l=>l.name===o.name&&l.type==="start")||n.push({markerElement:null,name:o.name,type:"start"})),o.type==="start"&&(r.some(l=>l.name===o.name&&l.type==="end")||s.unshift({markerElement:null,name:o.name,type:"end"}));return[...n,...r,...s]}_getUniqueMarkerName(e){const t=e.split(":"),r=z().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${r}`:`${t.join(":")}:${r}`}}class y extends b{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[G]}init(){this.editor.editing.view.addObserver(v),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,r){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:r==="cut"},()=>{const s=n._copySelectedFragmentWithMarkers(r,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:r})})}_setupPasteDrop(){const e=this.editor,t=e.model,r=e.editing.view,n=r.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",(o,i)=>{i.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(n,"clipboardInput",(o,i)=>{const l=i.dataTransfer;let c;if(i.content)c=i.content;else{let p="";l.getData("text/html")?p=ge(l.getData("text/html")):l.getData("text/plain")&&(p=de(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(p)}const d=new q(this,"inputTransformation"),g=l.getData("application/ckeditor5-editor-id")||null;this.fire(d,{content:c,dataTransfer:l,sourceEditorId:g,targetRanges:i.targetRanges,method:i.method}),d.stop.called&&o.stop(),r.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,i)=>{if(i.content.isEmpty)return;const c=this.editor.data.toModel(i.content,"$clipboardHolder");c.childCount!=0&&(o.stop(),t.change(()=>{this.fire("contentInsertion",{content:c,method:i.method,sourceEditorId:i.sourceEditorId,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,i)=>{i.resultRange=s._pasteFragmentWithMarkers(i.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,s=(o,i)=>{const l=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,o.name)};this.listenTo(n,"copy",s,{priority:"low"}),this.listenTo(n,"cut",(o,i)=>{e.model.canEditAt(e.model.document.selection)?s(o,i):i.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(o,i)=>{const l=e.data.toView(i.content,{isClipboardPipeline:!0});n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:l,method:i.method})},{priority:"low"}),this.listenTo(n,"clipboardOutput",(o,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",H(e.data.htmlProcessor.domConverter,i.content)),i.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),i.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}const P=re("px");class me extends le{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>P(t)),top:e.to("top",t=>P(t)),width:e.to("width",t=>P(t))}}})}}class E extends b{removeDropMarkerDelayed=j(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=V(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=V(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0);_dropTargetLineView=new me;_domEmitter=new(A());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,r,n,s,o){this.removeDropMarkerDelayed.cancel();const i=U(this.editor,e,t,r,n,s,o);/* istanbul ignore next -- @preserve */if(i){if(o&&o.containsRange(i))return this.removeDropMarker();this._updateDropMarkerThrottled(i)}}getFinalDropRange(e,t,r,n,s,o){const i=U(this.editor,e,t,r,n,s,o);return this.removeDropMarker(),i}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:r})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(r);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,r=t.model.markers;t.model.change(n=>{r.has("drop-target")?r.get("drop-target").getRange().isEqual(e)||n.updateMarker("drop-target",{range:e}):n.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const r=this.toDomElement(t);return r.append("",t.createElement("span"),""),r})}_updateDropTargetLine(e){const t=this.editor.editing,r=e.start.nodeBefore,n=e.start.nodeAfter,s=e.start.parent,o=r?t.mapper.toViewElement(r):null,i=o?t.view.domConverter.mapViewToDom(o):null,l=n?t.mapper.toViewElement(n):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(s);if(!d)return;const g=t.view.domConverter.mapViewToDom(d),p=this._getScrollableRect(d),{scrollX:u,scrollY:h}=m.window,M=i?new _(i):null,S=c?new _(c):null,D=new _(g).excludeScrollbarsAndBorders(),O=M?M.bottom:D.top,C=S?S.top:D.bottom,I=m.window.getComputedStyle(g),R=O<=C?(O+C)/2:C;if(p.top<R&&R<p.bottom){const J=D.left+parseFloat(I.paddingLeft),Q=D.right-parseFloat(I.paddingRight),F=Math.max(J+u,p.left),Z=Math.min(Q+u,p.right);this._dropTargetLineView.set({isVisible:!0,left:F,top:R+h,width:Z-F})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let r;if(this._scrollables.has(t))r=this._scrollables.get(t).domElement;else{const n=this.editor.editing.view.domConverter.mapViewToDom(e);r=he(n),this._domEmitter.listenTo(r,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const s=new te(r,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:r,resizeObserver:s})}return new _(r).excludeScrollbarsAndBorders()}}function U(a,e,t,r,n,s,o){const i=a.model,l=a.editing.mapper;let d=$(a,e);for(;d;){if(!s){if(i.schema.checkChild(d,"$text")){if(t){const g=t[0].start,p=l.toModelPosition(g);if(!o||Array.from(o.getItems({shallow:!0})).every(h=>i.schema.checkChild(p,h))){if(i.schema.checkChild(p,"$text"))return i.createRange(p);if(g)return w(a,$(a,g.parent),r,n)}}}else if(i.schema.isInline(d))return w(a,d,r,n)}if(i.schema.isBlock(d))return w(a,d,r,n);if(i.schema.checkChild(d,"$block")){const g=Array.from(d.getChildren()).filter(h=>h.is("element")&&!ue(a,h));let p=0,u=g.length;if(u==0)return i.createRange(i.createPositionAt(d,"end"));for(;p<u-1;){const h=Math.floor((p+u)/2);X(a,g[h],r,n)=="before"?u=h:p=h}return w(a,g[p],r,n)}d=d.parent}return null}function ue(a,e){const t=a.editing.mapper,r=a.editing.view.domConverter,n=t.toViewElement(e);if(!n)return!0;const s=r.mapViewToDom(n);return m.window.getComputedStyle(s).float!="none"}function w(a,e,t,r){const n=a.model;return n.createRange(n.createPositionAt(e,X(a,e,t,r)))}function X(a,e,t,r){const n=a.editing.mapper,s=a.editing.view.domConverter,o=n.toViewElement(e),i=s.mapViewToDom(o),l=new _(i);return a.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":r<(l.top+l.bottom)/2?"before":"after"}function $(a,e){const t=a.editing.mapper,r=a.editing.view,n=t.toModelElement(e);if(n)return n;const s=r.createPositionBefore(e),o=t.findMappedViewAncestor(s);return t.toModelElement(o)}function he(a){let e=a;do{e=e.parentElement;const t=m.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}class fe extends b{_isBlockDragging=!1;_domEmitter=new(A());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,r,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),f.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const r=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(r,"dragstart",(n,s)=>this._handleBlockDragStart(s)),this._domEmitter.listenTo(m.document,"dragover",(n,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"drop",(n,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&r.setAttribute("draggable","true"),this.on("change:isEnabled",(n,s,o)=>{r.setAttribute("draggable",o?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,r=t.document.selection,n=this.editor.editing.view,s=Array.from(r.getSelectedBlocks()),o=t.createRange(t.createPositionBefore(s[0]),t.createPositionAfter(s[s.length-1]));t.change(i=>i.setSelection(o)),this._isBlockDragging=!0,n.focus(),n.getObserver(v).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),r=e.clientY,n=document.elementFromPoint(t,r),s=this.editor.editing.view;!n||!n.closest(".ck-editor__editable")||s.getObserver(v).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:n,clientX:t,clientY:r,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class be extends b{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=j(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(A());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[y,ae,E,fe]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(v),t.addObserver(ne),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(r,n,s)=>{s?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(r,n,s)=>{s||this._finalizeDragging(!1)}),f.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,r=e.editing.view,n=r.document,s=e.plugins.get(E);this.listenTo(n,"dragstart",(o,i)=>{if(i.target?.is("editableElement")){i.preventDefault();return}if(this._prepareDraggedRange(i.target),!this._draggedRange){i.preventDefault();return}this._draggingUid=z(),i.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",i.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(i.dataTransfer,l,"dragstart");const{dataTransfer:d,domTarget:g,domEvent:p}=i,{clientX:u}=p;this._updatePreview({dataTransfer:d,domTarget:g,clientX:u}),i.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(n,"dragend",(o,i)=>{this._finalizeDragging(!i.dataTransfer.isCanceled&&i.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(m.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(n,"dragenter",()=>{this.isEnabled&&r.focus()}),this.listenTo(n,"dragleave",()=>{s.removeDropMarkerDelayed()}),this.listenTo(n,"dragging",(o,i)=>{if(!this.isEnabled){i.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=i.domEvent;s.updateDropMarker(i.target,i.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(i.dataTransfer.dropEffect="copy"),f.isGecko||(i.dataTransfer.effectAllowed=="copy"?i.dataTransfer.dropEffect="copy":["all","copyMove"].includes(i.dataTransfer.effectAllowed)&&(i.dataTransfer.dropEffect="move")),o.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,r=e.editing.view.document,n=e.plugins.get(E);this.listenTo(r,"clipboardInput",(s,o)=>{if(o.method!="drop")return;const{clientX:i,clientY:l}=o.domEvent,c=n.getFinalDropRange(o.target,o.targetRanges,i,l,this._blockMode,this._draggedRange);if(!c){this._finalizeDragging(!1),s.stop();return}if(this._draggedRange&&this._draggingUid!=o.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),N(o.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),s.stop();return}o.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(y);e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const n=r.targetRanges.map(s=>this.editor.editing.mapper.toModelRange(s));this.editor.model.change(s=>s.setSelection(n))},{priority:"high"}),e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const n=N(r.dataTransfer)=="move",s=!r.resultRange||!r.resultRange.isCollapsed;this._finalizeDragging(s&&n)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,r=t.document;this.listenTo(r,"mousedown",(n,s)=>{if(f.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let o=W(s.target);if(f.isBlink&&!e.isReadOnly&&!o&&!r.selection.isCollapsed){const i=r.selection.getSelectedElement();(!i||!k(i))&&(o=r.selection.editableElement)}o&&(t.change(i=>{i.setAttribute("draggable","true",o)}),this._draggableElement=e.editing.mapper.toModelElement(o))}),this.listenTo(r,"mouseup",()=>{f.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,r=t.model;t.plugins.get(E).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&r.change(s=>{const o=r.createSelection(this._draggedRange);r.deleteContent(o,{doNotAutoparagraph:!0});const i=o.getFirstPosition().parent;i.isEmpty&&!r.schema.checkChild(i,"$text")&&r.schema.checkChild(i,"paragraph")&&s.insertElement("paragraph",i,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,r=t.model,n=r.document.selection,s=e?W(e):null;if(s){const c=t.editing.mapper.toModelElement(s);this._draggedRange=T.fromRange(r.createRangeOn(c)),this._blockMode=r.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(n.isCollapsed&&!n.getFirstPosition().parent.isEmpty)return;const o=Array.from(n.getSelectedBlocks()),i=n.getFirstRange();if(o.length==0){this._draggedRange=T.fromRange(i);return}const l=Y(r,o);if(o.length>1)this._draggedRange=T.fromRange(l),this._blockMode=!0;else if(o.length==1){const c=i.start.isTouching(l.start)&&i.end.isTouching(l.end);this._draggedRange=T.fromRange(c?l:i),this._blockMode=c}r.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:r}){const n=this.editor.editing.view,s=n.document.selection.editableElement,o=n.domConverter.mapViewToDom(s),i=m.window.getComputedStyle(o);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=x(m.document,"div",{style:"position: fixed; left: -999999px;"}),m.document.body.appendChild(this._previewContainer));const l=new _(o);if(o.contains(t))return;const c=parseFloat(i.paddingLeft),d=x(m.document,"div");d.className="ck ck-content",d.style.width=i.width,d.style.paddingLeft=`${l.left-r+c}px`,f.isiOS&&(d.style.backgroundColor="white"),n.domConverter.setContentOf(d,e.getData("text/html")),e.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function N(a){return f.isGecko?a.dropEffect:["all","copyMove"].includes(a.effectAllowed)?"move":"copy"}function W(a){if(a.is("editableElement"))return null;if(a.hasClass("ck-widget__selection-handle"))return a.findAncestor(k);if(k(a))return a;const e=a.findAncestor(t=>k(t)||t.is("editableElement"));return k(e)?e:null}function Y(a,e){const t=e[0],r=e[e.length-1],n=t.getCommonAncestor(r),s=a.createPositionBefore(t),o=a.createPositionAfter(r);if(n&&n.is("element")&&!a.schema.isLimit(n)){const i=a.createRangeOn(n),l=s.isTouching(i.start),c=o.isTouching(i.end);if(l&&c)return Y(a,[n])}return a.createRange(s,o)}class _e extends b{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}init(){const e=this.editor,t=e.model,r=e.editing.view,n=t.document.selection;r.addObserver(v),e.plugins.get(y).on("contentInsertion",(s,o)=>{ke(o.content,t)&&t.change(i=>{const l=Array.from(n.getAttributes()).filter(([d])=>t.schema.getAttributeProperties(d).isFormatting);n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),l.push(...n.getAttributes());const c=i.createRangeIn(o.content);for(const d of c.getItems())for(const g of l)t.schema.checkAttribute(d,g[0])&&i.setAttribute(g[0],g[1],d)})})}}function ke(a,e){let t=e.createRangeIn(a);if(a.childCount==1){const r=a.getChild(0);r.is("element")&&e.schema.isBlock(r)&&!e.schema.isObject(r)&&!e.schema.isLimit(r)&&(t=e.createRangeIn(r))}for(const r of t.getItems())if(!e.schema.isInline(r)||Array.from(r.getAttributeKeys()).find(s=>e.schema.getAttributeProperties(s).isFormatting))return!1;return!0}class Ce extends b{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[G,y,be,_e]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}export{Ce as Clipboard,G as ClipboardMarkersUtils,v as ClipboardObserver,y as ClipboardPipeline,be as DragDrop,fe as DragDropBlockToolbar,E as DragDropTarget,_e as PastePlainText,de as plainTextToHtml,H as viewToPlainText};
|
|
20
|
+
`:""}class G extends b{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,r=i=>i.model.getSelectedContent(i.model.document.selection)){return this.editor.model.change(i=>{const s=i.model.document.selection;i.setSelection(t);const o=this._insertFakeMarkersIntoSelection(i,i.model.document.selection,e),n=r(i),l=this._removeFakeMarkersInsideElement(i,n);for(const[c,d]of Object.entries(o)){l[c]||=i.createRangeIn(n);for(const g of d)i.remove(g)}n.markers.clear();for(const[c,d]of Object.entries(l))n.markers.set(c,d);return i.setSelection(s),n})}_pasteMarkersIntoTransformedElement(e,t){const r=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(i=>{const s=this._insertFakeMarkersElements(i,r),o=t(i),n=this._removeFakeMarkersInsideElement(i,o);for(const l of Object.values(s).flat())i.remove(l);for(const[l,c]of Object.entries(n))i.model.markers.has(l)||i.addMarker(l,{usingOperation:!0,affectsData:!0,range:c});return o})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const r of t)e.markers.set(r.name,r.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,r={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const i=this._markersToCopy.get(e);this._markersToCopy.set(e,r),t(),i?this._markersToCopy.set(e,i):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const r=this._getMarkerClipboardConfig(e);if(!r)return!1;if(!t)return!0;const{allowedActions:i}=r;return i==="all"||i.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,r){const i=this._getCopyableMarkersFromSelection(e,t,r);return this._insertFakeMarkersElements(e,i)}_getCopyableMarkersFromSelection(e,t,r){const i=Array.from(t.getRanges()),s=new Set(i.flatMap(n=>Array.from(e.model.markers.getMarkersIntersectingRange(n)))),o=n=>{if(!this._isMarkerCopyable(n.name,r))return!1;const{copyPartiallySelected:c}=this._getMarkerClipboardConfig(n.name);if(!c){const d=n.getRange();return i.some(g=>g.containsRange(d,!0))}return!0};return Array.from(s).filter(o).map(n=>({name:r==="dragstart"?this._getUniqueMarkerName(n.name):n.name,range:n.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:r}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([s,o])=>{if(!this._hasMarkerConfiguration(s))return[{name:s,range:o}];if(this._isMarkerCopyable(s,t)){const n=this._getMarkerClipboardConfig(s),l=r.markers.has(s)&&r.markers.get(s).getRange().root.rootName==="$graveyard";return(n.duplicateOnPaste||l)&&(s=this._getUniqueMarkerName(s)),[{name:s,range:o}]}return[]})}_insertFakeMarkersElements(e,t){const r={},i=t.flatMap(s=>{const{start:o,end:n}=s.range;return[{position:o,marker:s,type:"start"},{position:n,marker:s,type:"end"}]}).sort(({position:s},{position:o})=>s.isBefore(o)?1:-1);for(const{position:s,marker:o,type:n}of i){const l=e.createElement("$marker",{"data-name":o.name,"data-type":n});r[o.name]||(r[o.name]=[]),r[o.name].push(l),e.insert(l,s)}return r}_removeFakeMarkersInsideElement(e,t){const i=this._getAllFakeMarkersFromElement(e,t).reduce((s,o)=>{const n=o.markerElement&&e.createPositionBefore(o.markerElement);let l=s[o.name],c=!1;return l?.start&&l?.end&&(this._getMarkerClipboardConfig(o.name).duplicateOnPaste?s[this._getUniqueMarkerName(o.name)]=s[o.name]:c=!0,l=null),c||(s[o.name]={...l,[o.type]:n}),o.markerElement&&e.remove(o.markerElement),s},{});return ce(i,s=>new se(s.start||e.createPositionFromPath(t,[0]),s.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const r=Array.from(e.createRangeIn(t)).flatMap(({item:o})=>{if(!o.is("element","$marker"))return[];const n=o.getAttribute("data-name"),l=o.getAttribute("data-type");return[{markerElement:o,name:n,type:l}]}),i=[],s=[];for(const o of r)o.type==="end"&&(r.some(l=>l.name===o.name&&l.type==="start")||i.push({markerElement:null,name:o.name,type:"start"})),o.type==="start"&&(r.some(l=>l.name===o.name&&l.type==="end")||s.unshift({markerElement:null,name:o.name,type:"end"}));return[...i,...r,...s]}_getUniqueMarkerName(e){const t=e.split(":"),r=z().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${r}`:`${t.join(":")}:${r}`}}class y extends b{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[G]}init(){this.editor.editing.view.addObserver(v),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,r){const i=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:r==="cut"},()=>{const s=i._copySelectedFragmentWithMarkers(r,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:r})})}_setupPasteDrop(){const e=this.editor,t=e.model,r=e.editing.view,i=r.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(i,"clipboardInput",(o,n)=>{n.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(i,"clipboardInput",(o,n)=>{const l=n.dataTransfer;let c;if(n.content)c=n.content;else{let p="";l.getData("text/html")?p=ge(l.getData("text/html")):l.getData("text/plain")&&(p=de(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(p)}const d=new q(this,"inputTransformation"),g=l.getData("application/ckeditor5-editor-id")||null;this.fire(d,{content:c,dataTransfer:l,sourceEditorId:g,targetRanges:n.targetRanges,method:n.method}),d.stop.called&&o.stop(),r.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,n)=>{if(n.content.isEmpty)return;const c=this.editor.data.toModel(n.content,"$clipboardHolder");c.childCount!=0&&(o.stop(),t.change(()=>{this.fire("contentInsertion",{content:c,method:n.method,sourceEditorId:n.sourceEditorId,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,n)=>{n.resultRange=s._pasteFragmentWithMarkers(n.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,s=(o,n)=>{const l=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,o.name)};this.listenTo(i,"copy",s,{priority:"low"}),this.listenTo(i,"cut",(o,n)=>{e.model.canEditAt(e.model.document.selection)?s(o,n):n.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(o,n)=>{const l=e.data.toView(n.content,{isClipboardPipeline:!0});i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:l,method:n.method})},{priority:"low"}),this.listenTo(i,"clipboardOutput",(o,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",H(e.data.htmlProcessor.domConverter,n.content)),n.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),n.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}const P=re("px");class me extends le{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>P(t)),top:e.to("top",t=>P(t)),width:e.to("width",t=>P(t))}}})}}class E extends b{removeDropMarkerDelayed=j(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=V(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=V(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0);_dropTargetLineView=new me;_domEmitter=new(A());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,r,i,s,o){this.removeDropMarkerDelayed.cancel();const n=U(this.editor,e,t,r,i,s,o);/* istanbul ignore next -- @preserve */if(n){if(o&&o.containsRange(n))return this.removeDropMarker();this._updateDropMarkerThrottled(n)}}getFinalDropRange(e,t,r,i,s,o){const n=U(this.editor,e,t,r,i,s,o);return this.removeDropMarker(),n}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:r})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(r);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,r=t.model.markers;t.model.change(i=>{r.has("drop-target")?r.get("drop-target").getRange().isEqual(e)||i.updateMarker("drop-target",{range:e}):i.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const r=this.toDomElement(t);return r.append("",t.createElement("span"),""),r})}_updateDropTargetLine(e){const t=this.editor.editing,r=e.start.nodeBefore,i=e.start.nodeAfter,s=e.start.parent,o=r?t.mapper.toViewElement(r):null,n=o?t.view.domConverter.mapViewToDom(o):null,l=i?t.mapper.toViewElement(i):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(s);if(!d)return;const g=t.view.domConverter.mapViewToDom(d),p=this._getScrollableRect(d),{scrollX:u,scrollY:h}=m.window,w=n?new _(n):null,S=c?new _(c):null,D=new _(g).excludeScrollbarsAndBorders(),O=w?w.bottom:D.top,C=S?S.top:D.bottom,I=m.window.getComputedStyle(g),R=O<=C?(O+C)/2:C;if(p.top<R&&R<p.bottom){const J=D.left+parseFloat(I.paddingLeft),Q=D.right-parseFloat(I.paddingRight),F=Math.max(J+u,p.left),Z=Math.min(Q+u,p.right);this._dropTargetLineView.set({isVisible:!0,left:F,top:R+h,width:Z-F})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let r;if(this._scrollables.has(t))r=this._scrollables.get(t).domElement;else{const i=this.editor.editing.view.domConverter.mapViewToDom(e);r=he(i),this._domEmitter.listenTo(r,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const s=new te(r,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:r,resizeObserver:s})}return new _(r).excludeScrollbarsAndBorders()}}function U(a,e,t,r,i,s,o){const n=a.model,l=a.editing.mapper;let d=$(a,e);for(;d;){if(!s){if(n.schema.checkChild(d,"$text")){if(t){const g=t[0].start,p=l.toModelPosition(g);if(!o||Array.from(o.getItems({shallow:!0})).every(h=>n.schema.checkChild(p,h))){if(n.schema.checkChild(p,"$text"))return n.createRange(p);if(g)return M(a,$(a,g.parent),r,i)}}}else if(n.schema.isInline(d))return M(a,d,r,i)}if(n.schema.isBlock(d))return M(a,d,r,i);if(n.schema.checkChild(d,"$block")){const g=Array.from(d.getChildren()).filter(h=>h.is("element")&&!ue(a,h));let p=0,u=g.length;if(u==0)return n.createRange(n.createPositionAt(d,"end"));for(;p<u-1;){const h=Math.floor((p+u)/2);X(a,g[h],r,i)=="before"?u=h:p=h}return M(a,g[p],r,i)}d=d.parent}return null}function ue(a,e){const t=a.editing.mapper,r=a.editing.view.domConverter,i=t.toViewElement(e);if(!i)return!0;const s=r.mapViewToDom(i);return m.window.getComputedStyle(s).float!="none"}function M(a,e,t,r){const i=a.model;return i.createRange(i.createPositionAt(e,X(a,e,t,r)))}function X(a,e,t,r){const i=a.editing.mapper,s=a.editing.view.domConverter,o=i.toViewElement(e),n=s.mapViewToDom(o),l=new _(n);return a.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":r<(l.top+l.bottom)/2?"before":"after"}function $(a,e){const t=a.editing.mapper,r=a.editing.view,i=t.toModelElement(e);if(i)return i;const s=r.createPositionBefore(e),o=t.findMappedViewAncestor(s);return t.toModelElement(o)}function he(a){let e=a;do{e=e.parentElement;const t=m.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}class fe extends b{_isBlockDragging=!1;_domEmitter=new(A());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,r,i)=>{i?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),f.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const r=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(r,"dragstart",(i,s)=>this._handleBlockDragStart(s)),this._domEmitter.listenTo(m.document,"dragover",(i,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"drop",(i,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&r.setAttribute("draggable","true"),this.on("change:isEnabled",(i,s,o)=>{r.setAttribute("draggable",o?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,r=t.document.selection,i=this.editor.editing.view,s=Array.from(r.getSelectedBlocks()),o=t.createRange(t.createPositionBefore(s[0]),t.createPositionAfter(s[s.length-1]));t.change(n=>n.setSelection(o)),this._isBlockDragging=!0,i.focus(),i.getObserver(v).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),r=e.clientY,i=document.elementFromPoint(t,r),s=this.editor.editing.view;!i||!i.closest(".ck-editor__editable")||s.getObserver(v).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:i,clientX:t,clientY:r,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class be extends b{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=j(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(A());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[y,ae,E,fe]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(v),t.addObserver(ne),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(r,i,s)=>{s?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(r,i,s)=>{s||this._finalizeDragging(!1)}),f.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,r=e.editing.view,i=r.document,s=e.plugins.get(E);this.listenTo(i,"dragstart",(o,n)=>{if(n.target?.is("editableElement")){n.preventDefault();return}if(this._prepareDraggedRange(n.target),!this._draggedRange){n.preventDefault();return}this._draggingUid=z(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,l,"dragstart");const{dataTransfer:d,domTarget:g,domEvent:p}=n,{clientX:u}=p;this._updatePreview({dataTransfer:d,domTarget:g,clientX:u}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(i,"dragend",(o,n)=>{this._finalizeDragging(!n.dataTransfer.isCanceled&&n.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(m.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(i,"dragenter",()=>{this.isEnabled&&r.focus()}),this.listenTo(i,"dragleave",()=>{s.removeDropMarkerDelayed()}),this.listenTo(i,"dragging",(o,n)=>{if(!this.isEnabled){n.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=n.domEvent;s.updateDropMarker(n.target,n.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(n.dataTransfer.dropEffect="copy"),f.isGecko||(n.dataTransfer.effectAllowed=="copy"?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),o.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,r=e.editing.view.document,i=e.plugins.get(E);this.listenTo(r,"clipboardInput",(s,o)=>{if(o.method!="drop")return;const{clientX:n,clientY:l}=o.domEvent,c=i.getFinalDropRange(o.target,o.targetRanges,n,l,this._blockMode,this._draggedRange);if(!c){this._finalizeDragging(!1),s.stop();return}if(this._draggedRange&&this._draggingUid!=o.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),N(o.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),s.stop();return}o.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(y);e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const i=r.targetRanges.map(s=>this.editor.editing.mapper.toModelRange(s));this.editor.model.change(s=>s.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const i=N(r.dataTransfer)=="move",s=!r.resultRange||!r.resultRange.isCollapsed;this._finalizeDragging(s&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,r=t.document;this.listenTo(r,"mousedown",(i,s)=>{if(f.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let o=W(s.target);if(f.isBlink&&!e.isReadOnly&&!o&&!r.selection.isCollapsed){const n=r.selection.getSelectedElement();(!n||!k(n))&&(o=r.selection.editableElement)}o&&(t.change(n=>{n.setAttribute("draggable","true",o)}),this._draggableElement=e.editing.mapper.toModelElement(o))}),this.listenTo(r,"mouseup",()=>{f.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,r=t.model;t.plugins.get(E).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&r.change(s=>{const o=r.createSelection(this._draggedRange);r.deleteContent(o,{doNotAutoparagraph:!0});const n=o.getFirstPosition().parent;n.isEmpty&&!r.schema.checkChild(n,"$text")&&r.schema.checkChild(n,"paragraph")&&s.insertElement("paragraph",n,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,r=t.model,i=r.document.selection,s=e?W(e):null;if(s){const c=t.editing.mapper.toModelElement(s);this._draggedRange=T.fromRange(r.createRangeOn(c)),this._blockMode=r.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const o=Array.from(i.getSelectedBlocks()),n=i.getFirstRange();if(o.length==0){this._draggedRange=T.fromRange(n);return}const l=Y(r,o);if(o.length>1)this._draggedRange=T.fromRange(l),this._blockMode=!0;else if(o.length==1){const c=n.start.isTouching(l.start)&&n.end.isTouching(l.end);this._draggedRange=T.fromRange(c?l:n),this._blockMode=c}r.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:r}){const i=this.editor.editing.view,s=i.document.selection.editableElement,o=i.domConverter.mapViewToDom(s),n=m.window.getComputedStyle(o);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=x(m.document,"div",{style:"position: fixed; left: -999999px;"}),m.document.body.appendChild(this._previewContainer));const l=new _(o);if(o.contains(t))return;const c=parseFloat(n.paddingLeft),d=x(m.document,"div");d.className="ck ck-content",d.style.width=n.width,d.style.paddingLeft=`${l.left-r+c}px`,f.isiOS&&(d.style.backgroundColor="white"),i.domConverter.setContentOf(d,e.getData("text/html")),e.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function N(a){return f.isGecko?a.dropEffect:["all","copyMove"].includes(a.effectAllowed)?"move":"copy"}function W(a){if(a.is("editableElement"))return null;if(a.hasClass("ck-widget__selection-handle"))return a.findAncestor(k);if(k(a))return a;const e=a.findAncestor(t=>k(t)||t.is("editableElement"));return k(e)?e:null}function Y(a,e){const t=e[0],r=e[e.length-1],i=t.getCommonAncestor(r),s=a.createPositionBefore(t),o=a.createPositionAfter(r);if(i&&i.is("element")&&!a.schema.isLimit(i)){const n=a.createRangeOn(i),l=s.isTouching(n.start),c=o.isTouching(n.end);if(l&&c)return Y(a,[i])}return a.createRange(s,o)}class _e extends b{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}init(){const e=this.editor,t=e.model,r=e.editing.view,i=t.document.selection;r.addObserver(v),e.plugins.get(y).on("contentInsertion",(s,o)=>{ke(o.content,t)&&t.change(n=>{const l=Array.from(i.getAttributes()).filter(([d])=>t.schema.getAttributeProperties(d).isFormatting);i.isCollapsed||t.deleteContent(i,{doNotAutoparagraph:!0}),l.push(...i.getAttributes());const c=n.createRangeIn(o.content);for(const d of c.getItems())for(const g of l)t.schema.checkAttribute(d,g[0])&&n.setAttribute(g[0],g[1],d)})})}}function ke(a,e){let t=e.createRangeIn(a);if(a.childCount==1){const r=a.getChild(0);r.is("element")&&e.schema.isBlock(r)&&!e.schema.isObject(r)&&!e.schema.isLimit(r)&&(t=e.createRangeIn(r))}for(const r of t.getItems())if(!e.schema.isInline(r)||Array.from(r.getAttributeKeys()).find(s=>e.schema.getAttributeProperties(s).isFormatting))return!1;return!0}class Ce extends b{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[G,y,be,_e]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}export{Ce as Clipboard,G as ClipboardMarkersUtils,v as ClipboardObserver,y as ClipboardPipeline,be as DragDrop,fe as DragDropBlockToolbar,E as DragDropTarget,_e as PastePlainText,de as plainTextToHtml,H as viewToPlainText};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ContextPlugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{ContextPlugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{CKEditorError as i,ObservableMixin as p,logWarning as _,EmitterMixin as g}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/const T={autoRefresh:!0},d=36e5,k=5e3;class l extends p(){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new i("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),typeof e=="function"?this._refresh=e:this._refresh=()=>w(e),this._options={...T,...t}}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){const e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw _("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(k),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",r=!/^".*"$/.test(e),s=t&&e.split(".").length===3;if(!(r&&s))throw new i("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;const t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));return t?Math.floor((t*1e3-Date.now())/2):d}catch{return d}}static create(e,t={}){return new l(e,t).init()}}function w(n){return new Promise((e,t)=>{const r=new XMLHttpRequest;r.open("GET",n),r.addEventListener("load",()=>{const s=r.status,o=r.response;return s<200||s>299?t(new i("token-cannot-download-new-token",null)):e(o)}),r.addEventListener("error",()=>t(new Error("Network Error"))),r.addEventListener("abort",()=>t(new Error("Abort"))),r.send()})}const h=/^data:(\S*?);base64,/;class m extends g(){file;xhr;_token;_apiAddress;constructor(e,t,r){if(super(),!e)throw new i("fileuploader-missing-file",null);if(!t)throw new i("fileuploader-missing-token",null);if(!r)throw new i("fileuploader-missing-api-address",null);this.file=R(e)?E(e):e,this._token=t,this._apiAddress=r}onProgress(e){return this.on("progress",(t,r)=>e(r)),this}onError(e){return this.once("error",(t,r)=>e(r)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this.xhr,t=r=>()=>this.fire("error",r);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort"));/* istanbul ignore else -- @preserve */e.upload&&e.upload.addEventListener("progress",r=>{r.lengthComputable&&this.fire("progress",{total:r.total,uploaded:r.loaded})}),e.addEventListener("load",()=>{const r=e.status,s=e.response;if(r<200||r>299)return this.fire("error",s.message||s.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((r,s)=>{t.addEventListener("load",()=>{const o=t.status,a=t.response;return o<200||o>299?a.message?s(new i("fileuploader-uploading-data-failed",this,{message:a.message})):s(a.error):r(a)}),t.addEventListener("error",()=>s(new Error("Network Error"))),t.addEventListener("abort",()=>s(new Error("Abort"))),t.send(e)})}}function E(n,e=512){try{const t=n.match(h)[1],r=atob(n.replace(h,"")),s=[];for(let o=0;o<r.length;o+=e){const a=r.slice(o,o+e),c=new Array(a.length);for(let u=0;u<a.length;u++)c[u]=a.charCodeAt(u);s.push(new Uint8Array(c))}return new Blob(s,{type:t})}catch{throw new i("fileuploader-decoding-image-data-error",null)}}function R(n){return typeof n!="string"?!1:!!n.match(h)?.length}class v{_token;_apiAddress;constructor(e,t){if(!e)throw new i("uploadgateway-missing-token",null);if(!t)throw new i("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new m(e,this._token,this._apiAddress)}}class y extends f{static get pluginName(){return"CloudServicesCore"}static get isOfficialPlugin(){return!0}createToken(e,t){return new l(e,t)}createUploadGateway(e,t){return new v(e,t)}}class C extends f{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;token=null;_tokens=new Map;static get pluginName(){return"CloudServices"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}async init(){const t=this.context.config.get("cloudServices")||{};for(const[o,a]of Object.entries(t))this[o]=a;if(!this.tokenUrl){this.token=null;return}const s=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl);try{this.token=await s.init(),this._tokens.set(this.tokenUrl,this.token)}catch(o){throw s.destroy(),o}}async registerTokenUrl(e){if(this._tokens.has(e))return this.getTokenFor(e);const r=await this.context.plugins.get("CloudServicesCore").createToken(e).init();return this._tokens.set(e,r),r}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new i("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}}export{C as CloudServices,y as CloudServicesCore,l as Token};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as C,Command as S}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as C,Command as S}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{ShiftEnter as y}from"../../../../../@ckeditor_ckeditor5-enter@45.2.2/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{UpcastWriter as O}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{ClipboardPipeline as R}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.2/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Collection as M,first as B}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{createDropdown as N,addListToDropdown as q,MenuBarMenuView as F,MenuBarMenuListView as $,MenuBarMenuListItemView as z,MenuBarMenuListItemButtonView as W,ViewModel as j,SplitButtonView as U}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{IconCodeBlock as w}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/function h(i){const e=i.t,n=i.config.get("codeBlock.languages");for(const o of n)o.label==="Plain text"&&(o.label=e("Plain text")),o.class===void 0&&(o.class=`language-${o.language}`);return n}function k(i,e,n){const o={};for(const c of i)if(e==="class"){const s=c[e].split(" ").shift();o[s]=c[n]}else o[c[e]]=c[n];return o}function x(i){return i.data.match(/^(\s*)/)[0]}function H(i,e){const n=i.createDocumentFragment(),o=e.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ObservableMixin as P,Collection as W,CKEditorError as l,insertToPriorityArray as V,setDataInElement as q,Config as j,parseBase64EncodedObject as Y,toArray as J,crc32 as Q,releaseDate as X,uid as A,logError as Z,Locale as ee,EmitterMixin as te,KeystrokeHandler as ie,global as T,env as _}from"../../../../../@ckeditor_ckeditor5-utils@45.2.
|
|
1
|
+
import{ObservableMixin as P,Collection as W,CKEditorError as l,insertToPriorityArray as V,setDataInElement as q,Config as j,parseBase64EncodedObject as Y,toArray as J,crc32 as Q,releaseDate as X,uid as A,logError as Z,Locale as ee,EmitterMixin as te,KeystrokeHandler as ie,global as T,env as _}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{Model as ne,DataController as se,StylesProcessor as oe,EditingController as re,Conversion as ae}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{EditorWatchdog as le,ContextWatchdog as ce}from"../../../../../@ckeditor_ckeditor5-watchdog@45.2.2/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js";import{isFunction as M}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isFunction.js";import{get as ue}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js";import{set as de}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/set.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class Te extends P(){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",U,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",U),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}function U(o){o.return=!1,o.stop()}class he extends P(){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const i=e.model.document.selection,u=!(i.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!u)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",F,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",F),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function F(o){o.return=!1,o.stop()}class Ne extends he{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){V(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}class H extends te(){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],i=[]){super(),this._context=e,this._availablePlugins=new Map;for(const n of t)n.pluginName&&this._availablePlugins.set(n.pluginName,n);this._contextPlugins=new Map;for(const[n,u]of i)this._contextPlugins.set(n,u),this._contextPlugins.set(u,n),n.pluginName&&this._availablePlugins.set(n.pluginName,n)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new l("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const n=this,u=this._context;w(e),g(e);const y=e.filter(s=>!v(s,t)),p=[...k(y)];C(p,i);const E=L(p);return S(E,"init").then(()=>S(E,"afterInit")).then(()=>E);function b(s){return typeof s=="function"}function x(s){return b(s)&&!!s.isContextPlugin}function v(s,c){return c.some(r=>r===s||f(s)===r||f(r)===s)}function f(s){return b(s)?s.pluginName||s.name:s}function w(s,c=new Set){s.forEach(r=>{b(r)&&(c.has(r)||(c.add(r),r.pluginName&&!n._availablePlugins.has(r.pluginName)&&n._availablePlugins.set(r.pluginName,r),r.requires&&w(r.requires,c)))})}function k(s,c=new Set){return s.map(r=>b(r)?r:n._availablePlugins.get(r)).reduce((r,a)=>c.has(a)?r:(c.add(a),a.requires&&(g(a.requires,a),k(a.requires,c).forEach(d=>r.add(d))),r.add(a)),new Set)}function g(s,c=null){s.map(r=>b(r)?r:n._availablePlugins.get(r)||r).forEach(r=>{O(r,c),D(r,c),I(r,c)})}function O(s,c){if(!b(s))throw c?new l("plugincollection-soft-required",u,{missingPlugin:s,requiredBy:f(c)}):new l("plugincollection-plugin-not-found",u,{plugin:s})}function D(s,c){if(x(c)&&!x(s))throw new l("plugincollection-context-required",u,{plugin:f(s),requiredBy:f(c)})}function I(s,c){if(c&&v(s,t))throw new l("plugincollection-required",u,{plugin:f(s),requiredBy:f(c)})}function L(s){return s.map(c=>{let r=n._contextPlugins.get(c);return r=r||new c(u),n._add(c,r),r})}function S(s,c){return s.reduce((r,a)=>!a[c]||n._contextPlugins.has(a)?r:r.then(a[c].bind(a)),Promise.resolve())}function C(s,c){for(const r of c){if(typeof r!="function")throw new l("plugincollection-replace-plugin-invalid-type",null,{pluginItem:r});const a=r.pluginName;if(!a)throw new l("plugincollection-replace-plugin-missing-name",null,{pluginItem:r});if(r.requires&&r.requires.length)throw new l("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:a});const d=n._availablePlugins.get(a);if(!d)throw new l("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:a});const m=s.indexOf(d);if(m===-1){if(n._contextPlugins.has(d))return;throw new l("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:a})}if(d.requires&&d.requires.length)throw new l("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:a});s.splice(m,1,r),n._availablePlugins.set(a,r)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new l("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}class G{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...i}=e||{};this.config=new j(i,this.constructor.defaultConfig);const n=this.constructor.builtinPlugins;this.config.define("plugins",n),this.plugins=new H(this,n);const u=this.config.get("language")||{};this.locale=new ee({uiLanguage:typeof u=="string"?u:u.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new W}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new l("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new l("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new l("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}class fe extends P(){context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}}class ge{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new l("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class me extends ie{editor;constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const n=t;t=(u,y)=>{this.editor.execute(n),y()}}super.set(e,t,i)}}const N="contentEditing",z="common";class ye{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:N,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const n=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&n.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:n}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:n}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:z}),n&&n.forEach(u=>{this.addKeystrokeInfoGroup({categoryId:e,...u})})}addKeystrokeInfoGroup({categoryId:e=N,id:t,label:i,keystrokes:n}){const u=this.keystrokeInfos.get(e);if(!u)throw new l("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});u.groups.set(t,{id:t,label:i,keystrokes:n||[]})}addKeystrokeInfos({categoryId:e=N,groupId:t=z,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new l("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const n=this.keystrokeInfos.get(e);if(!n.groups.has(t))throw new l("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});n.groups.get(t).keystrokes.push(...i)}}function pe(o){return{sessionId:ke(),pageSessionId:Pe(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:we(o),plugins:be(o.plugins),distribution:_e(),env:Ee(),integration:Object.create(null),menuBar:{isVisible:!!o.config.get("menuBar.isVisible")},language:{ui:o.locale.uiLanguage,content:o.locale.contentLanguage},toolbar:{main:R(o.config.get("toolbar")),block:R(o.config.get("blockToolbar")),balloon:R(o.config.get("balloonToolbar"))}}}function we(o){return Object.getPrototypeOf(o).constructor.editorName}function be(o){return Array.from(o).filter(([e])=>!!e.pluginName).map(([e])=>{const{pluginName:t,isContextPlugin:i,isOfficialPlugin:n,isPremiumPlugin:u}=e;return{isContext:!!i,isOfficial:!!n,isPremium:!!u,name:t}})}function R(o){if(!o)return;const e=Array.isArray(o)?{items:o}:o,t=u(e.items||[]);return{isMultiline:t.includes("-"),shouldNotGroupWhenFull:!!e.shouldNotGroupWhenFull,items:n(t)};function n(y){return y.filter(p=>p!=="|"&&p!=="-")}function u(y){return y.flatMap(p=>typeof p=="string"?[p]:u(p.items))}}function _e(){return{channel:window[Symbol.for("cke distribution")]||"sh"}}function Ee(){let o="unknown",e="unknown";return _.isMac?o="mac":_.isWindows?o="windows":_.isiOS?o="ios":_.isAndroid&&(o="android"),_.isGecko?e="gecko":_.isBlink?e="blink":_.isSafari&&(e="safari"),{os:o,browser:e}}function ke(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",A()),localStorage.getItem("__ckeditor-session-id")}function Pe(){return T.window.CKEDITOR_PAGE_SESSION_ID=T.window.CKEDITOR_PAGE_SESSION_ID||A(),T.window.CKEDITOR_PAGE_SESSION_ID}class Re extends P(){static get editorName(){return"Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;constructor(e={}){if(super(),"sanitizeHtml"in e)throw new l("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:i,...n}=t.defaultConfig||{},{translations:u=i,...y}=e,p=e.language||n.language;this._context=e.context||new G({language:p,translations:u}),this._context._addEditor(this,!e.context);const E=Array.from(t.builtinPlugins||[]);this.config=new j(y,n),this.config.define("plugins",E),this.config.define(this._context._getEditorConfig()),x(this.config),this.plugins=new H(this,E,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new ge,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new ne,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const b=new oe;this.data=new se(this.model,b),this.editing=new re(this.model,b),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new ae([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new me(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new ye(this),v(this);function x(f){let w=f.get("licenseKey");if(!w&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(w=window.CKEDITOR_GLOBAL_LICENSE_KEY,f.set("licenseKey",w)),!w)throw new l("license-key-missing")}function v(f){const w=f.config.get("licenseKey"),k=window[Symbol.for("cke distribution")]||"sh";function g(a){f.enableReadOnlyMode(Symbol("invalidLicense")),f._showLicenseError(a)}function O(a){const d=a.split(".");return d.length!=3?null:d[1]}function D(a){return["exp","jti","vc"].every(m=>m in a)}function I(a){return Object.getOwnPropertyNames(a).sort().filter(h=>h!="vc"&&a[h]!=null).map(h=>a[h])}function L(a){const{hostname:d}=new URL(window.location.href);if(a.includes(d))return!0;const m=d.split(".");return a.filter(h=>h.includes("*")).map(h=>h.split(".")).filter(h=>h.length<=m.length).map(h=>Array(m.length-h.length).fill(h[0]==="*"?"*":"").concat(h)).some(h=>m.every(($,K)=>h[K]===$||h[K]==="*"))}function S(a){const d=a[0].toUpperCase()+a.slice(1),m=a==="evaluation"?"an":"a";console.info(`%cCKEditor 5 ${d} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`⚠️ You are using ${m} ${a} license of CKEditor 5${a==="trial"?" which is for evaluation purposes only":""}. For production usage, please obtain a production license at https://portal.ckeditor.com/`)}if(w=="GPL"){k=="cloud"&&g("distributionChannel");return}const C=O(w);if(!C){g("invalid");return}const s=Y(C);if(!s){g("invalid");return}if(!D(s)){g("invalid");return}if(s.distributionChannel&&!J(s.distributionChannel).includes(k)){g("distributionChannel");return}if(Q(I(s))!=s.vc.toLowerCase()){g("invalid");return}if(new Date(s.exp*1e3)<X){g("expired");return}const r=s.licensedHosts;if(r&&r.length>0&&!L(r)){g("domainLimit");return}if(["evaluation","trial"].includes(s.licenseType)&&s.exp*1e3<Date.now()){g("expired");return}if(["development","evaluation","trial"].includes(s.licenseType)){const{licenseType:a}=s;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[a]||(S(a),window.CKEDITOR_WARNING_SUPPRESSIONS[a]=!0)}if(["evaluation","trial"].includes(s.licenseType)){const a=s.licenseType,d=setTimeout(()=>{g(`${a}Limit`)},6e5);f.on("destroy",()=>{clearTimeout(d)})}s.usageEndpoint&&f.once("ready",()=>{const a={requestId:A(),requestTime:Math.round(Date.now()/1e3),license:w,editor:xe(f)};f._sendUsageRequest(s.usageEndpoint,a).then(d=>{const{status:m,message:h}=d;h&&console.warn(h),m!="ok"&&g("usageLimit")},()=>{Z("license-key-validation-endpoint-not-reachable",{url:s.usageEndpoint})})},{priority:"high"})}}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new l("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new l("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new l("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],n=e.get("extraPlugins")||[],u=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(n),i,u)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){/* istanbul ignore next -- @preserve */l.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}static Context=G;static EditorWatchdog=le;static ContextWatchdog=ce;_showLicenseError(e,t){setTimeout(()=>{if(e=="invalid")throw new l("invalid-license-key");if(e=="expired")throw new l("license-key-expired");if(e=="domainLimit")throw new l("license-key-domain-limit");if(e=="featureNotAllowed")throw new l("license-key-plugin-not-allowed",null,{pluginName:t});if(e=="evaluationLimit")throw new l("license-key-evaluation-limit");if(e=="trialLimit")throw new l("license-key-trial-limit");if(e=="developmentLimit")throw new l("license-key-development-limit");if(e=="usageLimit")throw new l("license-key-usage-limit");if(e=="distributionChannel")throw new l("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){const i=new Headers({"Content-Type":"application/json"}),n=await fetch(new URL(e),{method:"POST",headers:i,body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP Response: ${n.status}`);return n.json()}}function xe(o){const e=pe(o);function t(i,n){if(ue(e,i)!==void 0)throw new l("editor-usage-data-path-already-set",{path:i});de(e,i,n)}return o.fire("collectUsageData",{setUsageData:t}),e}function Ae(o){if(!M(o.updateSourceElement))throw new l("attachtoform-missing-elementapi-interface",o);const e=o.sourceElement;if(ve(e)&&e.form){let t;const i=e.form,n=()=>o.updateSourceElement();M(i.submit)&&(t=i.submit,i.submit=()=>{n(),t.apply(i)}),i.addEventListener("submit",n),o.on("destroy",()=>{i.removeEventListener("submit",n),t&&(i.submit=t)})}}function ve(o){return!!o&&o.tagName.toLowerCase()==="textarea"}function B(o){class e extends o{sourceElement;updateSourceElement(i){if(!this.sourceElement)throw new l("editor-missing-sourceelement",this);const n=this.config.get("updateSourceElementOnDestroy"),u=this.sourceElement instanceof HTMLTextAreaElement;if(!n&&!u){q(this.sourceElement,"");return}const y=typeof i=="string"?i:this.data.get();q(this.sourceElement,y)}}return e}B.updateSourceElement=B(Object).prototype.updateSourceElement;class Ke extends fe{_actions;static get pluginName(){return"PendingActions"}static get isOfficialPlugin(){return!0}init(){this.set("hasAny",!1),this._actions=new W({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new l("pendingactions-add-invalid-message",this);const t=new(P());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}export{he as Command,G as Context,fe as ContextPlugin,Re as Editor,B as ElementApiMixin,Ne as MultiCommand,Ke as PendingActions,Te as Plugin,Ae as attachToForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{BoxedEditorUIView as f,StickyPanelView as w,ToolbarView as m,MenuBarView as p,InlineEditableUIView as b,EditorUI as y,normalizeToolbarConfig as v,DialogView as u}from"../../../../../@ckeditor_ckeditor5-ui@45.2.
|
|
1
|
+
import{BoxedEditorUIView as f,StickyPanelView as w,ToolbarView as m,MenuBarView as p,InlineEditableUIView as b,EditorUI as y,normalizeToolbarConfig as v,DialogView as u}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{enablePlaceholder as P}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{CKEditorError as k,getDataFromElement as T,ElementReplacer as V,Rect as a}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ElementApiMixin as C,attachToForm as B,Editor as E}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{isElement as S}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isElement.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class _ extends y{view;_toolbarConfig;_elementReplacer;constructor(t,i){super(t),this.view=i,this._toolbarConfig=v(t.config.get("toolbar")),this._elementReplacer=new V,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const i=this.editor,o=this.view,n=i.editing.view,e=o.editable,s=n.document.getRoot();e.name=s.rootName,o.render();const r=e.element;this.setEditableElement(e.name,r),o.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),o.menuBarView&&this.initMenuBar(o.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const t=this.view,i=this.editor.editing.view;this._elementReplacer.restore(),i.getDomRoot(t.editable.name)&&i.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.view;t.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),t.stickyPanel.limiterElement=t.element,t.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:i})=>i||0),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const t=this.editor,i=t.editing.view,o=i.document.getRoot(),n=t.sourceElement;let e;const s=t.config.get("placeholder");s&&(e=typeof s=="string"?s:s[this.view.editable.name]),!e&&n&&n.tagName.toLowerCase()==="textarea"&&(e=n.getAttribute("placeholder")),e&&(o.placeholder=e),P({view:i,element:o,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:t}=this.view,i=this.editor.plugins.get("ContextualBalloon");i.on("getPositionOptions",n=>{const e=n.return;if(!e||!t.isSticky||!t.element)return;const s=new a(t.element).height,r=typeof e.target=="function"?e.target():e.target,h=typeof e.limiter=="function"?e.limiter():e.limiter;if(r&&h&&new a(r).height>=new a(h).height-s)return;const d={...e.viewportOffsetConfig},g=(d.top||0)+s;n.return={...e,viewportOffsetConfig:{...d,top:g}}},{priority:"low"});const o=()=>{i.visibleView&&i.updatePosition()};this.listenTo(t,"change:isSticky",o),this.listenTo(this.editor.ui,"change:viewportOffset",o)}_handleScrollToTheSelectionWithStickyPanel(t,i,o){const n=this.view.stickyPanel;if(n.isSticky){const e=new a(n.element).height;i.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(o)};this.listenTo(n,"change:isSticky",e),setTimeout(()=>{this.stopListening(n,"change:isSticky",e)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,i=this.editor.plugins.get("Dialog");i.on("show",()=>{const o=i.view;o.on("moveTo",(n,e)=>{if(!t.isSticky||o.wasMoved||o.isModal)return;const s=new a(t.contentPanelElement);e[1]<s.bottom+u.defaultOffset&&(e[1]=s.bottom+u.defaultOffset)},{priority:"high"})},{priority:"low"})}}class R extends f{stickyPanel;toolbar;editable;constructor(t,i,o={}){super(t),this.stickyPanel=new w(t),this.toolbar=new m(t,{shouldGroupWhenFull:o.shouldToolbarGroupWhenFull}),o.useMenuBar&&(this.menuBarView=new p(t)),this.editable=new b(t,i,void 0,{label:o.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class W extends C(E){static get editorName(){return"ClassicEditor"}ui;constructor(t,i={}){if(!c(t)&&i.initialData!==void 0)throw new k("editor-create-initial-data",null);super(i),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",x(t)),c(t)&&(this.sourceElement=t),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),e=new R(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o,useMenuBar:n.isVisible,label:this.config.get("label")});this.ui=new _(this,e),B(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(t,i={}){return new Promise(o=>{const n=new this(t,i);o(n.initPlugins().then(()=>n.ui.init(c(t)?t:null)).then(()=>n.data.init(n.config.get("initialData"))).then(()=>n.fire("ready")).then(()=>n))})}}function x(l){return c(l)?T(l):l}function c(l){return S(l)}export{W as ClassicEditor,R as ClassicEditorUIView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{global as re,EmitterMixin as N,CKEditorError as f,compareArrays as F,toMap as pe,ObservableMixin as U,count as Zt,isIterable as le,toArray as ae,EventInfo as Rt,Collection as Lt,uid as Fs,spliceArray as en,logWarning as W,DomEmitterMixin as Ds,isValidAttributeName as Bs,first as Wt,isText as E,indexOf as Ee,getAncestors as Vs,isComment as Le,env as M,scrollViewportToShowTarget as $s,isInsideSurrogatePair as Wn,isInsideCombinedSymbol as qn,remove as tn,insertAt as zn,diff as gt,fastDiff as Ls,keyCodes as de,isArrowKeyCode as Ws,priorities as pt,isInsideEmojiSequence as qs,isNode as ot,getCode as zs}from"../../../../../@ckeditor_ckeditor5-utils@45.2.
|
|
1
|
+
import{global as re,EmitterMixin as N,CKEditorError as f,compareArrays as F,toMap as pe,ObservableMixin as U,count as Zt,isIterable as le,toArray as ae,EventInfo as Rt,Collection as Lt,uid as Fs,spliceArray as en,logWarning as W,DomEmitterMixin as Ds,isValidAttributeName as Bs,first as Wt,isText as E,indexOf as Ee,getAncestors as Vs,isComment as Le,env as M,scrollViewportToShowTarget as $s,isInsideSurrogatePair as Wn,isInsideCombinedSymbol as qn,remove as tn,insertAt as zn,diff as gt,fastDiff as Ls,keyCodes as de,isArrowKeyCode as Ws,priorities as pt,isInsideEmojiSequence as qs,isNode as ot,getCode as zs}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{clone as Un}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/clone.js";import{isEqual as nn}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{isObject as at}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isObject.js";import{unset as Us}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/unset.js";import{get as lt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js";import{isPlainObject as Tt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{assignIn as Js}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/assignIn.js";import{merge as Jn}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/merge.js";import{set as js}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/set.js";import{cloneDeep as ce}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";import{isEqualWith as Gs}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js";import{debounce as Mt}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/const Ne=new WeakMap;let sn=!1;function al({view:s,element:e,text:t,isDirectHost:n=!0,keepOnFocus:r=!1}){const i=s.document;Ne.has(i)||(Ne.set(i,new Map),i.registerPostFixer(a=>_t(Ne.get(i),a)),i.on("change:isComposing",()=>{s.change(a=>_t(Ne.get(i),a))},{priority:"high"})),e.is("editableElement")&&e.on("change:placeholder",(a,l,c)=>o(c)),e.placeholder?o(e.placeholder):t&&o(t),t&&Zs();function o(a){const l={text:a,isDirectHost:n,keepOnFocus:r,hostElement:n?e:null};Ne.get(i).set(e,l),s.change(c=>_t([[e,l]],c))}}function Hs(s,e){return e.hasClass("ck-placeholder")?!1:(s.addClass("ck-placeholder",e),!0)}function Ks(s,e){return e.hasClass("ck-placeholder")?(s.removeClass("ck-placeholder",e),!0):!1}function Xs(s,e){if(!s.isAttached()||Ys(s))return!1;const t=s.document,r=t.selection.anchor;return t.isComposing&&r&&r.parent===s?!1:e||!t.isFocused?!0:!!r&&r.parent!==s}function Ys(s){for(const e of s.getChildren())if(!e.is("uiElement"))return!0;return!1}function _t(s,e){const t=[];let n=!1;for(const[r,i]of s)i.isDirectHost&&(t.push(r),rn(e,r,i)&&(n=!0));for(const[r,i]of s){if(i.isDirectHost)continue;const o=Qs(r);o&&(t.includes(o)||(i.hostElement=o,rn(e,r,i)&&(n=!0)))}return n}function rn(s,e,t){const{text:n,isDirectHost:r,hostElement:i}=t;let o=!1;return i.getAttribute("data-placeholder")!==n&&(s.setAttribute("data-placeholder",n,i),o=!0),(r||e.childCount==1)&&Xs(i,t.keepOnFocus)?Hs(s,i)&&(o=!0):Ks(s,i)&&(o=!0),o}function Qs(s){if(s.childCount){const e=s.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}function Zs(){sn||W("enableplaceholder-deprecated-text-option"),sn=!0}/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as m,Command as E}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Observer as b,BubblingEventInfo as v,DomEventData as k}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{env as S}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*//**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as t}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Clipboard as r}from"../../../../../@ckeditor_ckeditor5-clipboard@45.2.2/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js";import{Enter as i,ShiftEnter as e}from"../../../../../@ckeditor_ckeditor5-enter@45.2.2/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{SelectAll as o}from"../../../../../@ckeditor_ckeditor5-select-all@45.2.2/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js";import{Typing as s}from"../../../../../@ckeditor_ckeditor5-typing@45.2.2/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";import{Undo as m}from"../../../../../@ckeditor_ckeditor5-undo@45.2.2/node_modules/@ckeditor/ckeditor5-undo/dist/index.js";import{AccessibilityHelp as l}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class d extends t{static get requires(){return[l,r,i,o,e,s,m]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}export{d as Essentials};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as p,Command as _}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as p,Command as _}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconFindReplace as w,IconPreviousArrow as x}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{Dialog as T,DropdownView as v,createDropdown as F,FormHeaderView as B,ButtonView as V,MenuBarMenuListItemButtonView as A,DialogViewPosition as I,CssTransitionDisablerMixin as E,View as g,ViewCollection as D,FocusCycler as O,submitHandler as S,CollapsibleView as P,SwitchButtonView as b,LabeledFieldView as N,createLabeledInputText as M}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{scrollViewportToShowTarget as H,Collection as m,uid as W,ObservableMixin as $,FocusTracker as L,KeystrokeHandler as U,isVisible as q,Rect as G}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as K}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";import{escapeRegExp as j}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class z extends g{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(t){super(t);const e=t.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(i,s)=>i>0&&!s),this._findInputView=this._createInputField(e("Find in text…")),this._findPrevButtonView=this._createButton({label:e("Previous result"),class:"ck-button-prev",icon:x,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:e("Next result"),class:"ck-button-next",icon:x,keystroke:"F3",tooltip:!0}),this._replaceInputView=this._createInputField(e("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:e("Replace all"),class:"ck-button-replaceall",withText:!0}),this._replaceButtonView=this._createButton({label:e("Replace"),class:"ck-button-replace",withText:!0}),this._findButtonView=this._createButton({label:e("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new L,this._keystrokes=new U,this._focusables=new D,this.focusCycler=new O({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children})}render(){super.render(),S({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(t){t===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const t=this.locale,e=t.t,i=new g(t);return this._findInputView.fieldView.on("input",()=>{this.isDirty=!0}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:s})=>s),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:s})=>s),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:s},n)=>s&&n),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(s,n)=>s||!n?"":e("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.");return}this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){const t=this.locale,e=t.t,i=this.bindTemplate,s=new g(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(o,r)=>e("%0 of %1",[o,r])),s.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const n=()=>{const o=this._findInputView.fieldView.element;if(!o||!q(o))return;const r=new G(s.element).width,h=t.uiLanguageDirection==="ltr"?"paddingRight":"paddingLeft";r?o.style[h]=`calc( 2 * var(--ck-spacing-standard) + ${r}px )`:o.style[h]=""};this.on("change:_resultsCounterText",n,{priority:"low"}),this.on("change:isDirty",n,{priority:"low"}),this._findInputView.template.children[0].children.push(s)}_createAdvancedOptionsCollapsible(){const t=this.locale.t,e=new P(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return e.set({label:t("Advanced options"),isCollapsed:!0}),e}_createActionButtonsDiv(){const t=new g(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},i)=>e&&i),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},i)=>e&&i),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),t.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),t}_createMatchCaseSwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Match case"),withText:!0}),e.bind("isOn").to(this,"_matchCase"),e.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),e}_createWholeWordsOnlySwitch(){const t=this.locale.t,e=new b(this.locale);return e.set({label:t("Whole words only"),withText:!0}),e.bind("isOn").to(this,"_wholeWordsOnly"),e.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),e}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){const t=i=>i.stopPropagation(),e=i=>{i.stopPropagation(),i.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",i=>{e(i),this._findNextButtonView.fire("execute")}),this._keystrokes.set("shift+f3",i=>{e(i),this._findPrevButtonView.fire("execute")}),this._keystrokes.set("enter",i=>{const s=i.target;s===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i)):s===this._replaceInputView.fieldView.element&&!this.isDirty&&(this._replaceButtonView.fire("execute"),e(i))}),this._keystrokes.set("shift+enter",i=>{i.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(i))}),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t)}_createButton(t){const e=new V(this.locale);return e.set(t),e}_createInputField(t,e){const i=new N(this.locale,M);return i.label=t,i.class=e,i}}class Q extends p{static get requires(){return[T]}static get pluginName(){return"FindAndReplaceUI"}static get isOfficialPlugin(){return!0}formView;constructor(t){super(t),t.config.define("findAndReplace.uiType","dialog"),this.formView=null}init(){const t=this.editor,e=t.config.get("findAndReplace.uiType")==="dropdown",i=t.commands.get("find"),s=this.editor.t;t.ui.componentFactory.add("findAndReplace",()=>{let n;return e?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),t.keystrokes.set("Ctrl+F",(o,r)=>{if(i.isEnabled){if(n instanceof v){const h=n.buttonView;h.isOn||h.fire("execute")}else n.isOn?t.plugins.get("Dialog").view.focus():n.fire("execute");r()}}),n}),e||t.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),t.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Find in the document"),keystroke:"CTRL+F"}]})}_createDropdown(){const t=this.editor,e=t.locale.t,i=F(t.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new B(t.locale,{label:e("Find and replace")}),0),i.panelView.children.add(this.formView)}),i.on("change:isOpen",(s,n,o)=>{o?this._setupFormView():this.fire("searchReseted")},{priority:"low"}),i.buttonView.set({icon:w,label:e("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),i}_createDialogButtonForToolbar(){const t=this.editor,e=this._createButton(V),i=t.plugins.get("Dialog");return e.set({tooltip:!0}),e.bind("isOn").to(i,"id",s=>s==="findAndReplace"),e.on("execute",()=>{e.isOn?i.hide():this._showDialog()}),e}_createDialogButtonForMenuBar(){const t=this._createButton(A),e=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return t.set({role:"menuitemcheckbox",isToggleable:!0}),t.bind("isOn").to(i,"id",s=>s==="findAndReplace"),t.on("execute",()=>{if(e.id==="findAndReplace"){e.hide();return}this._showDialog()}),t}_createButton(t){const e=this.editor,i=e.commands.get("find"),s=new t(e.locale),n=e.locale.t;return s.bind("isEnabled").to(i),s.set({icon:w,label:n("Find and replace"),keystroke:"CTRL+F"}),s}_showDialog(){const t=this.editor,e=t.plugins.get("Dialog"),i=t.locale.t;this.formView||(this.formView=this._createFormView()),e.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:I.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire("searchReseted")}})}_createFormView(){const t=this.editor,e=new(E(z))(t.locale),i=t.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;e.bind("highlightOffset").to(n,"highlightedOffset"),e.listenTo(n.results,"change",()=>{e.matchCount=n.results.length});const o=i.get("findNext"),r=i.get("findPrevious"),h=i.get("replace"),a=i.get("replaceAll");return e.bind("_areCommandsEnabled").to(o,"isEnabled",r,"isEnabled",h,"isEnabled",a,"isEnabled",(l,d,u,f)=>({findNext:l,findPrevious:d,replace:u,replaceAll:f})),e.delegate("findNext","findPrevious","replace","replaceAll").to(this),e.on("change:isDirty",(l,d,u)=>{u&&this.fire("searchReseted")}),e}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}}class Z extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:i}={}){const{editor:s}=this,{model:n}=s,o=s.plugins.get("FindAndReplaceUtils");let r,h="";typeof t=="string"?r=(...d)=>({results:o.findByTextCallback(t,{matchCase:e,wholeWords:i})(...d),searchText:t}):r=t;const a=r;r=(...d)=>{const u=a(...d);return u&&"searchText"in u&&(h=u.searchText),u};const l=n.document.getRootNames().reduce((d,u)=>o.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(u)),n,r,d),null);return this._state.clear(n),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=h,r&&(this._state.lastSearchCallback=r),this._state.matchCase=!!e,this._state.matchWholeWords=!!i,{results:l,findCallback:r}}}class J extends $(){constructor(t){super(),this.set("results",new m),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",(e,{removed:i,index:s})=>{if(Array.from(i).length){let n=!1;if(t.change(o=>{for(const r of i)this.highlightedResult===r&&(n=!0),t.markers.has(r.marker.name)&&o.removeMarker(r.marker)}),n){const o=s>=this.results.length?0:s;this.highlightedResult=this.results.get(o)}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(t)})}clear(t){this.searchText="",t.change(e=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],s=t.markers.get(`findResultHighlighted:${i}`);s&&e.removeMarker(s)}[...this.results].forEach(({marker:i})=>{e.removeMarker(i)})}),this.results.clear()}refreshHighlightOffset(t){const{highlightedResult:e,results:i}=this;e?this.highlightedOffset=R(t,[...i]).indexOf(e)+1:this.highlightedOffset=0}}function R(c,t){const e={before:-1,same:0,after:1,different:1};return c.document.getRootNames().flatMap(i=>t.filter(s=>s.marker.getStart().root.rootName===i).sort((s,n)=>e[s.marker.getStart().compareWith(n.marker.getStart())]))}class k extends _{_state;constructor(t,e){super(t),this.isEnabled=!0,this._state=e,this._isEnabledBasedOnSelection=!1}_replace(t,e){const{model:i}=this.editor,s=e.marker.getRange();i.canEditAt(s)&&i.change(n=>{if(s.root.rootName==="$graveyard"){this._state.results.remove(e);return}let o={};for(const r of s.getItems())if(r.is("$text")||r.is("$textProxy")){o=r.getAttributes();break}i.insertContent(n.createText(t,o),s),this._state.results.has(e)&&this._state.results.remove(e)})}}class X extends k{execute(t,e){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(t,e),this._state.results.length){const s=R(this.editor.model,[...this._state.results]);this._state.highlightedResult=s[i%s.length]}}}class Y extends k{execute(t,e){const{editor:i}=this,{model:s}=i,n=i.plugins.get("FindAndReplaceUtils"),o=e instanceof m?e:s.document.getRootNames().reduce((r,h)=>n.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(h)),s,n.findByTextCallback(e,this._state),r),null);o.length&&s.change(()=>{[...o].forEach(r=>{this._replace(t,r)})})}}class C extends _{_state;constructor(t,e){super(t),this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),i=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(i)}}class ee extends C{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),i=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(i)}}class te extends p{static get pluginName(){return"FindAndReplaceUtils"}static get isOfficialPlugin(){return!0}updateFindResultFromRange(t,e,i,s){const n=s||new m,o=r=>n.find(h=>{const{marker:a}=h,l=a.getRange(),d=r.getRange();return l.isEqual(d)});return e.change(r=>{[...t].forEach(({type:h,item:a})=>{if(h==="elementStart"&&e.schema.checkChild(a,"$text")){let l=i({item:a,text:this.rangeToText(e.createRangeIn(a))});if(!l)return;"results"in l&&(l=l.results),l.forEach(d=>{const u=`findResult:${W()}`,f=r.addMarker(u,{usingOperation:!1,affectsData:!1,range:r.createRange(r.createPositionAt(a,d.start),r.createPositionAt(a,d.end))}),y=ie(n,f);o(f)||n.add({id:u,label:d.label,marker:f},y)})}})}),n}rangeToText(t){return Array.from(t.getItems({shallow:!0})).reduce((e,i)=>i.is("$text")||i.is("$textProxy")?e+i.data:`${e}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as h,Command as K}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as h,Command as K}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{createDropdown as S,addListToDropdown as B,MenuBarMenuView as O,MenuBarMenuListView as P,MenuBarMenuListItemView as L,MenuBarMenuListItemButtonView as T,normalizeColorOptions as q,getLocalizedColorOptions as j,focusChildOnDropdownOpen as H,ColorSelectorView as E,ViewModel as D}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{CKEditorError as I,Collection as _}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconFontBackground as Y,IconFontColor as W,IconFontFamily as V,IconFontSize as k}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{addBackgroundRules as Z,isLength as J,isPercentage as Q}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class C extends K{attributeKey;constructor(e,o){super(e),this.attributeKey=o}refresh(){const e=this.editor.model,o=e.document;this.value=o.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(o.selection,this.attributeKey)}execute(e={}){const o=this.editor.model,i=o.document.selection,s=e.value,u=e.batch,a=r=>{if(i.isCollapsed)s?r.setSelectionAttribute(this.attributeKey,s):r.removeSelectionAttribute(this.attributeKey);else{const c=o.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const m of c)s?r.setAttribute(this.attributeKey,s,m):r.removeAttribute(this.attributeKey,m)}};u?o.enqueueChange(u,r=>{a(r)}):o.change(r=>{a(r)})}}const p="fontSize",g="fontFamily",w="fontColor",y="fontBackgroundColor";function $(t,e){const o={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const n of e)o.model.values.push(n.model),o.view[n.model]=n.view,n.upcastAlso&&(o.upcastAlso[n.model]=n.upcastAlso);return o}function R(t){return e=>ee(e.getStyle(t))}function M(t){return(e,{writer:o})=>o.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}function X({dropdownView:t,colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:u,colorPickerViewConfig:a}){const r=t.locale,c=new E(r,{colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:s,documentColorsCount:u,colorPickerViewConfig:a});return t.colorSelectorView=c,t.panelView.children.add(c),c}function ee(t){return t.replace(/\s/g,"")}class te extends C{constructor(e){super(e,g)}}/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as f,Command as H}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as f,Command as H}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Paragraph as v}from"../../../../../@ckeditor_ckeditor5-paragraph@45.2.2/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js";import{priorities as E,Collection as V,first as x}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{ViewModel as M,createDropdown as C,addListToDropdown as k,MenuBarMenuView as L,MenuBarMenuListView as P,MenuBarMenuListItemView as T,MenuBarMenuListItemButtonView as y}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class B extends H{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){const e=x(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>w(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,r=t.document,s=e.value;t.change(c=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(a=>w(a,s,t.schema));for(const a of l)a.is("element",s)||c.rename(a,s)})}}function w(m,e,t){return t.checkChild(m.parent,e)&&!t.isObject(m)}const b="paragraph";class O extends f{static get pluginName(){return"HeadingEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[v]}init(){const e=this.editor,t=e.config.get("heading.options"),r=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),r.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new B(e,r))}afterInit(){const e=this.editor,t=e.commands.get("enter"),r=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,c)=>{const l=e.model.document.selection.getFirstPosition().parent;r.some(g=>l.is("element",g.model))&&!l.is("element",b)&&l.childCount===0&&c.writer.rename(l,b)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:E.low+1})}}/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as w,Command as V}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconEraser as k,IconMarker as x,IconPen as B}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as y,createDropdown as E,addToolbarToDropdown as H,MenuBarMenuView as M,MenuBarMenuListView as A,MenuBarMenuListItemView as f,MenuBarMenuListItemButtonView as v,ListSeparatorView as T,SplitButtonView as I,ToolbarSeparatorView as P}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class O extends V{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,r=t.document.selection,o=e.value;t.change(i=>{if(r.isCollapsed){const s=r.getFirstPosition();if(r.hasAttribute("highlight")){const n=c=>c.item.hasAttribute("highlight")&&c.item.getAttribute("highlight")===this.value,h=s.getLastMatchingPosition(n,{direction:"backward"}),l=s.getLastMatchingPosition(n),u=i.createRange(h,l);!o||this.value===o?(s.isEqual(l)||i.removeAttribute("highlight",u),i.removeSelectionAttribute("highlight")):(s.isEqual(l)||i.setAttribute("highlight",o,u),i.setSelectionAttribute("highlight",o))}else o&&i.setSelectionAttribute("highlight",o)}else{const s=t.schema.getValidRanges(r.getRanges(),"highlight");for(const n of s)o?i.setAttribute("highlight",o,n):i.removeAttribute("highlight",n)}})}}class _ extends w{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(R(t)),e.commands.add("highlight",new O(e))}}function R(d){const e={model:{key:"highlight",values:[]},view:{}};for(const t of d)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}class S extends w{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),k,null,g=>{g.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,g);function g(r){r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",o=>o===e.model),r.iconView.fillColor=e.color,r.isToggleable=!0}}_addButton(e,t,g,r,o){const i=this.editor;i.ui.componentFactory.add(e,s=>{const n=new y(s),h=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return n.set({label:h,icon:g,tooltip:!0}),n.on("execute",()=>{i.execute("highlight",{value:r}),i.editing.view.focus()}),o(n),n})}_addDropdown(e){const t=this.editor,g=t.t,r=t.ui.componentFactory,o=e[0],i=e.reduce((s,n)=>(s[n.model]=n,s),{});r.add("highlight",s=>{const n=t.commands.get("highlight"),h=E(s,I),l=h.buttonView;l.set({label:g("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),l.bind("icon").to(n,"value",a=>b(c(a,"type"))),l.bind("color").to(n,"value",a=>c(a,"color")),l.bind("commandValue").to(n,"value",a=>c(a,"model")),l.bind("isOn").to(n,"value",a=>!!a),l.delegate("execute").to(h);const u=()=>{const a=e.map(m=>{const p=r.create("highlight:"+m.model);return this.listenTo(p,"execute",()=>{h.buttonView.set({lastExecuted:m.model})}),p});return a.push(new P),a.push(r.create("removeHighlight")),a};h.bind("isEnabled").to(n,"isEnabled"),H(h,u,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:g("Text highlight toolbar")}),C(h),l.on("execute",()=>{t.execute("highlight",{value:l.commandValue})}),this.listenTo(h,"execute",()=>{t.editing.view.focus()});function c(a,m){const p=!a||a===l.lastExecuted?l.lastExecuted:a;return i[p][m]}return h})}_addMenuBarButton(e){const t=this.editor,g=t.t,r=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{const i=new M(o);i.buttonView.set({label:g("Highlight"),icon:b("marker")}),i.bind("isEnabled").to(r),i.buttonView.iconView.fillColor="transparent";const s=new A(o);for(const l of e){const u=new f(o,i),c=new v(o);c.set({label:l.title,icon:b(l.type),role:"menuitemradio",isToggleable:!0}),c.iconView.fillColor=l.color,c.delegate("execute").to(i),c.bind("isOn").to(r,"value",a=>a===l.model),c.on("execute",()=>{t.execute("highlight",{value:l.model}),t.editing.view.focus()}),u.children.add(c),s.items.add(u)}s.items.add(new T(o));const n=new f(o,i),h=new v(o);return h.set({label:g("Remove highlight"),icon:k}),h.delegate("execute").to(i),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),n.children.add(h),s.items.add(n),i.panelView.children.add(s),i})}}function C(d){d.buttonView.actionView.iconView.bind("fillColor").to(d.buttonView,"color")}function b(d){return d==="marker"?x:B}class G extends w{static get requires(){return[_,S]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}export{G as Highlight,_ as HighlightEditing,S as HighlightUI};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as s,Command as m}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as u,toWidget as d,findOptimalInsertionRange as h}from"../../../../../@ckeditor_ckeditor5-widget@45.2.2/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{IconHorizontalLine as g}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as z,MenuBarMenuListItemButtonView as L}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class p extends m{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=f(n,e,t)}execute(){const t=this.editor.model;t.change(e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})})}}function f(o,t,e){const n=E(o,e);return t.checkChild(n,"horizontalLine")}function E(o,t){const n=h(o,t).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}class H extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.model.schema,n=t.t,a=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),a.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),a.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const c=n("Horizontal line"),l=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",l),i.setCustomProperty("hr",!0,l),b(l,i,c)}}),a.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new p(t))}}function b(o,t,e){return t.setCustomProperty("horizontalLine",!0,o),d(o,t,{label:e})}class v extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(z);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(L))}_createButton(t){const e=this.editor,n=e.locale,a=e.commands.get("horizontalLine"),r=new t(e.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:g}),r.bind("isEnabled").to(a,"isEnabled"),this.listenTo(r,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),r}}class B extends s{static get requires(){return[H,v,u]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{B as HorizontalLine,H as HorizontalLineEditing,v as HorizontalLineUI};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as f,Command as B}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as f,Command as B}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{Widget as V,toWidget as S,findOptimalInsertionRange as A}from"../../../../../@ckeditor_ckeditor5-widget@45.2.2/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{ButtonView as P,MenuBarMenuListItemButtonView as T}from"../../../../../@ckeditor_ckeditor5-ui@45.2.2/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{logWarning as I,createElement as b}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{IconHtml as L,IconPencil as C,IconCheck as D,IconCancel as M}from"../../../../../@ckeditor_ckeditor5-icons@45.2.2/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/class y extends B{refresh(){const e=this.editor.model,i=e.schema,a=e.document.selection,t=H(a);this.isEnabled=O(a,i,e),this.value=t?t.getAttribute("value")||"":null}execute(e){const i=this.editor.model,a=i.document.selection;i.change(t=>{let w;this.value!==null?w=H(a):(w=t.createElement("rawHtml"),i.insertObject(w,null,null,{setSelection:"on"})),t.setAttribute("value",e,w)})}}function O(m,e,i){const a=W(m,i);return e.checkChild(a,"rawHtml")}function W(m,e){const a=A(m,e).start.parent;return a.isEmpty&&!a.is("rootElement")?a.parent:a}function H(m){const e=m.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}class z extends f{_widgetButtonViewReferences=new Set;static get pluginName(){return"HtmlEmbedEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:i=>(I("html-embed-provide-sanitize-function"),{html:i,hasChanged:!1})})}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new y(e)),this._setupConversion()}_setupConversion(){const e=this.editor,i=e.t,a=e.editing.view,t=this._widgetButtonViewReferences,w=e.config.get("htmlEmbed");this.editor.editing.view.on("render",()=>{for(const o of t){if(o.element&&o.element.isConnected)return;o.destroy(),t.delete(o)}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(o,{writer:l})=>l.createElement("rawHtml",{value:o.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(o,{writer:l})=>l.createRawElement("div",{class:"raw-html-embed"},function(s){s.innerHTML=o.getAttribute("value")||""})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(o,{writer:l})=>{let s,n,c;const r=l.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(u){s=u,g({editor:e,domElement:u,state:n,props:c}),s.addEventListener("mousedown",()=>{if(n.isEditable){const h=e.model;h.document.selection.getSelectedElement()!==o&&h.change(R=>R.setSelection(o,"on"))}},!0)}),p={makeEditable(){n=Object.assign({},n,{isEditable:!0}),g({domElement:s,editor:e,state:n,props:c}),a.change(u=>{u.setAttribute("data-cke-ignore-events","true",r)}),s.querySelector("textarea").focus()},save(u){u!==n.getRawHtmlValue()?(e.execute("htmlEmbed",u),e.editing.view.focus()):this.cancel()},cancel(){n=Object.assign({},n,{isEditable:!1}),g({domElement:s,editor:e,state:n,props:c}),e.editing.view.focus(),a.change(u=>{u.removeAttribute("data-cke-ignore-events",r)})}};n={showPreviews:w.showPreviews,isEditable:!1,getRawHtmlValue:()=>o.getAttribute("value")||""},c={sanitizeHtml:w.sanitizeHtml,textareaPlaceholder:i("Paste raw HTML here..."),onEditClick(){p.makeEditable()},onSaveClick(u){p.save(u)},onCancelClick(){p.cancel()}};const d=l.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":i("HTML snippet"),dir:e.locale.uiLanguageDirection},r);return l.setCustomProperty("rawHtmlApi",p,d),l.setCustomProperty("rawHtml",!0,d),S(d,l,{label:i("HTML snippet"),hasSelectionHandle:!0})}});function g({editor:o,domElement:l,state:s,props:n}){l.textContent="";const c=l.ownerDocument;let r;if(s.isEditable){const d={isDisabled:!1,placeholder:n.textareaPlaceholder};r=E({domDocument:c,state:s,props:d}),l.append(r)}else if(s.showPreviews){const d={sanitizeHtml:n.sanitizeHtml};l.append(x({domDocument:c,state:s,props:d,editor:o}))}else{const d={isDisabled:!0,placeholder:n.textareaPlaceholder};l.append(E({domDocument:c,state:s,props:d}))}const p={onEditClick:n.onEditClick,onSaveClick:()=>{n.onSaveClick(r.value)},onCancelClick:n.onCancelClick};l.prepend(k({editor:o,domDocument:c,state:s,props:p}))}function k({editor:o,domDocument:l,state:s,props:n}){const c=b(l,"div",{class:"raw-html-embed__buttons-wrapper"});if(s.isEditable){const r=v(o,"save",n.onSaveClick),p=v(o,"cancel",n.onCancelClick);c.append(r.element,p.element),t.add(r).add(p)}else{const r=v(o,"edit",n.onEditClick);c.append(r.element),t.add(r)}return c}function E({domDocument:o,state:l,props:s}){const n=b(o,"textarea",{placeholder:s.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=s.isDisabled,n.value=l.getRawHtmlValue(),n}function x({editor:o,domDocument:l,state:s,props:n}){const c=n.sanitizeHtml(s.getRawHtmlValue()),r=s.getRawHtmlValue().length>0?i("No preview available"):i("Empty snippet content"),p=b(l,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},r),d=b(l,"div",{class:"raw-html-embed__preview-content",dir:o.locale.contentLanguageDirection}),h=l.createRange().createContextualFragment(c.html);return d.appendChild(h),b(l,"div",{class:"raw-html-embed__preview"},[p,d])}}}function v(m,e,i){const{t:a}=m.locale,t=new P(m.locale),w=m.commands.get("htmlEmbed");return t.set({class:`raw-html-embed__${e}-button`,icon:C,tooltip:!0,tooltipPosition:m.locale.uiLanguageDirection==="rtl"?"e":"w"}),t.render(),e==="edit"?(t.set({icon:C,label:a("Edit source")}),t.bind("isEnabled").to(w)):e==="save"?(t.set({icon:D,label:a("Save changes")}),t.bind("isEnabled").to(w)):t.set({icon:M,label:a("Cancel")}),t.on("execute",i),t}class F extends f{static get pluginName(){return"HtmlEmbedUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,a=e.locale.t;e.ui.componentFactory.add("htmlEmbed",()=>{const t=this._createButton(P);return t.set({tooltip:!0,label:a("Insert HTML")}),t}),e.ui.componentFactory.add("menuBar:htmlEmbed",()=>{const t=this._createButton(T);return t.set({label:a("HTML snippet")}),t})}_createButton(e){const i=this.editor,a=i.commands.get("htmlEmbed"),t=new e(i.locale);return t.set({icon:L}),t.bind("isEnabled").to(a,"isEnabled"),this.listenTo(t,"execute",()=>{i.execute("htmlEmbed"),i.editing.view.focus(),i.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()}),t}}class G extends f{static get requires(){return[z,F,V]}static get pluginName(){return"HtmlEmbed"}static get isOfficialPlugin(){return!0}}export{G as HtmlEmbed,z as HtmlEmbedEditing,F as HtmlEmbedUI};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Plugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.
|
|
1
|
+
import{Plugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.2/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{logWarning as X,global as V,uid as H,priorities as S,CKEditorError as Q,toArray as k,isValidAttributeName as Y}from"../../../../../@ckeditor_ckeditor5-utils@45.2.2/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{UpcastWriter as R,HtmlDataProcessor as J,Matcher as M,StylesMap as Z}from"../../../../../@ckeditor_ckeditor5-engine@45.2.2/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ee,toWidget as K}from"../../../../../@ckeditor_ckeditor5-widget@45.2.2/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{Enter as te}from"../../../../../@ckeditor_ckeditor5-enter@45.2.2/node_modules/@ckeditor/ckeditor5-enter/dist/index.js";import{isEqual as N}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/predicate/isEqual.js";import{mergeWith as re}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mergeWith.js";import{startCase as ie}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/string/startCase.js";import{isPlainObject as oe}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js";import{cloneDeep as le}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeep.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/function p(s,e,r,t){e&&ne(s,e,t),r&&w(s,r,t)}function w(s,e,r){if(e.attributes)for(const[t,i]of Object.entries(e.attributes))s.setAttribute(t,i,r);e.styles&&s.setStyle(e.styles,r),e.classes&&s.addClass(e.classes,r)}function ne(s,e,r){if(e.attributes)for(const[t]of Object.entries(e.attributes))s.removeAttribute(t,r);if(e.styles)for(const t of Object.keys(e.styles))s.removeStyle(t,r);e.classes&&s.removeClass(e.classes,r)}function se(s,e){const r=le(s);let t="attributes";for(t in e)t=="classes"?r[t]=Array.from(new Set([...s[t]||[],...e[t]])):r[t]={...s[t],...e[t]};return r}function v(s,e,r,t,i){const o=e.getAttribute(r),l={};for(const n of["attributes","styles","classes"]){if(n!=t){o&&o[n]&&(l[n]=o[n]);continue}if(t=="classes"){const a=new Set(o&&o.classes||[]);i(a),a.size&&(l[n]=Array.from(a));continue}const m=new Map(Object.entries(o&&o[n]||{}));i(m),m.size&&(l[n]=Object.fromEntries(m))}Object.keys(l).length?e.is("documentSelection")?s.setSelectionAttribute(r,l):s.setAttribute(r,l,e):o&&(e.is("documentSelection")?s.removeSelectionAttribute(r):s.removeAttribute(r,e))}function me(s){return ie(s).replace(/ /g,"")}function b(s){return`html${me(s)}Attributes`}function x({model:s}){return(e,r)=>r.writer.createElement(s,{htmlContent:e.getCustomProperty("$rawContent")})}function ae(s,{view:e,isInline:r}){const t=s.t;return(i,{writer:o})=>{const l=t("HTML object"),n=T(e,i,o),m=i.getAttribute(b(e));o.addClass("html-object-embed__content",n),m&&w(o,m,n);const a=o.createContainerElement(r?"span":"div",{class:"html-object-embed","data-html-object-embed-label":l},n);return K(a,o,{label:l})}}function T(s,e,r){return r.createRawElement(s,null,(t,i)=>{i.setContentOf(t,e.getAttribute("htmlContent"))})}function ue({view:s,model:e,allowEmpty:r},t){return o=>{o.on(`element:${s}`,(l,n,m)=>{let a=t.processViewAttributes(n.viewItem,m);if(!(!a&&!m.consumable.test(n.viewItem,{name:!0}))){if(a=a||{},m.consumable.consume(n.viewItem,{name:!0}),n.modelRange||(n=Object.assign(n,m.convertChildren(n.viewItem,n.modelCursor))),r&&n.modelRange.isCollapsed&&Object.keys(a).length){const u=m.writer.createElement("htmlEmptyElement");if(!m.safeInsert(u,n.modelCursor))return;const c=m.getSplitParts(u);n.modelRange=m.writer.createRange(n.modelRange.start,m.writer.createPositionAfter(c[c.length-1])),m.updateConversionResult(u,n),i(u,a,m);return}for(const u of n.modelRange.getItems())i(u,a,m)}},{priority:"low"})};function i(o,l,n){if(n.schema.checkAttribute(o,e)){const m=o.getAttribute(e),a=se(l,m||{});n.writer.setAttribute(e,a,o)}}}function L({model:s,view:e},r){return(t,{writer:i,consumable:o})=>{if(!t.hasAttribute(s))return null;const l=i.createContainerElement(e),n=t.getAttribute(s);return o.consume(t,`attribute:${s}`),w(i,n,l),l.getFillerOffset=()=>null,r?K(l,i):l}}function ce({priority:s,view:e}){return(r,t)=>{if(!r)return;const{writer:i}=t,o=i.createAttributeElement(e,null,{priority:s});return w(i,r,o),o}}function E({view:s},e){return r=>{r.on(`element:${s}`,(t,i,o)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const l=e.processViewAttributes(i.viewItem,o);l&&o.writer.setAttribute(b(i.viewItem.name),l,i.modelRange)},{priority:"low"})}}function F({view:s,model:e}){return r=>{r.on(`attribute:${b(s)}:${e}`,(t,i,o)=>{if(!o.consumable.consume(i.item,t.name))return;const{attributeOldValue:l,attributeNewValue:n}=i,m=o.writer,a=o.mapper.toViewElement(i.item);p(m,l,n,a)})}}/**
|