@ckeditor/ckeditor5-editor-inline 37.0.0-alpha.2 → 37.0.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md.
4
- */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(i){var r=e[i];if(void 0!==r)return r.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{InlineEditor:()=>z});var t=o(704),e=o(209);const r=function(t){return null!=t&&"object"==typeof t};const n="object"==typeof global&&global&&global.Object===Object&&global;var s="object"==typeof self&&self&&self.Object===Object&&self;const l=(n||s||Function("return this")()).Symbol;var a=Object.prototype,c=a.hasOwnProperty,d=a.toString,h=l?l.toStringTag:void 0;const u=function(t){var e=c.call(t,h),o=t[h];try{t[h]=void 0;var i=!0}catch(t){}var r=d.call(t);return i&&(e?t[h]=o:delete t[h]),r};var p=Object.prototype.toString;const b=function(t){return p.call(t)};var f="[object Null]",g="[object Undefined]",w=l?l.toStringTag:void 0;const v=function(t){return null==t?void 0===t?g:f:w&&w in Object(t)?u(t):b(t)};const m=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var y="[object Object]",O=Function.prototype,T=Object.prototype,j=O.toString,E=T.hasOwnProperty,P=j.call(Object);const x=function(t){if(!r(t)||v(t)!=y)return!1;var e=m(t);if(null===e)return!0;var o=E.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&j.call(o)==P};const _=function(t){return r(t)&&1===t.nodeType&&!x(t)};var F=o(273),S=o(492);class D extends F.EditorUI{constructor(t,e){super(t),this.view=e,this._toolbarConfig=(0,F.normalizeToolbarConfig)(t.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const t=this.editor,e=this.view,o=t.editing.view,i=e.editable,r=o.document.getRoot();i.name=r.rootName,e.render();const n=i.element;this.setEditableElement(i.name,n),i.bind("isFocused").to(this.focusTracker),o.attachDomRoot(n),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.editor,e=this.view,o=e.editable.element,i=e.toolbar;e.panel.bind("isVisible").to(this.focusTracker,"isFocused"),e.bind("viewportTopOffset").to(this,"viewportOffset",(({top:t})=>t||0)),e.listenTo(t.ui,"update",(()=>{e.panel.isVisible&&e.panel.pin({target:o,positions:e.panelPositions})})),i.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(i)}_initPlaceholder(){const t=this.editor,e=t.editing.view,o=e.document.getRoot(),i=(t.sourceElement,t.config.get("placeholder"));if(i){const t="string"==typeof i?i:i[o.rootName];t&&(0,S.enablePlaceholder)({view:e,element:o,text:t,isDirectHost:!1,keepOnFocus:!0})}}}const C=(0,e.toUnit)("px");class R extends F.EditorUIView{constructor(t,e,o,i={}){super(t);const r=t.t;this.toolbar=new F.ToolbarView(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull,isFloating:!0}),this.set("viewportTopOffset",0),this.panel=new F.BalloonPanelView(t),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new F.InlineEditableUIView(t,e,o,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)}),this._resizeObserver=null}render(){super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.panel.content.add(this.toolbar);if(this.toolbar.options.shouldGroupWhenFull){const t=this.editable.element;this._resizeObserver=new e.ResizeObserver(t,(()=>{this.toolbar.maxWidth=C(new e.Rect(t).width)}))}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(t,e){let o;return o=t.top>e.height+this.viewportTopOffset?t.top-e.height:t.bottom>e.height+this.viewportTopOffset+50?this.viewportTopOffset:t.bottom,o}_getPanelPositions(){const t=[(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left+t.width-e.width,name:"toolbar_east",config:{withArrow:!1}})];return"ltr"===this.locale.uiLanguageDirection?t:t.reverse()}}class z extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,i={}){if(!A(o)&&void 0!==i.initialData)throw new e.CKEditorError("editor-create-initial-data",null);super(i),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return A(t)?(0,e.getDataFromElement)(t):t}(o)),this.model.document.createRoot(),A(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o));const r=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new R(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:r});this.ui=new D(this,n),(0,t.attachToForm)(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,o={}){return new Promise((i=>{if(A(t)&&"TEXTAREA"===t.tagName)throw new e.CKEditorError("editor-wrong-element",null);const r=new this(t,o);i(r.initPlugins().then((()=>r.ui.init())).then((()=>r.data.init(r.config.get("initialData")))).then((()=>r.fire("ready"))).then((()=>r)))}))}}function A(t){return _(t)}})(),(window.CKEditor5=window.CKEditor5||{}).editorInline=i})();
4
+ */(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},273:(t,e,o)=>{t.exports=o(79)("./src/ui.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},434:(t,e,o)=>{t.exports=o(79)("./src/watchdog.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(i){var r=e[i];if(void 0!==r)return r.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{InlineEditor:()=>D});var t=o(704),e=o(209),r=o(434),n=o(273),s=o(492);class l extends n.EditorUI{constructor(t,e){super(t),this.view=e,this._toolbarConfig=(0,n.normalizeToolbarConfig)(t.config.get("toolbar"))}get element(){return this.view.editable.element}init(){const t=this.editor,e=this.view,o=t.editing.view,i=e.editable,r=o.document.getRoot();i.name=r.rootName,e.render();const n=i.element;this.setEditableElement(i.name,n),i.bind("isFocused").to(this.focusTracker),o.attachDomRoot(n),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_initToolbar(){const t=this.editor,e=this.view,o=e.editable.element,i=e.toolbar;e.panel.bind("isVisible").to(this.focusTracker,"isFocused"),e.bind("viewportTopOffset").to(this,"viewportOffset",(({top:t})=>t||0)),e.listenTo(t.ui,"update",(()=>{e.panel.isVisible&&e.panel.pin({target:o,positions:e.panelPositions})})),i.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(i)}_initPlaceholder(){const t=this.editor,e=t.editing.view,o=e.document.getRoot(),i=(t.sourceElement,t.config.get("placeholder"));if(i){const t="string"==typeof i?i:i[o.rootName];t&&(0,s.enablePlaceholder)({view:e,element:o,text:t,isDirectHost:!1,keepOnFocus:!0})}}}const a=(0,e.toUnit)("px");class c extends n.EditorUIView{constructor(t,e,o,i={}){super(t);const r=t.t;this.toolbar=new n.ToolbarView(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull,isFloating:!0}),this.set("viewportTopOffset",0),this.panel=new n.BalloonPanelView(t),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new n.InlineEditableUIView(t,e,o,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)}),this._resizeObserver=null}render(){super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.panel.content.add(this.toolbar);if(this.toolbar.options.shouldGroupWhenFull){const t=this.editable.element;this._resizeObserver=new e.ResizeObserver(t,(()=>{this.toolbar.maxWidth=a(new e.Rect(t).width)}))}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(t,e){let o;return o=t.top>e.height+this.viewportTopOffset?t.top-e.height:t.bottom>e.height+this.viewportTopOffset+50?this.viewportTopOffset:t.bottom,o}_getPanelPositions(){const t=[(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left,name:"toolbar_west",config:{withArrow:!1}}),(t,e)=>({top:this._getPanelPositionTop(t,e),left:t.left+t.width-e.width,name:"toolbar_east",config:{withArrow:!1}})];return"ltr"===this.locale.uiLanguageDirection?t:t.reverse()}}const d=function(t){return null!=t&&"object"==typeof t};const h="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const p=(h||u||Function("return this")()).Symbol;var b=Object.prototype,f=b.hasOwnProperty,g=b.toString,w=p?p.toStringTag:void 0;const v=function(t){var e=f.call(t,w),o=t[w];try{t[w]=void 0;var i=!0}catch(t){}var r=g.call(t);return i&&(e?t[w]=o:delete t[w]),r};var m=Object.prototype.toString;const y=function(t){return m.call(t)};var O=p?p.toStringTag:void 0;const E=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":O&&O in Object(t)?v(t):y(t)};const T=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var j=Function.prototype,P=Object.prototype,x=j.toString,_=P.hasOwnProperty,F=x.call(Object);const C=function(t){if(!d(t)||"[object Object]"!=E(t))return!1;var e=T(t);if(null===e)return!0;var o=_.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&x.call(o)==F};const S=function(t){return d(t)&&1===t.nodeType&&!C(t)};class D extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,i={}){if(!W(o)&&void 0!==i.initialData)throw new e.CKEditorError("editor-create-initial-data",null);super(i),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return W(t)?(0,e.getDataFromElement)(t):t}(o)),this.model.document.createRoot(),W(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o));const r=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new c(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:r});this.ui=new l(this,n),(0,t.attachToForm)(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,o={}){return new Promise((i=>{if(W(t)&&"TEXTAREA"===t.tagName)throw new e.CKEditorError("editor-wrong-element",null);const r=new this(t,o);i(r.initPlugins().then((()=>r.ui.init())).then((()=>r.data.init(r.config.get("initialData")))).then((()=>r.fire("ready"))).then((()=>r)))}))}}function W(t){return S(t)}D.Context=t.Context,D.EditorWatchdog=r.EditorWatchdog,D.ContextWatchdog=r.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorInline=i})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-editor-inline",
3
- "version": "37.0.0-alpha.2",
3
+ "version": "37.0.0-rc.0",
4
4
  "description": "Inline editor implementation for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,29 +11,30 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "ckeditor5": "^37.0.0-alpha.2",
