@ckeditor/ckeditor5-page-break 39.0.2 → 40.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://CKEditor5.pageBreak/./theme/pagebreak.css","webpack://CKEditor5.pageBreak/../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.pageBreak/../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.pageBreak/./theme/icons/pagebreak.svg","webpack://CKEditor5.pageBreak/./theme/pagebreak.css?ddac","webpack://CKEditor5.pageBreak/../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.pageBreak/./src/pagebreak.js","webpack://CKEditor5.pageBreak/./src/pagebreakcommand.js","webpack://CKEditor5.pageBreak/./src/pagebreakediting.js","webpack://CKEditor5.pageBreak/./src/pagebreakui.js","webpack://CKEditor5.pageBreak/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.pageBreak/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.pageBreak/delegated \"./src/widget.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.pageBreak/external var \"CKEditor5.dll\"","webpack://CKEditor5.pageBreak/webpack/bootstrap","webpack://CKEditor5.pageBreak/webpack/runtime/compat get default export","webpack://CKEditor5.pageBreak/webpack/runtime/define property getters","webpack://CKEditor5.pageBreak/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.pageBreak/webpack/runtime/make namespace object","webpack://CKEditor5.pageBreak/webpack/runtime/nonce","webpack://CKEditor5.pageBreak/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAC4H;AAC7B;AAC/F,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,kEAAkE,mBAAmB,WAAW,aAAa,uBAAuB,cAAc,kBAAkB,8BAA8B,iCAAiC,aAAa,kBAAkB,WAAW,+BAA+B,gBAAgB,yBAAyB,kBAAkB,uCAAuC,WAAW,cAAc,sDAAsD,gBAAgB,gBAAgB,kBAAkB,kBAAkB,yBAAyB,yBAAyB,sBAAsB,qBAAqB,iBAAiB,UAAU,aAAa,wBAAwB,UAAU,8BAA8B,cAAc,OAAO,8qBAA8qB,uBAAuB,gBAAgB,mBAAmB,kBAAkB,wBAAwB,4BAA4B,gBAAgB,kBAAkB,yBAAyB,gDAAgD,kBAAkB,KAAK,GAAG,oCAAoC,uBAAuB,eAAe,uBAAuB,mBAAmB,8BAA8B,sCAAsC,uBAAuB,+DAA+D,sBAAsB,sBAAsB,2BAA2B,iCAAiC,kDAAkD,uGAAuG,2BAA2B,0BAA0B,sBAAsB,GAAG,6FAA6F,6BAA6B,iBAAiB,kBAAkB,sBAAsB,OAAO,KAAK,GAAG,qBAAqB;AACl+E;AACA,iEAAe,uBAAuB,EAAC;;;;;;;;;;;;ACP1B;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA,4CAA4C,qBAAqB;AACjE;;AAEA;AACA,KAAK;AACL,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,qBAAqB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACjEa;;AAEb,kCAAkC;;AAElC,8BAA8B;;AAE9B,kDAAkD,gBAAgB,gEAAgE,wDAAwD,6DAA6D,sDAAsD;;AAE7S,uCAAuC,uDAAuD,uCAAuC,SAAS,OAAO,oBAAoB;;AAEzK,yCAAyC,8FAA8F,wBAAwB,eAAe,eAAe,gBAAgB,YAAY,MAAM,wBAAwB,+BAA+B,aAAa,qBAAqB,uCAAuC,cAAc,WAAW,YAAY,UAAU,MAAM,mDAAmD,UAAU,sBAAsB;;AAEve,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;;;;;ACnCA,iEAAe,8SAA8S;;;;;;;;;;;;;;;;;;ACA9N;AAC/F,YAA8K;;AAE9K,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,0JAAO;;;;AAIxB,iEAAe,iKAAc,MAAM;;;;;;;;;;;ACZtB;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAwC,GAAG,sBAAiB,GAAG,CAAI;;AAEnF;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,qEAAqE,qBAAqB,cAAc;;AAExG;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,yDAAyD;AACzD,IAAI;;AAEJ;;;AAGA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB,6BAA6B;AAClD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC5QA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACE;AACI;AACV;;AAExC;AACA;AACA;AACA;AACA;AACA,uCAAuC,+CAA+C;AACtF;AACA;AACA;AACe,wBAAwB,sDAAM;AAC7C;AACA;AACA;AACA;AACA,WAAW,yDAAgB,EAAE,oDAAW,EAAE,wDAAM;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACrCA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;AACoB;;AAEjE;AACA;AACA;AACA,iCAAiC,2DAA2D;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACe,+BAA+B,uDAAO;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;;AAEA;AACA;AACA,WAAW,iGAAiG;AAC5G,WAAW,mCAAmC;AAC9C,WAAW,iCAAiC;AAC5C,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,iGAAiG;AAC5G,WAAW,iCAAiC;AAC5C,aAAa;AACb;AACA,wBAAwB,+EAAyB;AACjD;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;AC/EA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACI;;AAEE;;AAElB;;AAEhC;AACA;AACA;AACA;AACA;AACe,+BAA+B,sDAAM;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA,OAAO,4BAA4B;AACnC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA,cAAc;AACd,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,wCAAwC,yDAAgB;AACxD;AACA;;AAEA,qBAAqB,0CAA0C;AAC/D,aAAa,6EAA6E;AAC1F;AACA,gBAAgB,oCAAoC;AACpD;AACA,YAAY,oCAAoC;AAChD,YAAY,kDAAkD;AAC9D,YAAY,QAAQ;AACpB,cAAc;AACd;AACA;;AAEA,QAAQ,8DAAQ,yBAAyB,QAAQ;AACjD;;;;;;;;;;;;;;;;;;;ACrIA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACE;;AAEW;;AAEzD;AACA;AACA;AACA;AACA;AACe,0BAA0B,sDAAM;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,wDAAU;;AAE9B;AACA;AACA,UAAU,kEAAa;AACvB;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;AACJ;AACA;;;;;;;;;;;ACxDA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACc;AACV","file":"page-break.js","sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".ck-content .page-break{align-items:center;clear:both;display:flex;justify-content:center;padding:5px 0;position:relative}.ck-content .page-break:after{border-bottom:2px dashed #c4c4c4;content:\\\"\\\";position:absolute;width:100%}.ck-content .page-break__label{background:#fff;border:1px solid #c4c4c4;border-radius:2px;box-shadow:2px 2px 1px rgba(0,0,0,.15);color:#333;display:block;font-family:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;font-size:.75em;font-weight:700;padding:.3em .6em;position:relative;text-transform:uppercase;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1}@media print{.ck-content .page-break{padding:0}.ck-content .page-break:after{display:none}}\", \"\",{\"version\":3,\"sources\":[\"webpack://./theme/pagebreak.css\"],\"names\":[],\"mappings\":\"AAKA,wBAKC,kBAAmB,CAHnB,UAAW,CAEX,YAAa,CAEb,sBAAuB,CAHvB,aAAc,CAFd,iBAaD,CANC,8BAGC,gCAAyC,CAFzC,UAAW,CACX,iBAAkB,CAElB,UACD,CAGD,+BAYC,eAA4B,CAN5B,wBAAiC,CACjC,iBAAkB,CAMlB,sCAA6C,CAF7C,UAAsB,CAPtB,aAAc,CAId,qDAA0D,CAC1D,eAAiB,CACjB,eAAiB,CAPjB,iBAAkB,CAFlB,iBAAkB,CAIlB,wBAAyB,CAWzB,wBAAyB,CACzB,qBAAsB,CACtB,oBAAqB,CACrB,gBAAiB,CAjBjB,SAkBD,CAGA,aACC,wBACC,SAKD,CAHC,8BACC,YACD,CAEF\",\"sourcesContent\":[\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n.ck-content .page-break {\\n\\tposition: relative;\\n\\tclear: both;\\n\\tpadding: 5px 0;\\n\\tdisplay: flex;\\n\\talign-items: center;\\n\\tjustify-content: center;\\n\\n\\t&::after {\\n\\t\\tcontent: '';\\n\\t\\tposition: absolute;\\n\\t\\tborder-bottom: 2px dashed hsl(0, 0%, 77%);\\n\\t\\twidth: 100%;\\n\\t}\\n}\\n\\n.ck-content .page-break__label {\\n\\tposition: relative;\\n\\tz-index: 1;\\n\\tpadding: .3em .6em;\\n\\tdisplay: block;\\n\\ttext-transform: uppercase;\\n\\tborder: 1px solid hsl(0, 0%, 77%);\\n\\tborder-radius: 2px;\\n\\tfont-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;\\n\\tfont-size: 0.75em;\\n\\tfont-weight: bold;\\n\\tcolor: hsl(0, 0%, 20%);\\n\\tbackground: hsl(0, 0%, 100%);\\n\\tbox-shadow: 2px 2px 1px hsla(0, 0%, 0%, 0.15);\\n\\n\\t/* Disable the possibility to select the label text by the user. */\\n\\t-webkit-user-select: none;\\n\\t-moz-user-select: none;\\n\\t-ms-user-select: none;\\n\\tuser-select: none;\\n}\\n\\n/* Do not show the page break element inside the print preview window. */\\n@media print {\\n\\t.ck-content .page-break {\\n\\t\\tpadding: 0;\\n\\n\\t\\t&::after {\\n\\t\\t\\tdisplay: none;\\n\\t\\t}\\n\\t}\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","export default \"<svg viewBox=\\\"0 0 20 20\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path d=\\\"M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z\\\"/><path d=\\\"M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z\\\"/><path d=\\\"M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z\\\"/></svg>\";","import api from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./pagebreak.css\";\n\nvar options = {\"injectType\":\"singletonStyleTag\",\"attributes\":{\"data-cke\":true}};\n\noptions.insert = \"head\";\noptions.singleton = true;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module page-break/pagebreak\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Widget } from 'ckeditor5/src/widget';\nimport PageBreakEditing from './pagebreakediting';\nimport PageBreakUI from './pagebreakui';\n\n/**\n * The page break feature.\n *\n * It provides the possibility to insert a page break into the rich-text editor.\n *\n * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class PageBreak extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ PageBreakEditing, PageBreakUI, Widget ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'PageBreak';\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module page-break/pagebreakcommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { findOptimalInsertionRange } from 'ckeditor5/src/widget';\n\n/**\n * The page break command.\n *\n * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.\n *\n * To insert a page break at the current selection, execute the command:\n *\n *\t\teditor.execute( 'pageBreak' );\n *\n * @extends module:core/command~Command\n */\nexport default class PageBreakCommand extends Command {\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tconst model = this.editor.model;\n\t\tconst schema = model.schema;\n\t\tconst selection = model.document.selection;\n\n\t\tthis.isEnabled = isPageBreakAllowedInParent( selection, schema, model );\n\t}\n\n\t/**\n\t * Executes the command.\n\t *\n\t * @fires execute\n\t */\n\texecute() {\n\t\tconst model = this.editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\tconst pageBreakElement = writer.createElement( 'pageBreak' );\n\n\t\t\tmodel.insertObject( pageBreakElement, null, null, {\n\t\t\t\tsetSelection: 'after'\n\t\t\t} );\n\t\t} );\n\t}\n}\n\n// Checks if a page break is allowed by the schema in the optimal insertion parent.\n//\n// @param {module:engine/model/selection~Selection|module:engine/model/documentselection~DocumentSelection} selection\n// @param {module:engine/model/schema~Schema} schema\n// @param {module:engine/model/model~Model} model Model instance.\n// @returns {Boolean}\nfunction isPageBreakAllowedInParent( selection, schema, model ) {\n\tconst parent = getInsertPageBreakParent( selection, model );\n\n\treturn schema.checkChild( parent, 'pageBreak' );\n}\n\n// Returns a node that will be used to insert a page break with `model.insertContent` to check if the page break can be placed there.\n//\n// @param {module:engine/model/selection~Selection|module:engine/model/documentselection~DocumentSelection} selection\n// @param {module:engine/model/model~Model} model Model instance.\n// @returns {module:engine/model/element~Element}\nfunction getInsertPageBreakParent( selection, model ) {\n\tconst insertionRange = findOptimalInsertionRange( selection, model );\n\tconst parent = insertionRange.start.parent;\n\n\tif ( parent.isEmpty && !parent.is( 'element', '$root' ) ) {\n\t\treturn parent.parent;\n\t}\n\n\treturn parent;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module page-break/pagebreakediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { toWidget } from 'ckeditor5/src/widget';\n\nimport PageBreakCommand from './pagebreakcommand';\n\nimport '../theme/pagebreak.css';\n\n/**\n * The page break editing feature.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class PageBreakEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'PageBreakEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst schema = editor.model.schema;\n\t\tconst t = editor.t;\n\t\tconst conversion = editor.conversion;\n\n\t\tschema.register( 'pageBreak', {\n\t\t\tinheritAllFrom: '$blockObject'\n\t\t} );\n\n\t\tconversion.for( 'dataDowncast' ).elementToStructure( {\n\t\t\tmodel: 'pageBreak',\n\t\t\tview: ( modelElement, { writer } ) => {\n\t\t\t\tconst divElement = writer.createContainerElement( 'div',\n\t\t\t\t\t{\n\t\t\t\t\t\tclass: 'page-break',\n\t\t\t\t\t\t// If user has no `.ck-content` styles, it should always break a page during print.\n\t\t\t\t\t\tstyle: 'page-break-after: always'\n\t\t\t\t\t},\n\t\t\t\t\t// For a rationale of using span inside a div see:\n\t\t\t\t\t// https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062.\n\t\t\t\t\twriter.createContainerElement( 'span', {\n\t\t\t\t\t\tstyle: 'display: none'\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\treturn divElement;\n\t\t\t}\n\t\t} );\n\n\t\tconversion.for( 'editingDowncast' ).elementToStructure( {\n\t\t\tmodel: 'pageBreak',\n\t\t\tview: ( modelElement, { writer } ) => {\n\t\t\t\tconst label = t( 'Page break' );\n\t\t\t\tconst viewWrapper = writer.createContainerElement( 'div' );\n\t\t\t\tconst viewLabelElement = writer.createRawElement(\n\t\t\t\t\t'span',\n\t\t\t\t\t{ class: 'page-break__label' },\n\t\t\t\t\tfunction( domElement ) {\n\t\t\t\t\t\tdomElement.innerText = t( 'Page break' );\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\twriter.addClass( 'page-break', viewWrapper );\n\t\t\t\twriter.insert( writer.createPositionAt( viewWrapper, 0 ), viewLabelElement );\n\n\t\t\t\treturn toPageBreakWidget( viewWrapper, writer, label );\n\t\t\t}\n\t\t} );\n\n\t\tconversion.for( 'upcast' )\n\t\t\t.elementToElement( {\n\t\t\t\tview: element => {\n\t\t\t\t\t// For upcast conversion it's enough if we check for element style and verify if it's empty\n\t\t\t\t\t// or contains only hidden span element.\n\n\t\t\t\t\tconst hasPageBreakBefore = element.getStyle( 'page-break-before' ) == 'always';\n\t\t\t\t\tconst hasPageBreakAfter = element.getStyle( 'page-break-after' ) == 'always';\n\n\t\t\t\t\tif ( !hasPageBreakBefore && !hasPageBreakAfter ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// The \"page break\" div accepts only single child or no child at all.\n\t\t\t\t\tif ( element.childCount == 1 ) {\n\t\t\t\t\t\tconst viewSpan = element.getChild( 0 );\n\n\t\t\t\t\t\t// The child must be the \"span\" element that is not displayed.\n\t\t\t\t\t\tif ( !viewSpan.is( 'element', 'span' ) || viewSpan.getStyle( 'display' ) != 'none' ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if ( element.childCount > 1 ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { name: true };\n\t\t\t\t},\n\t\t\t\tmodel: 'pageBreak',\n\n\t\t\t\t// This conversion must be checked before <br> conversion because some editors use\n\t\t\t\t// <br style=\"page-break-before:always\"> as a page break marker.\n\t\t\t\tconverterPriority: 'high'\n\t\t\t} );\n\n\t\teditor.commands.add( 'pageBreak', new PageBreakCommand( editor ) );\n\t}\n}\n\n// Converts a given {@link module:engine/view/element~Element} to a page break widget:\n// * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to\n// recognize the page break widget element.\n// * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n//\n// @param {module:engine/view/element~Element} viewElement\n// @param {module:engine/view/downcastwriter~DowncastWriter} writer An instance of the view writer.\n// @param {String} label The element's label.\n// @returns {module:engine/view/element~Element}\nfunction toPageBreakWidget( viewElement, writer, label ) {\n\twriter.setCustomProperty( 'pageBreak', true, viewElement );\n\n\treturn toWidget( viewElement, writer, { label } );\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module page-break/pagebreakui\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { ButtonView } from 'ckeditor5/src/ui';\n\nimport pageBreakIcon from '../theme/icons/pagebreak.svg';\n\n/**\n * The page break UI plugin.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class PageBreakUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'PageBreakUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\n\t\t// Add pageBreak button to feature components.\n\t\teditor.ui.componentFactory.add( 'pageBreak', locale => {\n\t\t\tconst command = editor.commands.get( 'pageBreak' );\n\t\t\tconst view = new ButtonView( locale );\n\n\t\t\tview.set( {\n\t\t\t\tlabel: t( 'Page break' ),\n\t\t\t\ticon: pageBreakIcon,\n\t\t\t\ttooltip: true\n\t\t\t} );\n\n\t\t\tview.bind( 'isEnabled' ).to( command, 'isEnabled' );\n\n\t\t\t// Execute command.\n\t\t\tthis.listenTo( view, 'execute', () => {\n\t\t\t\teditor.execute( 'pageBreak' );\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\treturn view;\n\t\t} );\n\t}\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/ui.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/widget.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nc = undefined;","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module page-break\n */\n\nexport { default as PageBreak } from './pagebreak';\nexport { default as PageBreakEditing } from './pagebreakediting';\nexport { default as PageBreakUI } from './pagebreakui';\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-page-break",
3
- "version": "39.0.2",
3
+ "version": "40.0.0",
4
4
  "description": "Page break feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "39.0.2"
