From bbc2b73e486859a7f2567d641058220de5bbf931 Mon Sep 17 00:00:00 2001
From: mostafaznv
Available methods: `hash-file`, `real-file-name`, `unique-real-file-name` |
-| toolbars.default | String | toolbar-1 | Specifies the default toolbar |
-| toolbars.toolbar-1.height | Integer | 400 | Editor's height. |
-| toolbars.toolbar-1.content-lang | String `format: ISO 639-1` | en | Language of editor's content. if you want to change text-direction (RTL, LTR), you need this |
-| toolbars.toolbar-1.ui-language.name | String `format: ISO 639-1` | en | Language of editor's ui. |
-| toolbars.toolbar-1.ui-language.script | String | null | URL of language file to use in editor's ui.
example 1: `asset('js/ckeditor-fa.js')`
example 2: `https://cdn.ckeditor.com/ckeditor5/34.0.0/decoupled-document/translations/fa.js` |
-| toolbars.toolbar-1.text-part-language | Array | | The text part language feature provides the ability to mark the language of selected text fragments. It makes working with multilingual content convenient and ensures that user agents can correctly present the content written in multiple languages, so graphical browsers and screen readers are able to identify how to pronounce text and display characters. |
-| toolbars.toolbar-1.should-not-group-when-full | Boolean | false | Indicates whether the editor shows 3 dots in overflow mode |
-| toolbars.toolbar-1.browser.image | Boolean | true | You can disable image picker by changing this flag |
-| toolbars.toolbar-1.browser.video | Boolean | true | You can disable video picker by changing this flag |
-| toolbars.toolbar-1.snippets | Array | | There are some pre-defined snippets in `resources/views/ckeditor`. you can add more snippets if you want.
**Note**: Snippets will only render CkEditor Elements. Standard HTML or Figures (table, image, video), see included views. https://ckeditor.com/docs |
-| toolbars.toolbar-1.items | Array | | These are toolbar buttons. you can remove or rearrange them |
-| toolbars.toolbar-1.options | Array | | Options of toolbar items. to see more information, please check the CkEditor's documentation. |
+| key | type | default | description |
+|-----------------------------------------------|----------------------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| video-model | String | App\Models\Video | Path of your video model |
+| memory | String | 256M | Max memory (php.ini override) for image resizing |
+| max-quality | Integer | 75 | Max image output quality |
+| max-width | Integer | 1024 | Image max width |
+| max-height | Integer | 768 | Image max height |
+| image-naming-method | String | hash-file | Naming Method of Images.
Available methods: `hash-file`, `real-file-name`, `unique-real-file-name` |
+| toolbars.default | String | toolbar-1 | Specifies the default toolbar |
+| toolbars.toolbar-1.height | Integer | 400 | Editor's height. |
+| toolbars.toolbar-1.content-lang | String `format: ISO 639-1` | en | Language of editor's content. if you want to change text-direction (RTL, LTR), you need this |
+| toolbars.toolbar-1.ui-language.name | String `format: ISO 639-1` | en | Language of editor's ui. |
+| toolbars.toolbar-1.ui-language.script | String | null | URL of language file to use in editor's ui.
example 1: `asset('js/ckeditor-fa.js')`
example 2: `https://cdn.ckeditor.com/ckeditor5/34.0.0/decoupled-document/translations/fa.js` |
+| toolbars.toolbar-1.text-part-language | Array | | The text part language feature provides the ability to mark the language of selected text fragments. It makes working with multilingual content convenient and ensures that user agents can correctly present the content written in multiple languages, so graphical browsers and screen readers are able to identify how to pronounce text and display characters. |
+| toolbars.toolbar-1.html-support | Array | | With the General HTML Support ("GHS") feature, you can easily enable HTML features that are not supported by any other dedicated CKEditor 5 plugins. GHS lets you add elements, attributes, classes, and styles to the source and ensures this markup stays in the editor window and in the output. [more information](https://ckeditor.com/docs/ckeditor5/latest/features/html/general-html-support.html) |
+| toolbars.toolbar-1.should-not-group-when-full | Boolean | false | Indicates whether the editor shows 3 dots in overflow mode |
+| toolbars.toolbar-1.browser.image | Boolean | true | You can disable image picker by changing this flag |
+| toolbars.toolbar-1.browser.video | Boolean | true | You can disable video picker by changing this flag |
+| toolbars.toolbar-1.snippets | Array | | There are some pre-defined snippets in `resources/views/ckeditor`. you can add more snippets if you want.
**Note**: Snippets will only render CkEditor Elements. Standard HTML or Figures (table, image, video), see included views. https://ckeditor.com/docs |
+| toolbars.toolbar-1.items | Array | | These are toolbar buttons. you can remove or rearrange them |
+| toolbars.toolbar-1.options | Array | | Options of toolbar items. to see more information, please check the CkEditor's documentation. |
------
@@ -354,6 +356,9 @@ return [
## Migration
+#### From 5.1.0 to 5.1.1
+`html-support` has been added to the toolbar properties in `config/nova-ckeditor.php`.
+
#### From 4.1.2 to 5.0.0
There were some backward incompatible changes made to the configuration file. Please review the updated config file for changes and make corresponding updates to ensure compatibility.
diff --git a/config/nova-ckeditor.php b/config/nova-ckeditor.php
index 3b0b4c6..93429e3 100644
--- a/config/nova-ckeditor.php
+++ b/config/nova-ckeditor.php
@@ -93,6 +93,26 @@
['title' => 'English', 'languageCode' => 'en']
],
+ /*
+ * General HTML Support
+ *
+ * @see https://ckeditor.com/docs/ckeditor5/latest/features/html/general-html-support.html#configuration
+ */
+
+ 'html-support' => [
+ 'allow' => [
+ [
+ 'name' => 'div',
+ 'classes' => true,
+ ],
+ [
+ 'name' => '/^(div|section|article)$/'
+ ]
+ ],
+
+ 'disallow' => []
+ ],
+
'should-not-group-when-full' => false,
'browser' => [
diff --git a/dist/js/field.js b/dist/js/field.js
index ff4ea55..7ebff85 100644
--- a/dist/js/field.js
+++ b/dist/js/field.js
@@ -1,2 +1,2 @@
/*! For license information please see field.js.LICENSE.txt */
-!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","Align center":"Align center","Align left":"Align left","Align right":"Align right",Aquamarine:"Aquamarine",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold","Break text":"Break text","Bulleted List":"Bulleted List",Cancel:"Cancel","Caption for image: %0":"Caption for image: %0","Caption for the image":"Caption for the image","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading","Choose language":"Choose language",Code:"Code",Column:"Column","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey","Document colors":"Document colors",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Edit source":"Edit source","Editor block content toolbar":"Editor block content toolbar","Editor contextual toolbar":"Editor contextual toolbar","Editor editing area: %0":"Editor editing area: %0","Editor toolbar":"Editor toolbar","Empty snippet content":"Empty snippet content","Enter image caption":"Enter image caption","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green",Grey:"Grey","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6","Horizontal line":"Horizontal line","HTML snippet":"HTML snippet",Huge:"Huge","Image toolbar":"Image toolbar","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert HTML":"Insert HTML","Insert image":"Insert image","Insert media":"Insert media","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Italic:"Italic",Justify:"Justify",Language:"Language","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Media URL":"Media URL","media widget":"media widget","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next","No preview available":"No preview available","Numbered List":"Numbered List","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab","Open media in new tab":"Open media in new tab",Orange:"Orange",Paragraph:"Paragraph","Paste raw HTML here...":"Paste raw HTML here...","Paste the media URL in the input.":"Paste the media URL in the input.","Plain text":"Plain text","Press Enter to type after or press Shift + Enter to type before the widget":"Press Enter to type after or press Shift + Enter to type before the widget",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Remove language":"Remove language","Rich Text Editor":"Rich Text Editor","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Save changes":"Save changes","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Side image":"Side image",Small:"Small",Source:"Source","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Strikethrough:"Strikethrough",Subscript:"Subscript",Superscript:"Superscript","Table toolbar":"Table toolbar","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative","The URL must not be empty.":"The URL must not be empty.","This link has no URL":"This link has no URL","This media URL is not supported.":"This media URL is not supported.",Tiny:"Tiny","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.","Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink","Upload failed":"Upload failed","Upload in progress":"Upload in progress",White:"White","Widget toolbar":"Widget toolbar","Wrap text":"Wrap text",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),(()=>{var __webpack_modules__={1185:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ckeditor_ckeditor__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(670),_snippet_browser__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7791),_media_browser__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(8783),_mixins_hasUUID__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9034),laravel_nova__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(9226),laravel_nova__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(laravel_nova__WEBPACK_IMPORTED_MODULE_4__),lodash_debounce__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(3279),lodash_debounce__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_5__),regex_parser__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9350),regex_parser__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(regex_parser__WEBPACK_IMPORTED_MODULE_6__);function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function _objectSpread(e){for(var t=1;t
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),e=r),o=this.editor.data.htmlProcessor.toView(e)}var r;const s=new f(this,"inputTransformation");this.fire(s,{content:o,dataTransfer:i,targetRanges:t.targetRanges,method:t.method}),s.stop.called&&e.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,n)=>{n.resultRange=t.insertContent(n.content)}),{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,i=(i,o)=>{const r=o.dataTransfer;o.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:i.name})};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((t,n)=>{e.isReadOnly?n.preventDefault():i(t,n)}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",xb(i.content))),"cut"==i.method&&e.model.deleteContent(t.selection)}),{priority:"low"})}}const Cb=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return V(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Oa(e,t,{leading:i,maxWait:t,trailing:o})};var Eb=n(3352),Tb={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};zo()(Eb.Z,Tb);Eb.Z.locals;class Sb extends Oo{static get pluginName(){return"DragDrop"}static get requires(){return[Ab,Tg]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Cb((e=>this._updateDropMarker(e)),40),this._removeDropMarkerDelayed=Ob((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=Ob((()=>this._clearDraggableAttributes()),40),t.addObserver(vb),t.addObserver(au),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",((e,t,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((e,t,n)=>{n||this._finalizeDragging(!1)})),r.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,n=t.document,i=e.editing.view,o=i.document;this.listenTo(o,"dragstart",((i,r)=>{const s=n.selection;if(r.target&&r.target.is("editableElement"))return void r.preventDefault();const a=r.target?Mb(r.target):null;if(a){const n=e.editing.mapper.toModelElement(a);this._draggedRange=Lc.fromRange(t.createRangeOn(n)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!o.selection.isCollapsed){const e=o.selection.getSelectedElement();e&&rg(e)||(this._draggedRange=Lc.fromRange(s.getFirstRange()))}if(!this._draggedRange)return void r.preventDefault();this._draggingUid=g(),r.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",r.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=t.createSelection(this._draggedRange.toRange()),l=e.data.toView(t.getSelectedContent(c));o.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:l,method:"dragstart"}),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(o,"dragend",((e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(o,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(o,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(o,"dragging",((t,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const i=Pb(e,n.targetRanges,n.target);this._draggedRange||(n.dataTransfer.dropEffect="copy"),r.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),i&&this._updateDropMarkerThrottled(i)}),{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"clipboardInput",((t,n)=>{if("drop"!=n.method)return;const i=Pb(e,n.targetRanges,n.target);if(this._removeDropMarker(),!i)return this._finalizeDragging(!1),void t.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==Ib(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(i,!0))return this._finalizeDragging(!1),void t.stop();n.targetRanges=[e.editing.mapper.toViewRange(i)]}),{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Ab);e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n=t.targetRanges.map((e=>this.editor.editing.mapper.toModelRange(e)));this.editor.model.change((e=>e.setSelection(n)))}),{priority:"high"}),e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const n="move"==Ib(t.dataTransfer),i=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",((i,o)=>{if(r.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let s=Mb(o.target);if(r.isBlink&&!e.isReadOnly&&!s&&!n.selection.isCollapsed){const e=n.selection.getSelectedElement();e&&rg(e)||(s=n.selection.editableElement)}s&&(t.change((e=>{e.setAttribute("draggable","true",s)})),this._draggableElement=e.editing.mapper.toModelElement(s))})),this.listenTo(n,"mouseup",(()=>{r.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change((t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_setupDropMarker(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.append("",e.createElement("span"),""),t}))}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change((t=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})}))}_removeDropMarker(){const e=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),e.markers.has("drop-target")&&e.change((e=>{e.removeMarker("drop-target")}))}_finalizeDragging(e){const t=this.editor,n=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Pb(e,t,n){const i=e.model,o=e.editing.mapper;let s=null;const a=t?t[0].start:null;if(n.is("uiElement")&&(n=n.parent),s=function(e,t){const n=e.model,i=e.editing.mapper;if(rg(t))return n.createRangeOn(i.toModelElement(t));if(!t.is("editableElement")){const e=t.findAncestor((e=>rg(e)||e.is("editableElement")));if(rg(e))return n.createRangeOn(i.toModelElement(e))}return null}(e,n),s)return s;const c=function(e,t){const n=e.editing.mapper,i=e.editing.view,o=n.toModelElement(t);if(o)return o;const r=i.createPositionBefore(t),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(e,n),l=a?o.toModelPosition(a):null;return l?(s=function(e,t,n){const i=e.model;if(!i.schema.checkChild(n,"$block"))return null;const o=i.createPositionAt(n,0),r=t.path.slice(0,o.path.length),s=i.createPositionFromPath(t.root,r),a=s.nodeAfter;if(a&&i.schema.isObject(a))return i.createRangeOn(a);return null}(e,l,c),s||(s=i.schema.getNearestSelectionRange(l,r.isGecko?"forward":"backward"),s||function(e,t){const n=e.model;let i=t;for(;i;){if(n.schema.isObject(i))return n.createRangeOn(i);i=i.parent}return null}(e,l.parent))):function(e,t){const n=e.model,i=n.schema,o=n.createPositionAt(t,0);return i.getNearestSelectionRange(o,"forward")}(e,c)}function Ib(e){return r.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function Ob(e,t){let n;function i(...o){i.cancel(),n=setTimeout((()=>e(...o)),t)}return i.cancel=()=>{clearTimeout(n)},i}function Mb(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(rg);if(rg(e))return e;const t=e.findAncestor((e=>rg(e)||e.is("editableElement")));return rg(t)?t:null}class Rb extends Oo{static get pluginName(){return"PastePlainText"}static get requires(){return[Ab]}init(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,o=t.document.selection;let r=!1;n.addObserver(vb),this.listenTo(i,"keydown",((e,t)=>{r=t.shiftKey})),e.plugins.get(Ab).on("contentInsertion",((e,n)=>{(r||function(e,t){if(e.childCount>1)return!1;const n=e.getChild(0);if(t.isObject(n))return!1;return 0==Array.from(n.getAttributeKeys()).length}(n.content,t.schema))&&t.change((e=>{const i=Array.from(o.getAttributes()).filter((([e])=>t.schema.getAttributeProperties(e).isFormatting));o.isCollapsed||t.deleteContent(o,{doNotAutoparagraph:!0}),i.push(...o.getAttributes());const r=e.createRangeIn(n.content);for(const t of r.getItems())t.is("$textProxy")&&e.setAttributes(i,t)}))}))}}class Nb extends Oo{static get pluginName(){return"Clipboard"}static get requires(){return[Ab,Sb,Rb]}}class Db extends Ro{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!Lb(e.schema,n))do{if(n=n.parent,!n)return}while(!Lb(e.schema,n));e.change((e=>{e.setSelection(n,"in")}))}}function Lb(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const Vb=mo("Ctrl+A");class jb extends Oo{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new Db(e)),this.listenTo(t,"keydown",((t,n)=>{fo(n)===Vb&&(e.execute("selectAll"),n.preventDefault())}))}}class Bb extends Oo{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",(t=>{const n=e.commands.get("selectAll"),i=new Vh(t),o=t.t;return i.set({label:o("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",(()=>{e.execute("selectAll"),e.editing.view.focus()})),i}))}}class zb extends Oo{static get requires(){return[jb,Bb]}static get pluginName(){return"SelectAll"}}class Fb extends Ro{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(e.data,"set",((e,t)=>{t[1]={...t[1]};const n=t[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(e.data,"set",((e,t)=>{t[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const i=this.editor.model,o=i.document,r=[],s=e.map((e=>e.getTransformedByOperations(n))),a=s.flat();for(const e of s){const t=e.filter((e=>e.root!=o.graveyard)).filter((e=>!Ub(e,a)));t.length&&(Hb(t),r.push(t[0]))}r.length&&i.change((e=>{e.setSelection(r,{backward:t})}))}_undo(e,t){const n=this.editor.model,i=n.document;this._createdBatches.add(t);const o=e.operations.slice().filter((e=>e.isDocumentOperation));o.reverse();for(const e of o){const o=e.baseVersion+1,r=Array.from(i.history.getOperations(o)),s=dd([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const o of s)t.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(e,o)}}}function Hb(e){e.sort(((e,t)=>e.start.isBefore(t.start)?-1:1));for(let t=1;t