@ckeditor/ckeditor5-editor-balloon 35.0.1 → 35.1.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-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(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},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 r={};(()=>{"use strict";o.r(r),o.d(r,{BalloonEditor:()=>F});var t=o(704),e=o(273),i=o(209);const n=function(t){return null!=t&&"object"==typeof t};const s="object"==typeof global&&global&&global.Object===Object&&global;var a="object"==typeof self&&self&&self.Object===Object&&self;const c=(s||a||Function("return this")()).Symbol;var l=Object.prototype,d=l.hasOwnProperty,u=l.toString,h=c?c.toStringTag:void 0;const g=function(t){var e=d.call(t,h),o=t[h];try{t[h]=void 0;var r=!0}catch(t){}var i=u.call(t);return r&&(e?t[h]=o:delete t[h]),i};var b=Object.prototype.toString;const f=function(t){return b.call(t)};var p=c?c.toStringTag:void 0;const m=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?g(t):f(t)};const v=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var y=Function.prototype,w=Object.prototype,j=y.toString,E=w.hasOwnProperty,O=j.call(Object);const x=function(t){if(!n(t)||"[object Object]"!=m(t))return!1;var e=v(t);if(null===e)return!0;var o=E.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&j.call(o)==O};const T=function(t){return n(t)&&1===t.nodeType&&!x(t)};var S=o(492);class P extends t.EditorUI{constructor(t,e){super(t),this.view=e}get element(){return this.view.editable.element}init(){const t=this.editor,o=this.view,r=t.plugins.get("BalloonToolbar"),i=t.editing.view,n=o.editable,s=i.document.getRoot();n.name=s.rootName,o.render();const a=n.element;this.setEditableElement(n.name,a),this.focusTracker.add(a),n.bind("isFocused").to(this.focusTracker),i.attachDomRoot(a),(0,e.enableToolbarKeyboardFocus)({origin:i,originFocusTracker:this.focusTracker,originKeystrokeHandler:t.keystrokes,toolbar:r.toolbarView,beforeFocus(){r.show()},afterBlur(){r.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy(),super.destroy()}_initPlaceholder(){const t=this.editor,e=t.editing.view,o=e.document.getRoot(),r=t.sourceElement,i=t.config.get("placeholder")||r&&"textarea"===r.tagName.toLowerCase()&&r.getAttribute("placeholder");i&&(0,S.enablePlaceholder)({view:e,element:o,text:i,isDirectHost:!1,keepOnFocus:!0})}}class D extends e.EditorUIView{constructor(t,o,r){super(t);const i=t.t;this.editable=new e.InlineEditableUIView(t,o,r,{label:t=>i("Rich Text Editor. Editing area: %0",t.name)})}render(){super.render(),this.registerChild(this.editable)}}class F extends t.Editor{constructor(o,r={}){if(!T(o)&&void 0!==r.initialData)throw new i.CKEditorError("editor-create-initial-data",null);super(r),void 0===this.config.get("initialData")&&this.config.set("initialData",function(t){return T(t)?(0,i.getDataFromElement)(t):t}(o)),T(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this));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 D(this.locale,this.editing.view,this.sourceElement);this.ui=new P(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(T(t)&&"TEXTAREA"===t.tagName)throw new i.CKEditorError("editor-wrong-element",null);const r=new this(t,e);o(r.initPlugins().then((()=>r.ui.init())).then((()=>r.data.init(r.config.get("initialData")))).then((()=>r.fire("ready"))).then((()=>r)))}))}}(0,i.mix)(F,t.DataApiMixin),(0,i.mix)(F,t.ElementApiMixin)})(),(window.CKEditor5=window.CKEditor5||{}).editorBalloon=r})();
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,{BalloonEditor:()=>C});var t=o(704),e=o(273),r=o(209);const n=function(t){return null!=t&&"object"==typeof t};const s="object"==typeof global&&global&&global.Object===Object&&global;var c="object"==typeof self&&self&&self.Object===Object&&self;const a=(s||c||Function("return this")()).Symbol;var l=Object.prototype,d=l.hasOwnProperty,u=l.toString,h=a?a.toStringTag:void 0;const g=function(t){var e=d.call(t,h),o=t[h];try{t[h]=void 0;var i=!0}catch(t){}var r=u.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=a?a.toStringTag:void 0;const m=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?g(t):b(t)};const v=function(t,e){return function(o){return t(e(o))}}(Object.getPrototypeOf,Object);var y=Function.prototype,w=Object.prototype,j=y.toString,E=w.hasOwnProperty,O=j.call(Object);const x=function(t){if(!n(t)||"[object Object]"!=m(t))return!1;var e=v(t);if(null===e)return!0;var o=E.call(e,"constructor")&&e.constructor;return"function"==typeof o&&o instanceof o&&j.call(o)==O};const S=function(t){return n(t)&&1===t.nodeType&&!x(t)};var P=o(492);class T extends t.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(){const t=this.view;this.editor.editing.view.detachDomRoot(t.editable.name),t.destroy(),super.destroy()}_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,P.enablePlaceholder)({view:e,element:o,text:r,isDirectHost:!1,keepOnFocus:!0})}}class D 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)}}class C extends t.Editor{constructor(o,i={}){if(!S(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 S(t)?(0,r.getDataFromElement)(t):t}(o)),S(o)&&(this.sourceElement=o,(0,t.secureSourceElement)(this));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 D(this.locale,this.editing.view,this.sourceElement);this.ui=new T(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(S(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)))}))}}(0,r.mix)(C,t.DataApiMixin),(0,r.mix)(C,t.ElementApiMixin)})(),(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": "35.0.1",
3
+ "version": "35.1.0",
4
4
  "description": "Balloon 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.1",
14
+ "ckeditor5": "^35.1.0",
15
15
  "lodash-es": "^4.17.15"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-basic-styles": "^35.0.1",
19
- "@ckeditor/ckeditor5-core": "^35.0.1",
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.1",
22
- "@ckeditor/ckeditor5-enter": "^35.0.1",
23
- "@ckeditor/ckeditor5-heading": "^35.0.1",
24
- "@ckeditor/ckeditor5-paragraph": "^35.0.1",
25
- "@ckeditor/ckeditor5-theme-lark": "^35.0.1",
26
- "@ckeditor/ckeditor5-typing": "^35.0.1",
27
- "@ckeditor/ckeditor5-ui": "^35.0.1",
28
- "@ckeditor/ckeditor5-undo": "^35.0.1",
29
- "@ckeditor/ckeditor5-utils": "^35.0.1",
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
  },
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  import { EditorUI } from 'ckeditor5/src/core';
11
- import { enableToolbarKeyboardFocus } from 'ckeditor5/src/ui';
12
11
  import { enablePlaceholder } from 'ckeditor5/src/engine';