15
+ "ckeditor5": "40.0.0"
16
16
  },
17
17
  "author": "CKSource (http://cksource.com/)",
18
18
  "license": "GPL-2.0-or-later",
@@ -1,15 +1,15 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- import type { PageBreak, PageBreakEditing, PageBreakUI, PageBreakCommand } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [PageBreak.pluginName]: PageBreak;
9
- [PageBreakEditing.pluginName]: PageBreakEditing;
10
- [PageBreakUI.pluginName]: PageBreakUI;
11
- }
12
- interface CommandsMap {
13
- pageBreak: PageBreakCommand;
14
- }
15
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { PageBreak, PageBreakEditing, PageBreakUI, PageBreakCommand } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [PageBreak.pluginName]: PageBreak;
9
+ [PageBreakEditing.pluginName]: PageBreakEditing;
10
+ [PageBreakUI.pluginName]: PageBreakUI;
11
+ }
12
+ interface CommandsMap {
13
+ pageBreak: PageBreakCommand;
14
+ }
15
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
package/src/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break
7
- */
8
- export { default as PageBreak } from './pagebreak';
9
- export { default as PageBreakEditing } from './pagebreakediting';
10
- export { default as PageBreakUI } from './pagebreakui';
11
- export type { default as PageBreakCommand } from './pagebreakcommand';
12
- import './augmentation';
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break
7
+ */
8
+ export { default as PageBreak } from './pagebreak';
9
+ export { default as PageBreakEditing } from './pagebreakediting';
10
+ export { default as PageBreakUI } from './pagebreakui';
11
+ export type { default as PageBreakCommand } from './pagebreakcommand';
12
+ import './augmentation';
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break
7
- */
8
- export { default as PageBreak } from './pagebreak';
9
- export { default as PageBreakEditing } from './pagebreakediting';
10
- export { default as PageBreakUI } from './pagebreakui';
11
- import './augmentation';
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break
7
+ */
8
+ export { default as PageBreak } from './pagebreak';
9
+ export { default as PageBreakEditing } from './pagebreakediting';
10
+ export { default as PageBreakUI } from './pagebreakui';
11
+ import './augmentation';
@@ -1,28 +1,28 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreak
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { Widget } from 'ckeditor5/src/widget';
10
- import PageBreakEditing from './pagebreakediting';
11
- import PageBreakUI from './pagebreakui';
12
- /**
13
- * The page break feature.
14
- *
15
- * It provides the possibility to insert a page break into the rich-text editor.
16
- *
17
- * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.
18
- */
19
- export default class PageBreak extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires(): readonly [typeof PageBreakEditing, typeof PageBreakUI, typeof Widget];
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName(): "PageBreak";
28
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreak
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { Widget } from 'ckeditor5/src/widget';
10
+ import PageBreakEditing from './pagebreakediting';
11
+ import PageBreakUI from './pagebreakui';
12
+ /**
13
+ * The page break feature.
14
+ *
15
+ * It provides the possibility to insert a page break into the rich-text editor.
16
+ *
17
+ * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.
18
+ */
19
+ export default class PageBreak extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires(): readonly [typeof PageBreakEditing, typeof PageBreakUI, typeof Widget];
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "PageBreak";
28
+ }
package/src/pagebreak.js CHANGED
@@ -1,32 +1,32 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreak
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { Widget } from 'ckeditor5/src/widget';
10
- import PageBreakEditing from './pagebreakediting';
11
- import PageBreakUI from './pagebreakui';
12
- /**
13
- * The page break feature.
14
- *
15
- * It provides the possibility to insert a page break into the rich-text editor.
16
- *
17
- * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.
18
- */
19
- export default class PageBreak extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires() {
24
- return [PageBreakEditing, PageBreakUI, Widget];
25
- }
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'PageBreak';
31
- }
32
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreak
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { Widget } from 'ckeditor5/src/widget';
10
+ import PageBreakEditing from './pagebreakediting';
11
+ import PageBreakUI from './pagebreakui';
12
+ /**
13
+ * The page break feature.
14
+ *
15
+ * It provides the possibility to insert a page break into the rich-text editor.
16
+ *
17
+ * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.
18
+ */
19
+ export default class PageBreak extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires() {
24
+ return [PageBreakEditing, PageBreakUI, Widget];
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName() {
30
+ return 'PageBreak';
31
+ }
32
+ }
@@ -1,29 +1,29 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakcommand
7
- */
8
- import { Command } from 'ckeditor5/src/core';
9
- /**
10
- * The page break command.
11
- *
12
- * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.
13
- *
14
- * To insert a page break at the current selection, execute the command:
15
- *
16
- * editor.execute( 'pageBreak' );
17
- */
18
- export default class PageBreakCommand extends Command {
19
- /**
20
- * @inheritDoc
21
- */
22
- refresh(): void;
23
- /**
24
- * Executes the command.
25
- *
26
- * @fires execute
27
- */
28
- execute(): void;
29
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakcommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core';
9
+ /**
10
+ * The page break command.
11
+ *
12
+ * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.
13
+ *
14
+ * To insert a page break at the current selection, execute the command:
15
+ *
16
+ * editor.execute( 'pageBreak' );
17
+ */
18
+ export default class PageBreakCommand extends Command {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ refresh(): void;
23
+ /**
24
+ * Executes the command.
25
+ *
26
+ * @fires execute
27
+ */
28
+ execute(): void;
29
+ }
@@ -1,61 +1,61 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakcommand
7
- */
8
- import { Command } from 'ckeditor5/src/core';
9
- import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
10
- /**
11
- * The page break command.
12
- *
13
- * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.
14
- *
15
- * To insert a page break at the current selection, execute the command:
16
- *
17
- * editor.execute( 'pageBreak' );
18
- */
19
- export default class PageBreakCommand extends Command {
20
- /**
21
- * @inheritDoc
22
- */
23
- refresh() {
24
- const model = this.editor.model;
25
- const schema = model.schema;
26
- const selection = model.document.selection;
27
- this.isEnabled = isPageBreakAllowedInParent(selection, schema, model);
28
- }
29
- /**
30
- * Executes the command.
31
- *
32
- * @fires execute
33
- */
34
- execute() {
35
- const model = this.editor.model;
36
- model.change(writer => {
37
- const pageBreakElement = writer.createElement('pageBreak');
38
- model.insertObject(pageBreakElement, null, null, {
39
- setSelection: 'after'
40
- });
41
- });
42
- }
43
- }
44
- /**
45
- * Checks if a page break is allowed by the schema in the optimal insertion parent.
46
- */
47
- function isPageBreakAllowedInParent(selection, schema, model) {
48
- const parent = getInsertPageBreakParent(selection, model);
49
- return schema.checkChild(parent, 'pageBreak');
50
- }
51
- /**
52
- * Returns a node that will be used to insert a page break with `model.insertContent` to check if the page break can be placed there.
53
- */
54
- function getInsertPageBreakParent(selection, model) {
55
- const insertionRange = findOptimalInsertionRange(selection, model);
56
- const parent = insertionRange.start.parent;
57
- if (parent.isEmpty && !parent.is('element', '$root')) {
58
- return parent.parent;
59
- }
60
- return parent;
61
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakcommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core';
9
+ import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
10
+ /**
11
+ * The page break command.
12
+ *
13
+ * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.
14
+ *
15
+ * To insert a page break at the current selection, execute the command:
16
+ *
17
+ * editor.execute( 'pageBreak' );
18
+ */
19
+ export default class PageBreakCommand extends Command {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ refresh() {
24
+ const model = this.editor.model;
25
+ const schema = model.schema;
26
+ const selection = model.document.selection;
27
+ this.isEnabled = isPageBreakAllowedInParent(selection, schema, model);
28
+ }
29
+ /**
30
+ * Executes the command.
31
+ *
32
+ * @fires execute
33
+ */
34
+ execute() {
35
+ const model = this.editor.model;
36
+ model.change(writer => {
37
+ const pageBreakElement = writer.createElement('pageBreak');
38
+ model.insertObject(pageBreakElement, null, null, {
39
+ setSelection: 'after'
40
+ });
41
+ });
42
+ }
43
+ }
44
+ /**
45
+ * Checks if a page break is allowed by the schema in the optimal insertion parent.
46
+ */
47
+ function isPageBreakAllowedInParent(selection, schema, model) {
48
+ const parent = getInsertPageBreakParent(selection, model);
49
+ return schema.checkChild(parent, 'pageBreak');
50
+ }
51
+ /**
52
+ * Returns a node that will be used to insert a page break with `model.insertContent` to check if the page break can be placed there.
53
+ */
54
+ function getInsertPageBreakParent(selection, model) {
55
+ const insertionRange = findOptimalInsertionRange(selection, model);
56
+ const parent = insertionRange.start.parent;
57
+ if (parent.isEmpty && !parent.is('element', '$root')) {
58
+ return parent.parent;
59
+ }
60
+ return parent;
61
+ }
@@ -1,22 +1,22 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import '../theme/pagebreak.css';
10
- /**
11
- * The page break editing feature.
12
- */
13
- export default class PageBreakEditing extends Plugin {
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName(): "PageBreakEditing";
18
- /**
19
- * @inheritDoc
20
- */
21
- init(): void;
22
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import '../theme/pagebreak.css';
10
+ /**
11
+ * The page break editing feature.
12
+ */
13
+ export default class PageBreakEditing extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "PageBreakEditing";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ init(): void;
22
+ }
@@ -1,102 +1,102 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { toWidget } from 'ckeditor5/src/widget';
10
- import PageBreakCommand from './pagebreakcommand';
11
- import '../theme/pagebreak.css';
12
- /**
13
- * The page break editing feature.
14
- */
15
- export default class PageBreakEditing extends Plugin {
16
- /**
17
- * @inheritDoc
18
- */
19
- static get pluginName() {
20
- return 'PageBreakEditing';
21
- }
22
- /**
23
- * @inheritDoc
24
- */
25
- init() {
26
- const editor = this.editor;
27
- const schema = editor.model.schema;
28
- const t = editor.t;
29
- const conversion = editor.conversion;
30
- schema.register('pageBreak', {
31
- inheritAllFrom: '$blockObject'
32
- });
33
- conversion.for('dataDowncast').elementToStructure({
34
- model: 'pageBreak',
35
- view: (modelElement, { writer }) => {
36
- const divElement = writer.createContainerElement('div', {
37
- class: 'page-break',
38
- // If user has no `.ck-content` styles, it should always break a page during print.
39
- style: 'page-break-after: always'
40
- },
41
- // For a rationale of using span inside a div see:
42
- // https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062.
43
- writer.createContainerElement('span', {
44
- style: 'display: none'
45
- }));
46
- return divElement;
47
- }
48
- });
49
- conversion.for('editingDowncast').elementToStructure({
50
- model: 'pageBreak',
51
- view: (modelElement, { writer }) => {
52
- const label = t('Page break');
53
- const viewWrapper = writer.createContainerElement('div');
54
- const viewLabelElement = writer.createRawElement('span', { class: 'page-break__label' }, function (domElement) {
55
- domElement.innerText = t('Page break');
56
- });
57
- writer.addClass('page-break', viewWrapper);
58
- writer.insert(writer.createPositionAt(viewWrapper, 0), viewLabelElement);
59
- return toPageBreakWidget(viewWrapper, writer, label);
60
- }
61
- });
62
- conversion.for('upcast')
63
- .elementToElement({
64
- view: element => {
65
- // For upcast conversion it's enough if we check for element style and verify if it's empty
66
- // or contains only hidden span element.
67
- const hasPageBreakBefore = element.getStyle('page-break-before') == 'always';
68
- const hasPageBreakAfter = element.getStyle('page-break-after') == 'always';
69
- if (!hasPageBreakBefore && !hasPageBreakAfter) {
70
- return null;
71
- }
72
- // The "page break" div accepts only single child or no child at all.
73
- if (element.childCount == 1) {
74
- const viewSpan = element.getChild(0);
75
- // The child must be the "span" element that is not displayed.
76
- if (!viewSpan.is('element', 'span') || viewSpan.getStyle('display') != 'none') {
77
- return null;
78
- }
79
- }
80
- else if (element.childCount > 1) {
81
- return null;
82
- }
83
- return { name: true };
84
- },
85
- model: 'pageBreak',
86
- // This conversion must be checked before <br> conversion because some editors use
87
- // <br style="page-break-before:always"> as a page break marker.
88
- converterPriority: 'high'
89
- });
90
- editor.commands.add('pageBreak', new PageBreakCommand(editor));
91
- }
92
- }
93
- /**
94
- * Converts a given {@link module:engine/view/element~Element} to a page break widget:
95
- * * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
96
- * recognize the page break widget element.
97
- * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
98
- */
99
- function toPageBreakWidget(viewElement, writer, label) {
100
- writer.setCustomProperty('pageBreak', true, viewElement);
101
- return toWidget(viewElement, writer, { label });
102
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { toWidget } from 'ckeditor5/src/widget';
10
+ import PageBreakCommand from './pagebreakcommand';
11
+ import '../theme/pagebreak.css';
12
+ /**
13
+ * The page break editing feature.
14
+ */
15
+ export default class PageBreakEditing extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName() {
20
+ return 'PageBreakEditing';
21
+ }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init() {
26
+ const editor = this.editor;
27
+ const schema = editor.model.schema;
28
+ const t = editor.t;
29
+ const conversion = editor.conversion;
30
+ schema.register('pageBreak', {
31
+ inheritAllFrom: '$blockObject'
32
+ });
33
+ conversion.for('dataDowncast').elementToStructure({
34
+ model: 'pageBreak',
35
+ view: (modelElement, { writer }) => {
36
+ const divElement = writer.createContainerElement('div', {
37
+ class: 'page-break',
38
+ // If user has no `.ck-content` styles, it should always break a page during print.
39
+ style: 'page-break-after: always'
40
+ },
41
+ // For a rationale of using span inside a div see:
42
+ // https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062.
43
+ writer.createContainerElement('span', {
44
+ style: 'display: none'
45
+ }));
46
+ return divElement;
47
+ }
48
+ });
49
+ conversion.for('editingDowncast').elementToStructure({
50
+ model: 'pageBreak',
51
+ view: (modelElement, { writer }) => {
52
+ const label = t('Page break');
53
+ const viewWrapper = writer.createContainerElement('div');
54
+ const viewLabelElement = writer.createRawElement('span', { class: 'page-break__label' }, function (domElement) {
55
+ domElement.innerText = t('Page break');
56
+ });
57
+ writer.addClass('page-break', viewWrapper);
58
+ writer.insert(writer.createPositionAt(viewWrapper, 0), viewLabelElement);
59
+ return toPageBreakWidget(viewWrapper, writer, label);
60
+ }
61
+ });
62
+ conversion.for('upcast')
63
+ .elementToElement({
64
+ view: element => {
65
+ // For upcast conversion it's enough if we check for element style and verify if it's empty
66
+ // or contains only hidden span element.
67
+ const hasPageBreakBefore = element.getStyle('page-break-before') == 'always';
68
+ const hasPageBreakAfter = element.getStyle('page-break-after') == 'always';
69
+ if (!hasPageBreakBefore && !hasPageBreakAfter) {
70
+ return null;
71
+ }
72
+ // The "page break" div accepts only single child or no child at all.
73
+ if (element.childCount == 1) {
74
+ const viewSpan = element.getChild(0);
75
+ // The child must be the "span" element that is not displayed.
76
+ if (!viewSpan.is('element', 'span') || viewSpan.getStyle('display') != 'none') {
77
+ return null;
78
+ }
79
+ }
80
+ else if (element.childCount > 1) {
81
+ return null;
82
+ }
83
+ return { name: true };
84
+ },
85
+ model: 'pageBreak',
86
+ // This conversion must be checked before <br> conversion because some editors use
87
+ // <br style="page-break-before:always"> as a page break marker.
88
+ converterPriority: 'high'
89
+ });
90
+ editor.commands.add('pageBreak', new PageBreakCommand(editor));
91
+ }
92
+ }
93
+ /**
94
+ * Converts a given {@link module:engine/view/element~Element} to a page break widget:
95
+ * * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
96
+ * recognize the page break widget element.
97
+ * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
98
+ */
99
+ function toPageBreakWidget(viewElement, writer, label) {
100
+ writer.setCustomProperty('pageBreak', true, viewElement);
101
+ return toWidget(viewElement, writer, { label });
102
+ }
@@ -1,21 +1,21 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- /**
10
- * The page break UI plugin.
11
- */
12
- export default class PageBreakUI extends Plugin {
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "PageBreakUI";
17
- /**
18
- * @inheritDoc
19
- */
20
- init(): void;
21
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ /**
10
+ * The page break UI plugin.
11
+ */
12
+ export default class PageBreakUI extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "PageBreakUI";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ init(): void;
21
+ }
@@ -1,45 +1,45 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module page-break/pagebreakui
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { ButtonView } from 'ckeditor5/src/ui';
10
- import pageBreakIcon from '../theme/icons/pagebreak.svg';
11
- /**
12
- * The page break UI plugin.
13
- */
14
- export default class PageBreakUI extends Plugin {
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName() {
19
- return 'PageBreakUI';
20
- }
21
- /**
22
- * @inheritDoc
23
- */
24
- init() {
25
- const editor = this.editor;
26
- const t = editor.t;
27
- // Add pageBreak button to feature components.
28
- editor.ui.componentFactory.add('pageBreak', locale => {
29
- const command = editor.commands.get('pageBreak');
30
- const view = new ButtonView(locale);
31
- view.set({
32
- label: t('Page break'),
33
- icon: pageBreakIcon,
34
- tooltip: true
35
- });
36
- view.bind('isEnabled').to(command, 'isEnabled');
37
- // Execute command.
38
- this.listenTo(view, 'execute', () => {
39
- editor.execute('pageBreak');
40
- editor.editing.view.focus();
41
- });
42
- return view;
43
- });
44
- }
45
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module page-break/pagebreakui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import { ButtonView } from 'ckeditor5/src/ui';
10
+ import pageBreakIcon from '../theme/icons/pagebreak.svg';
11
+ /**
12
+ * The page break UI plugin.
13
+ */
14
+ export default class PageBreakUI extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName() {
19
+ return 'PageBreakUI';
20
+ }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init() {
25
+ const editor = this.editor;
26
+ const t = editor.t;
27
+ // Add pageBreak button to feature components.
28
+ editor.ui.componentFactory.add('pageBreak', locale => {
29
+ const command = editor.commands.get('pageBreak');
30
+ const view = new ButtonView(locale);
31
+ view.set({
32
+ label: t('Page break'),
33
+ icon: pageBreakIcon,
34
+ tooltip: true
35
+ });
36
+ view.bind('isEnabled').to(command, 'isEnabled');
37
+ // Execute command.
38
+ this.listenTo(view, 'execute', () => {
39
+ editor.execute('pageBreak');
40
+ editor.editing.view.focus();
41
+ });
42
+ return view;
43
+ });
44
+ }
45
+ }