@ckeditor/ckeditor5-editor-inline 40.2.0 → 41.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +1 -1
- package/build/editor-inline.js +2 -2
- package/package.json +3 -2
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/inlineeditor.d.ts +5 -5
- package/src/inlineeditor.js +8 -7
- package/src/inlineeditorui.d.ts +4 -4
- package/src/inlineeditorui.js +3 -3
- package/src/inlineeditoruiview.d.ts +5 -5
- package/src/inlineeditoruiview.js +3 -3
package/LICENSE.md
CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
|
|
2
2
|
==========================
|
3
3
|
|
4
4
|
**Inline editor implementation** – https://github.com/ckeditor/ckeditor5-editor-inline <br>
|
5
|
-
Copyright (c) 2003–
|
5
|
+
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
6
6
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
8
8
|
|
package/build/editor-inline.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/*!
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md.
|
4
|
-
*/(()=>{var t={
|
4
|
+
*/(()=>{var t={968:(t,e,o)=>{t.exports=o(672)("./src/core.js")},684:(t,e,o)=>{t.exports=o(672)("./src/engine.js")},348:(t,e,o)=>{t.exports=o(672)("./src/ui.js")},316:(t,e,o)=>{t.exports=o(672)("./src/utils.js")},344:(t,e,o)=>{t.exports=o(672)("./src/watchdog.js")},672: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:()=>W});var t=o(968),e=o(316),r=o(344),n=o(348),s=o(684);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.config.get("placeholder");if(i){const t="string"==typeof i?i:i[o.rootName];t&&(o.placeholder=t)}(0,s.enablePlaceholder)({view:e,element:o,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 T=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":O&&O in Object(t)?v(t):y(t)};const j=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var E=Function.prototype,P=Object.prototype,x=E.toString,_=P.hasOwnProperty,F=x.call(Object);const C=function(t){if(!d(t)||"[object Object]"!=T(t))return!1;var e=j(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(!R(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 R(t)?(0,e.getDataFromElement)(t):t}(o)),this.model.document.createRoot(),R(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(R(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)))}))}}D.Context=t.Context,D.EditorWatchdog=r.EditorWatchdog,D.ContextWatchdog=r.ContextWatchdog;const W=D;function R(t){return S(t)}})(),(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": "
|
3
|
+
"version": "41.1.0",
|
4
4
|
"description": "Inline editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -9,9 +9,10 @@
|
|
9
9
|
"ckeditor5-editor",
|
10
10
|
"ckeditor5-dll"
|
11
11
|
],
|
12
|
+
"type": "module",
|
12
13
|
"main": "src/index.js",
|
13
14
|
"dependencies": {
|
14
|
-
"ckeditor5": "
|
15
|
+
"ckeditor5": "41.1.0",
|
15
16
|
"lodash-es": "4.17.21"
|
16
17
|
},
|
17
18
|
"author": "CKSource (http://cksource.com/)",
|
package/src/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline
|
7
7
|
*/
|
8
|
-
export { default as InlineEditor } from './inlineeditor';
|
8
|
+
export { default as InlineEditor } from './inlineeditor.js';
|
package/src/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline
|
7
7
|
*/
|
8
|
-
export { default as InlineEditor } from './inlineeditor';
|
8
|
+
export { default as InlineEditor } from './inlineeditor.js';
|
package/src/inlineeditor.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline/inlineeditor
|
7
7
|
*/
|
8
|
-
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
|
9
|
-
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
10
|
-
import InlineEditorUI from './inlineeditorui';
|
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>;
|
8
|
+
import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core.js';
|
9
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
|
10
|
+
import InlineEditorUI from './inlineeditorui.js';
|
11
|
+
declare const InlineEditor_base: import("ckeditor5/src/utils.js").Mixed<import("ckeditor5/src/utils.js").Mixed<typeof Editor, import("ckeditor5/src/core.js").ElementApi>, import("ckeditor5/src/core.js").DataApi>;
|
12
12
|
/**
|
13
13
|
* The {@glink installation/getting-started/predefined-builds#inline-editor inline editor} implementation.
|
14
14
|
* It uses an inline editable and a floating toolbar.
|
package/src/inlineeditor.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline/inlineeditor
|
7
7
|
*/
|
8
|
-
import { Editor, Context, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';
|
9
|
-
import { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils';
|
10
|
-
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
|
11
|
-
import InlineEditorUI from './inlineeditorui';
|
12
|
-
import InlineEditorUIView from './inlineeditoruiview';
|
8
|
+
import { Editor, Context, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core.js';
|
9
|
+
import { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils.js';
|
10
|
+
import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
|
11
|
+
import InlineEditorUI from './inlineeditorui.js';
|
12
|
+
import InlineEditorUIView from './inlineeditoruiview.js';
|
13
13
|
import { isElement as _isElement } from 'lodash-es';
|
14
14
|
/**
|
15
15
|
* The {@glink installation/getting-started/predefined-builds#inline-editor inline editor} implementation.
|
@@ -34,7 +34,7 @@ import { isElement as _isElement } from 'lodash-es';
|
|
34
34
|
* Read more about initializing the editor from source or as a build in
|
35
35
|
* {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
|
36
36
|
*/
|
37
|
-
|
37
|
+
class InlineEditor extends DataApiMixin(ElementApiMixin(Editor)) {
|
38
38
|
/**
|
39
39
|
* Creates an instance of the inline editor.
|
40
40
|
*
|
@@ -218,6 +218,7 @@ InlineEditor.EditorWatchdog = EditorWatchdog;
|
|
218
218
|
* Exposed as static editor field for easier access in editor builds.
|
219
219
|
*/
|
220
220
|
InlineEditor.ContextWatchdog = ContextWatchdog;
|
221
|
+
export default InlineEditor;
|
221
222
|
function getInitialData(sourceElementOrData) {
|
222
223
|
return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;
|
223
224
|
}
|
package/src/inlineeditorui.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline/inlineeditorui
|
7
7
|
*/
|
8
|
-
import { type Editor } from 'ckeditor5/src/core';
|
9
|
-
import { EditorUI } from 'ckeditor5/src/ui';
|
10
|
-
import type InlineEditorUIView from './inlineeditoruiview';
|
8
|
+
import { type Editor } from 'ckeditor5/src/core.js';
|
9
|
+
import { EditorUI } from 'ckeditor5/src/ui.js';
|
10
|
+
import type InlineEditorUIView from './inlineeditoruiview.js';
|
11
11
|
/**
|
12
12
|
* The inline editor UI class.
|
13
13
|
*
|
package/src/inlineeditorui.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
|
-
import { EditorUI, normalizeToolbarConfig } from 'ckeditor5/src/ui';
|
6
|
-
import { enablePlaceholder } from 'ckeditor5/src/engine';
|
5
|
+
import { EditorUI, normalizeToolbarConfig } from 'ckeditor5/src/ui.js';
|
6
|
+
import { enablePlaceholder } from 'ckeditor5/src/engine.js';
|
7
7
|
/**
|
8
8
|
* The inline editor UI class.
|
9
9
|
*
|
@@ -1,13 +1,13 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline/inlineeditoruiview
|
7
7
|
*/
|
8
|
-
import { BalloonPanelView, EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui';
|
9
|
-
import { type PositioningFunction, type Locale } from 'ckeditor5/src/utils';
|
10
|
-
import type {
|
8
|
+
import { BalloonPanelView, EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui.js';
|
9
|
+
import { type PositioningFunction, type Locale } from 'ckeditor5/src/utils.js';
|
10
|
+
import type { EditingView } from 'ckeditor5/src/engine.js';
|
11
11
|
/**
|
12
12
|
* Inline editor UI view. Uses an nline editable and a floating toolbar.
|
13
13
|
*/
|
@@ -110,7 +110,7 @@ export default class InlineEditorUIView extends EditorUIView {
|
|
110
110
|
* in the main {@link module:editor-inline/inlineeditoruiview~InlineEditorUIView#toolbar toolbar}.
|
111
111
|
* See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.
|
112
112
|
*/
|
113
|
-
constructor(locale: Locale, editingView:
|
113
|
+
constructor(locale: Locale, editingView: EditingView, editableElement?: HTMLElement, options?: {
|
114
114
|
shouldToolbarGroupWhenFull?: boolean;
|
115
115
|
});
|
116
116
|
/**
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/**
|
2
|
-
* @license Copyright (c) 2003-
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
6
|
* @module editor-inline/inlineeditoruiview
|
7
7
|
*/
|
8
|
-
import { BalloonPanelView, EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui';
|
9
|
-
import { Rect, ResizeObserver, toUnit } from 'ckeditor5/src/utils';
|
8
|
+
import { BalloonPanelView, EditorUIView, InlineEditableUIView, ToolbarView } from 'ckeditor5/src/ui.js';
|
9
|
+
import { Rect, ResizeObserver, toUnit } from 'ckeditor5/src/utils.js';
|
10
10
|
const toPx = toUnit('px');
|
11
11
|
/**
|
12
12
|
* Inline editor UI view. Uses an nline editable and a floating toolbar.
|