@ckeditor/ckeditor5-editor-balloon 38.2.0-alpha.1 → 39.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -4,7 +4,6 @@ CKEditor 5 balloon editor implementation
4
4
  [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-editor-balloon.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-balloon)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
6
6
  [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
7
- ![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-editor-balloon)
8
7
 
9
8
  The balloon editor implementation (Medium-like editor) for CKEditor 5.
10
9
 
@@ -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")},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,{BalloonEditor:()=>R});var t=o(704),e=o(273),r=o(209),n=o(434),s=o(492);class c extends e.EditorUI{constructor(t,e){super(t),this.view=e}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.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_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})}}}class a extends e.EditorUIView{constructor(t,o,i){super(t);const r=t.t;this.editable=new e.InlineEditableUIView(t,o,i,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)})}render(){super.render(),this.registerChild(this.editable)}}const l=function(t){return null!=t&&"object"==typeof t};const d="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const h=(d||u||Function("return this")()).Symbol;var g=Object.prototype,f=g.hasOwnProperty,p=g.toString,b=h?h.toStringTag:void 0;const m=function(t){var e=f.call(t,b),o=t[b];try{t[b]=void 0;var i=!0}catch(t){}var r=p.call(t);return i&&(e?t[b]=o:delete t[b]),r};var v=Object.prototype.toString;const y=function(t){return v.call(t)};var w=h?h.toStringTag:void 0;const E=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?m(t):y(t)};const j=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var x=Function.prototype,O=Object.prototype,S=x.toString,P=O.hasOwnProperty,T=S.call(Object);const C=function(t){if(!l(t)||"[object Object]"!=E(t))return!1;var e=j(t);if(null===e)return!0;var o=P.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&S.call(o)==T};const D=function(t){return l(t)&&1===t.nodeType&&!C(t)};class R extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,i={}){if(!F(o)&&void 0!==i.initialData)throw new r.CKEditorError("editor-create-initial-data",null);super(i),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return F(t)?(0,r.getDataFromElement)(t):t}(o)),F(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o));const n=this.config.get("plugins");n.push(e.BalloonToolbar),this.config.set("plugins",n),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const s=new a(this.locale,this.editing.view,this.sourceElement);this.ui=new c(this,s),(0,t.attachToForm)(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,e={}){return new Promise((o=>{if(F(t)&&"TEXTAREA"===t.tagName)throw new r.CKEditorError("editor-wrong-element",null);const i=new this(t,e);o(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function F(t){return D(t)}R.Context=t.Context,R.EditorWatchdog=n.EditorWatchdog,R.ContextWatchdog=n.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorBalloon=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,{BalloonEditor:()=>R});var t=o(704),e=o(273),r=o(209),n=o(434),s=o(492);class c extends e.EditorUI{constructor(t,e){super(t),this.view=e}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.fire("ready")}destroy(){super.destroy();const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy()}_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})}}class a extends e.EditorUIView{constructor(t,o,i){super(t);const r=t.t;this.editable=new e.InlineEditableUIView(t,o,i,{label:t=>r("Rich Text Editor. Editing area: %0",t.name)})}render(){super.render(),this.registerChild(this.editable)}}const l=function(t){return null!=t&&"object"==typeof t};const d="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const h=(d||u||Function("return this")()).Symbol;var g=Object.prototype,p=g.hasOwnProperty,f=g.toString,b=h?h.toStringTag:void 0;const m=function(t){var e=p.call(t,b),o=t[b];try{t[b]=void 0;var i=!0}catch(t){}var r=f.call(t);return i&&(e?t[b]=o:delete t[b]),r};var v=Object.prototype.toString;const y=function(t){return v.call(t)};var w=h?h.toStringTag:void 0;const j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?m(t):y(t)};const E=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var O=Function.prototype,x=Object.prototype,S=O.toString,P=x.hasOwnProperty,T=S.call(Object);const C=function(t){if(!l(t)||"[object Object]"!=j(t))return!1;var e=E(t);if(null===e)return!0;var o=P.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&S.call(o)==T};const D=function(t){return l(t)&&1===t.nodeType&&!C(t)};class R extends((0,t.DataApiMixin)((0,t.ElementApiMixin)(t.Editor))){constructor(o,i={}){if(!F(o)&&void 0!==i.initialData)throw new r.CKEditorError("editor-create-initial-data",null);super(i),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return F(t)?(0,r.getDataFromElement)(t):t}(o)),F(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this,o));const n=this.config.get("plugins");n.push(e.BalloonToolbar),this.config.set("plugins",n),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const s=new a(this.locale,this.editing.view,this.sourceElement);this.ui=new c(this,s),(0,t.attachToForm)(this)}destroy(){const t=this.getData();return this.ui.destroy(),super.destroy().then((()=>{this.sourceElement&&this.updateSourceElement(t)}))}static create(t,e={}){return new Promise((o=>{if(F(t)&&"TEXTAREA"===t.tagName)throw new r.CKEditorError("editor-wrong-element",null);const i=new this(t,e);o(i.initPlugins().then((()=>i.ui.init())).then((()=>i.data.init(i.config.get("initialData")))).then((()=>i.fire("ready"))).then((()=>i)))}))}}function F(t){return D(t)}R.Context=t.Context,R.EditorWatchdog=n.EditorWatchdog,R.ContextWatchdog=n.ContextWatchdog})(),(window.CKEditor5=window.CKEditor5||{}).editorBalloon=i})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-editor-balloon",
3
- "version": "38.2.0-alpha.1",
3
+ "version": "39.0.0",
4
4
  "description": "Balloon editor implementation for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -10,10 +10,9 @@
