@ckeditor/ckeditor5-source-editing 38.0.1 → 38.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/source-editing.js +1 -1
- package/build/source-editing.js.map +1 -0
- package/package.json +3 -24
- package/src/augmentation.d.ts +10 -10
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +9 -9
- package/src/index.js +9 -9
- package/src/sourceediting.d.ts +102 -102
- package/src/sourceediting.js +298 -298
- package/src/utils/formathtml.d.ts +19 -19
- package/src/utils/formathtml.js +128 -128
package/build/source-editing.js
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
/*!
|
3
3
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
4
4
|
* For licensing, see LICENSE.md.
|
5
|
-
*/(()=>{var e={821:(e,t,i)=>{"use strict";i.d(t,{Z:()=>r});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck-source-editing-area{overflow:hidden;position:relative}.ck-source-editing-area textarea,.ck-source-editing-area:after{border:1px solid transparent;font-family:monospace;font-size:var(--ck-font-size-normal);line-height:var(--ck-line-height-base);margin:0;padding:var(--ck-spacing-large);white-space:pre-wrap}.ck-source-editing-area:after{content:attr(data-value) " ";display:block;visibility:hidden}.ck-source-editing-area textarea{border-color:var(--ck-color-base-border);border-radius:0;box-sizing:border-box;height:100%;outline:none;overflow:hidden;position:absolute;resize:none;width:100%}.ck-rounded-corners .ck-source-editing-area textarea,.ck-source-editing-area textarea.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck-source-editing-area textarea:not([readonly]):focus{border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;outline:none}',""]);const r=o},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i=e(t);return t[2]?"@media ".concat(t[2]," {").concat(i,"}"):i})).join("")},t.i=function(e,i,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(o[a]=!0)}for(var s=0;s<e.length;s++){var d=[].concat(e[s]);n&&o[d[0]]||(i&&(d[2]?d[2]="".concat(i," and ").concat(d[2]):d[2]=i),t.push(d))}},t}},62:(e,t,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),a=[];function s(e){for(var t=-1,i=0;i<a.length;i++)if(a[i].identifier===e){t=i;break}return t}function d(e,t){for(var i={},n=[],o=0;o<e.length;o++){var r=e[o],d=t.base?r[0]+t.base:r[0],c=i[d]||0,l="".concat(d," ").concat(c);i[d]=c+1;var u=s(l),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(a[u].references++,a[u].updater(h)):a.push({identifier:l,updater:p(h,t),references:1}),n.push(l)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var l,u=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function h(e,t,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function m(e,t,i){var n=i.css,o=i.media,r=i.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,g=0;function p(e,t){var i,n,o;if(t.singleton){var r=g++;i=f||(f=c(t)),n=h.bind(null,i,r,!1),o=h.bind(null,i,r,!0)}else i=c(t),n=m.bind(null,i,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var i=d(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var o=s(i[n]);a[o].references--}for(var r=d(e,t),c=0;c<i.length;c++){var l=s(i[c]);0===a[l].references&&(a[l].updater(),a.splice(l,1))}i=r}}}},704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={id:n,exports:{}};return e[n](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var n={};(()=>{"use strict";i.r(n),i.d(n,{SourceEditing:()=>h});var e=i(704),t=i(273),o=i(209);function r(e){const t=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"br",isVoid:!0},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"input",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"textarea",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],i=t.map((e=>e.name)).join("|"),n=e.replace(new RegExp(`</?(${i})( .*?)?>`,"g"),"\n$&\n").split("\n");let o=0;return n.filter((e=>e.length)).map((e=>function(e,t){return t.some((t=>!t.isVoid&&!!new RegExp(`<${t.name}( .*?)?>`).test(e)))}(e,t)?a(e,o++):function(e,t){return t.some((t=>new RegExp(`</${t.name}>`).test(e)))}(e,t)?a(e,--o):a(e,o))).join("\n")}function a(e,t,i=" "){return`${i.repeat(Math.max(0,t))}${e}`}var s=i(62),d=i.n(s),c=i(821),l={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};d()(c.Z,l);c.Z.locals;const u="SourceEditingMode";class h extends e.Plugin{constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new o.ElementReplacer,this._replacedRoots=new Map,this._dataFromRoots=new Map}static get pluginName(){return"SourceEditing"}static get requires(){return[e.PendingActions]}init(){const i=this.editor,n=i.t;i.ui.componentFactory.add("sourceEditing",(o=>{const r=new t.ButtonView(o);return r.set({label:n("Source"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,withText:!0,class:"ck-source-editing-button"}),r.bind("isOn").to(this,"isSourceEditingMode"),r.bind("isEnabled").to(this,"isEnabled",i,"isReadOnly",i.plugins.get(e.PendingActions),"hasAny",((e,t,i)=>!!e&&(!t&&!i))),this.listenTo(r,"execute",(()=>{this.isSourceEditingMode=!this.isSourceEditingMode})),r})),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",((e,t,i)=>{i?(this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())})),this.on("change:isEnabled",((e,t,i)=>this._handleReadOnlyMode(!i))),this.listenTo(i,"change:isReadOnly",((e,t,i)=>this._handleReadOnlyMode(i)))),i.data.on("get",(()=>{this.isSourceEditingMode&&this.updateEditorData()}),{priority:"high"})}afterInit(){const e=this.editor;["RealTimeCollaborativeEditing","CommentsEditing","TrackChangesEditing","RevisionHistory"].some((t=>e.plugins.has(t)))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}updateEditorData(){const e=this.editor,t={};for(const[e,i]of this._replacedRoots){const n=this._dataFromRoots.get(e),o=i.dataset.value;n!==o&&(t[e]=o)}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0}})}_showSourceEditing(){const e=this.editor,t=e.editing.view,i=e.model;i.change((e=>{e.setSelection(null),e.removeSelectionAttribute(i.document.selection.getAttributeKeys())}));for(const[i,n]of t.domRoots){const r=m(e.data.get({rootName:i})),a=(0,o.createElement)(n.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),s=(0,o.createElement)(n.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[a]);a.value=r,a.setSelectionRange(0,0),a.addEventListener("input",(()=>{s.dataset.value=a.value,e.ui.update()})),t.change((e=>{const n=t.document.getRoot(i);e.addClass("ck-hidden",n)})),e.ui.setEditableElement("sourceEditing:"+i,a),this._replacedRoots.set(i,s),this._elementReplacer.replace(n,s),this._dataFromRoots.set(i,r)}this._focusSourceEditing()}_hideSourceEditing(){const e=this.editor.editing.view;this.updateEditorData(),e.change((t=>{for(const[i]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(i))})),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),e.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(u)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(u)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}}function m(e){return function(e){return e.startsWith("<")}(e)?r(e):e}})(),(window.CKEditor5=window.CKEditor5||{}).sourceEditing=n})();
|
5
|
+
*/(()=>{var e={40:(e,t,i)=>{"use strict";i.d(t,{Z:()=>r});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck-source-editing-area{overflow:hidden;position:relative}.ck-source-editing-area textarea,.ck-source-editing-area:after{border:1px solid transparent;font-family:monospace;font-size:var(--ck-font-size-normal);line-height:var(--ck-line-height-base);margin:0;padding:var(--ck-spacing-large);white-space:pre-wrap}.ck-source-editing-area:after{content:attr(data-value) " ";display:block;visibility:hidden}.ck-source-editing-area textarea{border-color:var(--ck-color-base-border);border-radius:0;box-sizing:border-box;height:100%;outline:none;overflow:hidden;position:absolute;resize:none;width:100%}.ck-rounded-corners .ck-source-editing-area textarea,.ck-source-editing-area textarea.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck-source-editing-area textarea:not([readonly]):focus{border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;outline:none}',""]);const r=o},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i=e(t);return t[2]?"@media ".concat(t[2]," {").concat(i,"}"):i})).join("")},t.i=function(e,i,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(o[a]=!0)}for(var s=0;s<e.length;s++){var d=[].concat(e[s]);n&&o[d[0]]||(i&&(d[2]?d[2]="".concat(i," and ").concat(d[2]):d[2]=i),t.push(d))}},t}},62:(e,t,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),a=[];function s(e){for(var t=-1,i=0;i<a.length;i++)if(a[i].identifier===e){t=i;break}return t}function d(e,t){for(var i={},n=[],o=0;o<e.length;o++){var r=e[o],d=t.base?r[0]+t.base:r[0],c=i[d]||0,l="".concat(d," ").concat(c);i[d]=c+1;var u=s(l),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(a[u].references++,a[u].updater(h)):a.push({identifier:l,updater:p(h,t),references:1}),n.push(l)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var a=r(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var l,u=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function h(e,t,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function m(e,t,i){var n=i.css,o=i.media,r=i.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,g=0;function p(e,t){var i,n,o;if(t.singleton){var r=g++;i=f||(f=c(t)),n=h.bind(null,i,r,!1),o=h.bind(null,i,r,!0)}else i=c(t),n=m.bind(null,i,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var i=d(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var o=s(i[n]);a[o].references--}for(var r=d(e,t),c=0;c<i.length;c++){var l=s(i[c]);0===a[l].references&&(a[l].updater(),a.splice(l,1))}i=r}}}},704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={id:n,exports:{}};return e[n](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var n={};(()=>{"use strict";i.r(n),i.d(n,{SourceEditing:()=>h});var e=i(704),t=i(273),o=i(209);function r(e){const t=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"br",isVoid:!0},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"input",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"textarea",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],i=t.map((e=>e.name)).join("|"),n=e.replace(new RegExp(`</?(${i})( .*?)?>`,"g"),"\n$&\n").split("\n");let o=0;return n.filter((e=>e.length)).map((e=>function(e,t){return t.some((t=>!t.isVoid&&!!new RegExp(`<${t.name}( .*?)?>`).test(e)))}(e,t)?a(e,o++):function(e,t){return t.some((t=>new RegExp(`</${t.name}>`).test(e)))}(e,t)?a(e,--o):a(e,o))).join("\n")}function a(e,t,i=" "){return`${i.repeat(Math.max(0,t))}${e}`}var s=i(62),d=i.n(s),c=i(40),l={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};d()(c.Z,l);c.Z.locals;const u="SourceEditingMode";class h extends e.Plugin{static get pluginName(){return"SourceEditing"}static get requires(){return[e.PendingActions]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new o.ElementReplacer,this._replacedRoots=new Map,this._dataFromRoots=new Map}init(){const i=this.editor,n=i.t;i.ui.componentFactory.add("sourceEditing",(o=>{const r=new t.ButtonView(o);return r.set({label:n("Source"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,withText:!0,class:"ck-source-editing-button"}),r.bind("isOn").to(this,"isSourceEditingMode"),r.bind("isEnabled").to(this,"isEnabled",i,"isReadOnly",i.plugins.get(e.PendingActions),"hasAny",((e,t,i)=>!!e&&(!t&&!i))),this.listenTo(r,"execute",(()=>{this.isSourceEditingMode=!this.isSourceEditingMode})),r})),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",((e,t,i)=>{i?(this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())})),this.on("change:isEnabled",((e,t,i)=>this._handleReadOnlyMode(!i))),this.listenTo(i,"change:isReadOnly",((e,t,i)=>this._handleReadOnlyMode(i)))),i.data.on("get",(()=>{this.isSourceEditingMode&&this.updateEditorData()}),{priority:"high"})}afterInit(){const e=this.editor;["RealTimeCollaborativeEditing","CommentsEditing","TrackChangesEditing","RevisionHistory"].some((t=>e.plugins.has(t)))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}updateEditorData(){const e=this.editor,t={};for(const[e,i]of this._replacedRoots){const n=this._dataFromRoots.get(e),o=i.dataset.value;n!==o&&(t[e]=o)}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0}})}_showSourceEditing(){const e=this.editor,t=e.editing.view,i=e.model;i.change((e=>{e.setSelection(null),e.removeSelectionAttribute(i.document.selection.getAttributeKeys())}));for(const[i,n]of t.domRoots){const r=m(e.data.get({rootName:i})),a=(0,o.createElement)(n.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),s=(0,o.createElement)(n.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[a]);a.value=r,a.setSelectionRange(0,0),a.addEventListener("input",(()=>{s.dataset.value=a.value,e.ui.update()})),t.change((e=>{const n=t.document.getRoot(i);e.addClass("ck-hidden",n)})),e.ui.setEditableElement("sourceEditing:"+i,a),this._replacedRoots.set(i,s),this._elementReplacer.replace(n,s),this._dataFromRoots.set(i,r)}this._focusSourceEditing()}_hideSourceEditing(){const e=this.editor.editing.view;this.updateEditorData(),e.change((t=>{for(const[i]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(i))})),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),e.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(u)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(u)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}}function m(e){return function(e){return e.startsWith("<")}(e)?r(e):e}})(),(window.CKEditor5=window.CKEditor5||{}).sourceEditing=n})();
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack://CKEditor5.sourceEditing/./theme/sourceediting.css","webpack://CKEditor5.sourceEditing/../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.sourceEditing/../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.sourceEditing/./theme/icons/source-editing.svg","webpack://CKEditor5.sourceEditing/./theme/sourceediting.css?822d","webpack://CKEditor5.sourceEditing/../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.sourceEditing/./src/sourceediting.js","webpack://CKEditor5.sourceEditing/./src/utils/formathtml.js","webpack://CKEditor5.sourceEditing/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.sourceEditing/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.sourceEditing/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.sourceEditing/external var \"CKEditor5.dll\"","webpack://CKEditor5.sourceEditing/webpack/bootstrap","webpack://CKEditor5.sourceEditing/webpack/runtime/compat get default export","webpack://CKEditor5.sourceEditing/webpack/runtime/define property getters","webpack://CKEditor5.sourceEditing/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.sourceEditing/webpack/runtime/make namespace object","webpack://CKEditor5.sourceEditing/webpack/runtime/nonce","webpack://CKEditor5.sourceEditing/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAC4H;AAC7B;AAC/F,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,kEAAkE,gBAAgB,kBAAkB,+DAA+D,6BAA6B,sBAAsB,qCAAqC,uCAAuC,SAAS,gCAAgC,qBAAqB,8BAA8B,+BAA+B,cAAc,kBAAkB,iCAAiC,yCAAyC,gBAAgB,sBAAsB,YAAY,aAAa,gBAAgB,kBAAkB,YAAY,WAAW,yGAAyG,sCAAsC,yBAAyB,0BAA0B,uDAAuD,4BAA4B,sCAAsC,aAAa,OAAO,o4BAAo4B,qEAAqE,sEAAsE,6BAA6B,uBAAuB,qBAAqB,GAAG,uEAAuE,qCAAqC,cAAc,kCAAkC,4CAA4C,0CAA0C,2BAA2B,0BAA0B,GAAG,oCAAoC,oCAAoC,uBAAuB,mBAAmB,GAAG,sCAAsC,uBAAuB,gBAAgB,iBAAiB,iBAAiB,kBAAkB,qBAAqB,2BAA2B,gDAAgD,iCAAiC,gCAAgC,iCAAiC,KAAK,+BAA+B,2BAA2B,kDAAkD,KAAK,GAAG,qUAAqU,qBAAqB,4DAA4D,6CAA6C,qBAAqB,KAAK,GAAG,0QAA0Q,mDAAmD,mCAAmC,4RAA4R,mCAAmC,GAAG,kHAAkH,+CAA+C,GAAG,qBAAqB;AAC/rI;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,2rBAA2rB;;;;;;;;;;;;;;;;;;ACA3mB;AAC/F,YAAkL;;AAElL,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,8JAAO;;;;AAIxB,iEAAe,qKAAc,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;;AAEA;;AAE4D;AACd;AACuB;AACrB;;AAEZ;;AAE8B;;AAElE;;AAEA;AACA;AACA;AACA;AACA;AACA,uCAAuC,qEAAqE;AAC5G,IAAI,uCAAuC;AAC3C;AACA;AACA;AACe,4BAA4B,sDAAM;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,8DAAc;AACzB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,8BAA8B,gEAAe;;AAE7C;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,wDAAU;;AAEpC;AACA;AACA,UAAU,uEAAiB;AAC3B;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,8DAAc;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG,IAAI,mBAAmB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA,iDAAiD,WAAW;;AAE5D,2CAA2C,kEAAa;AACxD;AACA;AACA,KAAK;;AAEL,0CAA0C,kEAAa;AACvD;AACA;AACA,IAAI;;AAEJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,aAAa,qBAAqB;AAC9D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6EAA6E,wBAAwB;AACrG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uEAAuE;AACpF;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;;AAEA,QAAQ,6DAAU;AAClB;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;;;;;;;;;;;;;;;;AC7ZA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa;AACb;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,gCAAgC;AACpC,IAAI,gCAAgC;AACpC,IAAI,8BAA8B;AAClC,IAAI,mCAAmC;AACvC,IAAI,0BAA0B;AAC9B,IAAI,gCAAgC;AACpC,IAAI,+BAA+B;AACnC,IAAI,2BAA2B;AAC/B,IAAI,4BAA4B;AAChC,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,iCAAiC;AACrC,IAAI,mCAAmC;AACvC,IAAI,+BAA+B;AACnC,IAAI,+BAA+B;AACnC,IAAI,6BAA6B;AACjC,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,2BAA2B;AAC/B,IAAI,+BAA+B;AACnC,IAAI,+BAA+B;AACnC,IAAI,0BAA0B;AAC9B,IAAI,6BAA6B;AACjC,IAAI,2BAA2B;AAC/B,IAAI,6BAA6B;AACjC,IAAI,4BAA4B;AAChC,IAAI,2BAA2B;AAC/B,IAAI,0BAA0B;AAC9B,IAAI,gCAAgC;AACpC,IAAI,8BAA8B;AAClC,IAAI,8BAA8B;AAClC,IAAI,2BAA2B;AAC/B,IAAI,iCAAiC;AACrC,IAAI,2BAA2B;AAC/B,IAAI,8BAA8B;AAClC,IAAI,2BAA2B;AAC/B,IAAI;AACJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,sBAAsB;AACtD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA,2BAA2B,cAAc;AACzC,GAAG;AACH;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA,YAAY,iDAAiD,GAAG,MAAM;AACtE;;;;;;;;;;;AC9IA;;;;;;;;;;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;;AAE2D","file":"source-editing.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-source-editing-area{overflow:hidden;position:relative}.ck-source-editing-area textarea,.ck-source-editing-area:after{border:1px solid transparent;font-family:monospace;font-size:var(--ck-font-size-normal);line-height:var(--ck-line-height-base);margin:0;padding:var(--ck-spacing-large);white-space:pre-wrap}.ck-source-editing-area:after{content:attr(data-value) \\\" \\\";display:block;visibility:hidden}.ck-source-editing-area textarea{border-color:var(--ck-color-base-border);border-radius:0;box-sizing:border-box;height:100%;outline:none;overflow:hidden;position:absolute;resize:none;width:100%}.ck-rounded-corners .ck-source-editing-area textarea,.ck-source-editing-area textarea.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck-source-editing-area textarea:not([readonly]):focus{border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;outline:none}\", \"\",{\"version\":3,\"sources\":[\"webpack://./theme/sourceediting.css\",\"webpack://./../ckeditor5-theme-lark/theme/mixins/_rounded.css\",\"webpack://./../ckeditor5-theme-lark/theme/mixins/_focus.css\",\"webpack://./../ckeditor5-theme-lark/theme/mixins/_shadow.css\"],\"names\":[],\"mappings\":\"AASA,wBAEC,eAAgB,CADhB,iBAED,CAEA,+DAIC,4BAA6B,CAG7B,qBAAsB,CADtB,oCAAqC,CADrC,sCAAuC,CAFvC,QAAS,CADT,+BAAgC,CAMhC,oBACD,CAEA,8BACC,4BAA6B,CAE7B,aAAc,CADd,iBAED,CAEA,iCASC,wCAAyC,CC7BzC,eAAgB,CD2BhB,qBAAsB,CAJtB,WAAY,CAEZ,YAAa,CACb,eAAgB,CALhB,iBAAkB,CAGlB,WAAY,CAFZ,UAkBD,CApBA,yGChBE,qCAAsC,CD4BtC,wBAAyB,CACzB,yBAOF,CAJC,uDEpCA,2BAA2B,CCF3B,qCAA8B,CDC9B,YFwCA\",\"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@import \\\"@ckeditor/ckeditor5-theme-lark/theme/mixins/_rounded.css\\\";\\n@import \\\"@ckeditor/ckeditor5-theme-lark/theme/mixins/_focus.css\\\";\\n@import \\\"@ckeditor/ckeditor5-theme-lark/theme/mixins/_shadow.css\\\";\\n\\n.ck-source-editing-area {\\n\\tposition: relative;\\n\\toverflow: hidden;\\n}\\n\\n.ck-source-editing-area::after,\\n.ck-source-editing-area textarea {\\n\\tpadding: var(--ck-spacing-large);\\n\\tmargin: 0;\\n\\tborder: 1px solid transparent;\\n\\tline-height: var(--ck-line-height-base);\\n\\tfont-size: var(--ck-font-size-normal);\\n\\tfont-family: monospace;\\n\\twhite-space: pre-wrap;\\n}\\n\\n.ck-source-editing-area::after {\\n\\tcontent: attr(data-value) \\\" \\\";\\n\\tvisibility: hidden;\\n\\tdisplay: block;\\n}\\n\\n.ck-source-editing-area textarea {\\n\\tposition: absolute;\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\tresize: none;\\n\\toutline: none;\\n\\toverflow: hidden;\\n\\tbox-sizing: border-box;\\n\\n\\tborder-color: var(--ck-color-base-border);\\n\\n\\t@mixin ck-rounded-corners {\\n\\t\\tborder-top-left-radius: 0;\\n\\t\\tborder-top-right-radius: 0;\\n\\t}\\n\\n\\t&:not([readonly]):focus {\\n\\t\\t@mixin ck-focus-ring;\\n\\t\\t@mixin ck-box-shadow var(--ck-inner-shadow);\\n\\t}\\n}\\n\",\"/*\\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/**\\n * Implements rounded corner interface for .ck-rounded-corners class.\\n *\\n * @see $ck-border-radius\\n */\\n@define-mixin ck-rounded-corners {\\n\\tborder-radius: 0;\\n\\n\\t@nest .ck-rounded-corners &,\\n\\t&.ck-rounded-corners {\\n\\t\\tborder-radius: var(--ck-border-radius);\\n\\t\\t@mixin-content;\\n\\t}\\n}\\n\",\"/*\\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/**\\n * A visual style of focused element's border.\\n */\\n@define-mixin ck-focus-ring {\\n\\t/* Disable native outline. */\\n\\toutline: none;\\n\\tborder: var(--ck-focus-ring)\\n}\\n\",\"/*\\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/**\\n * A helper to combine multiple shadows.\\n */\\n@define-mixin ck-box-shadow $shadowA, $shadowB: 0 0 {\\n\\tbox-shadow: $shadowA, $shadowB;\\n}\\n\\n/**\\n * Gives an element a drop shadow so it looks like a floating panel.\\n */\\n@define-mixin ck-drop-shadow {\\n\\t@mixin ck-box-shadow var(--ck-drop-shadow);\\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=\\\"m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z\\\"/><path d=\\\"M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z\\\"/></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]!./sourceediting.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 source-editing/sourceediting\n */\n\n/* global console */\n\nimport { Plugin, PendingActions } from 'ckeditor5/src/core';\nimport { ButtonView } from 'ckeditor5/src/ui';\nimport { createElement, ElementReplacer } from 'ckeditor5/src/utils';\nimport { formatHtml } from './utils/formathtml';\n\nimport '../theme/sourceediting.css';\n\nimport sourceEditingIcon from '../theme/icons/source-editing.svg';\n\nconst COMMAND_FORCE_DISABLE_ID = 'SourceEditingMode';\n\n/**\n * The source editing feature.\n *\n * It provides the possibility to view and edit the source of the document.\n *\n * For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the\n * {@glink api/source-editing package page}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class SourceEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'SourceEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ PendingActions ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * Flag indicating whether the document source mode is active.\n\t\t *\n\t\t * @observable\n\t\t * @member {Boolean}\n\t\t */\n\t\tthis.set( 'isSourceEditingMode', false );\n\n\t\t/**\n\t\t * The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.\n\t\t *\n\t\t * @private\n\t\t * @member {module:utils/elementreplacer~ElementReplacer}\n\t\t */\n\t\tthis._elementReplacer = new ElementReplacer();\n\n\t\t/**\n\t\t * Maps all root names to wrapper elements containing the document source.\n\t\t *\n\t\t * @private\n\t\t * @member {Map.<String,HTMLElement>}\n\t\t */\n\t\tthis._replacedRoots = new Map();\n\n\t\t/**\n\t\t * Maps all root names to their document data.\n\t\t *\n\t\t * @private\n\t\t * @member {Map.<String,String>}\n\t\t */\n\t\tthis._dataFromRoots = new Map();\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\teditor.ui.componentFactory.add( 'sourceEditing', locale => {\n\t\t\tconst buttonView = new ButtonView( locale );\n\n\t\t\tbuttonView.set( {\n\t\t\t\tlabel: t( 'Source' ),\n\t\t\t\ticon: sourceEditingIcon,\n\t\t\t\ttooltip: true,\n\t\t\t\twithText: true,\n\t\t\t\tclass: 'ck-source-editing-button'\n\t\t\t} );\n\n\t\t\tbuttonView.bind( 'isOn' ).to( this, 'isSourceEditingMode' );\n\n\t\t\t// The button should be disabled if one of the following conditions is met:\n\t\t\tbuttonView.bind( 'isEnabled' ).to(\n\t\t\t\tthis, 'isEnabled',\n\t\t\t\teditor, 'isReadOnly',\n\t\t\t\teditor.plugins.get( PendingActions ), 'hasAny',\n\t\t\t\t( isEnabled, isEditorReadOnly, hasAnyPendingActions ) => {\n\t\t\t\t\t// (1) The plugin itself is disabled.\n\t\t\t\t\tif ( !isEnabled ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (2) The editor is in read-only mode.\n\t\t\t\t\tif ( isEditorReadOnly ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (3) Any pending action is scheduled. It may change the model, so modifying the document source should be prevented\n\t\t\t\t\t// until the model is finally set.\n\t\t\t\t\tif ( hasAnyPendingActions ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.listenTo( buttonView, 'execute', () => {\n\t\t\t\tthis.isSourceEditingMode = !this.isSourceEditingMode;\n\t\t\t} );\n\n\t\t\treturn buttonView;\n\t\t} );\n\n\t\t// Currently, the plugin handles the source editing mode by itself only for the classic editor. To use this plugin with other\n\t\t// integrations, listen to the `change:isSourceEditingMode` event and act accordingly.\n\t\tif ( this._isAllowedToHandleSourceEditingMode() ) {\n\t\t\tthis.on( 'change:isSourceEditingMode', ( evt, name, isSourceEditingMode ) => {\n\t\t\t\tif ( isSourceEditingMode ) {\n\t\t\t\t\tthis._showSourceEditing();\n\t\t\t\t\tthis._disableCommands();\n\t\t\t\t} else {\n\t\t\t\t\tthis._hideSourceEditing();\n\t\t\t\t\tthis._enableCommands();\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tthis.on( 'change:isEnabled', ( evt, name, isEnabled ) => this._handleReadOnlyMode( !isEnabled ) );\n\n\t\t\tthis.listenTo( editor, 'change:isReadOnly', ( evt, name, isReadOnly ) => this._handleReadOnlyMode( isReadOnly ) );\n\t\t}\n\n\t\t// Update the editor data while calling editor.getData() in the source editing mode.\n\t\teditor.data.on( 'get', () => {\n\t\t\tif ( this.isSourceEditingMode ) {\n\t\t\t\tthis._updateEditorData();\n\t\t\t}\n\t\t}, { priority: 'high' } );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tafterInit() {\n\t\tconst editor = this.editor;\n\n\t\tconst collaborationPluginNamesToWarn = [\n\t\t\t'RealTimeCollaborativeEditing',\n\t\t\t'CommentsEditing',\n\t\t\t'TrackChangesEditing',\n\t\t\t'RevisionHistory'\n\t\t];\n\n\t\t// Currently, the basic integration with Collaboration Features is to display a warning in the console.\n\t\tif ( collaborationPluginNamesToWarn.some( pluginName => editor.plugins.has( pluginName ) ) ) {\n\t\t\tconsole.warn(\n\t\t\t\t'You initialized the editor with the source editing feature and at least one of the collaboration features. ' +\n\t\t\t\t'Please be advised that the source editing feature may not work, and be careful when editing document source ' +\n\t\t\t\t'that contains markers created by the collaboration features.'\n\t\t\t);\n\t\t}\n\n\t\t// Restricted Editing integration can also lead to problems. Warn the user accordingly.\n\t\tif ( editor.plugins.has( 'RestrictedEditingModeEditing' ) ) {\n\t\t\tconsole.warn(\n\t\t\t\t'You initialized the editor with the source editing feature and restricted editing feature. ' +\n\t\t\t\t'Please be advised that the source editing feature may not work, and be careful when editing document source ' +\n\t\t\t\t'that contains markers created by the restricted editing feature.'\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding\n\t * root.\n\t *\n\t * The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on\n\t * the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it\n\t * needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for\n\t * the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,\n\t * but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both\n\t * of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The\n\t * content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.\n\t * Since both children occupy the same grid cell, both have always the same height.\n\t *\n\t * @private\n\t */\n\t_showSourceEditing() {\n\t\tconst editor = this.editor;\n\t\tconst editingView = editor.editing.view;\n\t\tconst model = editor.model;\n\n\t\tmodel.change( writer => {\n\t\t\twriter.setSelection( null );\n\t\t\twriter.removeSelectionAttribute( model.document.selection.getAttributeKeys() );\n\t\t} );\n\n\t\t// It is not needed to iterate through all editing roots, as currently the plugin supports only the Classic Editor with a single\n\t\t// main root, but this code may help understand and use this feature in external integrations.\n\t\tfor ( const [ rootName, domRootElement ] of editingView.domRoots ) {\n\t\t\tconst data = formatSource( editor.data.get( { rootName } ) );\n\n\t\t\tconst domSourceEditingElementTextarea = createElement( domRootElement.ownerDocument, 'textarea', {\n\t\t\t\trows: '1',\n\t\t\t\t'aria-label': 'Source code editing area'\n\t\t\t} );\n\n\t\t\tconst domSourceEditingElementWrapper = createElement( domRootElement.ownerDocument, 'div', {\n\t\t\t\tclass: 'ck-source-editing-area',\n\t\t\t\t'data-value': data\n\t\t\t}, [ domSourceEditingElementTextarea ] );\n\n\t\t\tdomSourceEditingElementTextarea.value = data;\n\n\t\t\t// Setting a value to textarea moves the input cursor to the end. We want the selection at the beginning.\n\t\t\tdomSourceEditingElementTextarea.setSelectionRange( 0, 0 );\n\n\t\t\t// Bind the textarea's value to the wrapper's `data-value` property. Each change of the textarea's value updates the\n\t\t\t// wrapper's `data-value` property.\n\t\t\tdomSourceEditingElementTextarea.addEventListener( 'input', () => {\n\t\t\t\tdomSourceEditingElementWrapper.dataset.value = domSourceEditingElementTextarea.value;\n\t\t\t} );\n\n\t\t\teditingView.change( writer => {\n\t\t\t\tconst viewRoot = editingView.document.getRoot( rootName );\n\n\t\t\t\twriter.addClass( 'ck-hidden', viewRoot );\n\t\t\t} );\n\n\t\t\t// Register the element so it becomes available for Alt+F10 and Esc navigation.\n\t\t\teditor.ui.setEditableElement( 'sourceEditing:' + rootName, domSourceEditingElementTextarea );\n\n\t\t\tthis._replacedRoots.set( rootName, domSourceEditingElementWrapper );\n\n\t\t\tthis._elementReplacer.replace( domRootElement, domSourceEditingElementWrapper );\n\n\t\t\tthis._dataFromRoots.set( rootName, data );\n\t\t}\n\n\t\tthis._focusSourceEditing();\n\t}\n\n\t/**\n\t * Restores all hidden editing roots and sets the source data in them.\n\t *\n\t * @private\n\t */\n\t_hideSourceEditing() {\n\t\tconst editor = this.editor;\n\t\tconst editingView = editor.editing.view;\n\n\t\tthis._updateEditorData();\n\n\t\teditingView.change( writer => {\n\t\t\tfor ( const [ rootName ] of this._replacedRoots ) {\n\t\t\t\twriter.removeClass( 'ck-hidden', editingView.document.getRoot( rootName ) );\n\t\t\t}\n\t\t} );\n\n\t\tthis._elementReplacer.restore();\n\n\t\tthis._replacedRoots.clear();\n\t\tthis._dataFromRoots.clear();\n\n\t\teditingView.focus();\n\t}\n\n\t/**\n\t * Updates the source data in all hidden editing roots.\n\t *\n\t * @private\n\t */\n\t_updateEditorData() {\n\t\tconst editor = this.editor;\n\t\tconst data = {};\n\n\t\tfor ( const [ rootName, domSourceEditingElementWrapper ] of this._replacedRoots ) {\n\t\t\tconst oldData = this._dataFromRoots.get( rootName );\n\t\t\tconst newData = domSourceEditingElementWrapper.dataset.value;\n\n\t\t\t// Do not set the data unless some changes have been made in the meantime.\n\t\t\t// This prevents empty undo steps after switching to the normal editor.\n\t\t\tif ( oldData !== newData ) {\n\t\t\t\tdata[ rootName ] = newData;\n\t\t\t}\n\t\t}\n\n\t\tif ( Object.keys( data ).length ) {\n\t\t\teditor.data.set( data, { batchType: { isUndoable: true } } );\n\t\t}\n\t}\n\n\t/**\n\t * Focuses the textarea containing document source from the first editing root.\n\t *\n\t * @private\n\t */\n\t_focusSourceEditing() {\n\t\tconst editor = this.editor;\n\t\tconst [ domSourceEditingElementWrapper ] = this._replacedRoots.values();\n\t\tconst textarea = domSourceEditingElementWrapper.querySelector( 'textarea' );\n\n\t\t// The FocusObserver was disabled by View.render() while the DOM root was getting hidden and the replacer\n\t\t// revealed the textarea. So it couldn't notice that the DOM root got blurred in the process.\n\t\t// Let's sync this state manually here because otherwise Renderer will attempt to render selection\n\t\t// in an invisible DOM root.\n\t\teditor.editing.view.document.isFocused = false;\n\n\t\ttextarea.focus();\n\t}\n\n\t/**\n\t * Disables all commands.\n\t *\n\t * @private\n\t */\n\t_disableCommands() {\n\t\tconst editor = this.editor;\n\n\t\tfor ( const command of editor.commands.commands() ) {\n\t\t\tcommand.forceDisabled( COMMAND_FORCE_DISABLE_ID );\n\t\t}\n\t}\n\n\t/**\n\t * Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.\n\t *\n\t * @private\n\t */\n\t_enableCommands() {\n\t\tconst editor = this.editor;\n\n\t\tfor ( const command of editor.commands.commands() ) {\n\t\t\tcommand.clearForceDisabled( COMMAND_FORCE_DISABLE_ID );\n\t\t}\n\t}\n\n\t/**\n\t * Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.\n\t *\n\t * @param {Boolean} isReadOnly Indicates whether all textarea elements should be read-only.\n\t */\n\t_handleReadOnlyMode( isReadOnly ) {\n\t\tif ( !this.isSourceEditingMode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor ( const [ , domSourceEditingElementWrapper ] of this._replacedRoots ) {\n\t\t\tdomSourceEditingElementWrapper.querySelector( 'textarea' ).readOnly = isReadOnly;\n\t\t}\n\t}\n\n\t/**\n\t * Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only\n\t * for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.\n\t *\n\t * @private\n\t * @returns {Boolean}\n\t */\n\t_isAllowedToHandleSourceEditingMode() {\n\t\tconst editor = this.editor;\n\t\tconst editable = editor.ui.view.editable;\n\n\t\t// Checks, if the editor's editable belongs to the editor's DOM tree.\n\t\treturn editable && !editable._hasExternalElement;\n\t}\n}\n\n// Formats the content for a better readability.\n//\n// For a non-HTML source the unchanged input string is returned.\n//\n// @param {String} input Input string to check.\n// @returns {Boolean}\nfunction formatSource( input ) {\n\tif ( !isHtml( input ) ) {\n\t\treturn input;\n\t}\n\n\treturn formatHtml( input );\n}\n\n// Checks, if the document source is HTML. It is sufficient to just check the first character from the document data.\n//\n// @param {String} input Input string to check.\n// @returns {Boolean}\nfunction isHtml( input ) {\n\treturn input.startsWith( '<' );\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 source-editing/utils/formathtml\n */\n\n/**\n * A simple (and naive) HTML code formatter that returns a formatted HTML markup that can be easily\n * parsed by human eyes. It beautifies the HTML code by adding new lines between elements that behave like block elements\n * (https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements\n * and a few more like `tr`, `td`, and similar ones) and inserting indents for nested content.\n *\n * WARNING: This function works only on a text that does not contain any indentations or new lines.\n * Calling this function on the already formatted text will damage the formatting.\n *\n * @param {String} input An HTML string to format.\n * @returns {String}\n */\nexport function formatHtml( input ) {\n\t// A list of block-like elements around which the new lines should be inserted, and within which\n\t// the indentation of their children should be increased.\n\t// The list is partially based on https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements that contains\n\t// a full list of HTML block-level elements.\n\t// A void element is an element that cannot have any child - https://html.spec.whatwg.org/multipage/syntax.html#void-elements.\n\t// Note that <pre> element is not listed on this list to avoid breaking whitespace formatting.\n\tconst elementsToFormat = [\n\t\t{ name: 'address', isVoid: false },\n\t\t{ name: 'article', isVoid: false },\n\t\t{ name: 'aside', isVoid: false },\n\t\t{ name: 'blockquote', isVoid: false },\n\t\t{ name: 'br', isVoid: true },\n\t\t{ name: 'details', isVoid: false },\n\t\t{ name: 'dialog', isVoid: false },\n\t\t{ name: 'dd', isVoid: false },\n\t\t{ name: 'div', isVoid: false },\n\t\t{ name: 'dl', isVoid: false },\n\t\t{ name: 'dt', isVoid: false },\n\t\t{ name: 'fieldset', isVoid: false },\n\t\t{ name: 'figcaption', isVoid: false },\n\t\t{ name: 'figure', isVoid: false },\n\t\t{ name: 'footer', isVoid: false },\n\t\t{ name: 'form', isVoid: false },\n\t\t{ name: 'h1', isVoid: false },\n\t\t{ name: 'h2', isVoid: false },\n\t\t{ name: 'h3', isVoid: false },\n\t\t{ name: 'h4', isVoid: false },\n\t\t{ name: 'h5', isVoid: false },\n\t\t{ name: 'h6', isVoid: false },\n\t\t{ name: 'header', isVoid: false },\n\t\t{ name: 'hgroup', isVoid: false },\n\t\t{ name: 'hr', isVoid: true },\n\t\t{ name: 'input', isVoid: true },\n\t\t{ name: 'li', isVoid: false },\n\t\t{ name: 'main', isVoid: false },\n\t\t{ name: 'nav', isVoid: false },\n\t\t{ name: 'ol', isVoid: false },\n\t\t{ name: 'p', isVoid: false },\n\t\t{ name: 'section', isVoid: false },\n\t\t{ name: 'table', isVoid: false },\n\t\t{ name: 'tbody', isVoid: false },\n\t\t{ name: 'td', isVoid: false },\n\t\t{ name: 'textarea', isVoid: false },\n\t\t{ name: 'th', isVoid: false },\n\t\t{ name: 'thead', isVoid: false },\n\t\t{ name: 'tr', isVoid: false },\n\t\t{ name: 'ul', isVoid: false }\n\t];\n\n\tconst elementNamesToFormat = elementsToFormat.map( element => element.name ).join( '|' );\n\n\t// It is not the fastest way to format the HTML markup but the performance should be good enough.\n\tconst lines = input\n\t\t// Add new line before and after `<tag>` and `</tag>`.\n\t\t// It may separate individual elements with two new lines, but this will be fixed below.\n\t\t.replace( new RegExp( `</?(${ elementNamesToFormat })( .*?)?>`, 'g' ), '\\n$&\\n' )\n\t\t// Divide input string into lines, which start with either an opening tag, a closing tag, or just a text.\n\t\t.split( '\\n' );\n\n\tlet indentCount = 0;\n\n\treturn lines\n\t\t.filter( line => line.length )\n\t\t.map( line => {\n\t\t\tif ( isNonVoidOpeningTag( line, elementsToFormat ) ) {\n\t\t\t\treturn indentLine( line, indentCount++ );\n\t\t\t}\n\n\t\t\tif ( isClosingTag( line, elementsToFormat ) ) {\n\t\t\t\treturn indentLine( line, --indentCount );\n\t\t\t}\n\n\t\t\treturn indentLine( line, indentCount );\n\t\t} )\n\t\t.join( '\\n' );\n}\n\n// Checks, if an argument is an opening tag of a non-void element to be formatted.\n//\n// @param {String} line String to check.\n// @param {Array} elementsToFormat Elements to be formatted.\n// @param {String} elementsToFormat.name Element name.\n// @param {Boolean} elementsToFormat.isVoid Flag indicating whether element is a void one.\n// @returns {Boolean}\nfunction isNonVoidOpeningTag( line, elementsToFormat ) {\n\treturn elementsToFormat.some( element => {\n\t\tif ( element.isVoid ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( !new RegExp( `<${ element.name }( .*?)?>` ).test( line ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n\n// Checks, if an argument is a closing tag.\n//\n// @param {String} line String to check.\n// @param {Array} elementsToFormat Elements to be formatted.\n// @param {String} elementsToFormat.name Element name.\n// @param {Boolean} elementsToFormat.isVoid Flag indicating whether element is a void one.\n// @returns {Boolean}\nfunction isClosingTag( line, elementsToFormat ) {\n\treturn elementsToFormat.some( element => {\n\t\treturn new RegExp( `</${ element.name }>` ).test( line );\n\t} );\n}\n\n// Indents a line by a specified number of characters.\n//\n// @param {String} line Line to indent.\n// @param {Number} indentCount Number of characters to use for indentation.\n// @param {String} [indentChar] Indentation character(s). 4 spaces by default.\n// @returns {String}\nfunction indentLine( line, indentCount, indentChar = ' ' ) {\n\t// More about Math.max() here in https://github.com/ckeditor/ckeditor5/issues/10698.\n\treturn `${ indentChar.repeat( Math.max( 0, indentCount ) ) }${ line }`;\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/utils.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 source-editing\n */\n\nexport { default as SourceEditing } from './sourceediting';\n"],"sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-source-editing",
|
3
|
-
"version": "38.
|
3
|
+
"version": "38.1.1",
|
4
4
|
"description": "Source editing feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,24 +12,8 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"@ckeditor/ckeditor5-theme-lark": "
|
16
|
-
"ckeditor5": "
|
17
|
-
},
|
18
|
-
"devDependencies": {
|
19
|
-
"@ckeditor/ckeditor5-core": "^38.0.1",
|
20
|
-
"@ckeditor/ckeditor5-dev-utils": "^37.0.0",
|
21
|
-
"@ckeditor/ckeditor5-editor-classic": "^38.0.1",
|
22
|
-
"@ckeditor/ckeditor5-engine": "^38.0.1",
|
23
|
-
"@ckeditor/ckeditor5-essentials": "^38.0.1",
|
24
|
-
"@ckeditor/ckeditor5-heading": "^38.0.1",
|
25
|
-
"@ckeditor/ckeditor5-markdown-gfm": "^38.0.1",
|
26
|
-
"@ckeditor/ckeditor5-paragraph": "^38.0.1",
|
27
|
-
"@ckeditor/ckeditor5-table": "^38.0.1",
|
28
|
-
"@ckeditor/ckeditor5-ui": "^38.0.1",
|
29
|
-
"@ckeditor/ckeditor5-utils": "^38.0.1",
|
30
|
-
"typescript": "^4.8.4",
|
31
|
-
"webpack": "^5.58.1",
|
32
|
-
"webpack-cli": "^4.9.0"
|
15
|
+
"@ckeditor/ckeditor5-theme-lark": "38.1.1",
|
16
|
+
"ckeditor5": "38.1.1"
|
33
17
|
},
|
34
18
|
"engines": {
|
35
19
|
"node": ">=16.0.0",
|
@@ -53,10 +37,5 @@
|
|
53
37
|
"ckeditor5-metadata.json",
|
54
38
|
"CHANGELOG.md"
|
55
39
|
],
|
56
|
-
"scripts": {
|
57
|
-
"build": "tsc -p ./tsconfig.json",
|
58
|
-
"postversion": "npm run build",
|
59
|
-
"dll:build": "webpack"
|
60
|
-
},
|
61
40
|
"types": "src/index.d.ts"
|
62
41
|
}
|
package/src/augmentation.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
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 { SourceEditing } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface PluginsMap {
|
8
|
-
[SourceEditing.pluginName]: SourceEditing;
|
9
|
-
}
|
10
|
-
}
|
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 { SourceEditing } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface PluginsMap {
|
8
|
+
[SourceEditing.pluginName]: SourceEditing;
|
9
|
+
}
|
10
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -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,9 +1,9 @@
|
|
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 source-editing
|
7
|
-
*/
|
8
|
-
export { default as SourceEditing } from './sourceediting';
|
9
|
-
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 source-editing
|
7
|
+
*/
|
8
|
+
export { default as SourceEditing } from './sourceediting';
|
9
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
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 source-editing
|
7
|
-
*/
|
8
|
-
export { default as SourceEditing } from './sourceediting';
|
9
|
-
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 source-editing
|
7
|
+
*/
|
8
|
+
export { default as SourceEditing } from './sourceediting';
|
9
|
+
import './augmentation';
|
package/src/sourceediting.d.ts
CHANGED
@@ -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 source-editing/sourceediting
|
7
|
-
*/
|
8
|
-
import { type Editor, Plugin, PendingActions } from 'ckeditor5/src/core';
|
9
|
-
import '../theme/sourceediting.css';
|
10
|
-
/**
|
11
|
-
* The source editing feature.
|
12
|
-
*
|
13
|
-
* It provides the possibility to view and edit the source of the document.
|
14
|
-
*
|
15
|
-
* For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the
|
16
|
-
* {@glink api/source-editing package page}.
|
17
|
-
*/
|
18
|
-
export default class SourceEditing extends Plugin {
|
19
|
-
/**
|
20
|
-
* @inheritDoc
|
21
|
-
*/
|
22
|
-
static get pluginName():
|
23
|
-
/**
|
24
|
-
* @inheritDoc
|
25
|
-
*/
|
26
|
-
static get requires(): readonly [typeof PendingActions];
|
27
|
-
/**
|
28
|
-
* Flag indicating whether the document source mode is active.
|
29
|
-
*
|
30
|
-
* @observable
|
31
|
-
*/
|
32
|
-
isSourceEditingMode: boolean;
|
33
|
-
/**
|
34
|
-
* The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.
|
35
|
-
*/
|
36
|
-
private _elementReplacer;
|
37
|
-
/**
|
38
|
-
* Maps all root names to wrapper elements containing the document source.
|
39
|
-
*/
|
40
|
-
private _replacedRoots;
|
41
|
-
/**
|
42
|
-
* Maps all root names to their document data.
|
43
|
-
*/
|
44
|
-
private _dataFromRoots;
|
45
|
-
/**
|
46
|
-
* @inheritDoc
|
47
|
-
*/
|
48
|
-
constructor(editor: Editor);
|
49
|
-
/**
|
50
|
-
* @inheritDoc
|
51
|
-
*/
|
52
|
-
init(): void;
|
53
|
-
/**
|
54
|
-
* @inheritDoc
|
55
|
-
*/
|
56
|
-
afterInit(): void;
|
57
|
-
/**
|
58
|
-
* Updates the source data in all hidden editing roots.
|
59
|
-
*/
|
60
|
-
updateEditorData(): void;
|
61
|
-
/**
|
62
|
-
* Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding
|
63
|
-
* root.
|
64
|
-
*
|
65
|
-
* The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on
|
66
|
-
* the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it
|
67
|
-
* needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for
|
68
|
-
* the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,
|
69
|
-
* but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both
|
70
|
-
* of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The
|
71
|
-
* content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.
|
72
|
-
* Since both children occupy the same grid cell, both have always the same height.
|
73
|
-
*/
|
74
|
-
private _showSourceEditing;
|
75
|
-
/**
|
76
|
-
* Restores all hidden editing roots and sets the source data in them.
|
77
|
-
*/
|
78
|
-
private _hideSourceEditing;
|
79
|
-
/**
|
80
|
-
* Focuses the textarea containing document source from the first editing root.
|
81
|
-
*/
|
82
|
-
private _focusSourceEditing;
|
83
|
-
/**
|
84
|
-
* Disables all commands.
|
85
|
-
*/
|
86
|
-
private _disableCommands;
|
87
|
-
/**
|
88
|
-
* Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.
|
89
|
-
*/
|
90
|
-
private _enableCommands;
|
91
|
-
/**
|
92
|
-
* Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.
|
93
|
-
*
|
94
|
-
* @param isReadOnly Indicates whether all textarea elements should be read-only.
|
95
|
-
*/
|
96
|
-
private _handleReadOnlyMode;
|
97
|
-
/**
|
98
|
-
* Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only
|
99
|
-
* for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.
|
100
|
-
*/
|
101
|
-
private _isAllowedToHandleSourceEditingMode;
|
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 source-editing/sourceediting
|
7
|
+
*/
|
8
|
+
import { type Editor, Plugin, PendingActions } from 'ckeditor5/src/core';
|
9
|
+
import '../theme/sourceediting.css';
|
10
|
+
/**
|
11
|
+
* The source editing feature.
|
12
|
+
*
|
13
|
+
* It provides the possibility to view and edit the source of the document.
|
14
|
+
*
|
15
|
+
* For a detailed overview, check the {@glink features/source-editing source editing feature documentation} and the
|
16
|
+
* {@glink api/source-editing package page}.
|
17
|
+
*/
|
18
|
+
export default class SourceEditing extends Plugin {
|
19
|
+
/**
|
20
|
+
* @inheritDoc
|
21
|
+
*/
|
22
|
+
static get pluginName(): "SourceEditing";
|
23
|
+
/**
|
24
|
+
* @inheritDoc
|
25
|
+
*/
|
26
|
+
static get requires(): readonly [typeof PendingActions];
|
27
|
+
/**
|
28
|
+
* Flag indicating whether the document source mode is active.
|
29
|
+
*
|
30
|
+
* @observable
|
31
|
+
*/
|
32
|
+
isSourceEditingMode: boolean;
|
33
|
+
/**
|
34
|
+
* The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.
|
35
|
+
*/
|
36
|
+
private _elementReplacer;
|
37
|
+
/**
|
38
|
+
* Maps all root names to wrapper elements containing the document source.
|
39
|
+
*/
|
40
|
+
private _replacedRoots;
|
41
|
+
/**
|
42
|
+
* Maps all root names to their document data.
|
43
|
+
*/
|
44
|
+
private _dataFromRoots;
|
45
|
+
/**
|
46
|
+
* @inheritDoc
|
47
|
+
*/
|
48
|
+
constructor(editor: Editor);
|
49
|
+
/**
|
50
|
+
* @inheritDoc
|
51
|
+
*/
|
52
|
+
init(): void;
|
53
|
+
/**
|
54
|
+
* @inheritDoc
|
55
|
+
*/
|
56
|
+
afterInit(): void;
|
57
|
+
/**
|
58
|
+
* Updates the source data in all hidden editing roots.
|
59
|
+
*/
|
60
|
+
updateEditorData(): void;
|
61
|
+
/**
|
62
|
+
* Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding
|
63
|
+
* root.
|
64
|
+
*
|
65
|
+
* The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on
|
66
|
+
* the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it
|
67
|
+
* needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for
|
68
|
+
* the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,
|
69
|
+
* but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both
|
70
|
+
* of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The
|
71
|
+
* content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.
|
72
|
+
* Since both children occupy the same grid cell, both have always the same height.
|
73
|
+
*/
|
74
|
+
private _showSourceEditing;
|
75
|
+
/**
|
76
|
+
* Restores all hidden editing roots and sets the source data in them.
|
77
|
+
*/
|
78
|
+
private _hideSourceEditing;
|
79
|
+
/**
|
80
|
+
* Focuses the textarea containing document source from the first editing root.
|
81
|
+
*/
|
82
|
+
private _focusSourceEditing;
|
83
|
+
/**
|
84
|
+
* Disables all commands.
|
85
|
+
*/
|
86
|
+
private _disableCommands;
|
87
|
+
/**
|
88
|
+
* Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.
|
89
|
+
*/
|
90
|
+
private _enableCommands;
|
91
|
+
/**
|
92
|
+
* Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.
|
93
|
+
*
|
94
|
+
* @param isReadOnly Indicates whether all textarea elements should be read-only.
|
95
|
+
*/
|
96
|
+
private _handleReadOnlyMode;
|
97
|
+
/**
|
98
|
+
* Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only
|
99
|
+
* for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.
|
100
|
+
*/
|
101
|
+
private _isAllowedToHandleSourceEditingMode;
|
102
|
+
}
|