13
12
 
14
13
  /**
@@ -48,7 +47,6 @@ export default class BalloonEditorUI extends EditorUI {
48
47
  init() {
49
48
  const editor = this.editor;
50
49
  const view = this.view;
51
- const balloonToolbar = editor.plugins.get( 'BalloonToolbar' );
52
50
  const editingView = editor.editing.view;
53
51
  const editable = view.editable;
54
52
  const editingRoot = editingView.document.getRoot();
@@ -67,11 +65,6 @@ export default class BalloonEditorUI extends EditorUI {
67
65
  // editable areas (roots) but the balloon editor has only one.
68
66
  this.setEditableElement( editable.name, editableElement );
69
67
 
70
- // Let the global focus tracker know that the editable UI element is focusable and
71
- // belongs to the editor. From now on, the focus tracker will sustain the editor focus
72
- // as long as the editable is focused (e.g. the user is typing).
73
- this.focusTracker.add( editableElement );
74
-
75
68
  // Let the editable UI element respond to the changes in the global editor focus
76
69
  // tracker. It has been added to the same tracker a few lines above but, in reality, there are
77
70
  // many focusable areas in the editor, like balloons, toolbars or dropdowns and as long
@@ -85,19 +78,6 @@ export default class BalloonEditorUI extends EditorUI {
85
78
  // of the editor's engine. This is where the engine meets the UI.
86
79
  editingView.attachDomRoot( editableElement );
87
80
 
88
- enableToolbarKeyboardFocus( {
89
- origin: editingView,
90
- originFocusTracker: this.focusTracker,
91
- originKeystrokeHandler: editor.keystrokes,
92
- toolbar: balloonToolbar.toolbarView,
93
- beforeFocus() {
94
- balloonToolbar.show();
95
- },
96
- afterBlur() {
97
- balloonToolbar.hide();
98
- }
99
- } );
100
-
101
81
  this._initPlaceholder();
102
82
  this.fire( 'ready' );
103
83
  }