10
10
  "ckeditor5-dll"
11
11
  ],
12
12
  "main": "src/index.js",
13
- "type": "module",
14
13
  "dependencies": {
15
- "ckeditor5": "38.2.0-alpha.1",
16
- "lodash-es": "^4.17.15"
14
+ "ckeditor5": "39.0.0",
15
+ "lodash-es": "4.17.21"
17
16
  },
18
17
  "engines": {
19
18
  "node": ">=16.0.0",
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module editor-balloon/ballooneditor
7
7
  */
8
- import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core.js';
9
- import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
10
- import BalloonEditorUI from './ballooneditorui.js';
11
- declare const BalloonEditor_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>;
8
+ import { Editor, Context, type EditorConfig } from 'ckeditor5/src/core';
9
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
10
+ import BalloonEditorUI from './ballooneditorui';
11
+ declare const BalloonEditor_base: import("ckeditor5/src/utils").Mixed<import("ckeditor5/src/utils").Mixed<typeof Editor, import("ckeditor5/src/core").ElementApi>, import("ckeditor5/src/core").DataApi>;
12
12
  /**
13
13
  * The {@glink installation/getting-started/predefined-builds#balloon-editor balloon editor}
14
14
  * implementation (Medium-like editor).
@@ -5,12 +5,12 @@
5
5
  /**
6
6
  * @module editor-balloon/ballooneditor
7
7
  */
8
- import { Editor, Context, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core.js';
9
- import { BalloonToolbar } from 'ckeditor5/src/ui.js';
10
- import { CKEditorError, getDataFromElement } from 'ckeditor5/src/utils.js';
11
- import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog.js';
12
- import BalloonEditorUI from './ballooneditorui.js';
13
- import BalloonEditorUIView from './ballooneditoruiview.js';
8
+ import { Editor, Context, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';
9
+ import { BalloonToolbar } from 'ckeditor5/src/ui';
10
+ import { CKEditorError, getDataFromElement } from 'ckeditor5/src/utils';
11
+ import { ContextWatchdog, EditorWatchdog } from 'ckeditor5/src/watchdog';
12
+ import BalloonEditorUI from './ballooneditorui';
13
+ import BalloonEditorUIView from './ballooneditoruiview';
14
14
  import { isElement as _isElement } from 'lodash-es';
15
15
  /**
16
16
  * The {@glink installation/getting-started/predefined-builds#balloon-editor balloon editor}
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module editor-balloon/ballooneditorui
7
7
  */
8
- import { type Editor } from 'ckeditor5/src/core.js';
9
- import { EditorUI } from 'ckeditor5/src/ui.js';
10
- import type BalloonEditorUIView from './ballooneditoruiview.js';
8
+ import { type Editor } from 'ckeditor5/src/core';
9
+ import { EditorUI } from 'ckeditor5/src/ui';
10
+ import type BalloonEditorUIView from './ballooneditoruiview';
11
11
  /**
12
12
  * The balloon editor UI class.
13
13
  */
@@ -36,7 +36,7 @@ export default class BalloonEditorUI extends EditorUI {
36
36
  */
37
37
  destroy(): void;
38
38
  /**
39
- * Enable the placeholder text on the editing root, if any was configured.
39
+ * Enable the placeholder text on the editing root.
40
40
  */
41
41
  private _initPlaceholder;
42
42
  }
@@ -2,8 +2,8 @@
2
2
  * @license Copyright (c) 2003-2023, 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 } from 'ckeditor5/src/ui.js';
6
- import { enablePlaceholder } from 'ckeditor5/src/engine.js';
5
+ import { EditorUI } from 'ckeditor5/src/ui';
6
+ import { enablePlaceholder } from 'ckeditor5/src/engine';
7
7
  /**
8
8
  * The balloon editor UI class.
9
9
  */
@@ -68,25 +68,24 @@ export default class BalloonEditorUI extends EditorUI {
68
68
  view.destroy();
69
69
  }
70
70
  /**
71
- * Enable the placeholder text on the editing root, if any was configured.
71
+ * Enable the placeholder text on the editing root.
72
72
  */
73
73
  _initPlaceholder() {
74
74
  const editor = this.editor;
75
75
  const editingView = editor.editing.view;
76
76
  const editingRoot = editingView.document.getRoot();
77
- const sourceElement = editor.sourceElement;
78
77
  const placeholder = editor.config.get('placeholder');
79
78
  if (placeholder) {
80
79
  const placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[editingRoot.rootName];
81
80
  if (placeholderText) {
82
- enablePlaceholder({
83
- view: editingView,
84
- element: editingRoot,
85
- text: placeholderText,
86
- isDirectHost: false,
87
- keepOnFocus: true
88
- });
81
+ editingRoot.placeholder = placeholderText;
89
82
  }
90
83
  }
84
+ enablePlaceholder({
85
+ view: editingView,
86
+ element: editingRoot,
87
+ isDirectHost: false,
88
+ keepOnFocus: true
89
+ });
91
90
  }
92
91
  }
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module editor-balloon/ballooneditoruiview
7
7
  */
8
- import { EditorUIView, InlineEditableUIView } from 'ckeditor5/src/ui.js';
9
- import type { Locale } from 'ckeditor5/src/utils.js';
10
- import type { View } from 'ckeditor5/src/engine.js';
8
+ import { EditorUIView, InlineEditableUIView } from 'ckeditor5/src/ui';
9
+ import type { Locale } from 'ckeditor5/src/utils';
10
+ import type { View } from 'ckeditor5/src/engine';
11
11
  /**
12
12
  * Contextual editor UI view. Uses the {@link module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}.
13
13
  */
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module editor-balloon/ballooneditoruiview
7
7
  */
8
- import { EditorUIView, InlineEditableUIView } from 'ckeditor5/src/ui.js';
8
+ import { EditorUIView, InlineEditableUIView } from 'ckeditor5/src/ui';
9
9
  /**
10
10
  * Contextual editor UI view. Uses the {@link module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}.
11
11
  */
package/src/index.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * @module editor-balloon
7
7
  */
8
- export { default as BalloonEditor } from './ballooneditor.js';
8
+ export { default as BalloonEditor } from './ballooneditor';
package/src/index.js CHANGED
@@ -5,4 +5,4 @@
5
5
  /**
6
6
  * @module editor-balloon
7
7
  */
8
- export { default as BalloonEditor } from './ballooneditor.js';
8
+ export { default as BalloonEditor } from './ballooneditor';