@ckeditor/ckeditor5-editor-inline 35.0.1 → 35.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/editor-inline.js +1 -1
- package/package.json +14 -13
- package/src/inlineeditorui.js +3 -13
package/build/editor-inline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license Copyright (c) 2003-2022, 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:()=>C});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=l?l.toStringTag:void 0;const g=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?u(t):b(t)};const w=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var
|
|
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:()=>C});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=l?l.toStringTag:void 0;const g=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?u(t):b(t)};const w=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var m=Function.prototype,v=Object.prototype,y=m.toString,O=v.hasOwnProperty,T=y.call(Object);const j=function(t){if(!r(t)||"[object Object]"!=g(t))return!1;var e=w(t);if(null===e)return!0;var o=O.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&y.call(o)==T};const E=function(t){return r(t)&&1===t.nodeType&&!j(t)};var P=o(273),x=o(492);class _ extends t.EditorUI{constructor(t,e){super(t),this.view=e,this._toolbarConfig=(0,P.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(){const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy(),super.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)),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,r=t.config.get("placeholder")||i&&"textarea"===i.tagName.toLowerCase()&&i.getAttribute("placeholder");r&&(0,x.enablePlaceholder)({view:e,element:o,text:r,isDirectHost:!1,keepOnFocus:!0})}}const F=(0,e.toUnit)("px");class S extends P.EditorUIView{constructor(t,e,o,i={}){super(t);const r=t.t;this.toolbar=new P.ToolbarView(t,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull,isFloating:!0}),this.set("viewportTopOffset",0),this.panel=new P.BalloonPanelView(t),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new P.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=F(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 C extends t.Editor{constructor(o,i={}){if(!E(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 E(t)?(0,e.getDataFromElement)(t):t}(o)),this.model.document.createRoot(),E(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this));const r=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=new S(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:r});this.ui=new _(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(E(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)))}))}}(0,e.mix)(C,t.DataApiMixin),(0,e.mix)(C,t.ElementApiMixin)})(),(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": "35.0
|
|
3
|
+
"version": "35.1.0",
|
|
4
4
|
"description": "Inline editor implementation for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -11,22 +11,23 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "src/index.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"ckeditor5": "^35.0
|
|
14
|
+
"ckeditor5": "^35.1.0",
|
|
15
15
|
"lodash-es": "^4.17.15"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.0
|
|
19
|
-
"@ckeditor/ckeditor5-core": "^35.0
|
|
18
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.1.0",
|
|
19
|
+
"@ckeditor/ckeditor5-core": "^35.1.0",
|
|
20
20
|
"@ckeditor/ckeditor5-dev-utils": "^30.0.0",
|
|
21
|
-
"@ckeditor/ckeditor5-engine": "^35.0
|
|
22
|
-
"@ckeditor/ckeditor5-enter": "^35.0
|
|
23
|
-
"@ckeditor/ckeditor5-heading": "^35.0
|
|
24
|
-
"@ckeditor/ckeditor5-
|
|
25
|
-
"@ckeditor/ckeditor5-
|
|
26
|
-
"@ckeditor/ckeditor5-
|
|
27
|
-
"@ckeditor/ckeditor5-
|
|
28
|
-
"@ckeditor/ckeditor5-
|
|
29
|
-
"@ckeditor/ckeditor5-
|
|
21
|
+
"@ckeditor/ckeditor5-engine": "^35.1.0",
|
|
22
|
+
"@ckeditor/ckeditor5-enter": "^35.1.0",
|
|
23
|
+
"@ckeditor/ckeditor5-heading": "^35.1.0",
|
|
24
|
+
"@ckeditor/ckeditor5-image": "^35.1.0",
|
|
25
|
+
"@ckeditor/ckeditor5-paragraph": "^35.1.0",
|
|
26
|
+
"@ckeditor/ckeditor5-theme-lark": "^35.1.0",
|
|
27
|
+
"@ckeditor/ckeditor5-typing": "^35.1.0",
|
|
28
|
+
"@ckeditor/ckeditor5-ui": "^35.1.0",
|
|
29
|
+
"@ckeditor/ckeditor5-undo": "^35.1.0",
|
|
30
|
+
"@ckeditor/ckeditor5-utils": "^35.1.0",
|
|
30
31
|
"webpack": "^5.58.1",
|
|
31
32
|
"webpack-cli": "^4.9.0"
|
|
32
33
|
},
|
package/src/inlineeditorui.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { EditorUI } from 'ckeditor5/src/core';
|
|
11
|
-
import {
|
|
11
|
+
import { normalizeToolbarConfig } from 'ckeditor5/src/ui';
|
|
12
12
|
import { enablePlaceholder } from 'ckeditor5/src/engine';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -74,11 +74,6 @@ export default class InlineEditorUI extends EditorUI {
|
|
|
74
74
|
// editable areas (roots) but the inline editor has only one.
|
|
75
75
|
this.setEditableElement( editable.name, editableElement );
|
|
76
76
|
|
|
77
|
-
// Let the global focus tracker know that the editable UI element is focusable and
|
|
78
|
-
// belongs to the editor. From now on, the focus tracker will sustain the editor focus
|
|
79
|
-
// as long as the editable is focused (e.g. the user is typing).
|
|
80
|
-
this.focusTracker.add( editableElement );
|
|
81
|
-
|
|
82
77
|
// Let the editable UI element respond to the changes in the global editor focus
|
|
83
78
|
// tracker. It has been added to the same tracker a few lines above but, in reality, there are
|
|
84
79
|
// many focusable areas in the editor, like balloons, toolbars or dropdowns and as long
|
|
@@ -119,7 +114,6 @@ export default class InlineEditorUI extends EditorUI {
|
|
|
119
114
|
const editor = this.editor;
|
|
120
115
|
const view = this.view;
|
|
121
116
|
const editableElement = view.editable.element;
|
|
122
|
-
const editingView = editor.editing.view;
|
|
123
117
|
const toolbar = view.toolbar;
|
|
124
118
|
|
|
125
119
|
// Set–up the view#panel.
|
|
@@ -141,12 +135,8 @@ export default class InlineEditorUI extends EditorUI {
|
|
|
141
135
|
|
|
142
136
|
toolbar.fillFromConfig( this._toolbarConfig, this.componentFactory );
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
originFocusTracker: this.focusTracker,
|
|
147
|
-
originKeystrokeHandler: editor.keystrokes,
|
|
148
|
-
toolbar
|
|
149
|
-
} );
|
|
138
|
+
// Register the toolbar so it becomes available for Alt+F10 and Esc navigation.
|
|
139
|
+
this.addToolbar( toolbar );
|
|
150
140
|
}
|
|
151
141
|
|
|
152
142
|
/**
|