TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import{Command as T,Plugin as f}from"@ckeditor/ckeditor5-core";import{logWarning as B,CKEditorError as b,first as E}from"@ckeditor/ckeditor5-utils";import{ButtonView as D,createDropdown as k,addToolbarToDropdown as N,MenuBarMenuView as _,MenuBarMenuListView as I,MenuBarMenuListItemView as V,MenuBarMenuListItemButtonView as M}from"@ckeditor/ckeditor5-ui";import{IconAlignLeft as O,IconAlignRight as L,IconAlignCenter as C,IconAlignJustify as P}from"@ckeditor/ckeditor5-icons";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const d=["left","right","center","justify"];function h(i){return d.includes(i)}function p(i,e){return e.contentLanguageDirection=="rtl"?i==="right":i==="left"}function A(i){const e=i.map(t=>{let o;return typeof t=="string"?o={name:t}:o=t,o}).filter(t=>{const o=d.includes(t.name);return o||B("alignment-config-name-not-recognized",{option:t}),o}),n=e.filter(t=>!!t.className).length;if(n&&n<e.length)throw new b("alignment-config-classnames-are-missing",{configuredOptions:i});return e.forEach((t,o,a)=>{const s=a.slice(o+1);if(s.some(r=>r.name==t.name))throw new b("alignment-config-name-already-defined",{option:t,configuredOptions:i});if(t.className&&s.some(l=>l.className==t.className))throw new b("alignment-config-classname-already-defined",{option:t,configuredOptions:i})}),e}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const w="alignment";class v extends T{refresh(){const n=this.editor.locale,t=E(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!t&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value=n.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const n=this.editor,t=n.locale,o=n.model,a=o.document,s=e.value;o.change(c=>{const r=Array.from(a.selection.getSelectedBlocks()).filter(g=>this._canBeAligned(g)),l=r[0].getAttribute("alignment");p(s,t)||l===s||!s?S(r,c):z(r,c,s)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,w)}}function S(i,e){for(const n of i)e.removeAttribute(w,n)}function z(i,e,n){for(const t of i)e.setAttribute(w,n,t)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class y extends f{static get pluginName(){return"AlignmentEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("alignment",{options:d.map(n=>({name:n}))})}init(){const e=this.editor,n=e.locale,t=e.model.schema,a=A(e.config.get("alignment.options")).filter(l=>h(l.name)&&!p(l.name,n)),s=a.some(l=>!!l.className);t.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),s?e.conversion.attributeToAttribute(G(a)):e.conversion.for("downcast").attributeToAttribute(F(a));const c=U(a);for(const l of c)e.conversion.for("upcast").attributeToAttribute(l);const r=j(a);for(const l of r)e.conversion.for("upcast").attributeToAttribute(l);e.commands.add("alignment",new v(e))}}function F(i){const e={};for(const{name:t}of i)e[t]={key:"style",value:{"text-align":t}};return{model:{key:"alignment",values:i.map(t=>t.name)},view:e}}function U(i){const e=[];for(const{name:n}of i)e.push({view:{key:"style",value:{"text-align":n}},model:{key:"alignment",value:n}});return e}function j(i){const e=[];for(const{name:n}of i)e.push({view:{key:"align",value:n},model:{key:"alignment",value:n}});return e}function G(i){const e={};for(const t of i)e[t.name]={key:"class",value:t.className};return{model:{key:"alignment",values:i.map(t=>t.name)},view:e}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const u=new Map([["left",O],["right",L],["center",C],["justify",P]]);class x extends f{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,n=A(e.config.get("alignment.options"));n.map(t=>t.name).filter(h).forEach(t=>this._addButton(t)),this._addToolbarDropdown(n),this._addMenuBarMenu(n)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,t=>this._createButton(t,e))}_createButton(e,n,t={}){const o=this.editor,a=o.commands.get("alignment"),s=new D(e);return s.set({label:this.localizedOptionTitles[n],icon:u.get(n),tooltip:!0,isToggleable:!0,...t}),s.bind("isEnabled").to(a),s.bind("isOn").to(a,"value",c=>c===n),this.listenTo(s,"execute",()=>{o.execute("alignment",{value:n}),o.editing.view.focus()}),s}_addToolbarDropdown(e){const n=this.editor;n.ui.componentFactory.add("alignment",o=>{const a=k(o),s=o.uiLanguageDirection==="rtl"?"w":"e",c=o.t;N(a,()=>e.map(m=>this._createButton(o,m.name,{tooltipPosition:s})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:c("Text alignment toolbar")}),a.buttonView.set({label:c("Text alignment"),tooltip:!0}),a.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const r=o.contentLanguageDirection==="rtl"?u.get("right"):u.get("left"),l=n.commands.get("alignment");return a.buttonView.bind("icon").to(l,"value",m=>u.get(m)||r),a.bind("isEnabled").to(l,"isEnabled"),this.listenTo(a,"execute",()=>{n.editing.view.focus()}),a})}_addMenuBarMenu(e){const n=this.editor;n.ui.componentFactory.add("menuBar:alignment",t=>{const o=n.commands.get("alignment"),a=t.t,s=new _(t),c=new I(t);s.bind("isEnabled").to(o),c.set({ariaLabel:a("Text alignment"),role:"menu"}),s.buttonView.set({label:a("Text alignment")});for(const r of e){const l=new V(t,s),m=new M(t);m.delegate("execute").to(s),m.set({label:this.localizedOptionTitles[r.name],icon:u.get(r.name),role:"menuitemcheckbox",isToggleable:!0}),m.on("execute",()=>{n.execute("alignment",{value:r.name}),n.editing.view.focus()}),m.bind("isOn").to(o,"value",g=>g===r.name),m.bind("isEnabled").to(o,"isEnabled"),l.children.add(m),c.items.add(l)}return s.panelView.children.add(c),s})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class J extends f{static get requires(){return[y,x]}static get pluginName(){return"Alignment"}static get isOfficialPlugin(){return!0}}export{J as Alignment,v as AlignmentCommand,y as AlignmentEditing,x as AlignmentUI,d as _ALIGNMENT_SUPPORTED_OPTIONS,h as _isAlignmentSupported,p as _isDefaultAlignment,A as _normalizeAlignmentOptions};
|
||||
@@ -0,0 +1,10 @@
|
||||
import{Plugin as y}from"@ckeditor/ckeditor5-core";import{Delete as P}from"@ckeditor/ckeditor5-typing";import{ModelLiveRange as B,ModelSchemaContext as S}from"@ckeditor/ckeditor5-engine";import{first as q}from"@ckeditor/ckeditor5-utils";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function g(o,t,e,s){let a,n=null;typeof s=="function"?a=s:(n=o.commands.get(s),a=()=>{o.execute(s)}),o.model.document.on("change:data",(h,l)=>{if(n&&!n.isEnabled||!t.isEnabled)return;const r=q(o.model.document.selection.getRanges());if(!r.isCollapsed||l.isUndo||!l.isLocal)return;const f=Array.from(o.model.document.differ.getChanges()),c=f[0];if(f.length!=1||c.type!=="insert"||c.name!="$text"||c.length!=1)return;const i=c.position.parent;if(i.is("element","codeBlock")||i.is("element","listItem")&&typeof s!="function"&&!["numberedList","bulletedList","todoList"].includes(s)||n&&n.value===!0)return;const u=i.getChild(0),A=o.model.createRangeOn(u);if(!A.containsRange(r)&&!r.end.isEqual(A.end))return;const p=e.exec(u.data.substr(0,r.end.offset));p&&o.model.enqueueChange(d=>{const m=o.model.document.selection,L=d.createPositionAt(i,0),$=d.createPositionAt(i,p[0].length),k=new B(L,$);if(a({match:p})!==!1){const x=Array.from(m.getAttributes());d.remove(k);const C=m.getFirstRange(),v=d.createRangeIn(i);i.isEmpty&&!v.isEqual(C)&&!v.containsRange(C,!0)&&d.remove(i),F(d,m,x)}k.detach(),o.model.enqueueChange(()=>{o.plugins.get("Delete").requestUndoOnBackspace()})})})}function F(o,t,e){const s=o.model.schema,a=t.getFirstPosition();let n=new S(a);s.checkChild(n,"$text")&&(n=n.push("$text"));for(const[h,l]of e)s.checkAttribute(n,h)&&o.setSelectionAttribute(h,l)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function b(o,t,e,s){let a,n;e instanceof RegExp?a=e:n=e,n=n||(h=>{let l;const r=[],f=[];for(;(l=a.exec(h))!==null&&!(l&&l.length<4);){let{index:c,"1":i,"2":u,"3":A}=l;const p=i+u+A;c+=l[0].length-p.length;const d=[c,c+i.length],m=[c+i.length+u.length,c+i.length+u.length+A.length];r.push(d),r.push(m),f.push([c+i.length,c+i.length+u.length])}return{remove:r,format:f}}),o.model.document.on("change:data",(h,l)=>{if(l.isUndo||!l.isLocal||!t.isEnabled)return;const r=o.model,f=r.document.selection;if(!f.isCollapsed)return;const c=Array.from(r.document.differ.getChanges()),i=c[0];if(c.length!=1||i.type!=="insert"||i.name!="$text"||i.length!=1)return;const u=f.focus,A=u.parent,{text:p,range:d}=I(r.createRange(r.createPositionAt(A,0),u),r),m=n(p),L=R(d.start,m.format,r),$=R(d.start,m.remove,r);L.length&&$.length&&r.enqueueChange(k=>{if(s(k,L)!==!1){for(const x of $.reverse())k.remove(x);r.enqueueChange(()=>{o.plugins.get("Delete").requestUndoOnBackspace()})}})})}function R(o,t,e){return t.filter(s=>s[0]!==void 0&&s[1]!==void 0).map(s=>e.createRange(o.getShiftedBy(s[0]),o.getShiftedBy(s[1])))}function I(o,t){let e=o.start;return{text:Array.from(o.getItems()).reduce((a,n)=>!(n.is("$text")||n.is("$textProxy"))||n.getAttribute("code")?(e=t.createPositionAfter(n),""):a+n.data,""),range:t.createRange(e,o.end)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class T extends y{static get requires(){return[P]}static get pluginName(){return"Autoformat"}static get isOfficialPlugin(){return!0}afterInit(){const t=this.editor,e=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Revert autoformatting action"),keystroke:"Backspace"}]})}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&g(this.editor,this,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&g(this.editor,this,/^1[.|)]\s$/,"numberedList"),t.get("todoList")&&g(this.editor,this,/^\[\s?\]\s$/,"todoList"),t.get("checkTodoList")&&g(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const e=_(this.editor,"bold");b(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),b(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(t.get("italic")){const e=_(this.editor,"italic");b(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),b(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(t.get("code")){const e=_(this.editor,"code");b(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(t.get("strikethrough")){const e=_(this.editor,"strikethrough");b(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(e=>{const s=e[7],a=new RegExp(`^(#{${s}})\\s$`);g(this.editor,this,a,()=>{if(!t.isEnabled||t.value===e)return!1;this.editor.execute("heading",{value:e})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&g(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const t=this.editor,e=t.model.document.selection;t.commands.get("codeBlock")&&g(t,this,/^```$/,()=>{if(e.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&g(this.editor,this,/^---$/,"horizontalLine")}}function _(o,t){return(e,s)=>{if(!o.commands.get(t).isEnabled)return!1;const n=o.model.schema.getValidRanges(s,t);for(const h of n)e.setAttribute(t,!0,h);e.removeSelectionAttribute(t)}}export{T as Autoformat,g as blockAutoformatEditing,b as inlineAutoformatEditing};
|
||||
@@ -0,0 +1,70 @@
|
||||
import{Command as G,Plugin as n}from"@ckeditor/ckeditor5-core";import{ModelDocumentSelection as X}from"@ckeditor/ckeditor5-engine";import{IconBold as j,IconCode as W,IconItalic as z,IconStrikethrough as J,IconSubscript as Q,IconSuperscript as Y,IconUnderline as Z}from"@ckeditor/ckeditor5-icons";import{MenuBarMenuListItemButtonView as a,ButtonView as d}from"@ckeditor/ckeditor5-ui";import{TwoStepCaretMovement as O,inlineHighlight as tt}from"@ckeditor/ckeditor5-typing";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class l extends G{attributeKey;constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,o=e.document.selection,c=t.forceValue===void 0?!this.value:t.forceValue;e.change(g=>{if(o.isCollapsed)c?g.setSelectionAttribute(this.attributeKey,!0):g.removeSelectionAttribute(this.attributeKey);else{const I=e.schema.getValidRanges(o.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(const r of I){let x=r,S=this.attributeKey;r.isCollapsed&&(x=r.start.parent,S=X._getStoreAttributeKey(this.attributeKey)),c?g.setAttribute(S,c,x):g.removeAttribute(S,x)}}})}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,i=t.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const o of i.getRanges())for(const c of o.getItems())if(e.checkAttribute(c,this.attributeKey))return c.hasAttribute(this.attributeKey);return!1}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const p="bold";class P extends n{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:p}),t.model.schema.setAttributeProperties(p,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:p,view:"strong",upcastAlso:["b",i=>{const o=i.getStyle("font-weight");return o&&(o=="bold"||Number(o)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(p,new l(t,p)),t.keystrokes.set("CTRL+B",p),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Bold text"),keystroke:"CTRL+B"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function u({editor:s,commandName:t,plugin:e,icon:i,label:o,keystroke:c}){return g=>{const I=s.commands.get(t),r=new g(s.locale);return r.set({label:o,icon:i,keystroke:c,isToggleable:!0}),r.bind("isEnabled").to(I,"isEnabled"),r.bind("isOn").to(I,"value"),r instanceof a?r.set({role:"menuitemcheckbox"}):r.set({tooltip:!0}),e.listenTo(r,"execute",()=>{s.execute(t),s.editing.view.focus()}),r}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const E="bold";class U extends n{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:E,plugin:this,icon:j,label:e("Bold"),keystroke:"CTRL+B"});t.ui.componentFactory.add(E,()=>i(d)),t.ui.componentFactory.add("menuBar:"+E,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class et extends n{static get requires(){return[P,U]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const m="code",it="ck-code_selected";class R extends n{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[O]}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:m}),t.model.schema.setAttributeProperties(m,{isFormatting:!0,copyOnEnter:!1}),t.conversion.attributeToElement({model:m,view:"code"}),t.commands.add(m,new l(t,m)),t.plugins.get(O).registerAttribute(m),tt(t,m,"code",it),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}function st(s,{insertAt:t}={}){if(typeof document>"u")return;const e=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",window.litNonce&&i.setAttribute("nonce",window.litNonce),t==="top"&&e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}st(".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const C="code";class F extends n{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:C,plugin:this,icon:W,label:e("Code")});t.ui.componentFactory.add(C,()=>i(d)),t.ui.componentFactory.add("menuBar:"+C,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class nt extends n{static get requires(){return[R,F]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const h="italic";class v extends n{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:h}),t.model.schema.setAttributeProperties(h,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:h,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(h,new l(t,h)),t.keystrokes.set("CTRL+I",h),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Italic text"),keystroke:"CTRL+I"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const T="italic";class L extends n{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:T,plugin:this,icon:z,keystroke:"CTRL+I",label:e("Italic")});t.ui.componentFactory.add(T,()=>i(d)),t.ui.componentFactory.add("menuBar:"+T,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class rt extends n{static get requires(){return[v,L]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const f="strikethrough";class K extends n{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:f}),t.model.schema.setAttributeProperties(f,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:f,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(f,new l(t,f)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const B="strikethrough";class $ extends n{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:B,plugin:this,icon:J,keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});t.ui.componentFactory.add(B,()=>i(d)),t.ui.componentFactory.add("menuBar:"+B,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class ot extends n{static get requires(){return[K,$]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const b="subscript";class H extends n{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:b}),t.model.schema.setAttributeProperties(b,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:b,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),t.commands.add(b,new l(t,b))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const N="subscript";class _ extends n{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:N,plugin:this,icon:Q,label:e("Subscript")});t.ui.componentFactory.add(N,()=>i(d)),t.ui.componentFactory.add("menuBar:"+N,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class ct extends n{static get requires(){return[H,_]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const y="superscript";class q extends n{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:y}),t.model.schema.setAttributeProperties(y,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:y,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(y,new l(t,y))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const A="superscript";class D extends n{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:A,plugin:this,icon:Y,label:e("Superscript")});t.ui.componentFactory.add(A,()=>i(d)),t.ui.componentFactory.add("menuBar:"+A,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class at extends n{static get requires(){return[q,D]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const k="underline";class V extends n{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:k}),t.model.schema.setAttributeProperties(k,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:k,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(k,new l(t,k)),t.keystrokes.set("CTRL+U","underline"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Underline text"),keystroke:"CTRL+U"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const w="underline";class M extends n{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=u({editor:t,commandName:w,plugin:this,icon:Z,label:e("Underline"),keystroke:"CTRL+U"});t.ui.componentFactory.add(w,()=>i(d)),t.ui.componentFactory.add("menuBar:"+w,()=>i(a))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class lt extends n{static get requires(){return[V,M]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}export{l as AttributeCommand,et as Bold,P as BoldEditing,U as BoldUI,nt as Code,R as CodeEditing,F as CodeUI,rt as Italic,v as ItalicEditing,L as ItalicUI,ot as Strikethrough,K as StrikethroughEditing,$ as StrikethroughUI,ct as Subscript,H as SubscriptEditing,_ as SubscriptUI,at as Superscript,q as SuperscriptEditing,D as SuperscriptUI,lt as Underline,V as UnderlineEditing,M as UnderlineUI,u as _getBasicStylesButtonCreator};
|
||||
@@ -0,0 +1,13 @@
|
||||
import{Command as B,Plugin as m}from"@ckeditor/ckeditor5-core";import{Enter as v}from"@ckeditor/ckeditor5-enter";import{Delete as x}from"@ckeditor/ckeditor5-typing";import{first as f}from"@ckeditor/ckeditor5-utils";import{IconQuote as y}from"@ckeditor/ckeditor5-icons";import{ButtonView as E,MenuBarMenuListItemButtonView as P}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class h extends B{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,i=t.document.selection,n=Array.from(i.getSelectedBlocks()),s=e.forceValue===void 0?!this.value:e.forceValue;t.change(u=>{if(!s)this._removeQuote(u,n.filter(d));else{const r=n.filter(l=>d(l)||k(o,l));this._applyQuote(u,r)}})}_getValue(){const e=this.editor.model.document.selection,t=f(e.getSelectedBlocks());return!!(t&&d(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=f(e.getSelectedBlocks());return o?k(t,o):!1}_removeQuote(e,t){p(e,t).reverse().forEach(o=>{if(o.start.isAtStart&&o.end.isAtEnd){e.unwrap(o.start.parent);return}if(o.start.isAtStart){const n=e.createPositionBefore(o.start.parent);e.move(o,n);return}o.end.isAtEnd||e.split(o.end);const i=e.createPositionAfter(o.end.parent);e.move(o,i)})}_applyQuote(e,t){const o=[];p(e,t).reverse().forEach(i=>{let n=d(i.start);n||(n=e.createElement("blockQuote"),e.wrap(i,n)),o.push(n)}),o.reverse().reduce((i,n)=>i.nextSibling==n?(e.merge(e.createPositionAfter(i)),i):n)}}function d(c){return c.parent.name=="blockQuote"?c.parent:null}function p(c,e){let t,o=0;const i=[];for(;o<e.length;){const n=e[o],s=e[o+1];t||(t=c.createPositionBefore(n)),(!s||n.nextSibling!=s)&&(i.push(c.createRange(t,c.createPositionAfter(n))),t=null),o++}return i}function k(c,e){const t=c.checkChild(e.parent,"blockQuote"),o=c.checkChild(["$root","blockQuote"],e);return t&&o}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class b extends m{static get pluginName(){return"BlockQuoteEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[v,x]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new h(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(s=>{const u=e.model.document.differ.getChanges();for(const r of u)if(r.type=="insert"){const l=r.position.nodeAfter;if(!l)continue;if(l.is("element","blockQuote")&&l.isEmpty)return s.remove(l),!0;if(l.is("element","blockQuote")&&!t.checkChild(r.position,l))return s.unwrap(l),!0;if(l.is("element")){const Q=s.createRangeIn(l);for(const a of Q.getItems())if(a.is("element","blockQuote")&&!t.checkChild(s.createPositionBefore(a),a))return s.unwrap(a),!0}}else if(r.type=="remove"){const l=r.position.parent;if(l.is("element","blockQuote")&&l.isEmpty)return s.remove(l),!0}return!1});const o=this.editor.editing.view.document,i=e.model.document.selection,n=e.commands.get("blockQuote");this.listenTo(o,"enter",(s,u)=>{if(!i.isCollapsed||!n.value)return;i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"}),this.listenTo(o,"delete",(s,u)=>{if(u.direction!="backward"||!i.isCollapsed||!n.value)return;const r=i.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),u.preventDefault(),s.stop())},{context:"blockquote"})}}function C(c,{insertAt:e}={}){if(typeof document>"u")return;const t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",window.litNonce&&o.setAttribute("nonce",window.litNonce),e==="top"&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=c:o.appendChild(document.createTextNode(c))}C(".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class g extends m{static get pluginName(){return"BlockQuoteUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{const t=this._createButton(E);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{const t=this._createButton(P);return t.set({role:"menuitemcheckbox"}),t})}_createButton(e){const t=this.editor,o=t.locale,i=t.commands.get("blockQuote"),n=new e(t.locale),s=o.t;return n.set({label:s("Block quote"),icon:y,isToggleable:!0}),n.bind("isEnabled").to(i,"isEnabled"),n.bind("isOn").to(i,"value"),this.listenTo(n,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus()}),n}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class A extends m{static get requires(){return[b,g]}static get pluginName(){return"BlockQuote"}static get isOfficialPlugin(){return!0}}export{A as BlockQuote,h as BlockQuoteCommand,b as BlockQuoteEditing,g as BlockQuoteUI};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
import{EditorUI as g,normalizeToolbarConfig as b,DialogView as u,BoxedEditorUIView as m,StickyPanelView as w,ToolbarView as y,MenuBarView as _,InlineEditableUIView as v}from"@ckeditor/ckeditor5-ui";import{enableViewPlaceholder as P}from"@ckeditor/ckeditor5-engine";import{ElementReplacer as T,Rect as c,CKEditorError as S,getDataFromElement as C}from"@ckeditor/ckeditor5-utils";import{ElementApiMixin as V,Editor as x,attachToForm as B}from"@ckeditor/ckeditor5-core";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class f extends g{view;_toolbarConfig;_elementReplacer;constructor(t,e){super(t),this.view=e,this._toolbarConfig=b(t.config.get("toolbar")),this._elementReplacer=new T,this.listenTo(t.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(t){const e=this.editor,i=this.view,r=e.editing.view,o=i.editable,s=r.document.getRoot();o.name=s.rootName,i.render();const l=o.element;this.setEditableElement(o.name,l),i.editable.bind("isFocused").to(this.focusTracker),r.attachDomRoot(l),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this.initMenuBar(i.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire("ready")}destroy(){super.destroy();const t=this.view,e=this.editor.editing.view;this._elementReplacer.restore(),e.getDomRoot(t.editable.name)&&e.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:e})=>e||0),t.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){const t=this.editor,e=t.editing.view,i=e.document.getRoot(),r=t.sourceElement;let o;const s=t.config.get("placeholder");s&&(o=typeof s=="string"?s:s[this.view.editable.name]),!o&&r&&r.tagName.toLowerCase()==="textarea"&&(o=r.getAttribute("placeholder")),o&&(i.placeholder=o),P({view:e,element:i,isDirectHost:!1,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:t}=this.view,e=this.editor.plugins.get("ContextualBalloon");e.on("getPositionOptions",r=>{const o=r.return;if(!o||!t.isSticky||!t.element)return;const s=new c(t.element).height,l=typeof o.target=="function"?o.target():o.target,d=typeof o.limiter=="function"?o.limiter():o.limiter;if(l&&d&&new c(l).height>=new c(d).height-s)return;const h={...o.viewportOffsetConfig},p=(h.top||0)+s;r.return={...o,viewportOffsetConfig:{...h,top:p}}},{priority:"low"});const i=()=>{e.visibleView&&e.updatePosition()};this.listenTo(t,"change:isSticky",i),this.listenTo(this.editor.ui,"change:viewportOffset",i)}_handleScrollToTheSelectionWithStickyPanel(t,e,i){const r=this.view.stickyPanel;if(r.isSticky){const o=new c(r.element).height;e.viewportOffset.top+=o}else{const o=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(r,"change:isSticky",o),setTimeout(()=>{this.stopListening(r,"change:isSticky",o)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const t=this.view.stickyPanel,e=this.editor.plugins.get("Dialog");e.on("show",()=>{const i=e.view;i.on("moveTo",(r,o)=>{if(!t.isSticky||i.wasMoved||i.isModal)return;const s=new c(t.contentPanelElement);o[1]<s.bottom+u.defaultOffset&&(o[1]=s.bottom+u.defaultOffset)},{priority:"high"})},{priority:"low"})}}function O(n,{insertAt:t}={}){if(typeof document>"u")return;const e=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",window.litNonce&&i.setAttribute("nonce",window.litNonce),t==="top"&&e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}O(".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-panel)}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content{border:solid var(--ck-color-base-border);border-radius:0;border-width:1px 1px 0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content.ck-sticky-panel__content_sticky{border-bottom-width:1px}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-menu-bar{border:0;border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content .ck-toolbar{border:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class k extends m{stickyPanel;toolbar;editable;constructor(t,e,i={}){super(t),this.stickyPanel=new w(t),this.toolbar=new y(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new _(t)),this.editable=new v(t,e,void 0,{label:i.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)}}function E(n){return typeof n=="object"&&n!==null}function R(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const e=n[Symbol.toStringTag];return e==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${e}]`}let t=n;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===t}function I(n){return E(n)&&n.nodeType===1&&!R(n)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class F extends V(x){static get editorName(){return"ClassicEditor"}ui;constructor(t,e={}){if(!a(t)&&e.initialData!==void 0)throw new S("editor-create-initial-data",null);super(e),this.config.define("menuBar.isVisible",!1),this.config.get("initialData")===void 0&&this.config.set("initialData",D(t)),a(t)&&(this.sourceElement=t),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),r=this.config.get("menuBar"),o=new k(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:r.isVisible,label:this.config.get("label")});this.ui=new f(this,o),B(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(t,e={}){return new Promise(i=>{const r=new this(t,e);i(r.initPlugins().then(()=>r.ui.init(a(t)?t:null)).then(()=>r.data.init(r.config.get("initialData"))).then(()=>r.fire("ready")).then(()=>r))})}}function D(n){return a(n)?C(n):n}function a(n){return I(n)}export{F as ClassicEditor,f as ClassicEditorUI,k as ClassicEditorUIView};
|
||||
@@ -0,0 +1,10 @@
|
||||
import{ElementApiMixin as u,Editor as h,secureSourceElement as g}from"@ckeditor/ckeditor5-core";import{CKEditorError as a,getDataFromElement as f}from"@ckeditor/ckeditor5-utils";import{EditorUI as b,EditorUIView as m,ToolbarView as w,MenuBarView as p,InlineEditableUIView as y}from"@ckeditor/ckeditor5-ui";import{enableViewPlaceholder as E}from"@ckeditor/ckeditor5-engine";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class d extends b{view;constructor(e,i){super(e),this.view=i}init(){const e=this.editor,i=this.view,n=e.editing.view,o=i.editable,r=n.document.getRoot();o.name=r.rootName,i.render();const l=o.element;this.setEditableElement(o.name,l),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(l),this._initPlaceholder(),this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire("ready")}destroy(){super.destroy();const e=this.view,i=this.editor.editing.view;i.getDomRoot(e.editable.name)&&i.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.editor,i=this.view;i.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(i.toolbar)}_initPlaceholder(){const e=this.editor,i=e.editing.view,n=i.document.getRoot(),o=e.config.get("placeholder");if(o){const r=typeof o=="string"?o:o[n.rootName];r&&(n.placeholder=r)}E({view:i,element:n,isDirectHost:!1,keepOnFocus:!0})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class c extends m{toolbar;editable;menuBarView;constructor(e,i,n={}){super(e),this.toolbar=new w(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.menuBarView=new p(e),this.editable=new y(e,i,n.editableElement,{label:n.label}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}}),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}})}render(){super.render(),this.registerChild([this.menuBarView,this.toolbar,this.editable])}}function T(t){return typeof t=="object"&&t!==null}function V(t){if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const i=t[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable?!1:t.toString()===`[object ${i}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function v(t){return T(t)&&t.nodeType===1&&!V(t)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class P extends u(h){static get editorName(){return"DecoupledEditor"}ui;constructor(e,i={}){if(!s(e)&&i.initialData!==void 0)throw new a("editor-create-initial-data",null);super(i),this.config.get("initialData")===void 0&&this.config.set("initialData",R(e)),s(e)&&(this.sourceElement=e,g(this,e)),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),o=new c(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:n,label:this.config.get("label")});this.ui=new d(this,o)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e)})}static create(e,i={}){return new Promise(n=>{if(s(e)&&e.tagName==="TEXTAREA")throw new a("editor-wrong-element",null);const o=new this(e,i);n(o.initPlugins().then(()=>o.ui.init()).then(()=>o.data.init(o.config.get("initialData"))).then(()=>o.fire("ready")).then(()=>o))})}}function R(t){return s(t)?f(t):t}function s(t){return v(t)}export{P as DecoupledEditor,d as DecoupledEditorUI,c as DecoupledEditorUIView};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
|
||||
import{Command as m,Plugin as E}from"@ckeditor/ckeditor5-core";import{Observer as k,BubblingEventInfo as S,ViewDocumentDomEventData as y}from"@ckeditor/ckeditor5-engine";import{env as C}from"@ckeditor/ckeditor5-utils";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function*d(s,e){for(const t of e)t&&s.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class p extends m{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,o=n.isCollapsed,r=n.getFirstRange(),a=r.start.parent,c=r.end.parent;if(i.isLimit(a)||i.isLimit(c))return!o&&a==c&&t.deleteContent(n),!1;if(o){const l=d(e.model.schema,n.getAttributes());return h(e,r.start),e.setSelectionAttribute(l),!0}else{const l=!(r.start.isAtStart&&r.end.isAtEnd),v=a==c;if(t.deleteContent(n,{leaveUnmerged:l}),l){if(v)return h(e,n.focus),!0;e.setSelection(c,0)}}return!1}}function h(s,e){s.split(e),s.setSelection(e.parent.nextSibling,0)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const T={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class f extends k{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(i,o)=>{n=o.shiftKey}),t.on("beforeinput",(i,o)=>{if(!this.isEnabled)return;let r=o.inputType;C.isSafari&&n&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,c=T[r];if(!c)return;const l=new S(t,"enter",o.targetRanges[0]);t.fire(l,new y(e,a,{isSoft:c.isSoft})),l.stop.called&&i.stop()})}observe(){}stopObserving(){}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class x extends E{static get pluginName(){return"Enter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,i=this.editor.t;t.addObserver(f),e.commands.add("enter",new p(e)),this.listenTo(n,"enter",(o,r)=>{n.isComposing||r.preventDefault(),!r.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class g extends m{execute(){const e=this.editor.model,t=e.document;e.change(n=>{B(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=A(e.schema,t.selection)}}function A(s,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!s.checkChild(t,"softBreak"))return!1;const n=e.getFirstRange(),i=n.start.parent,o=n.end.parent;return!((u(i,s)||u(o,s))&&i!==o)}function B(s,e,t){const n=t.isCollapsed,i=t.getFirstRange(),o=i.start.parent,r=i.end.parent,a=o==r;if(n){const c=d(s.schema,t.getAttributes());b(s,e,i.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(c)}else{const c=!(i.start.isAtStart&&i.end.isAtEnd);s.deleteContent(t,{leaveUnmerged:c}),a?b(s,e,t.focus):c&&e.setSelection(r,0)}}function b(s,e,t){const n=e.createElement("softBreak");s.insertContent(n,t),e.setSelection(n,"after")}function u(s,e){return s.is("rootElement")?!1:e.isLimit(s)||u(s.parent,e)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class O extends E{static get pluginName(){return"ShiftEnter"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,o=i.document,r=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(a,{writer:c})=>c.createEmptyElement("br")}),i.addObserver(f),e.commands.add("shiftEnter",new g(e)),this.listenTo(o,"enter",(a,c)=>{o.isComposing||c.preventDefault(),c.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r("Insert a soft break (a <code><br></code> element)"),keystroke:"Shift+Enter"}]})}}export{x as Enter,p as EnterCommand,f as EnterObserver,O as ShiftEnter,g as ShiftEnterCommand,d as _getCopyOnEnterAttributes};
|
||||
@@ -0,0 +1,4 @@
|
||||
import{Plugin as t}from"@ckeditor/ckeditor5-core";import{Clipboard as r}from"@ckeditor/ckeditor5-clipboard";import{Enter as i,ShiftEnter as e}from"@ckeditor/ckeditor5-enter";import{SelectAll as o}from"@ckeditor/ckeditor5-select-all";import{Typing as s}from"@ckeditor/ckeditor5-typing";import{Undo as m}from"@ckeditor/ckeditor5-undo";import{AccessibilityHelp as l}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class n extends t{static get requires(){return[l,r,i,o,e,s,m]}static get pluginName(){return"Essentials"}static get isOfficialPlugin(){return!0}}export{n as Essentials};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,67 @@
|
||||
import{Command as ae,Plugin as h}from"@ckeditor/ckeditor5-core";import{ModelDocumentSelection as ce,isLengthStyleValue as ue,isPercentageStyleValue as me,addBackgroundStylesRules as de}from"@ckeditor/ckeditor5-engine";import{ColorSelectorView as T,createDropdown as S,addListToDropdown as L,MenuBarMenuView as z,MenuBarMenuListView as E,MenuBarMenuListItemView as _,MenuBarMenuListItemButtonView as D,UIModel as I,normalizeColorOptions as fe,getLocalizedColorOptions as pe,focusChildOnDropdownOpen as ge}from"@ckeditor/ckeditor5-ui";import{Collection as $,CKEditorError as R}from"@ckeditor/ckeditor5-utils";import{IconFontFamily as U,IconFontSize as M,IconFontColor as be,IconFontBackground as he}from"@ckeditor/ckeditor5-icons";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class C extends ae{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,r=e.value,u=e.batch,a=s=>{if(i.isCollapsed)r?s.setSelectionAttribute(this.attributeKey,r):s.removeSelectionAttribute(this.attributeKey);else{const m=o.schema.getValidRanges(i.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(const d of m){let l=d,c=this.attributeKey;d.isCollapsed&&(l=d.start.parent,c=ce._getStoreAttributeKey(this.attributeKey)),r?s.setAttribute(c,r,l):s.removeAttribute(c,l)}}};u?o.enqueueChange(u,s=>{a(s)}):o.change(s=>{a(s)})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const p="fontSize",g="fontFamily",w="fontColor",y="fontBackgroundColor";function O(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 k(t){return e=>we(e.getStyle(t))}function N(t){return(e,{writer:o})=>o.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}function G({dropdownView:t,colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:r,documentColorsCount:u,colorPickerViewConfig:a}){const s=t.locale,m=new T(s,{colors:e,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:r,documentColorsCount:u,colorPickerViewConfig:a});return t.colorSelectorView=m,t.panelView.children.add(m),m}function we(t){return t.replace(/\s/g,"")}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class K extends C{constructor(e){super(e,g)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function A(t){return t.map(ye).filter(e=>e!==void 0)}function V(t){return t.replace(/["']/g,"").split(",").map(e=>e.trim())}function ye(t){if(typeof t=="object")return t;if(t==="default")return{title:"Default",model:void 0};if(typeof t=="string")return ve(t)}function ve(t){const e=V(t),o=e[0],n=e.map(Ce).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}function Ce(t){return t=t.trim(),t.indexOf(" ")>0&&(t=`'${t}'`),t}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class q extends h{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(g,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:g}),e.model.schema.setAttributeProperties(g,{isFormatting:!0,copyOnEnter:!0});const o=A(e.config.get("fontFamily.options")).filter(i=>i.model),n=O(g,o);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(g,new K(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:g,view:(o,{writer:n})=>n.createAttributeElement("span",{style:"font-family:"+o},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:g,value:o=>o.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:g,value:o=>o.getAttribute("face")}})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class j extends h{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(g),r=o("Font Family"),u=Fe(n,i);e.ui.componentFactory.add(g,a=>{const s=S(a);return L(s,u,{role:"menu",ariaLabel:r}),s.buttonView.set({label:r,icon:U,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",m=>{e.execute(m.source.commandName,{value:m.source.commandParam}),e.editing.view.focus()}),s}),e.ui.componentFactory.add(`menuBar:${g}`,a=>{const s=new z(a);s.buttonView.set({label:r,icon:U}),s.bind("isEnabled").to(i);const m=new E(a);for(const d of u){const l=new _(a,s),c=new D(a);c.set({role:"menuitemradio",isToggleable:!0}),c.bind(...Object.keys(d.model)).to(d.model),c.delegate("execute").to(s),c.on("execute",()=>{e.execute(d.model.commandName,{value:d.model.commandParam}),e.editing.view.focus()}),l.children.add(c),m.items.add(l)}return s.panelView.children.add(m),s})}_getLocalizedOptions(){const e=this.editor,o=e.t;return A(e.config.get(g).options).map(i=>(i.title==="Default"&&(i.title=o("Default")),i))}}function Fe(t,e){const o=new $;for(const n of t){const i={type:"button",model:new I({commandName:g,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};i.model.bind("isOn").to(e,"value",r=>{if(r===n.model)return!0;if(!r||!n.model)return!1;const u=V(r)[0].toLowerCase(),a=V(n.model)[0].toLowerCase();return u===a}),n.view&&typeof n.view!="string"&&n.view.styles&&i.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),o.add(i)}return o}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class H extends h{static get requires(){return[q,j]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class Y extends C{constructor(e){super(e,p)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function F(t){return t.map(e=>xe(e)).filter(e=>e!==void 0)}const W={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function xe(t){if(typeof t=="number"&&(t=String(t)),typeof t=="object"&&Oe(t))return B(t);const e=ze(t);if(e)return B(e);if(t==="default")return{model:void 0,title:"Default"};if(!ke(t))return Se(t)}function Se(t){return typeof t=="string"&&(t={title:t,model:`${parseFloat(t)}px`}),t.view={name:"span",styles:{"font-size":t.model}},B(t)}function B(t){return t.view&&typeof t.view!="string"&&!t.view.priority&&(t.view.priority=7),t}function ze(t){return typeof t=="string"?W[t]:W[t.model]}function Oe(t){return t.title&&t.model&&t.view}function ke(t){let e;if(typeof t=="object")if(t.model)e=parseFloat(t.model);else throw new R("font-size-invalid-definition",null,t);else e=parseFloat(t);return isNaN(e)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const Z=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class J extends h{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(p,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:p}),e.model.schema.setAttributeProperties(p,{isFormatting:!0,copyOnEnter:!0});const o=e.config.get("fontSize.supportAllValues"),n=F(this.editor.config.get("fontSize.options")).filter(r=>r.model),i=O(p,n);o?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(p,new Y(e))}_prepareAnyValueConverters(e){const o=this.editor,n=e.model.values.filter(i=>!ue(String(i))&&!me(String(i)));if(n.length)throw new R("font-size-invalid-use-of-named-presets",null,{presets:n});o.conversion.for("downcast").attributeToElement({model:p,view:(i,{writer:r})=>{if(i)return r.createAttributeElement("span",{style:"font-size:"+i},{priority:7})}}),o.conversion.for("upcast").elementToAttribute({model:{key:p,value:i=>i.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:p,value:o=>{const n=o.getAttribute("size"),i=n[0]==="-"||n[0]==="+";let r=parseInt(n,10);i&&(r=3+r);const u=Z.length-1,a=Math.min(Math.max(r,0),u);return Z[a]}}})}}function Ne(t,{insertAt:e}={}){if(typeof document>"u")return;const o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",window.litNonce&&n.setAttribute("nonce",window.litNonce),e==="top"&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}Ne(":root{--ck-content-font-size-tiny:0.7em;--ck-content-font-size-small:0.85em;--ck-content-font-size-big:1.4em;--ck-content-font-size-huge:1.8em}.ck-content .text-tiny{font-size:var(--ck-content-font-size-tiny)}.ck-content .text-small{font-size:var(--ck-content-font-size-small)}.ck-content .text-big{font-size:var(--ck-content-font-size-big)}.ck-content .text-huge{font-size:var(--ck-content-font-size-huge)}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class Q extends h{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,o=e.t,n=this._getLocalizedOptions(),i=e.commands.get(p),r=o("Font Size"),u=Ae(n,i);e.ui.componentFactory.add(p,a=>{const s=S(a);return L(s,u,{role:"menu",ariaLabel:r}),s.buttonView.set({label:r,icon:M,tooltip:!0}),s.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),s.bind("isEnabled").to(i),this.listenTo(s,"execute",m=>{e.execute(m.source.commandName,{value:m.source.commandParam}),e.editing.view.focus()}),s}),e.ui.componentFactory.add(`menuBar:${p}`,a=>{const s=new z(a);s.buttonView.set({label:r,icon:M}),s.bind("isEnabled").to(i);const m=new E(a);for(const d of u){const l=new _(a,s),c=new D(a);c.set({role:"menuitemradio",isToggleable:!0}),c.bind(...Object.keys(d.model)).to(d.model),c.delegate("execute").to(s),c.on("execute",()=>{e.execute(d.model.commandName,{value:d.model.commandParam}),e.editing.view.focus()}),l.children.add(c),m.items.add(l)}return s.panelView.children.add(m),s})}_getLocalizedOptions(){const e=this.editor,o=e.t,n={Default:o("Default"),Tiny:o("Tiny"),Small:o("Small"),Big:o("Big"),Huge:o("Huge")};return F(e.config.get(p).options).map(r=>{const u=n[r.title];return u&&u!=r.title&&(r=Object.assign({},r,{title:u})),r})}}function Ae(t,e){const o=new $;for(const n of t){const i={type:"button",model:new I({commandName:p,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&typeof n.view!="string"&&(n.view.styles&&i.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&i.model.set("class",`${i.model.class} ${n.view.classes}`)),i.model.bind("isOn").to(e,"value",r=>r===n.model),o.add(i)}return o}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class X extends h{static get requires(){return[J,Q]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return F(e)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class ee extends C{constructor(e){super(e,w)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class te extends h{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(w,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:w,value:k("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:w,value:o=>o.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:w,view:N("color")}),e.commands.add(w,new ee(e)),e.model.schema.extend("$text",{allowAttributes:w}),e.model.schema.setAttributeProperties(w,{isFormatting:!0,copyOnEnter:!0})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class P extends h{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:o,componentName:n,icon:i,dropdownLabel:r}){super(e),this.commandName=o,this.componentName=n,this.icon=i,this.dropdownLabel=r,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,o=e.locale,n=o.t,i=e.commands.get(this.commandName),r=e.config.get(this.componentName),u=fe(r.colors),a=pe(o,u),s=r.documentColors,m=r.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,d=>{const l=S(d);let c=!1;const f=G({dropdownView:l,colors:a.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:s!==0?n("Document colors"):"",documentColorsCount:s===void 0?this.columns:s,colorPickerViewConfig:m?r.colorPicker||{}:!1});return f.bind("selectedColor").to(i,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(i),f.on("execute",(b,v)=>{l.isOpen&&e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),v.source!=="colorPicker"&&e.editing.view.focus(),v.source==="colorPickerSaveButton"&&(l.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),l.on("change:isOpen",(b,v,x)=>{c||(c=!0,l.colorSelectorView.appendUI()),x&&(s!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),ge(l,()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(b=>b.isOn)),l}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,d=>{const l=new z(d);l.buttonView.set({label:this.dropdownLabel,icon:this.icon}),l.bind("isEnabled").to(i);let c=!1;const f=new T(d,{colors:a.map(b=>({label:b.label,color:b.model,options:{hasBorder:b.hasBorder}})),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:s!==0?n("Document colors"):"",documentColorsCount:s===void 0?this.columns:s,colorPickerViewConfig:!1});return f.bind("selectedColor").to(i,"value"),f.delegate("execute").to(l),f.on("execute",(b,v)=>{e.execute(this.commandName,{value:v.value,batch:this._undoStepBatch}),e.editing.view.focus()}),l.on("change:isOpen",(b,v,x)=>{c||(c=!0,f.appendUI()),x&&(s!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),l.panelView.children.add(f),l})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class oe extends P{constructor(e){const o=e.locale.t;super(e,{commandName:w,componentName:w,icon:be,dropdownLabel:o("Font Color")})}static get pluginName(){return"FontColorUI"}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class ne extends h{static get requires(){return[te,oe]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class ie extends C{constructor(e){super(e,y)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class se extends h{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(y,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(de),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:y,value:k("background-color")}}),e.conversion.for("downcast").attributeToElement({model:y,view:N("background-color")}),e.commands.add(y,new ie(e)),e.model.schema.extend("$text",{allowAttributes:y}),e.model.schema.setAttributeProperties(y,{isFormatting:!0,copyOnEnter:!0})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class re extends P{constructor(e){const o=e.locale.t;super(e,{commandName:y,componentName:y,icon:he,dropdownLabel:o("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class le extends h{static get requires(){return[se,re]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class Ve extends h{static get requires(){return[H,X,ne,le]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}export{Ve as Font,le as FontBackgroundColor,ie as FontBackgroundColorCommand,se as FontBackgroundColorEditing,re as FontBackgroundColorUI,ne as FontColor,ee as FontColorCommand,te as FontColorEditing,oe as FontColorUI,P as FontColorUIBase,C as FontCommand,H as FontFamily,K as FontFamilyCommand,q as FontFamilyEditing,j as FontFamilyUI,X as FontSize,Y as FontSizeCommand,J as FontSizeEditing,Q as FontSizeUI,G as _addFontColorSelectorToDropdown,O as _buildFontDefinition,A as _normalizeFontFamilyOptions,F as _normalizeFontSizeOptions,N as _renderDowncastFontElement,k as _renderUpcastFontColorAttribute};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
import{Command as B,Plugin as b}from"@ckeditor/ckeditor5-core";import{ModelDocumentSelection as E}from"@ckeditor/ckeditor5-engine";import{IconEraser as f,IconMarker as H,IconPen as M}from"@ckeditor/ckeditor5-icons";import{ButtonView as T,createDropdown as A,SplitButtonView as C,addToolbarToDropdown as I,MenuBarMenuView as S,MenuBarMenuListView as O,MenuBarMenuListItemView as w,MenuBarMenuListItemButtonView as v,ListSeparatorView as P,ToolbarSeparatorView as R}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class V extends B{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,h=t.document.selection,o=e.value;t.change(i=>{if(h.isCollapsed){const a=h.getFirstPosition();if(h.hasAttribute("highlight")){const r=d=>d.item.hasAttribute("highlight")&&d.item.getAttribute("highlight")===this.value,l=a.getLastMatchingPosition(r,{direction:"backward"}),n=a.getLastMatchingPosition(r),u=i.createRange(l,n);!o||this.value===o?(a.isEqual(n)||i.removeAttribute("highlight",u),i.removeSelectionAttribute("highlight")):(a.isEqual(n)||i.setAttribute("highlight",o,u),i.setSelectionAttribute("highlight",o))}else o&&i.setSelectionAttribute("highlight",o)}else{const a=t.schema.getValidRanges(h.getRanges(),"highlight",{includeEmptyRanges:!0});for(const r of a){let l=r,n="highlight";r.isCollapsed&&(l=r.start.parent,n=E._getStoreAttributeKey("highlight")),o?i.setAttribute(n,o,l):i.removeAttribute(n,l)}}})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class y extends b{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-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-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(_(t)),e.commands.add("highlight",new V(e))}}function _(g){const e={model:{key:"highlight",values:[]},view:{}};for(const t of g)e.model.values.push(t.model),e.view[t.model]={name:"mark",classes:t.class};return e}function D(g,{insertAt:e}={}){if(typeof document>"u")return;const t=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css",window.litNonce&&c.setAttribute("nonce",window.litNonce),e==="top"&&t.firstChild?t.insertBefore(c,t.firstChild):t.appendChild(c),c.styleSheet?c.styleSheet.cssText=g:c.appendChild(document.createTextNode(g))}D(":root{--ck-content-highlight-marker-yellow:#fdfd77;--ck-content-highlight-marker-green:#62f962;--ck-content-highlight-marker-pink:#fc7899;--ck-content-highlight-marker-blue:#72ccfd;--ck-content-highlight-pen-red:#e71313;--ck-content-highlight-pen-green:#128a00}.ck-content .marker-yellow{background-color:var(--ck-content-highlight-marker-yellow)}.ck-content .marker-green{background-color:var(--ck-content-highlight-marker-green)}.ck-content .marker-pink{background-color:var(--ck-content-highlight-marker-pink)}.ck-content .marker-blue{background-color:var(--ck-content-highlight-marker-blue)}.ck-content .pen-red{background-color:transparent;color:var(--ck-content-highlight-pen-red)}.ck-content .pen-green{background-color:transparent;color:var(--ck-content-highlight-pen-green)}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class x extends b{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"),f,null,c=>{c.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,p(e.type),e.model,c);function c(h){h.bind("isEnabled").to(t,"isEnabled"),h.bind("isOn").to(t,"value",o=>o===e.model),h.iconView.fillColor=e.color,h.isToggleable=!0}}_addButton(e,t,c,h,o){const i=this.editor;i.ui.componentFactory.add(e,a=>{const r=new T(a),l=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return r.set({label:l,icon:c,tooltip:!0}),r.on("execute",()=>{i.execute("highlight",{value:h}),i.editing.view.focus()}),o(r),r})}_addDropdown(e){const t=this.editor,c=t.t,h=t.ui.componentFactory,o=e[0],i=e.reduce((a,r)=>(a[r.model]=r,a),{});h.add("highlight",a=>{const r=t.commands.get("highlight"),l=A(a,C),n=l.buttonView;n.set({label:c("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),n.bind("icon").to(r,"value",s=>p(d(s,"type"))),n.bind("color").to(r,"value",s=>d(s,"color")),n.bind("commandValue").to(r,"value",s=>d(s,"model")),n.bind("isOn").to(r,"value",s=>!!s),n.delegate("execute").to(l);const u=()=>{const s=e.map(m=>{const k=h.create("highlight:"+m.model);return this.listenTo(k,"execute",()=>{l.buttonView.set({lastExecuted:m.model})}),k});return s.push(new R),s.push(h.create("removeHighlight")),s};l.bind("isEnabled").to(r,"isEnabled"),I(l,u,{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:c("Text highlight toolbar")}),F(l),n.on("execute",()=>{t.execute("highlight",{value:n.commandValue})}),this.listenTo(l,"execute",()=>{t.editing.view.focus()});function d(s,m){const k=!s||s===n.lastExecuted?n.lastExecuted:s;return i[k][m]}return l})}_addMenuBarButton(e){const t=this.editor,c=t.t,h=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",o=>{const i=new S(o);i.buttonView.set({label:c("Highlight"),icon:p("marker")}),i.bind("isEnabled").to(h),i.buttonView.iconView.fillColor="transparent";const a=new O(o);for(const n of e){const u=new w(o,i),d=new v(o);d.set({label:n.title,icon:p(n.type),role:"menuitemradio",isToggleable:!0}),d.iconView.fillColor=n.color,d.delegate("execute").to(i),d.bind("isOn").to(h,"value",s=>s===n.model),d.on("execute",()=>{t.execute("highlight",{value:n.model}),t.editing.view.focus()}),u.children.add(d),a.items.add(u)}a.items.add(new P(o));const r=new w(o,i),l=new v(o);return l.set({label:c("Remove highlight"),icon:f}),l.delegate("execute").to(i),l.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),r.children.add(l),a.items.add(r),i.panelView.children.add(a),i})}}function F(g){g.buttonView.actionView.iconView.bind("fillColor").to(g.buttonView,"color")}function p(g){return g==="marker"?H:M}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class L extends b{static get requires(){return[y,x]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}export{L as Highlight,V as HighlightCommand,y as HighlightEditing,x as HighlightUI};
|
||||
@@ -0,0 +1,13 @@
|
||||
import{Command as h,Plugin as s}from"@ckeditor/ckeditor5-core";import{findOptimalInsertionRange as p,toWidget as g,Widget as f}from"@ckeditor/ckeditor5-widget";import{IconHorizontalLine as z}from"@ckeditor/ckeditor5-icons";import{ButtonView as L,MenuBarMenuListItemButtonView as E}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class c extends h{refresh(){const e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=y(n,t,e)}execute(){const e=this.editor.model;e.change(t=>{const n=t.createElement("horizontalLine");e.insertObject(n,null,null,{setSelection:"after"})})}}function y(o,e,t){const n=b(o,t);return e.checkChild(n,"horizontalLine")}function b(o,e){const n=p(o,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}function w(o,{insertAt:e}={}){if(typeof document>"u")return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",window.litNonce&&n.setAttribute("nonce",window.litNonce),e==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=o:n.appendChild(document.createTextNode(o))}w(".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{background:#dedede;border:0;height:4px;margin:15px 0}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class d extends s{static get pluginName(){return"HorizontalLineEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model.schema,n=e.t,l=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),l.for("dataDowncast").elementToElement({model:"horizontalLine",view:(r,{writer:i})=>i.createEmptyElement("hr")}),l.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(r,{writer:i})=>{const u=n("Horizontal line"),a=i.createContainerElement("div",null,i.createEmptyElement("hr"));return i.addClass("ck-horizontal-line",a),i.setCustomProperty("hr",!0,a),x(a,i,u)}}),l.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new c(e))}}function x(o,e,t){return e.setCustomProperty("horizontalLine",!0,o),g(o,e,{label:t})}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class m extends s{static get pluginName(){return"HorizontalLineUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{const t=this._createButton(L);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(E))}_createButton(e){const t=this.editor,n=t.locale,l=t.commands.get("horizontalLine"),r=new e(t.locale),i=n.t;return r.set({label:i("Horizontal line"),icon:z}),r.bind("isEnabled").to(l,"isEnabled"),this.listenTo(r,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus()}),r}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class H extends s{static get requires(){return[d,m,f]}static get pluginName(){return"HorizontalLine"}static get isOfficialPlugin(){return!0}}export{H as HorizontalLine,c as HorizontalLineCommand,d as HorizontalLineEditing,m as HorizontalLineUI};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
|
||||
import{Command as h,Plugin as f}from"@ckeditor/ckeditor5-core";import{ModelDocumentSelection as C}from"@ckeditor/ckeditor5-engine";import{getLanguageDirection as A,Collection as P}from"@ckeditor/ckeditor5-utils";import{createDropdown as T,addListToDropdown as V,MenuBarMenuView as y,MenuBarMenuListView as v,ListSeparatorView as D,MenuBarMenuListItemView as M,MenuBarMenuListItemButtonView as I,UIModel as b}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function m(c,e){return e=e||A(c),`${c}:${e}`}function x(c){const[e,t]=c.split(":");return{languageCode:e,textDirection:t}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class p extends h{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const r=this.editor.model,o=r.document.selection,u=e?m(e,t):!1;r.change(g=>{if(o.isCollapsed)u?g.setSelectionAttribute("language",u):g.removeSelectionAttribute("language");else{const a=r.schema.getValidRanges(o.getRanges(),"language",{includeEmptyRanges:!0});for(const i of a){let n=i,l="language";i.isCollapsed&&(n=i.start.parent,l=C._getStoreAttributeKey("language")),u?g.setAttribute(l,u,n):g.removeAttribute(l,n)}}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,r=e.document.selection;if(r.isCollapsed)return r.getAttribute("language")||!1;for(const s of r.getRanges())for(const o of s.getItems())if(t.checkAttribute(o,"language"))return o.getAttribute("language")||!1;return!1}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class w extends f{static get pluginName(){return"TextPartLanguageEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new p(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:t=>{const r=t.getAttribute("lang"),s=t.getAttribute("dir");return m(r,s)}},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(t,{writer:r},s)=>{if(!t||!s.item.is("$textProxy")&&!s.item.is("documentSelection"))return;const{languageCode:o,textDirection:u}=x(t);return r.createAttributeElement("span",{lang:o,dir:u})}})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class L extends f{static get pluginName(){return"TextPartLanguageUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,r=t("Choose language"),s=t("Language");e.ui.componentFactory.add("textPartLanguage",o=>{const{definitions:u,titles:g}=this._getItemMetadata(),a=e.commands.get("textPartLanguage"),i=T(o);return V(i,u,{ariaLabel:s,role:"menu"}),i.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),i.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),i.bind("isEnabled").to(a,"isEnabled"),i.buttonView.bind("label").to(a,"value",n=>n&&g[n]||r),i.buttonView.bind("ariaLabel").to(a,"value",n=>{const l=n&&g[n];return l?`${l}, ${s}`:s}),this.listenTo(i,"execute",n=>{a.execute({languageCode:n.source.languageCode,textDirection:n.source.textDirection}),e.editing.view.focus()}),i}),e.ui.componentFactory.add("menuBar:textPartLanguage",o=>{const{definitions:u}=this._getItemMetadata(),g=e.commands.get("textPartLanguage"),a=new y(o);a.buttonView.set({label:s});const i=new v(o);i.set({ariaLabel:t("Language"),role:"menu"});for(const n of u){if(n.type!="button"){i.items.add(new D(o));continue}const l=new M(o,a),d=new I(o);d.set({role:"menuitemradio",isToggleable:!0}),d.bind(...Object.keys(n.model)).to(n.model),d.delegate("execute").to(a),l.children.add(d),i.items.add(l)}return a.bind("isEnabled").to(g,"isEnabled"),a.panelView.children.add(i),a.on("execute",n=>{g.execute({languageCode:n.source.languageCode,textDirection:n.source.textDirection}),e.editing.view.focus()}),a})}_getItemMetadata(){const e=this.editor,t=new P,r={},s=e.commands.get("textPartLanguage"),o=e.config.get("language.textPartLanguage"),u=e.locale.t,g=u("Remove language");t.add({type:"button",model:new b({label:g,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(const a of o){const i={type:"button",model:new b({label:a.title,languageCode:a.languageCode,role:"menuitemradio",textDirection:a.textDirection,withText:!0})},n=m(a.languageCode,a.textDirection);i.model.bind("isOn").to(s,"value",l=>l===n),t.add(i),r[n]=a.title}return{definitions:t,titles:r}}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class E extends f{static get requires(){return[w,L]}static get pluginName(){return"TextPartLanguage"}static get isOfficialPlugin(){return!0}}export{E as TextPartLanguage,p as TextPartLanguageCommand,w as TextPartLanguageEditing,L as TextPartLanguageUI,x as _parseLanguageAttribute,m as _stringifyLanguageAttribute};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
import{Command as l,Plugin as d}from"@ckeditor/ckeditor5-core";import{first as u}from"@ckeditor/ckeditor5-utils";import{ButtonView as g}from"@ckeditor/ckeditor5-ui";import{IconParagraph as f}from"@ckeditor/ckeditor5-icons";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class h extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,a=e.document,r=u(a.selection.getSelectedBlocks());this.value=!!r&&r.is("element","paragraph"),this.isEnabled=!!r&&m(r,e.schema)}execute(e={}){const a=this.editor.model,r=a.document,t=e.selection||r.selection;a.canEditAt(t)&&a.change(n=>{const o=t.getSelectedBlocks();for(const c of o)!c.is("element","paragraph")&&m(c,a.schema)&&n.rename(c,"paragraph")})}}function m(s,e){return e.checkChild(s.parent,"paragraph")&&!e.isObject(s)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class p extends l{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const a=this.editor.model,r=e.attributes;let t=e.position;return a.canEditAt(t)?a.change(n=>{if(t=this._findPositionToInsertParagraph(t,n),!t)return null;const o=n.createElement("paragraph");return r&&a.schema.setAllowedAttributes(o,r,n),a.insertContent(o,t),n.setSelection(o,"in"),n.createPositionAt(o,0)}):null}_findPositionToInsertParagraph(e,a){const r=this.editor.model;if(r.schema.checkChild(e,"paragraph"))return e;const t=r.schema.findAllowedParent(e,"paragraph");if(!t)return null;const n=e.parent,o=r.schema.checkChild(n,"$text");return n.isEmpty||o&&e.isAtEnd?r.createPositionAfter(n):!n.isEmpty&&o&&e.isAtStart?r.createPositionBefore(n):a.split(e,t).position}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class i extends d{static get pluginName(){return"Paragraph"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,a=e.model;e.commands.add("paragraph",new h(e)),e.commands.add("insertParagraph",new p(e)),a.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(r,{writer:t})=>!i.paragraphLikeElements.has(r.name)||r.isEmpty?null:t.createElement("paragraph"),view:/.+/,converterPriority:"low"})}static paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"])}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class P extends d{static get requires(){return[i]}init(){const e=this.editor,a=e.t;e.ui.componentFactory.add("paragraph",r=>{const t=new g(r),n=e.commands.get("paragraph");return t.label=a("Paragraph"),t.icon=f,t.tooltip=!0,t.isToggleable=!0,t.bind("isEnabled").to(n),t.bind("isOn").to(n,"value"),t.on("execute",()=>{e.execute("paragraph")}),t})}}export{p as InsertParagraphCommand,i as Paragraph,P as ParagraphButtonUI,h as ParagraphCommand};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
import{Plugin as a,Command as f}from"@ckeditor/ckeditor5-core";import{IconRemoveFormat as F}from"@ckeditor/ckeditor5-icons";import{ButtonView as h,MenuBarMenuListItemButtonView as b}from"@ckeditor/ckeditor5-ui";import{first as c}from"@ckeditor/ckeditor5-utils";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const n="removeFormat";class u extends a{static get pluginName(){return"RemoveFormatUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.ui.componentFactory.add(n,()=>{const e=this._createButton(h);return e.set({tooltip:!0}),e}),t.ui.componentFactory.add(`menuBar:${n}`,()=>this._createButton(b))}_createButton(t){const e=this.editor,i=e.locale,s=e.commands.get(n),o=new t(e.locale),r=i.t;return o.set({label:r("Remove Format"),icon:F}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{e.execute(n),e.editing.view.focus()}),o}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class d extends f{_customAttributesHandlers=[];refresh(){const t=this.editor.model;this.isEnabled=!!c(this._getFormattingItems(t.document.selection))}execute(){const t=this.editor.model;t.change(e=>{for(const i of this._getFormattingItems(t.document.selection))if(i.is("selection"))for(const s of this._getFormattingAttributes(i))e.removeSelectionAttribute(s);else{const s=e.createRangeOn(i);for(const o of this._getFormattingAttributes(i))this._removeFormatting(o,i,s,e)}})}registerCustomAttribute(t,e){this._customAttributesHandlers.push({isFormatting:t,removeFormatting:e})}_removeFormatting(t,e,i,s){let o=!1;for(const{isFormatting:r,removeFormatting:g}of this._customAttributesHandlers)r(t,e)&&(g(t,i,s),o=!0);o||s.removeAttribute(t,i)}*_getFormattingItems(t){const e=this.editor.model,i=e.schema,s=o=>!!c(this._getFormattingAttributes(o));for(const o of t.getRanges())for(const r of o.getItems())i.isBlock(r)&&o.end.isTouching(e.createPositionAt(r,0))||s(r)&&(yield r);for(const o of t.getSelectedBlocks())s(o)&&(yield o);s(t)&&(yield t)}*_getFormattingAttributes(t){const e=this.editor.model.schema;for(const[i]of t.getAttributes()){for(const{isFormatting:o}of this._customAttributesHandlers)o(i,t)&&(yield i);const s=e.getAttributeProperties(i);s&&s.isFormatting&&(yield i)}}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class l extends a{static get pluginName(){return"RemoveFormatEditing"}static get licenseFeatureCode(){return"RF"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const t=this.editor;t.commands.add("removeFormat",new d(t))}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class v extends a{static get requires(){return[l,u]}static get pluginName(){return"RemoveFormat"}static get isOfficialPlugin(){return!0}}export{v as RemoveFormat,d as RemoveFormatCommand,l as RemoveFormatEditing,u as RemoveFormatUI};
|
||||
@@ -0,0 +1,13 @@
|
||||
import{Command as m,Plugin as o}from"@ckeditor/ckeditor5-core";import{getCode as g,parseKeystroke as f}from"@ckeditor/ckeditor5-utils";import{IconSelectAll as p}from"@ckeditor/ckeditor5-icons";import{ButtonView as A,MenuBarMenuListItemButtonView as h}from"@ckeditor/ckeditor5-ui";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class r extends m{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!a(e.schema,i))do if(i=i.parent,!i)return;while(!a(e.schema,i));e.change(n=>{n.setSelection(i,"in")})}}function a(l,e){return l.isLimit(e)&&(l.checkChild(e,"$text")||l.checkChild(e,"paragraph"))}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const S=f("Ctrl+A");class u extends o{static get pluginName(){return"SelectAllEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add("selectAll",new r(e)),this.listenTo(n,"keydown",(c,s)=>{g(s)===S&&(e.execute("selectAll"),s.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class d extends o{static get pluginName(){return"SelectAllUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const t=this._createButton(A);return t.set({tooltip:!0}),t}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(h))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),c=new e(t.locale),s=i.t;return c.set({label:s("Select all"),icon:p,keystroke:"Ctrl+A"}),c.bind("isEnabled").to(n,"isEnabled"),this.listenTo(c,"execute",()=>{t.execute("selectAll"),t.editing.view.focus()}),c}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class w extends o{static get requires(){return[u,d]}static get pluginName(){return"SelectAll"}static get isOfficialPlugin(){return!0}}export{w as SelectAll,r as SelectAllCommand,u as SelectAllEditing,d as SelectAllUI};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,37 @@
|
||||
import{Plugin as h,Command as E}from"@ckeditor/ckeditor5-core";import{ButtonView as U,View as f,addKeyboardHandlingForGrid as C,LabelView as G,ViewCollection as D,FocusCycler as N,createDropdown as P}from"@ckeditor/ckeditor5-ui";import{FocusTracker as k,KeystrokeHandler as b,first as H,logWarning as I}from"@ckeditor/ckeditor5-utils";import{findAttributeRange as L,findAttributeRangeBound as R}from"@ckeditor/ckeditor5-typing";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class m extends U{styleDefinition;previewView;constructor(t,e){super(t),this.styleDefinition=e,this.previewView=this._createPreview(),this.set({label:e.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const t=new f(this.locale);return t.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),t}}function y(r,{insertAt:t}={}){if(!r||typeof document>"u")return;const e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",window.litNonce&&s.setAttribute("nonce",window.litNonce),t==="top"&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=r:s.appendChild(document.createTextNode(r))}y(":root{--ck-style-panel-columns:3}.ck.ck-style-panel .ck-style-grid{display:grid;grid-template-columns:repeat(var(--ck-style-panel-columns),auto);justify-content:start}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{display:flex;flex-direction:column;justify-content:space-between}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{align-content:center;align-items:center;display:flex;flex-basis:100%;flex-grow:1;justify-content:flex-start}:root{--ck-style-panel-button-width:120px;--ck-style-panel-button-height:80px;--ck-style-panel-button-label-background:#f0f0f0;--ck-style-panel-button-hover-label-background:#ebebeb;--ck-style-panel-button-hover-border-color:#b3b3b3}.ck.ck-style-panel .ck-style-grid{column-gap:var(--ck-spacing-large);row-gap:var(--ck-spacing-large)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{--ck-color-button-default-hover-background:var(--ck-color-base-background);--ck-color-button-default-active-background:var(--ck-color-base-background);height:var(--ck-style-panel-button-height);padding:0;width:var(--ck-style-panel-button-width)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-button__label{flex-shrink:0;height:22px;line-height:22px;overflow:hidden;padding:0 var(--ck-spacing-medium);text-overflow:ellipsis;width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{background:var(--ck-color-base-background);border:2px solid var(--ck-color-base-background);opacity:.9;overflow:hidden;padding:var(--ck-spacing-medium);width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled{--ck-color-button-default-disabled-background:var(--ck-color-base-foreground)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled:not(:focus){border-color:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled .ck-style-grid__button__preview{border-color:var(--ck-color-base-foreground);filter:saturate(.3);opacity:.4}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on{border-color:var(--ck-color-base-active)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on .ck-button__label{box-shadow:0 -1px 0 var(--ck-color-base-active);z-index:1}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on:hover{border-color:var(--ck-color-base-active-focus)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on) .ck-button__label{background:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on):hover .ck-button__label{background:var(--ck-style-panel-button-hover-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on){border-color:var(--ck-style-panel-button-hover-border-color)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on) .ck-style-grid__button__preview{opacity:1}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class _ extends f{focusTracker;keystrokes;children;constructor(t,e){super(t),this.focusTracker=new k,this.keystrokes=new b,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const s of e){const i=new m(t,s);this.children.add(i)}this.on("change:activeStyles",()=>{for(const s of this.children)s.isOn=this.activeStyles.includes(s.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(const s of this.children)s.isEnabled=this.enabledStyles.includes(s.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const t of this.children)this.focusTracker.add(t.element);C({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}y(".ck.ck-style-panel .ck-style-panel__style-group>.ck-label{margin:var(--ck-spacing-large) 0}.ck.ck-style-panel .ck-style-panel__style-group:first-child>.ck-label{margin-top:0}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class p extends f{gridView;labelView;constructor(t,e,s){super(t),this.labelView=new G(t),this.labelView.text=e,this.gridView=new _(t,s),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}y(":root{--ck-style-panel-max-height:470px}.ck.ck-style-panel{max-height:var(--ck-style-panel-max-height);overflow-y:auto;padding:var(--ck-spacing-large)}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class S extends f{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(t,e){super(t);const s=t.t;this.focusTracker=new k,this.keystrokes=new b,this.children=this.createCollection(),this.blockStylesGroupView=new p(t,s("Block styles"),e.block),this.inlineStylesGroupView=new p(t,s("Text styles"),e.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new D,this._focusCycler=new N({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),e.block.length&&this.children.add(this.blockStylesGroupView),e.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}function O(r){return r!==null&&(typeof r=="object"||typeof r=="function")}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const j=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class d extends h{_htmlSupport;static get pluginName(){return"StyleUtils"}static get isOfficialPlugin(){return!0}constructor(t){super(t),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(t,e=[]){const s={block:[],inline:[]};for(const i of e){const l=[],o=[];for(const n of t.getDefinitionsForView(i.element)){const u="appliesToBlock"in n?n.appliesToBlock:!1;if(n.isBlock||u){if(typeof u=="string")l.push(u);else if(n.isBlock){const a=n;l.push(n.model),a.paragraphLikeModel&&l.push(a.paragraphLikeModel)}}else o.push(n.model)}const c=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);l.length?s.block.push({...i,previewTemplate:c,modelElements:l,isBlock:!0}):s.inline.push({...i,previewTemplate:c,ghsAttributes:o})}return s}isStyleEnabledForBlock(t,e){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(t.element);return s.schema.checkAttribute(e,i)?t.modelElements.includes(e.name):!1}isStyleActiveForBlock(t,e){const s=this._htmlSupport.getGhsAttributeNameForElement(t.element),i=e.getAttribute(s);return this.hasAllClasses(i,t.classes)}getAffectedBlocks(t,e){return t.modelElements.includes(e.name)?[e]:null}isStyleEnabledForInlineSelection(t,e){const s=this.editor.model;for(const i of t.ghsAttributes)if(s.schema.checkAttributeInSelection(e,i))return!0;return!1}isStyleActiveForInlineSelection(t,e){for(const s of t.ghsAttributes){const i=this._getValueFromFirstAllowedNode(e,s);if(this.hasAllClasses(i,t.classes))return!0}return!1}getAffectedInlineSelectable(t,e){return e}getStylePreview(t,e){const{element:s,classes:i}=t;return{tag:M(s)?s:"div",attributes:{class:i},children:e}}hasAllClasses(t,e){return O(t)&&z(t)&&e.every(s=>t.classes.includes(s))}configureGHSDataFilter({block:t,inline:e}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(t.map(w)),s.loadAllowedConfig(e.map(w))}_getValueFromFirstAllowedNode(t,e){const i=this.editor.model.schema;if(t.isCollapsed)return t.getAttribute(e);for(const l of t.getRanges())for(const o of l.getItems())if(i.checkAttribute(o,e))return o.getAttribute(e);return null}}function z(r){return!!r.classes&&Array.isArray(r.classes)}function M(r){return!j.includes(r)}function w({element:r,classes:t}){return{name:r,classes:t}}y(".ck.ck-dropdown.ck-style-dropdown.ck-style-dropdown_multiple-active>.ck-button>.ck-button__label{font-style:italic}");/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class A extends h{static get pluginName(){return"StyleUI"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const t=this.editor,e=t.plugins.get("DataSchema"),s=t.plugins.get("StyleUtils"),i=t.config.get("style.definitions"),l=s.normalizeConfig(e,i);t.ui.componentFactory.add("style",o=>{const c=o.t,n=P(o),u=t.commands.get("style");return n.once("change:isOpen",()=>{const a=new S(o,l);n.panelView.children.add(a),a.delegate("execute").to(n),a.bind("activeStyles").to(u,"value"),a.bind("enabledStyles").to(u,"enabledStyles")}),n.bind("isEnabled").to(u),n.buttonView.withText=!0,n.buttonView.bind("label").to(u,"value",a=>a.length>1?c("Multiple styles"):a.length===1?a[0]:c("Styles")),n.bind("class").to(u,"value",a=>{const g=["ck-style-dropdown"];return a.length>1&&g.push("ck-style-dropdown_multiple-active"),g.join(" ")}),n.on("execute",a=>{t.execute("style",{styleName:a.source.styleDefinition.name}),t.editing.view.focus()}),n})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class v extends E{_styleDefinitions;_styleUtils;constructor(t,e){super(t),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=e,this._styleUtils=this.editor.plugins.get(d)}refresh(){const t=this.editor.model,e=t.document.selection,s=new Set,i=new Set;for(const o of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(o,e)&&i.add(o.name),this._styleUtils.isStyleActiveForInlineSelection(o,e)&&s.add(o.name);const l=H(e.getSelectedBlocks())||e.getFirstPosition().parent;if(l){const o=l.getAncestors({includeSelf:!0,parentFirst:!0});for(const c of o){if(c.is("rootElement"))break;for(const n of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(n,c)&&(i.add(n.name),this._styleUtils.isStyleActiveForBlock(n,c)&&s.add(n.name));if(t.schema.isObject(c))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(s).sort():[]}execute({styleName:t,forceValue:e}){if(!this.enabledStyles.includes(t)){I("style-command-executed-with-incorrect-style-name");return}const s=this.editor.model,i=s.document.selection,l=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block],c=o.filter(({name:a})=>this.value.includes(a)),n=o.find(({name:a})=>a==t),u=e===void 0?!this.value.includes(n.name):e;s.change(()=>{let a;$(n)?a=this._findAffectedBlocks(J(i),n):a=[this._styleUtils.getAffectedInlineSelectable(n,i)];for(const g of a)u?l.addModelHtmlClass(n.element,n.classes,g):l.removeModelHtmlClass(n.element,q(c,n),g)})}_findAffectedBlocks(t,e){const s=new Set;for(const i of t){const l=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const o of l){if(o.is("rootElement"))break;const c=this._styleUtils.getAffectedBlocks(e,o);if(c){for(const n of c)s.add(n);break}}}return s}}function q(r,t){return r.reduce((e,s)=>s.name===t.name?e:e.filter(i=>!s.classes.includes(i)),t.classes)}function $(r){return"isBlock"in r}function J(r){const t=Array.from(r.getSelectedBlocks());return t.length?t:[r.getFirstPosition().parent]}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class x extends h{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return"ListStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const t=this.editor;t.plugins.has("ListEditing")&&(this._styleUtils=t.plugins.get(d),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(e,[s,i])=>{this._isStyleEnabledForBlock(s,i)&&(e.return=!0,e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(e,[s,i])=>{this._isStyleActiveForBlock(s,i)&&(e.return=!0,e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(e,[s,i])=>{const l=this._getAffectedBlocks(s,i);l&&(e.return=l,e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(e,[s,i])=>{const l=this._getStylePreview(s,i);l&&(e.return=l,e.stop())},{priority:"high"}))}_isStyleEnabledForBlock(t,e){const s=this.editor.model;if(!["ol","ul","li"].includes(t.element)||!this._listUtils.isListItemBlock(e))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(t.element);if(t.element=="ol"||t.element=="ul"){if(!s.schema.checkAttribute(e,i))return!1;const o=this._listUtils.isNumberedListType(e.getAttribute("listType"))?"ol":"ul";return t.element==o}else return s.schema.checkAttribute(e,i)}_isStyleActiveForBlock(t,e){const s=this._htmlSupport.getGhsAttributeNameForElement(t.element),i=e.getAttribute(s);return this._styleUtils.hasAllClasses(i,t.classes)}_getAffectedBlocks(t,e){return this._isStyleEnabledForBlock(t,e)?t.element=="li"?this._listUtils.expandListBlocksToCompleteItems(e,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(e):null}_getStylePreview(t,e){const{element:s,classes:i}=t;return s=="ol"||s=="ul"?{tag:s,attributes:{class:i},children:[{tag:"li",children:e}]}:s=="li"?{tag:"ol",children:[{tag:s,attributes:{class:i},children:e}]}:null}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class B extends h{_tableUtils;_styleUtils;static get pluginName(){return"TableStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d]}init(){const t=this.editor;t.plugins.has("TableEditing")&&(this._styleUtils=t.plugins.get(d),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(e,[s,i])=>{this._isApplicable(s,i)&&(e.return=this._isStyleEnabledForBlock(s,i),e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(e,[s,i])=>{this._isApplicable(s,i)&&(e.return=this._getAffectedBlocks(s,i),e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(e,[{block:s}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(s.filter(l=>l.element=="figcaption").map(l=>({name:"caption",classes:l.classes})))}))}_isApplicable(t,e){return["td","th"].includes(t.element)?e.name=="tableCell":["thead","tbody"].includes(t.element)?e.name=="table":!1}_isStyleEnabledForBlock(t,e){if(["td","th"].includes(t.element)){const s=this._tableUtils.getCellLocation(e),l=e.parent.parent,o=l.getAttribute("headingRows")||0,c=l.getAttribute("headingColumns")||0,n=s.row<o||s.column<c;return t.element=="th"?n:!n}if(["thead","tbody"].includes(t.element)){const s=e.getAttribute("headingRows")||0;return t.element=="thead"?s>0:s<this._tableUtils.getRows(e)}/* istanbul ignore next -- @preserve */return!1}_getAffectedBlocks(t,e){return this._isStyleEnabledForBlock(t,e)?[e]:null}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class V extends h{_styleUtils;_htmlSupport;static get pluginName(){return"LinkStyleSupport"}static get isOfficialPlugin(){return!0}static get requires(){return[d,"GeneralHtmlSupport"]}init(){const t=this.editor;t.plugins.has("LinkEditing")&&(this._styleUtils=t.plugins.get(d),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(e,[s,i])=>{s.element=="a"&&(e.return=this._isStyleEnabled(s,i),e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(e,[s,i])=>{s.element=="a"&&(e.return=this._isStyleActive(s,i),e.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(e,[s,i])=>{if(s.element!="a")return;const l=this._getAffectedSelectable(s,i);l&&(e.return=l,e.stop())},{priority:"high"}))}_isStyleEnabled(t,e){const s=this.editor.model;if(e.isCollapsed)return e.hasAttribute("linkHref");for(const i of e.getRanges())for(const l of i.getItems())if((l.is("$textProxy")||s.schema.isInline(l))&&l.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(t,e){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(t.element);if(e.isCollapsed){if(e.hasAttribute("linkHref")){const l=e.getAttribute(i);if(this._styleUtils.hasAllClasses(l,t.classes))return!0}return!1}for(const l of e.getRanges())for(const o of l.getItems())if((o.is("$textProxy")||s.schema.isInline(o))&&o.hasAttribute("linkHref")){const c=o.getAttribute(i);return this._styleUtils.hasAllClasses(c,t.classes)}return!1}_getAffectedSelectable(t,e){const s=this.editor.model;if(e.isCollapsed){const l=e.getAttribute("linkHref");return L(e.getFirstPosition(),"linkHref",l,s)}const i=[];for(const l of e.getRanges()){const o=s.createRange(F(l.start,"linkHref",!0,s),F(l.end,"linkHref",!1,s));for(const c of o.getItems())(c.is("$textProxy")||s.schema.isInline(c))&&c.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(c))}return K(i)}}function F(r,t,e,s){const i=r.textNode||(e?r.nodeAfter:r.nodeBefore);if(!i||!i.hasAttribute(t))return r;const l=i.getAttribute(t);return R(r,t,l,e,s)}function K(r){for(let t=1;t<r.length;t++){const e=r[t-1].getJoined(r[t]);e&&r.splice(--t,2,e)}return r}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class T extends h{static get pluginName(){return"StyleEditing"}static get isOfficialPlugin(){return!0}static get requires(){return["GeneralHtmlSupport",d,x,B,V]}init(){const t=this.editor,e=t.plugins.get("DataSchema"),s=t.plugins.get("StyleUtils"),i=t.config.get("style.definitions"),l=s.normalizeConfig(e,i);t.commands.add("style",new v(t,l)),s.configureGHSDataFilter(l)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class W extends h{static get pluginName(){return"Style"}static get isOfficialPlugin(){return!0}static get requires(){return[T,A]}}export{V as LinkStyleSupport,x as ListStyleSupport,W as Style,v as StyleCommand,T as StyleEditing,A as StyleUI,d as StyleUtils,B as TableStyleSupport,m as _StyleGridButtonView,_ as _StyleGridView,p as _StyleGroupView,S as _StylePanelView};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
function t(n,{insertAt:e}={}){}t();
|
||||
@@ -0,0 +1,43 @@
|
||||
import{Command as q,Plugin as x}from"@ckeditor/ckeditor5-core";import{env as v,EventInfo as ie,count as se,isInsideSurrogatePair as oe,isInsideCombinedSymbol as re,isInsideEmojiSequence as ce,keyCodes as E,ObservableMixin as le}from"@ckeditor/ckeditor5-utils";import{Observer as N,FocusObserver as ae,ViewDocumentDomEventData as A,_tryFixingModelRange as M,ModelLiveRange as ue,BubblingEventInfo as B,MouseObserver as de,TouchObserver as fe}from"@ckeditor/ckeditor5-engine";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class I{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,s)=>{s.isLocal&&s.isUndoable&&s!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class G extends q{_buffer;constructor(e,t){super(e),this._buffer=new I(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,s=e.text||"",i=s.length;let c=n.selection;if(e.selection?c=e.selection:e.range&&(c=t.createSelection(e.range)),!t.canEditAt(c))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const a=Array.from(n.selection.getAttributes());t.deleteContent(c),s&&t.insertContent(l.createText(s,a),c),r?l.setSelection(r):c.is("documentSelection")||l.setSelection(c),this._buffer.unlock(),this._buffer.input(i)})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const $=["insertText","insertReplacementText"],he=[...$,"insertCompositionText"];class me extends N{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(ae);const t=v.isAndroid?he:$,n=e.document;n.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{data:c,targetRanges:r,inputType:l,domEvent:a,isComposing:u}=i;if(!t.includes(l))return;this.focusObserver.flush();const d=new ie(n,"insertText");n.fire(d,new A(e,a,{text:c,selection:e.createSelection(r),isComposing:u})),d.stop.called&&s.stop()}),v.isAndroid||n.on("compositionend",(s,{data:i,domEvent:c})=>{this.isEnabled&&i&&n.fire("insertText",new A(e,c,{text:i,isComposing:!0}))},{priority:"low"})}observe(){}stopObserving(){}}function ge(o,e,{signal:t,edges:n}={}){let s,i=null;const c=n!=null&&n.includes("leading"),r=n==null||n.includes("trailing"),l=()=>{i!==null&&(o.apply(s,i),s=void 0,i=null)},a=()=>{r&&l(),m()};let u=null;const d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,a()},e)},h=()=>{u!==null&&(clearTimeout(u),u=null)},m=()=>{h(),s=void 0,i=null},f=()=>{h(),l()},g=function(...b){if(t?.aborted)return;s=this,i=b;const R=u==null;d(),c&&R&&l()};return g.schedule=d,g.cancel=m,g.flush=f,t?.addEventListener("abort",m,{once:!0}),g}function pe(o,e=0,t={}){typeof t!="object"&&(t={});const{leading:n=!1,trailing:s=!0,maxWait:i}=t,c=Array(2);n&&(c[0]="leading"),s&&(c[1]="trailing");let r,l=null;const a=ge(function(...h){r=o.apply(this,h),l=null},e,{edges:c}),u=function(...h){return i!=null&&(l===null&&(l=Date.now()),Date.now()-l>=i)?(r=o.apply(this,h),l=Date.now(),a.cancel(),a.schedule(),r):(a.apply(this,h),r)},d=()=>(a.flush(),r);return u.cancel=a.cancel,u.flush=d,u}function z(o){if(o==null)return"";if(typeof o=="string")return o;if(Array.isArray(o))return o.map(z).join(",");const e=String(o);return e==="0"&&Object.is(Number(o),-0)?"-0":e}function be(o){return o.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}function _e(o){return be(z(o))}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class W extends x{_typingQueue;static get pluginName(){return"Input"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.editing.mapper,i=t.document.selection;this._typingQueue=new ye(e),n.addObserver(me);const c=new G(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",c),e.commands.add("input",c),this.listenTo(n.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput")},{priority:"high"}),this.listenTo(n.document,"insertText",(r,l)=>{const{text:a,selection:u}=l;if(n.document.selection.isFake&&u&&n.document.selection.isSimilar(u)&&l.preventDefault(),u&&Array.from(u.getRanges()).some(f=>!f.isCollapsed)&&l.preventDefault(),!c.isEnabled){l.preventDefault();return}let d;u&&(d=Array.from(u.getRanges()).filter(f=>f.root.is("rootElement")).map(f=>s.toModelRange(f)).map(f=>M(f,t.schema)||f)),(!d||!d.length)&&(d=Array.from(i.getRanges()));let h=a;if(v.isAndroid){const f=Array.from(d[0].getItems()).reduce((g,b)=>g+(b.is("$textProxy")?b.data:""),"");if(f&&(f.length<=h.length?h.startsWith(f)&&(h=h.substring(f.length),d[0].start=d[0].start.getShiftedBy(f.length)):f.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h="")),h.length==0&&d[0].isCollapsed)return}const m={text:h,selection:t.createSelection(d)};this._typingQueue.push(m,!!l.isComposing),l.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented")}),v.isAndroid?this.listenTo(n.document,"keydown",(r,l)=>{i.isCollapsed||l.keyCode!=229||!n.document.isComposing||U(t,c)}):this.listenTo(n.document,"compositionstart",()=>{i.isCollapsed||U(t,c)},{priority:"high"}),this.listenTo(n.document,"mutations",(r,{mutations:l})=>{if(this._typingQueue.hasAffectedElements())for(const{node:a}of l){const u=Ee(a,s),d=s.toModelElement(u);if(this._typingQueue.isElementAffected(d)){this._typingQueue.flush("mutations");return}}}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("before composition end")},{priority:"high"}),this.listenTo(n.document,"compositionend",()=>{this._typingQueue.flush("after composition end");const r=[];if(this._typingQueue.hasAffectedElements())for(const l of this._typingQueue.flushAffectedElements()){const a=s.toViewElement(l);a&&r.push({type:"children",node:a})}(r.length||!v.isAndroid)&&n.document.fire("mutations",{mutations:r})},{priority:"lowest"})}destroy(){super.destroy(),this._typingQueue.destroy()}}class ye{editor;flushDebounced=pe(()=>this.flush("timeout"),50);_queue=[];_isComposing=!1;_affectedElements=new Set;constructor(e){this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e,t){const n={text:e.text};if(e.selection){n.selectionRanges=[];for(const s of e.selection.getRanges())n.selectionRanges.push(ue.fromRange(s)),this._affectedElements.add(s.start.parent)}this._queue.push(n),this._isComposing||=t,this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const n=e.selectionRanges.map(s=>ve(s)).filter(s=>!!s);n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){const t=this.editor,n=t.model,s=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const c=t.commands.get("insertText").buffer;n.enqueueChange(c.batch,()=>{for(c.lock();this._queue.length;){const r=this.shift();t.execute("insertText",r)}c.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),s.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}}function U(o,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),o.enqueueChange(t.batch,()=>{o.deleteContent(o.document.selection)}),t.unlock()}function ve(o){const e=o.toRange();return o.detach(),e.root.rootName=="$graveyard"?null:e}function Ee(o,e){let t=o.is("$text")?o.parent:o;for(;!e.toModelElement(t);)t=t.parent;return t}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class F extends q{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new I(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const i=s.createSelection(e.selection||n.selection);if(!t.canEditAt(i))return;const c=e.sequence||1,r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(c)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(i,c)){this.editor.execute("paragraph",{selection:i});return}if(i.isCollapsed)return;let l=0;i.getFirstRange().getMinimalFlatRanges().forEach(a=>{l+=se(a.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(l),s.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(i))||!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!(r&&r.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,i=t.schema.getLimitElement(s),c=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(c,i),e.setSelection(c,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),i=n.schema.getLimitElement(s),c=i.getChild(0);return!(s.parent!=c||!e.containsEntireContent(c)||!n.schema.checkChild(i,"paragraph")||c.name=="paragraph")}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const Te="character",Q="word",Ce="codePoint",y="selection",T="backward",w="forward",j={deleteContent:{unit:y,direction:T},deleteContentBackward:{unit:Ce,direction:T},deleteWordBackward:{unit:Q,direction:T},deleteHardLineBackward:{unit:y,direction:T},deleteSoftLineBackward:{unit:y,direction:T},deleteContentForward:{unit:Te,direction:w},deleteWordForward:{unit:Q,direction:w},deleteHardLineForward:{unit:y,direction:w},deleteSoftLineForward:{unit:y,direction:w}};class H extends N{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(s,i)=>{if(!this.isEnabled)return;const{targetRanges:c,domEvent:r,inputType:l}=i,a=j[l];if(!a)return;const u={direction:a.direction,unit:a.unit,sequence:n};u.unit==y&&(u.selectionToRemove=e.createSelection(c[0])),l==="deleteContentBackward"&&(v.isAndroid&&(u.sequence=1),Ae(c)&&(u.unit=y,u.selectionToRemove=e.createSelection(c)));const d=new B(t,"delete",c[0]);t.fire(d,new A(e,r,u)),d.stop.called&&s.stop()}),v.isBlink&&xe(this)}observe(){}stopObserving(){}}function xe(o){const e=o.view,t=e.document;let n=null,s=!1;t.on("keydown",(r,{keyCode:l})=>{n=l,s=!1}),t.on("keyup",(r,{keyCode:l,domEvent:a})=>{const u=t.selection,d=o.isEnabled&&l==n&&i(l)&&!u.isCollapsed&&!s;if(n=null,d){const h=u.getFirstRange(),m=new B(t,"delete",h),f={unit:y,direction:c(l),selectionToRemove:u};t.fire(m,new A(e,a,f))}}),t.on("beforeinput",(r,{inputType:l})=>{const a=j[l];i(n)&&a&&a.direction==c(n)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(r,{inputType:l,data:a})=>{n==E.delete&&l=="insertText"&&a=="\x7F"&&r.stop()},{priority:"high"});function i(r){return r==E.backspace||r==E.delete}function c(r){return r==E.backspace?T:w}}function Ae(o){if(o.length!=1||o[0].isCollapsed)return!1;const e=o[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:n,item:s}of e){if(n.parent.is("$text")){const i=n.parent.data,c=n.offset;if(oe(i,c)||re(i,c)||ce(i,c))continue;t++}else(s.is("containerElement")||s.is("emptyElement"))&&t++;if(t>1)return!0}return!1}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class K extends x{_undoOnBackspace;static get pluginName(){return"Delete"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.editing.view,n=t.document,s=e.model.document;t.addObserver(H),this._undoOnBackspace=!1;const i=new F(e,"forward");e.commands.add("deleteForward",i),e.commands.add("forwardDelete",i),e.commands.add("delete",new F(e,"backward")),this.listenTo(n,"delete",(c,r)=>{n.isComposing||r.preventDefault();const{direction:l,sequence:a,selectionToRemove:u,unit:d}=r,h=l==="forward"?"deleteForward":"delete",m={sequence:a};if(d=="selection"){const f=Array.from(u.getRanges()).map(g=>e.editing.mapper.toModelRange(g)).map(g=>M(g,e.model.schema)||g);m.selection=e.model.createSelection(f)}else m.unit=d;e.execute(h,m),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(n,"keydown",(c,r)=>{if(n.isComposing||r.keyCode!=E.backspace||!s.selection.isCollapsed)return;const l=e.model.schema.getLimitElement(s.selection),a=e.model.createPositionAt(l,0);if(a.isTouching(s.selection.getFirstPosition())){r.preventDefault();const u=e.model.schema.getNearestSelectionRange(a,"forward");if(!u)return;const d=t.createSelection(e.editing.mapper.toViewRange(u)),h=d.getFirstRange(),m=new B(document,"delete",h),f={unit:"selection",direction:"backward",selectionToRemove:d};n.fire(m,new A(t,r.domEvent,f))}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(c,r)=>{this._undoOnBackspace&&r.direction=="backward"&&r.sequence==1&&r.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),r.preventDefault(),c.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class we extends x{static get requires(){return[W,K]}static get pluginName(){return"Typing"}static get isOfficialPlugin(){return!0}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function V(o,e){let t=o.start;return{text:Array.from(o.getWalker({ignoreElementEnd:!1})).reduce((s,{item:i})=>i.is("$text")||i.is("$textProxy")?s+i.data:(t=e.createPositionAfter(i),""),""),range:e.createRange(t,o.end)}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class Y extends le(){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(n,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(n,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,c=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:l}=V(c,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const u=Object.assign(t,{text:r,range:l});typeof a=="object"&&Object.assign(u,a),this.fire(`matched:${e}`,u)}}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class Se extends x{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return"TwoStepCaretMovement"}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,n=e.editing.view,s=e.locale,i=t.document.selection;this.listenTo(n.document,"arrowKey",(c,r)=>{if(!i.isCollapsed||r.shiftKey||r.altKey||r.ctrlKey)return;const l=r.keyCode==E.arrowright,a=r.keyCode==E.arrowleft;if(!l&&!a)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&a?d=this._handleForwardMovement(r):d=this._handleBackwardMovement(r),d===!0&&c.stop()},{context:"$text",priority:"highest"}),this.listenTo(i,"change:range",(c,r)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!r.directChange&&p(i.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden||i.isAtStart&&_(s,t)?!1:p(i,t)?(e&&k(e),_(s,t)&&p(i,t,!0)?S(n,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,s=n.document.selection,i=s.getFirstPosition();return this._isGravityOverridden?(e&&k(e),this._restoreGravity(),p(i,t,!0)?S(n,t):O(n,t,i),!0):i.isAtStart?_(s,t)?(e&&k(e),O(n,t,i),!0):!1:!_(s,t)&&p(i,t,!0)?(e&&k(e),O(n,t,i),!0):J(i,t)?i.isAtEnd&&!_(s,t)&&p(i,t)?(e&&k(e),O(n,t,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(de),e.editing.view.addObserver(fe);let i=!1,c=!1;this.listenTo(s,"touchstart",()=>{c=!1,i=!0}),this.listenTo(s,"mousedown",()=>{c=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!c&&!i||(c=!1,i=!1,!n.isCollapsed)||!_(n,r))return;const l=n.getFirstPosition();p(l,r)&&(l.isAtStart||p(l,r,!0)?S(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,n=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const i=n.getFirstPosition();_(n,s)&&p(i,s)&&S(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,n=t.document.selection,s=e.editing.view;let i=!1,c=!1;this.listenTo(s.document,"delete",(r,l)=>{i=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!i)return;const r=n.getFirstPosition();c=_(n,this.attributes)&&!J(r,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{i&&(i=!1,!c&&e.model.enqueueChange(()=>{const r=n.getFirstPosition();_(n,this.attributes)&&p(r,this.attributes)&&(r.isAtStart||p(r,this.attributes,!0)?S(t,this.attributes):this._isGravityOverridden||this._overrideGravity())}))},{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function _(o,e){for(const t of e)if(o.hasAttribute(t))return!0;return!1}function O(o,e,t){const n=t.nodeBefore;o.change(s=>{if(n){const i=[],c=o.schema.isObject(n)&&o.schema.isInline(n);for(const[r,l]of n.getAttributes())o.schema.checkAttribute("$text",r)&&(!c||o.schema.getAttributeProperties(r).copyFromObject!==!1)&&i.push([r,l]);s.setSelectionAttribute(i)}else s.removeSelectionAttribute(e)})}function S(o,e){o.change(t=>{t.removeSelectionAttribute(e)})}function k(o){o.preventDefault()}function J(o,e){const t=o.getShiftedBy(-1);return p(t,e)}function p(o,e,t=!1){const{nodeBefore:n,nodeAfter:s}=o;for(const i of e){const c=n?n.getAttribute(i):void 0,r=s?s.getAttribute(i):void 0;if(!(t&&(c===void 0||r===void 0))&&r!==c)return!0}return!1}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/const X={copyright:{from:"(c)",to:"\xA9"},registeredTrademark:{from:"(r)",to:"\xAE"},trademark:{from:"(tm)",to:"\u2122"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"\xBD",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"\u2153",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"\u2154",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"\xBC",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"\xBE",null]},lessThanOrEqual:{from:"<=",to:"\u2264"},greaterThanOrEqual:{from:">=",to:"\u2265"},notEqual:{from:"!=",to:"\u2260"},arrowLeft:{from:"<-",to:"\u2190"},arrowRight:{from:"->",to:"\u2192"},horizontalEllipsis:{from:"...",to:"\u2026"},enDash:{from:/(^| )(--)( )$/,to:[null,"\u2013",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"\u2014",null]},quotesPrimary:{from:C('"'),to:[null,"\u201C",null,"\u201D"]},quotesSecondary:{from:C("'"),to:[null,"\u2018",null,"\u2019"]},quotesPrimaryEnGb:{from:C("'"),to:[null,"\u2018",null,"\u2019"]},quotesSecondaryEnGb:{from:C('"'),to:[null,"\u201C",null,"\u201D"]},quotesPrimaryPl:{from:C('"'),to:[null,"\u201E",null,"\u201D"]},quotesSecondaryPl:{from:C("'"),to:[null,"\u201A",null,"\u2019"]}},Z={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},ke=["symbols","mathematical","typography","quotes"];class Re extends x{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("typing",{transformations:{include:ke}})}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{const n=t.anchor,s=!!n&&n.parent.is("element","codeBlock"),i=t.hasAttribute("code");this.isEnabled=!(s||i)}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,n=e.plugins.get("Delete"),s=Be(e.config.get("typing.transformations")),i=r=>{for(const l of s)if(l.from.test(r))return{normalizedTransformation:l}},c=new Y(e.model,i);c.on("matched:data",(r,l)=>{if(!l.batch.isTyping)return;const{from:a,to:u}=l.normalizedTransformation,d=a.exec(l.text),h=u(d.slice(1)),m=l.range;let f=d.index;t.enqueueChange(g=>{for(let b=1;b<d.length;b++){const R=d[b],D=h[b-1];if(D==null){f+=R.length;continue}const P=m.start.getShiftedBy(f),te=t.createRange(P,P.getShiftedBy(R.length)),ne=Pe(P);t.insertContent(g.createText(D,ne),te),f+=D.length}t.enqueueChange(()=>{n.requestUndoOnBackspace()})})}),c.bind("isEnabled").to(this)}}function Oe(o){return typeof o=="string"?new RegExp(`(${_e(o)})$`):o}function De(o){return typeof o=="string"?()=>[o]:o instanceof Array?()=>o:o}function Pe(o){return(o.textNode?o.textNode:o.nodeAfter).getAttributes()}function C(o){return new RegExp(`(^|\\s)(${o})([^${o}]*)(${o})$`)}function Be(o){const e=o.extra||[],t=o.remove||[],n=i=>!t.includes(i),s=o.include.concat(e).filter(n);return Ie(s).filter(n).map(i=>typeof i=="string"&&X[i]?X[i]:i).filter(i=>typeof i=="object").map(i=>({from:Oe(i.from),to:De(i.to)}))}function Ie(o){const e=new Set;for(const t of o)if(typeof t=="string"&&Z[t])for(const n of Z[t])e.add(n);else e.add(t);return Array.from(e)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function ee(o,e,t,n){return n.createRange(L(o,e,t,!0,n),L(o,e,t,!1,n))}function L(o,e,t,n,s){let i=o.textNode||(n?o.nodeBefore:o.nodeAfter),c=null;for(;i&&i.getAttribute(e)==t;)c=i,i=n?i.previousSibling:i.nextSibling;return c?s.createPositionAt(c,n?"before":"after"):o}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function Fe(o,e,t,n){const s=o.editing.view,i=new Set;s.document.registerPostFixer(c=>{const r=o.model.document.selection;let l=!1;if(r.hasAttribute(e)){const a=ee(r.getFirstPosition(),e,r.getAttribute(e),o.model),u=o.editing.mapper.toViewRange(a);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(n)&&(c.addClass(n,d),i.add(d),l=!0)}return l}),o.conversion.for("editingDowncast").add(c=>{c.on("insert",r,{priority:"highest"}),c.on("remove",r,{priority:"highest"}),c.on("attribute",r,{priority:"highest"}),c.on("selection",r,{priority:"highest"});function r(){s.change(l=>{for(const a of i.values())l.removeClass(n,a),i.delete(a)})}})}export{K as Delete,F as DeleteCommand,W as Input,G as InsertTextCommand,Re as TextTransformation,Y as TextWatcher,Se as TwoStepCaretMovement,we as Typing,I as TypingChangeBuffer,H as _DeleteObserver,ee as findAttributeRange,L as findAttributeRangeBound,V as getLastTextLine,Fe as inlineHighlight};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
|
||||
import{Command as R,Plugin as u}from"@ckeditor/ckeditor5-core";import{transformOperationSets as k,NoOperation as C}from"@ckeditor/ckeditor5-engine";import{ButtonView as T,MenuBarMenuListItemButtonView as O}from"@ckeditor/ckeditor5-ui";import{IconUndo as f,IconRedo as g}from"@ckeditor/ckeditor5-icons";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class m extends R{_stack=[];_createdBatches=new WeakSet;constructor(t){super(t),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(t.data,"set",(e,o)=>{o[1]={...o[1]};const s=o[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(t.data,"set",(e,o)=>{o[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(t){const e=this.editor.model.document.selection,o={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:o}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,o){const s=this.editor.model,i=s.document,n=[],d=t.map(r=>r.getTransformedByOperations(o)),h=d.flat();for(const r of d){const l=r.filter(c=>c.root!=i.graveyard).filter(c=>!w(c,h));l.length&&(U(l),n.push(l[0]))}n.length&&s.change(r=>{r.setSelection(n,{backward:e})})}_undo(t,e){const o=this.editor.model,s=o.document;this._createdBatches.add(e);const i=t.operations.slice().filter(n=>n.isDocumentOperation);i.reverse();for(const n of i){const d=n.baseVersion+1,h=Array.from(s.history.getOperations(d)),l=k([n.getReversed()],h,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let c of l){const p=c.affectedSelectable;p&&!o.canEditAt(p)&&(c=new C(c.baseVersion)),e.addOperation(c),o.applyOperation(c),s.history.setOperationAsUndone(n,c)}}}}function U(a){a.sort((t,e)=>t.start.isBefore(e.start)?-1:1);for(let t=1;t<a.length;t++){const o=a[t-1].getJoined(a[t],!0);o&&(t--,a.splice(t,2,o))}}function w(a,t){return t.some(e=>e!==a&&e.containsRange(a,!0))}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class _ extends m{execute(t=null){const e=t?this._stack.findIndex(i=>i.batch==t):this._stack.length-1,o=this._stack.splice(e,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(o.batch,s);const i=this.editor.model.document.history.getOperations(o.batch.baseVersion);this._restoreSelection(o.selection.ranges,o.selection.isBackward,i)}),this.fire("revert",o.batch,s),this.refresh()}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class B extends m{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,()=>{const s=t.batch.operations[t.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(s);this._restoreSelection(t.selection.ranges,t.selection.isBackward,i),this._undo(t.batch,e)}),this.fire("revert",t.batch,e),this.refresh()}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class b extends u{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.t;this._undoCommand=new _(t),this._redoCommand=new B(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",(o,s)=>{const i=s[0];if(!i.isDocumentOperation)return;const n=i.batch,d=this._redoCommand.createdBatches.has(n),h=this._undoCommand.createdBatches.has(n);this._batchRegistry.has(n)||(this._batchRegistry.add(n),n.isUndoable&&(d?this._undoCommand.addBatch(n):h||(this._undoCommand.addBatch(n),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(o,s,i)=>{this._redoCommand.addBatch(i)}),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Undo"),keystroke:"CTRL+Z"},{label:e("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class y extends u{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,o=t.t,s=e.uiLanguageDirection=="ltr"?f:g,i=e.uiLanguageDirection=="ltr"?g:f;this._addButtonsToFactory("undo",o("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",o("Redo"),"CTRL+Y",i)}_addButtonsToFactory(t,e,o,s){const i=this.editor;i.ui.componentFactory.add(t,()=>{const n=this._createButton(T,t,e,o,s);return n.set({tooltip:!0}),n}),i.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(O,t,e,o,s))}_createButton(t,e,o,s,i){const n=this.editor,d=n.locale,h=n.commands.get(e),r=new t(d);return r.set({label:o,icon:i,keystroke:s}),r.bind("isEnabled").to(h,"isEnabled"),this.listenTo(r,"execute",()=>{n.execute(e),n.editing.view.focus()}),r}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class S extends u{static get requires(){return[b,y]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}}export{B as RedoCommand,S as Undo,_ as UndoCommand,b as UndoEditing,m as UndoRedoBaseCommand,y as UndoUI};
|
||||
@@ -0,0 +1,13 @@
|
||||
import{Plugin as n,PendingActions as u}from"@ckeditor/ckeditor5-core";import{ObservableMixin as h,Collection as m,logWarning as p,uid as w,CKEditorError as c}from"@ckeditor/ckeditor5-utils";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class g extends h(){total;_reader;_data;constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((s,r)=>{t.onload=()=>{const a=t.result;this._data=a,s(a)},t.onerror=()=>{r("error")},t.onabort=()=>{r("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class d extends n{loaders=new m;_loadersMap=new Map;_pendingAction=null;static get pluginName(){return"FileRepository"}static get isOfficialPlugin(){return!0}static get requires(){return[u]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return p("filerepository-no-upload-adapter"),null;const t=new f(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(s=>{this._loadersMap.set(s,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let s=0;for(const r of this.loaders)s+=r.uploaded;this.uploaded=s}),t.on("change:uploadTotal",()=>{let s=0;for(const r of this.loaders)r.uploadTotal&&(s+=r.uploadTotal);this.uploadTotal=s}),t}destroyLoader(e){const t=e instanceof f?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((s,r)=>{s===t&&this._loadersMap.delete(r)})}_updatePendingAction(){const e=this.editor.plugins.get(u);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,s=r=>`${t("Upload in progress")} ${parseInt(r)}%.`;this._pendingAction=e.add(s(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",s)}}else e.remove(this._pendingAction),this._pendingAction=null}}class f extends h(){id;_filePromiseWrapper;_adapter;_reader;constructor(e,t){super(),this.id=w(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new g,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(s,r)=>r?s/r*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new c("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new c("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((s,r)=>{t.rejecter=r,t.isFulfilled=!1,e.then(a=>{t.isFulfilled=!0,s(a)}).catch(a=>{t.isFulfilled=!0,r(a)})}),t}}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class P extends n{static get requires(){return[d]}static get pluginName(){return"Base64UploadAdapter"}static get licenseFeatureCode(){return"B64A"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this.editor.plugins.get(d).createUploadAdapter=e=>new b(e)}}let b=class{loader;reader;constructor(e){this.loader=e}upload(){return new Promise((e,t)=>{const s=this.reader=new window.FileReader;s.addEventListener("load",()=>{e({default:s.result})}),s.addEventListener("error",r=>{t(r)}),s.addEventListener("abort",()=>{t()}),this.loader.file.then(r=>{s.readAsDataURL(r)})})}abort(){this.reader.abort()}};/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class A extends n{static get requires(){return[d]}static get pluginName(){return"SimpleUploadAdapter"}static get licenseFeatureCode(){return"SUA"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){const e=this.editor.config.get("simpleUpload");if(e){if(!e.uploadUrl){p("simple-upload-adapter-missing-uploadurl");return}this.editor.plugins.get(d).createUploadAdapter=t=>new x(t,e)}}}class x{loader;options;xhr;constructor(e,t){this.loader=e,this.options=t}upload(){return this.loader.file.then(e=>new Promise((t,s)=>{this._initRequest(),this._initListeners(t,s,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.options.uploadUrl,!0),e.responseType="json"}_initListeners(e,t,s){const r=this.xhr,a=this.loader,l=`Couldn't upload file: ${s.name}.`;r.addEventListener("error",()=>t(l)),r.addEventListener("abort",()=>t()),r.addEventListener("load",()=>{const i=r.response;if(!i||i.error)return t(i&&i.error&&i.error.message?i.error.message:l);const _=i.url?{default:i.url}:i.urls;e({...i,urls:_})});/* istanbul ignore else -- @preserve */r.upload&&r.upload.addEventListener("progress",i=>{i.lengthComputable&&(a.uploadTotal=i.total,a.uploaded=i.loaded)})}_sendRequest(e){let t=this.options.headers||{};typeof t=="function"&&(t=t(e));const s=this.options.withCredentials||!1;for(const a of Object.keys(t))this.xhr.setRequestHeader(a,t[a]);this.xhr.withCredentials=s;const r=new FormData;r.append("upload",e),this.xhr.send(r)}}export{P as Base64UploadAdapter,g as FileReader,d as FileRepository,A as SimpleUploadAdapter};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
import{Plugin as b}from"@ckeditor/ckeditor5-core";import{Template as y,View as x}from"@ckeditor/ckeditor5-ui";import{env as T}from"@ckeditor/ckeditor5-utils";/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/function p(e){if(e.is("$text")||e.is("$textProxy"))return e.data;const t=e;let n="",i=null;for(const r of t.getChildren()){const o=p(r);i&&i.is("element")&&(n+=`
|
||||
`),n+=o,i=r}return n}function C(e){return typeof e=="object"&&e!==null}function O(e,t,{signal:n,edges:i}={}){let r,o=null;const u=i!=null&&i.includes("leading"),c=i==null||i.includes("trailing"),l=()=>{o!==null&&(e.apply(r,o),r=void 0,o=null)},a=()=>{c&&l(),g()};let s=null;const h=()=>{s!=null&&clearTimeout(s),s=setTimeout(()=>{s=null,a()},t)},d=()=>{s!==null&&(clearTimeout(s),s=null)},g=()=>{d(),r=void 0,o=null},_=()=>{d(),l()},f=function(...w){if(n?.aborted)return;r=this,o=w;const m=s==null;h(),u&&m&&l()};return f.schedule=h,f.cancel=g,f.flush=_,n?.addEventListener("abort",g,{once:!0}),f}function P(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:i=!1,trailing:r=!0,maxWait:o}=n,u=Array(2);i&&(u[0]="leading"),r&&(u[1]="trailing");let c,l=null;const a=O(function(...d){c=e.apply(this,d),l=null},t,{edges:u}),s=function(...d){return o!=null&&(l===null&&(l=Date.now()),Date.now()-l>=o)?(c=e.apply(this,d),l=Date.now(),a.cancel(),a.schedule(),c):(a.apply(this,d),c)},h=()=>(a.flush(),c);return s.cancel=a.cancel,s.flush=h,s}function W(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:i=!0,trailing:r=!0}=n;return P(e,t,{leading:i,trailing:r,maxWait:t})}function S(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){const n=e[Symbol.toStringTag];return n==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${n}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function V(e){return C(e)&&e.nodeType===1&&!S(e)}/**
|
||||
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
||||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
||||
*/class E extends b{_config;_outputView;_wordsMatchRegExp;constructor(t){super(t),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=t.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=T.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu}static get pluginName(){return"WordCount"}static get licenseFeatureCode(){return"WC"}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this.editor.model.document.on("change:data",W(this._refreshStats.bind(this),250)),typeof this._config.onUpdate=="function"&&this.on("update",(n,i)=>{this._config.onUpdate(i)}),V(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){const t=this.editor,n=t.t,i=t.config.get("wordCount.displayWords"),r=t.config.get("wordCount.displayCharacters"),o=y.bind(this,this),u=[];return this._outputView||(this._outputView=new x,(i||i===void 0)&&(this.bind("_wordsLabel").to(this,"words",c=>n("Words: %0",c)),u.push({tag:"div",children:[{text:[o.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(r||r===void 0)&&(this.bind("_charactersLabel").to(this,"characters",c=>n("Characters: %0",c)),u.push({tag:"div",children:[{text:[o.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:u}),this._outputView.render()),this._outputView.element}_getText(){let t="";for(const n of this.editor.model.document.getRoots())t!==""&&(t+=`
|
||||
`),t+=p(n);return t}_getCharacters(t){return t.replace(/\n/g,"").length}_getWords(t){return(t.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){const t=this._getText(),n=this.words=this._getWords(t),i=this.characters=this._getCharacters(t);this.fire("update",{words:n,characters:i})}}export{E as WordCount,p as _modelElementToPlainText};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user