@ckeditor/ckeditor5-indent
Advanced tools
Comparing version 27.0.0 to 27.1.0
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.indent=function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){t.exports=n(1)("./src/core.js")},function(t,e){t.exports=CKEditor5.dll},function(t,e,n){t.exports=n(1)("./src/ui.js")},function(t,e,n){t.exports=n(1)("./src/engine.js")},function(t,e,n){t.exports=n(1)("./src/utils.js")},function(t,e,n){"use strict";n.r(e);var i=n(0);class s extends i.Plugin{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new i.MultiCommand(t)),t.commands.add("outdent",new i.MultiCommand(t))}}var o=n(2),r='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95L5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',d='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>';class c extends i.Plugin{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?r:d,s="ltr"==e.uiLanguageDirection?d:r;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,s=>{const r=i.commands.get(t),d=new o.ButtonView(s);return d.set({label:e,icon:n,tooltip:!0}),d.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(d,"execute",()=>{i.execute(t),i.editing.view.focus()}),d})}}class a extends i.Plugin{static get pluginName(){return"Indent"}static get requires(){return[s,c]}}var l=n(3),u=n(4);class h extends i.Command{constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=Object(u.first)(t.document.selection.getSelectedBlocks());e&&t.schema.checkAttribute(e,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=function(t){const e=t.document.selection,n=t.schema;return Array.from(e.getSelectedBlocks()).filter(t=>n.checkAttribute(t,"blockIndent"))}(t);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)}})}}class g{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 f{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 m=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class b extends i.Plugin{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const t=this.editor,e=t.config.get("indentBlock"),n=!e.classes||!e.classes.length,i=Object.assign({direction:"forward"},e),s=Object.assign({direction:"backward"},e);n?(t.data.addStyleProcessorRules(l.addMarginRules),this._setupConversionUsingOffset(t.conversion),t.commands.add("indentBlock",new h(t,new g(i))),t.commands.add("outdentBlock",new h(t,new g(s)))):(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new h(t,new f(i))),t.commands.add("outdentBlock",new h(t,new f(s))))}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)||m).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=>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)}}e.default={Indent:a,IndentEditing:s,IndentUI:c,IndentBlock:b}}]).default; | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.indent=function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){t.exports=n(1)("./src/core.js")},function(t,e){t.exports=CKEditor5.dll},function(t,e,n){t.exports=n(1)("./src/ui.js")},function(t,e,n){t.exports=n(1)("./src/engine.js")},function(t,e,n){t.exports=n(1)("./src/utils.js")},function(t,e,n){"use strict";n.r(e);var i=n(0);class s extends i.Plugin{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new i.MultiCommand(t)),t.commands.add("outdent",new i.MultiCommand(t))}}var o=n(2),r='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',d='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>';class c extends i.Plugin{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?r:d,s="ltr"==e.uiLanguageDirection?d:r;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,s=>{const r=i.commands.get(t),d=new o.ButtonView(s);return d.set({label:e,icon:n,tooltip:!0}),d.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(d,"execute",()=>{i.execute(t),i.editing.view.focus()}),d})}}class a extends i.Plugin{static get pluginName(){return"Indent"}static get requires(){return[s,c]}}var l=n(3),u=n(4);class h extends i.Command{constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=Object(u.first)(t.document.selection.getSelectedBlocks());e&&t.schema.checkAttribute(e,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=function(t){const e=t.document.selection,n=t.schema;return Array.from(e.getSelectedBlocks()).filter(t=>n.checkAttribute(t,"blockIndent"))}(t);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)}})}}class g{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 f{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 m=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class b extends i.Plugin{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const t=this.editor,e=t.config.get("indentBlock"),n=!e.classes||!e.classes.length,i=Object.assign({direction:"forward"},e),s=Object.assign({direction:"backward"},e);n?(t.data.addStyleProcessorRules(l.addMarginRules),this._setupConversionUsingOffset(t.conversion),t.commands.add("indentBlock",new h(t,new g(i))),t.commands.add("outdentBlock",new h(t,new g(s)))):(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new h(t,new f(i))),t.commands.add("outdentBlock",new h(t,new f(s))))}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)||m).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=>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)}}e.default={Indent:a,IndentEditing:s,IndentUI:c,IndentBlock:b}}]).default; |
{ | ||
"name": "@ckeditor/ckeditor5-indent", | ||
"version": "27.0.0", | ||
"version": "27.1.0", | ||
"description": "Block indentation feature for CKEditor 5.", | ||
@@ -14,13 +14,13 @@ "keywords": [ | ||
"dependencies": { | ||
"ckeditor5": "^27.0.0" | ||
"ckeditor5": "^27.1.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-core": "^27.0.0", | ||
"@ckeditor/ckeditor5-core": "^27.1.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^24.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^27.0.0", | ||
"@ckeditor/ckeditor5-engine": "^27.0.0", | ||
"@ckeditor/ckeditor5-heading": "^27.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^27.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^27.0.0", | ||
"@ckeditor/ckeditor5-ui": "^27.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^27.1.0", | ||
"@ckeditor/ckeditor5-engine": "^27.1.0", | ||
"@ckeditor/ckeditor5-heading": "^27.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^27.1.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^27.1.0", | ||
"@ckeditor/ckeditor5-ui": "^27.1.0", | ||
"webpack": "^4.43.0", | ||
@@ -27,0 +27,0 @@ "webpack-cli": "^3.3.11" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Updatedckeditor5@^27.1.0