14
+ "ckeditor5": "^37.0.0-rc.0",
15
15
  "lodash-es": "^4.17.15"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.2",
19
- "@ckeditor/ckeditor5-core": "^37.0.0-alpha.2",
20
- "@ckeditor/ckeditor5-dev-utils": "^35.0.0",
21
- "@ckeditor/ckeditor5-engine": "^37.0.0-alpha.2",
22
- "@ckeditor/ckeditor5-enter": "^37.0.0-alpha.2",
23
- "@ckeditor/ckeditor5-heading": "^37.0.0-alpha.2",
24
- "@ckeditor/ckeditor5-image": "^37.0.0-alpha.2",
25
- "@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.2",
26
- "@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.2",
27
- "@ckeditor/ckeditor5-typing": "^37.0.0-alpha.2",
28
- "@ckeditor/ckeditor5-ui": "^37.0.0-alpha.2",
29
- "@ckeditor/ckeditor5-undo": "^37.0.0-alpha.2",
30
- "@ckeditor/ckeditor5-utils": "^37.0.0-alpha.2",
18
+ "@ckeditor/ckeditor5-basic-styles": "^37.0.0-rc.0",
19
+ "@ckeditor/ckeditor5-core": "^37.0.0-rc.0",
20
+ "@ckeditor/ckeditor5-dev-utils": "^36.0.0",
21
+ "@ckeditor/ckeditor5-engine": "^37.0.0-rc.0",
22
+ "@ckeditor/ckeditor5-enter": "^37.0.0-rc.0",
23
+ "@ckeditor/ckeditor5-heading": "^37.0.0-rc.0",
24
+ "@ckeditor/ckeditor5-image": "^37.0.0-rc.0",
25
+ "@ckeditor/ckeditor5-paragraph": "^37.0.0-rc.0",
26
+ "@ckeditor/ckeditor5-theme-lark": "^37.0.0-rc.0",
27
+ "@ckeditor/ckeditor5-typing": "^37.0.0-rc.0",
28
+ "@ckeditor/ckeditor5-ui": "^37.0.0-rc.0",
29
+ "@ckeditor/ckeditor5-undo": "^37.0.0-rc.0",
30
+ "@ckeditor/ckeditor5-utils": "^37.0.0-rc.0",
31
+ "@ckeditor/ckeditor5-watchdog": "^37.0.0-rc.0",
31
32
  "typescript": "^4.8.4",
