@ckeditor/ckeditor5-indent 47.5.0 → 47.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/indent.js CHANGED
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var t={237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,n)=>{t.exports=n(237)("./src/ui.js")},355:(t,e,n)=>{t.exports=n(237)("./src/icons.js")},584:(t,e,n)=>{t.exports=n(237)("./src/utils.js")},782:(t,e,n)=>{t.exports=n(237)("./src/core.js")},783:(t,e,n)=>{t.exports=n(237)("./src/engine.js")}},e={};function n(s){var i=e[s];if(void 0!==i)return i.exports;var o=e[s]={exports:{}};return t[s](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};(()=>{"use strict";n.r(s),n.d(s,{Indent:()=>d,IndentBlock:()=>f,IndentBlockCommand:()=>l,IndentEditing:()=>e,IndentUI:()=>r,_IndentUsingClasses:()=>g,_IndentUsingOffset:()=>u});var t=n(782);class e extends t.Plugin{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.commands.add("indent",new t.MultiCommand(e)),e.commands.add("outdent",new t.MultiCommand(e))}}var i=n(311),o=n(355);class r extends t.Plugin{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,n=t.t,s="ltr"==e.uiLanguageDirection?o.IconIndent:o.IconOutdent,i="ltr"==e.uiLanguageDirection?o.IconOutdent:o.IconIndent;this._defineButton("indent",n("Increase indent"),s),this._defineButton("outdent",n("Decrease indent"),i)}_defineButton(t,e,n){const s=this.editor;s.ui.componentFactory.add(t,()=>{const s=this._createButton(i.ButtonView,t,e,n);return s.set({tooltip:!0}),s}),s.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(i.MenuBarMenuListItemButtonView,t,e,n))}_createButton(t,e,n,s){const i=this.editor,o=i.commands.get(e),r=new t(i.locale);return r.set({label:n,icon:s}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{i.execute(e),i.editing.view.focus()}),r}}class d extends t.Plugin{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[e,r]}}var a=n(783),c=n(584);class l extends t.Command{_indentBehavior;constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=(0,c.first)(t.document.selection.getSelectedBlocks());e&&this._isIndentationChangeAllowed(e)?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=this._getBlocksToChange();t.change(t=>{for(const n of e){const e=n.getAttribute("blockIndent"),s=this._indentBehavior.getNextIndent(e);s?t.setAttribute("blockIndent",s,n):t.removeAttribute("blockIndent",n)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(t=>this._isIndentationChangeAllowed(t))}_isIndentationChangeAllowed(t){const e=this.editor;if(!e.model.schema.checkAttribute(t,"blockIndent"))return!1;if(!e.plugins.has("ListUtils"))return!0;if(!this._indentBehavior.isForward)return!0;return!e.plugins.get("ListUtils").isListItemBlock(t)}}class u{isForward;offset;unit;constructor(t){this.isForward="forward"===t.direction,this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||"0");return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||"0");if(!(!t||t.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=e+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class g{isForward;classes;constructor(t){this.isForward="forward"===t.direction,this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e<this.classes.length-1:e>=0}getNextIndent(t){const e=this.classes.indexOf(t),n=this.isForward?1:-1;return this.classes[e+n]}}const h=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class f extends t.Plugin{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new l(t,new g({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlock",new l(t,new g({direction:"backward",classes:e.classes})))):(t.data.addStyleProcessorRules(a.addMarginStylesRules),this._setupConversionUsingOffset(),t.commands.add("indentBlock",new l(t,new u({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlock",new l(t,new u({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const t=this.editor,e=t.model.schema,n=t.commands.get("indent"),s=t.commands.get("outdent"),i=t.config.get("heading.options");(i&&i.map(t=>t.model)||h).forEach(t=>{e.isRegistered(t)&&e.extend(t,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(t.commands.get("indentBlock")),s.registerChildCommand(t.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const t=this.editor.conversion,e="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";t.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>{if(!t.is("element","li"))return t.getStyle(e)}}}),t.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(t){const e={model:{key:"blockIndent",values:[]},view:{}};for(const n of t)e.model.values.push(n),e.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(e)}}})(),(window.CKEditor5=window.CKEditor5||{}).indent=s})();
5
+ */(()=>{var t={125:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,':root{--ck-content-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px;position:relative}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;border:0;display:inline-block;height:var(--ck-content-todo-list-checkmark-size);left:-25px;margin-left:0;margin-right:-15px;position:relative;right:0;vertical-align:middle;width:var(--ck-content-todo-list-checkmark-size)}.ck-content[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-left:-15px;margin-right:0;right:-25px}.ck-content .todo-list .todo-list__label>input:before{border:1px solid #333;border-radius:2px;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;transition:box-shadow .25s ease-in-out;width:100%}@media (prefers-reduced-motion:reduce){.ck-content .todo-list .todo-list__label>input:before{transition:none}}.ck-content .todo-list .todo-list__label>input:after{border-color:transparent;border-style:solid;border-width:0 calc(var(--ck-content-todo-list-checkmark-size)/8) calc(var(--ck-content-todo-list-checkmark-size)/8) 0;box-sizing:content-box;content:"";display:block;height:calc(var(--ck-content-todo-list-checkmark-size)/2.6);left:calc(var(--ck-content-todo-list-checkmark-size)/3);pointer-events:none;position:absolute;top:calc(var(--ck-content-todo-list-checkmark-size)/5.3);transform:rotate(45deg);width:calc(var(--ck-content-todo-list-checkmark-size)/5.3)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}.ck-content .todo-list .todo-list__label.todo-list__label_without-description input[type=checkbox]{position:absolute}.ck-editor__editable.ck-content .todo-list .todo-list__label>input,.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input{cursor:pointer}.ck-editor__editable.ck-content .todo-list .todo-list__label>input:hover:before,.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input{-webkit-appearance:none;border:0;display:inline-block;height:var(--ck-content-todo-list-checkmark-size);left:-25px;margin-left:0;margin-right:-15px;position:relative;right:0;vertical-align:middle;width:var(--ck-content-todo-list-checkmark-size)}.ck-editor__editable.ck-content[dir=rtl] .todo-list .todo-list__label>span[contenteditable=false]>input{left:0;margin-left:-15px;margin-right:0;right:-25px}.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input:before{border:1px solid #333;border-radius:2px;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;transition:box-shadow .25s ease-in-out;width:100%}@media (prefers-reduced-motion:reduce){.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input:before{transition:none}}.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input:after{border-color:transparent;border-style:solid;border-width:0 calc(var(--ck-content-todo-list-checkmark-size)/8) calc(var(--ck-content-todo-list-checkmark-size)/8) 0;box-sizing:content-box;content:"";display:block;height:calc(var(--ck-content-todo-list-checkmark-size)/2.6);left:calc(var(--ck-content-todo-list-checkmark-size)/3);pointer-events:none;position:absolute;top:calc(var(--ck-content-todo-list-checkmark-size)/5.3);transform:rotate(45deg);width:calc(var(--ck-content-todo-list-checkmark-size)/5.3)}.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-editor__editable.ck-content .todo-list .todo-list__label>span[contenteditable=false]>input[checked]:after{border-color:#fff}.ck-editor__editable.ck-content .todo-list .todo-list__label.todo-list__label_without-description input[type=checkbox]{position:absolute}',""]);const c=r},160:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,":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)}",""]);const c=r},163:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},237:t=>{"use strict";t.exports=CKEditor5.dll},305:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n}).join("")},e.i=function(t,n,i,s,o){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(i)for(var c=0;c<this.length;c++){var l=this[c][0];null!=l&&(r[l]=!0)}for(var a=0;a<t.length;a++){var d=[].concat(t[a]);i&&r[d[0]]||(void 0!==o&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=o),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),s&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=s):d[4]="".concat(s)),e.push(d))}},e}},311:(t,e,n)=>{t.exports=n(237)("./src/ui.js")},331:(t,e,n)=>{t.exports=n(237)("./src/clipboard.js")},355:(t,e,n)=>{t.exports=n(237)("./src/icons.js")},396:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,":root{--ck-content-list-marker-color:var(--ck-content-font-color);--ck-content-list-marker-font-family:var(--ck-content-font-family);--ck-content-list-marker-font-size:var(--ck-content-font-size)}.ck-content li>p:first-of-type{margin-top:0}.ck-content li>p:only-of-type{margin-bottom:0;margin-top:0}.ck-content li.ck-list-marker-bold::marker{font-weight:700}.ck-content li.ck-list-marker-italic::marker{font-style:italic}.ck-content li.ck-list-marker-color::marker{color:var(--ck-content-list-marker-color)}.ck-content li.ck-list-marker-font-family::marker{font-family:var(--ck-content-list-marker-font-family)}.ck-content li.ck-list-marker-font-size::marker{font-size:var(--ck-content-list-marker-font-size)}.ck-content li.ck-list-marker-font-size-tiny::marker{font-size:var(--ck-content-font-size-tiny)}.ck-content li.ck-list-marker-font-size-small::marker{font-size:var(--ck-content-font-size-small)}.ck-content li.ck-list-marker-font-size-big::marker{font-size:var(--ck-content-font-size-big)}.ck-content li.ck-list-marker-font-size-huge::marker{font-size:var(--ck-content-font-size-huge)}",""]);const c=r},424:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},446:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,".ck.ck-list-properties.ck-list-properties_without-styles{padding:var(--ck-spacing-large)}.ck.ck-list-properties.ck-list-properties_without-styles>*{min-width:14em}.ck.ck-list-properties.ck-list-properties_without-styles>*+*{margin-top:var(--ck-spacing-standard)}.ck.ck-list-properties.ck-list-properties_with-numbered-properties>.ck-list-styles-list{grid-template-columns:repeat(4,auto)}.ck.ck-list-properties.ck-list-properties_with-numbered-properties>.ck-collapsible{border-top:1px solid var(--ck-color-base-border)}.ck.ck-list-properties.ck-list-properties_with-numbered-properties>.ck-collapsible>.ck-collapsible__children>*{width:100%}.ck.ck-list-properties.ck-list-properties_with-numbered-properties>.ck-collapsible>.ck-collapsible__children>*+*{margin-top:var(--ck-spacing-standard)}.ck.ck-list-properties .ck.ck-numbered-list-properties__start-index .ck-input{min-width:auto;width:100%}.ck.ck-list-properties .ck.ck-numbered-list-properties__reversed-order{background:transparent;margin-bottom:calc(var(--ck-spacing-tiny)*-1);padding-left:0;padding-right:0}.ck.ck-list-properties .ck.ck-numbered-list-properties__reversed-order:active,.ck.ck-list-properties .ck.ck-numbered-list-properties__reversed-order:hover{background:none;border-color:transparent;box-shadow:none}",""]);const c=r},467:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,".ck.ck-list-styles-list{display:grid}:root{--ck-list-style-button-size:44px}.ck.ck-list-styles-list{column-gap:var(--ck-spacing-medium);grid-template-columns:repeat(3,auto);padding:var(--ck-spacing-large);row-gap:var(--ck-spacing-medium)}.ck.ck-list-styles-list .ck-button{box-sizing:content-box;margin:0;padding:0}.ck.ck-list-styles-list .ck-button,.ck.ck-list-styles-list .ck-button .ck-icon{height:var(--ck-list-style-button-size);width:var(--ck-list-style-button-size)}",""]);const c=r},507:(t,e,n)=>{t.exports=n(237)("./src/enter.js")},517:t=>{"use strict";t.exports=function(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}},584:(t,e,n)=>{t.exports=n(237)("./src/utils.js")},650:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,".ck-editor__editable .ck-list-bogus-paragraph{display:block}",""]);const c=r},719:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var o={},r=[],c=0;c<t.length;c++){var l=t[c],a=i.base?l[0]+i.base:l[0],d=o[a]||0,u="".concat(a," ").concat(d);o[a]=d+1;var m=n(u),k={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==m)e[m].references++,e[m].updater(k);else{var p=s(k,i);i.byIndex=c,e.splice(c,0,{identifier:u,updater:p,references:1})}r.push(u)}return r}function s(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,s){var o=i(t=t||[],s=s||{});return function(t){t=t||[];for(var r=0;r<o.length;r++){var c=n(o[r]);e[c].references--}for(var l=i(t,s),a=0;a<o.length;a++){var d=n(o[a]);0===e[d].references&&(e[d].updater(),e.splice(d,1))}o=l}}},725:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var i=n(792),s=n.n(i),o=n(305),r=n.n(o)()(s());r.push([t.id,".ck-content ol{list-style-type:decimal}.ck-content ol ol{list-style-type:lower-latin}.ck-content ol ol ol{list-style-type:lower-roman}.ck-content ol ol ol ol{list-style-type:upper-latin}.ck-content ol ol ol ol ol{list-style-type:upper-roman}.ck-content ul{list-style-type:disc}.ck-content ul ul{list-style-type:circle}.ck-content ul ul ul,.ck-content ul ul ul ul{list-style-type:square}",""]);const c=r},782:(t,e,n)=>{t.exports=n(237)("./src/core.js")},783:(t,e,n)=>{t.exports=n(237)("./src/engine.js")},792:t=>{"use strict";t.exports=function(t){return t[1]}},834:(t,e,n)=>{t.exports=n(237)("./src/typing.js")},863:t=>{"use strict";var e,n=(e=[],function(t,n){return e[t]=n,e.filter(Boolean).join("\n")});function i(t,e,i,s){var o;if(i)o="";else{o="",s.supports&&(o+="@supports (".concat(s.supports,") {")),s.media&&(o+="@media ".concat(s.media," {"));var r=void 0!==s.layer;r&&(o+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),o+=s.css,r&&(o+="}"),s.media&&(o+="}"),s.supports&&(o+="}")}if(t.styleSheet)t.styleSheet.cssText=n(e,o);else{var c=document.createTextNode(o),l=t.childNodes;l[e]&&t.removeChild(l[e]),l.length?t.insertBefore(c,l[e]):t.appendChild(c)}}var s={singleton:null,singletonCounter:0};t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=s.singletonCounter++,n=s.singleton||(s.singleton=t.insertStyleElement(t));return{update:function(t){i(n,e,!1,t)},remove:function(t){i(n,e,!0,t)}}}}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var o=e[i]={id:i,exports:{}};return t[i](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{Indent:()=>c,IndentBlock:()=>J,IndentBlockCommand:()=>d,IndentBlockListCommand:()=>q,IndentBlockListIntegration:()=>V,IndentBlockListItemCommand:()=>K,IndentEditing:()=>e,IndentUI:()=>r,_IndentUsingClasses:()=>m,_IndentUsingOffset:()=>u});var t=n(782);class e extends t.Plugin{static get pluginName(){return"IndentEditing"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;e.commands.add("indent",new t.MultiCommand(e)),e.commands.add("outdent",new t.MultiCommand(e))}}var s=n(311),o=n(355);class r extends t.Plugin{static get pluginName(){return"IndentUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?o.IconIndent:o.IconOutdent,s="ltr"==e.uiLanguageDirection?o.IconOutdent:o.IconIndent;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),s)}_defineButton(t,e,n){const i=this.editor;i.ui.componentFactory.add(t,()=>{const i=this._createButton(s.ButtonView,t,e,n);return i.set({tooltip:!0}),i}),i.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(s.MenuBarMenuListItemButtonView,t,e,n))}_createButton(t,e,n,i){const s=this.editor,o=s.commands.get(e),r=new t(s.locale);return r.set({label:n,icon:i}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{s.execute(e),s.editing.view.focus()}),r}}class c extends t.Plugin{static get pluginName(){return"Indent"}static get isOfficialPlugin(){return!0}static get requires(){return[e,r]}}var l=n(783),a=n(584);class d extends t.Command{_indentBehavior;constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=(0,a.first)(t.document.selection.getSelectedBlocks());e&&this._isIndentationChangeAllowed(e)?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=this._getBlocksToChange();t.change(t=>{for(const n of e){const e=n.getAttribute("blockIndent"),i=this._indentBehavior.getNextIndent(e);i?t.setAttribute("blockIndent",i,n):t.removeAttribute("blockIndent",n)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(t=>this._isIndentationChangeAllowed(t))}_isIndentationChangeAllowed(t){const e=this.editor;if(!e.model.schema.checkAttribute(t,"blockIndent"))return!1;if(!e.plugins.has("ListUtils"))return!0;if(!this._indentBehavior.isForward)return!0;return!e.plugins.get("ListUtils").isListItemBlock(t)}}class u{isForward;offset;unit;constructor(t){this.isForward="forward"===t.direction,this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||"0");return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||"0"),n=!t||t.endsWith(this.unit);if(e<0)return;if(!n)return this.isForward?this.offset+this.unit:void 0;const i=e+(this.isForward?this.offset:-this.offset);return i>0?i+this.unit:void 0}}class m{isForward;classes;constructor(t){this.isForward="forward"===t.direction,this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e<this.classes.length-1:e>=0}getNextIndent(t){const e=this.classes.indexOf(t)+(this.isForward?1:-1),n=Math.min(e,this.classes.length-1);return this.classes[n]}}n(834),n(507);Symbol.iterator;Symbol.iterator;Symbol.iterator;function k(t){return!!t&&t.is("element")&&t.hasAttribute("listItemId")}t.Command;t.Command;t.Command;t.Command;t.Plugin;t.Plugin;t.Command;t.Plugin;t.Plugin;var p=n(719),b=n.n(p),g=n(863),f=n.n(g),h=n(424),v=n.n(h),y=n(517),I=n.n(y),_=n(163),w=n.n(_),A=n(160),L={attributes:{"data-cke":!0}};L.setAttributes=I(),L.insert=v().bind(null,"head"),L.domAPI=f(),L.insertStyleElement=w();b()(A.A,L);A.A&&A.A.locals&&A.A.locals;t.Plugin;t.Plugin;t.Plugin;t.Plugin;t.Plugin;t.Plugin;var x=n(396),C={attributes:{"data-cke":!0}};C.setAttributes=I(),C.insert=v().bind(null,"head"),C.domAPI=f(),C.insertStyleElement=w();b()(x.A,C);x.A&&x.A.locals&&x.A.locals;t.Plugin;t.Plugin;n(331);var B=n(650),S={attributes:{"data-cke":!0}};S.setAttributes=I(),S.insert=v().bind(null,"head"),S.domAPI=f(),S.insertStyleElement=w();b()(B.A,S);B.A&&B.A.locals&&B.A.locals;var z=n(725),P={attributes:{"data-cke":!0}};P.setAttributes=I(),P.insert=v().bind(null,"head"),P.domAPI=f(),P.insertStyleElement=w();b()(z.A,P);z.A&&z.A.locals&&z.A.locals;t.Plugin;t.Command;const E={},T={},F={},O=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"},{listStyle:"arabic-indic",typeAttribute:null,listType:"numbered"}];for(const{listStyle:t,typeAttribute:e,listType:n}of O)E[t]=n,T[t]=e,e&&(F[e]=t);t.Command;t.Command;t.Plugin;t.Plugin;var N=n(446),D={attributes:{"data-cke":!0}};D.setAttributes=I(),D.insert=v().bind(null,"head"),D.domAPI=f(),D.insertStyleElement=w();b()(N.A,D);N.A&&N.A.locals&&N.A.locals;s.View;var U=n(467),j={attributes:{"data-cke":!0}};j.setAttributes=I(),j.insert=v().bind(null,"head"),j.domAPI=f(),j.insertStyleElement=w();b()(U.A,j);U.A&&U.A.locals&&U.A.locals;t.Command;var M=n(125),R={attributes:{"data-cke":!0}};R.setAttributes=I(),R.insert=v().bind(null,"head"),R.domAPI=f(),R.insertStyleElement=w();b()(M.A,R);M.A&&M.A.locals&&M.A.locals;t.Command;t.Command;t.Plugin;t.Plugin;t.Command;t.Command;t.Command;t.Plugin;t.Command;class q extends t.Command{_indentBehavior;constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this._getFirstListItemIfSelectionIsAtListStart(this.editor.model.document.selection);this.isEnabled=!!t&&this._indentBehavior.checkEnabled(t.getAttribute("blockIndentList"))}execute(t={}){const e=this.editor.model,n=e.document.selection;e.change(i=>{const s=this._getFirstListItemIfSelectionIsAtListStart(n),o=[];if(t.firstListOnly)o.push(s);else{const t=Array.from(n.getSelectedBlocks());for(const n of t)k(n)&&0===n.getAttribute("listIndent")&&e.schema.checkAttribute(n,"blockIndentList")&&o.push(n)}for(const t of o){const e=t.getAttribute("blockIndentList"),n=this._indentBehavior.getNextIndent(e);n?i.setAttribute("blockIndentList",n,t):i.removeAttribute("blockIndentList",t)}})}_getFirstListItemIfSelectionIsAtListStart(t){const e=t.getFirstPosition(),n=this.editor.plugins.get("ListUtils"),i=e.parent,s=this.editor.model.schema;return e.isAtStart&&k(i)&&0==i.getAttribute("listIndent")&&s.checkAttribute(i,"blockIndentList")&&n.isFirstListItemInList(i)?i:null}}class K extends t.Command{_indentBehavior;constructor(t,e){super(t),this._indentBehavior=e}refresh(){this.isEnabled=this._getAffectedListItems().length>0}execute(){this.editor.model.change(t=>{for(const e of this._getAffectedListItems())t.removeAttribute("blockIndentListItem",e)})}_getAffectedListItems(){const t=this.editor.model.document.selection,e=this.editor.plugins.get("ListUtils"),n=Array.from(t.getSelectedBlocks());return e.expandListBlocksToCompleteItems(n).filter(t=>this._isIndentationChangeAllowed(t))}_isIndentationChangeAllowed(t){if(!t.hasAttribute("blockIndentListItem"))return!1;const e=parseFloat(t.getAttribute("blockIndentListItem"));return isNaN(e)?!this._indentBehavior.isForward:this._indentBehavior.isForward&&e<0||!this._indentBehavior.isForward&&e>0}}class V extends t.Plugin{static get pluginName(){return"IndentBlockListIntegration"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;if(!this.editor.plugins.has("ListEditing"))return;const e=t.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClassesForListBlock(e.classes),this._setupConversionUsingClassesForListItemBlock(e.classes),t.commands.add("indentBlockList",new q(t,new m({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlockList",new q(t,new m({direction:"backward",classes:e.classes}))),t.commands.add("indentBlockListItem",new K(t,new m({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlockListItem",new K(t,new m({direction:"backward",classes:e.classes})))):(t.data.addStyleProcessorRules(l.addMarginStylesRules),this._setupConversionUsingOffsetForListBlock(),this._setupConversionUsingOffsetForListItemBlock(),t.commands.add("indentBlockList",new q(t,new u({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlockList",new q(t,new u({direction:"backward",offset:e.offset,unit:e.unit}))),t.commands.add("indentBlockListItem",new K(t,new u({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlockListItem",new K(t,new u({direction:"backward",offset:e.offset,unit:e.unit}))));t.plugins.get("ListEditing").on("postFixer",(t,{listNodes:e,writer:n})=>{for(const{node:i,previousNodeInList:s}of e)s&&s.getAttribute("listType")==i.getAttribute("listType")&&($("blockIndentList",i,s,n)&&(t.return=!0),s.getAttribute("listItemId")==i.getAttribute("listItemId")&&$("blockIndentListItem",i,s,n)&&(t.return=!0))}),this.listenTo(t.editing.view.document,"tab",(e,n)=>{const i=n.shiftKey?"outdentBlockList":"indentBlockList";this.editor.commands.get(i).isEnabled&&(t.execute(i,{firstListOnly:!0}),n.stopPropagation(),n.preventDefault(),e.stop())},{context:"li",priority:"high"})}afterInit(){const t=this.editor,e=t.model,n=e.schema;if(!t.plugins.has("ListEditing"))return;n.extend("$listItem",{allowAttributes:["blockIndentList","blockIndentListItem"]}),n.setAttributeProperties("blockIndentList",{isFormatting:!0}),n.setAttributeProperties("blockIndentListItem",{isFormatting:!0}),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"blockIndentList"),e.schema.addAttributeCheck(t=>{if(!t.last.getAttribute("listItemId"))return!1},"blockIndentListItem");const i=(e,n)=>{t.model.change(t=>{for(const e of n)e.hasAttribute("listItemId")&&(e.hasAttribute("blockIndentList")&&t.removeAttribute("blockIndentList",e),e.hasAttribute("blockIndentListItem")&&t.removeAttribute("blockIndentListItem",e))})},s=t.commands.get("indentList"),o=t.commands.get("outdentList");s&&this.listenTo(s,"afterExecute",i),o&&this.listenTo(o,"afterExecute",i);const r=t.commands.get("indent"),c=t.commands.get("outdent");r.registerChildCommand(t.commands.get("indentBlockList")),c.registerChildCommand(t.commands.get("outdentBlockList")),r.registerChildCommand(t.commands.get("indentBlockListItem")),c.registerChildCommand(t.commands.get("outdentBlockListItem"))}_setupConversionUsingOffsetForListBlock(){const t=this.editor,e=t.conversion,n="rtl"===t.locale.contentLanguageDirection?"margin-right":"margin-left",i=t.plugins.get("ListEditing");e.for("upcast").add(t=>{t.on("element:ol",W("blockIndentList",n)),t.on("element:ul",W("blockIndentList",n))}),i.registerDowncastStrategy({scope:"list",attributeName:"blockIndentList",setAttributeOnDowncast(t,e,i){e&&t.setStyle(n,e,i)}})}_setupConversionUsingOffsetForListItemBlock(){const t=this.editor,e=t.locale,n=t.conversion,i="rtl"===e.contentLanguageDirection?"margin-right":"margin-left",s=t.plugins.get("ListEditing");n.for("upcast").add(t=>{t.on("element:li",W("blockIndentListItem",i),{priority:"low"})}),s.registerDowncastStrategy({scope:"item",attributeName:"blockIndentListItem",setAttributeOnDowncast(t,e,n){e&&t.setStyle(i,e,n)}})}_setupConversionUsingClassesForListBlock(t){const e=this.editor,n=e.conversion,i=e.plugins.get("ListEditing");n.for("upcast").add(e=>{e.on("element:ol",H("blockIndentList",t)),e.on("element:ul",H("blockIndentList",t))}),i.registerDowncastStrategy({scope:"list",attributeName:"blockIndentList",setAttributeOnDowncast(t,e,n){e&&t.addClass(e,n)}})}_setupConversionUsingClassesForListItemBlock(t){const e=this.editor,n=e.conversion,i=e.plugins.get("ListEditing");n.for("upcast").add(e=>{e.on("element:li",H("blockIndentListItem",t),{priority:"low"})}),i.registerDowncastStrategy({scope:"item",attributeName:"blockIndentListItem",setAttributeOnDowncast(t,e,n){e&&t.addClass(e,n)}})}}function H(t,e){return(n,i,s)=>{const{writer:o,consumable:r}=s;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor));const c=Array.from(i.viewItem.getClassNames()),l=e.find(t=>c.includes(t));if(void 0===l)return;let a,d=!1;for(const e of i.modelRange.getItems({shallow:!0}))void 0===a&&(a=e.getAttribute("listIndent")),e.hasAttribute(t)||e.getAttribute("listIndent")===a&&(o.setAttribute(t,l,e),d=!0);d&&r.consume(i.viewItem,{classes:l})}}function W(t,e){return(n,i,s)=>{const{writer:o,consumable:r}=s;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor));const c=i.viewItem.getStyle(e);let l,a=!1;for(const e of i.modelRange.getItems({shallow:!0}))void 0===l&&(l=e.getAttribute("listIndent")),e.hasAttribute(t)||e.getAttribute("listIndent")===l&&(o.setAttribute(t,c,e),a=!0);a&&r.consume(i.viewItem,{styles:e})}}function $(t,e,n,i){const s=n.getAttribute(t);return e.getAttribute(t)!==s&&(s?i.setAttribute(t,s,e):i.removeAttribute(t,e),!0)}const G=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class J extends t.Plugin{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}static get isOfficialPlugin(){return!0}static get requires(){return[V]}init(){const t=this.editor,e=t.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new d(t,new m({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlock",new d(t,new m({direction:"backward",classes:e.classes})))):(t.data.addStyleProcessorRules(l.addMarginStylesRules),this._setupConversionUsingOffset(),t.commands.add("indentBlock",new d(t,new u({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlock",new d(t,new u({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const t=this.editor,e=t.model.schema,n=t.commands.get("indent"),i=t.commands.get("outdent"),s=t.config.get("heading.options");(s&&s.map(t=>t.model)||G).forEach(t=>{e.isRegistered(t)&&e.extend(t,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(t.commands.get("indentBlock")),i.registerChildCommand(t.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const t=this.editor.conversion,e="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";t.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>{if(!t.is("element","li"))return t.getStyle(e)}}}),t.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(t){const e={model:{key:"blockIndent",values:[]},view:{}};for(const n of t)e.model.values.push(n),e.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(e)}}})(),(window.CKEditor5=window.CKEditor5||{}).indent=i})();
@@ -44,6 +44,52 @@
44
44
  "_comment": "If classes are defined in `config.indentBlock.classes`, they are used instead of inline styles."
45
45
  }
46
46
  ]
47
+ },
48
+ {
49
+ "name": "Indent block list integration",
50
+ "className": "IndentBlockListIntegration",
51
+ "description": "Provides block indentation integration for lists, enabling indent and outdent of lists and list items.",
52
+ "docs": "features/indent.html",
53
+ "path": "src/integrations/indentblocklistintegration.js",
54
+ "requires": [
55
+ "IndentBlock"
56
+ ],
57
+ "htmlOutput": [
58
+ {
59
+ "elements": [
60
+ "ol",
61
+ "ul"
62
+ ],
63
+ "styles": [
64
+ "margin-left",
65
+ "margin-right"
66
+ ],
67
+ "_comment": "By default, the plugin uses inline styles for indentation."
68
+ },
69
+ {
70
+ "elements": "li",
71
+ "styles": [
72
+ "margin-left",
73
+ "margin-right"
74
+ ],
75
+ "_comment": "By default, the plugin uses inline styles for indentation."
76
+ },
77
+ {
78
+ "elements": [
79
+ "ol",
80
+ "ul"
81
+ ],
82
+ "classes": "*",
83
+ "isAlternative": true,
84
+ "_comment": "If classes are defined in `config.indentBlock.classes`, they are used instead of inline styles."
85
+ },
86
+ {
87
+ "elements": "li",
88
+ "classes": "*",
89
+ "isAlternative": true,
90
+ "_comment": "If classes are defined in `config.indentBlock.classes`, they are used instead of inline styles."
91
+ }
92
+ ]
47
93
  }
48
94
  ]
49
95
  }