32
33
  "webpack": "^5.58.1",
33
34
  "webpack-cli": "^4.9.0"
34
35
  },
35
36
  "engines": {
36
- "node": ">=14.0.0",
37
+ "node": ">=16.0.0",
37
38
  "npm": ">=5.7.1"
38
39
  },
39
40
  "author": "CKSource (http://cksource.com/)",
@@ -5,7 +5,8 @@
5
5
  /**
6
6
  * @module editor-inline/inlineeditor
7
7
  */
8
- import { Editor, type EditorConfig } from 'ckeditor5/src/core';
8
+ import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
9
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
9
10
  import InlineEditorUI from './inlineeditorui';
10
11
  declare const InlineEditor_base: import("ckeditor5/src/utils").Mixed<import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").ElementApi>, import("ckeditor5/src/core").DataApi>;
11
12
  /**
@@ -153,5 +154,23 @@ export default class InlineEditor extends InlineEditor_base {
153
154
  * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.
154
155
  */
155
156
  static create(sourceElementOrData: HTMLElement | string, config?: EditorConfig): Promise<InlineEditor>;
157
+ /**
158
+ * The {@link module:core/context~Context} class.
159
+ *
160
+ * Exposed as static editor field for easier access in editor builds.
161
+ */
162
+ static Context: typeof Context;
163
+ /**
164
+ * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
165
+ *
166
+ * Exposed as static editor field for easier access in editor builds.
167
+ */
168
+ static EditorWatchdog: typeof EditorWatchdog;
169
+ /**
170
+ * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
171
+ *
172
+ * Exposed as static editor field for easier access in editor builds.
173
+ */
174
+ static ContextWatchdog: typeof ContextWatchdog;
156
175
  }
157
176
  export {};
@@ -5,11 +5,12 @@
5
5
  /**
6
6
  * @module editor-inline/inlineeditor
7
7
  */
8
- import { Editor, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';
8
+ import { Editor, Context, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';
9
9
  import { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils';
10
- import { isElement as _isElement } from 'lodash-es';
10
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
11
11
  import InlineEditorUI from './inlineeditorui';
12
12
  import InlineEditorUIView from './inlineeditoruiview';
13
+ import { isElement as _isElement } from 'lodash-es';
13
14
  /**
14
15
  * The {@glink installation/getting-started/predefined-builds#inline-editor inline editor} implementation.
15
16
  * It uses an inline editable and a floating toolbar.
@@ -199,6 +200,24 @@ export default class InlineEditor extends DataApiMixin(ElementApiMixin(Editor))
199
200
  });
200
201
  }
201
202
  }
203
+ /**
204
+ * The {@link module:core/context~Context} class.
205
+ *
206
+ * Exposed as static editor field for easier access in editor builds.
207
+ */
208
+ InlineEditor.Context = Context;
209
+ /**
210
+ * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
211
+ *
212
+ * Exposed as static editor field for easier access in editor builds.
213
+ */
214
+ InlineEditor.EditorWatchdog = EditorWatchdog;
215
+ /**
216
+ * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
217
+ *
218
+ * Exposed as static editor field for easier access in editor builds.
219
+ */
220
+ InlineEditor.ContextWatchdog = ContextWatchdog;
202
221
  function getInitialData(sourceElementOrData) {
203
222
  return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;
204
223
  }