@ckeditor/ckeditor5-editor-inline 34.1.0 → 35.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +207 -0
- package/LICENSE.md +4 -0
- package/README.md +1 -1
- package/build/editor-inline.js +1 -1
- package/package.json +15 -14
- package/src/inlineeditor.js +12 -8
- package/src/inlineeditoruiview.js +9 -3
package/CHANGELOG.md
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
Changelog
|
2
|
+
=========
|
3
|
+
|
4
|
+
All changes in the package are documented in the main repository. See: https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md.
|
5
|
+
|
6
|
+
Changes for the past releases are available below.
|
7
|
+
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v18.0.0...v19.0.0) (2020-04-29)
|
9
|
+
|
10
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
11
|
+
|
12
|
+
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v17.0.0...v18.0.0) (2020-03-19)
|
14
|
+
|
15
|
+
### MAJOR BREAKING CHANGES
|
16
|
+
|
17
|
+
* From now on, the inline toolbar groups overflowing items by default. This behavior can be disabled by setting the [`config.toolbar.shouldNotGroupWhenFull`](https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_toolbar_toolbarview-ToolbarOptions.html#member-shouldGroupWhenFull) configuration option to `true`.
|
18
|
+
|
19
|
+
### Features
|
20
|
+
|
21
|
+
* The inline editor toolbar should group items when its width exceeds the editable’s width (see [ckeditor/ckeditor5#5597](https://github.com/ckeditor/ckeditor5/issues/5597)). ([1c5746c](https://github.com/ckeditor/ckeditor5-editor-inline/commit/1c5746c))
|
22
|
+
|
23
|
+
|
24
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v16.0.0...v17.0.0) (2020-02-19)
|
25
|
+
|
26
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
27
|
+
|
28
|
+
|
29
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v15.0.0...v16.0.0) (2019-12-04)
|
30
|
+
|
31
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
32
|
+
|
33
|
+
|
34
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.3.0...v15.0.0) (2019-10-23)
|
35
|
+
|
36
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
37
|
+
|
38
|
+
|
39
|
+
## [12.3.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.2.1...v12.3.0) (2019-08-26)
|
40
|
+
|
41
|
+
### Features
|
42
|
+
|
43
|
+
* The `InlineEditorUIView` should display on different sides of editable depending on the direction of the UI language. See [ckeditor/ckeditor5#1151](https://github.com/ckeditor/ckeditor5/issues/1151). ([c387059](https://github.com/ckeditor/ckeditor5-editor-inline/commit/c387059))
|
44
|
+
|
45
|
+
### Other changes
|
46
|
+
|
47
|
+
* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([1d21b8e](https://github.com/ckeditor/ckeditor5-editor-inline/commit/1d21b8e))
|
48
|
+
* Introduced a check that prevents sharing source elements between editor instances. See [ckeditor/ckeditor5#746](https://github.com/ckeditor/ckeditor5/issues/746). ([5e42fcf](https://github.com/ckeditor/ckeditor5-editor-inline/commit/5e42fcf))
|
49
|
+
|
50
|
+
|
51
|
+
## [12.2.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.2.0...v12.2.1) (2019-07-10)
|
52
|
+
|
53
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
54
|
+
|
55
|
+
|
56
|
+
## [12.2.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.1.1...v12.2.0) (2019-07-04)
|
57
|
+
|
58
|
+
### Features
|
59
|
+
|
60
|
+
* `InlineEditor.create()` will throw an error, when a `<textarea>` element is used. ([56c9f40](https://github.com/ckeditor/ckeditor5-editor-inline/commit/56c9f40))
|
61
|
+
|
62
|
+
|
63
|
+
## [12.1.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.1.0...v12.1.1) (2019-06-05)
|
64
|
+
|
65
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
66
|
+
|
67
|
+
|
68
|
+
## [12.1.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v12.0.0...v12.1.0) (2019-04-10)
|
69
|
+
|
70
|
+
### Features
|
71
|
+
|
72
|
+
* Introduced `EditorConfig#initialData`. ([59e97b5](https://github.com/ckeditor/ckeditor5-editor-inline/commit/59e97b5))
|
73
|
+
|
74
|
+
|
75
|
+
## [12.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v11.0.2...v12.0.0) (2019-02-28)
|
76
|
+
|
77
|
+
### Features
|
78
|
+
|
79
|
+
* Added support for the `config.placeholder` option which allows configuring the empty editor content placeholder (see [ckeditor/ckeditor5#479](https://github.com/ckeditor/ckeditor5/issues/479)). ([24016bd](https://github.com/ckeditor/ckeditor5-editor-inline/commit/24016bd))
|
80
|
+
|
81
|
+
### Bug fixes
|
82
|
+
|
83
|
+
* Fixed memory leaks during editor initialization and destruction (see [ckeditor/ckeditor5#1341](https://github.com/ckeditor/ckeditor5/issues/1341)). ([dd2bb90](https://github.com/ckeditor/ckeditor5-editor-inline/commit/dd2bb90))
|
84
|
+
|
85
|
+
### Other changes
|
86
|
+
|
87
|
+
* Adjustments to new editor initialization events. See breaking changes. ([9536767](https://github.com/ckeditor/ckeditor5-editor-inline/commit/9536767))
|
88
|
+
* Editor UI classes API refactoring. See breaking changes. ([f8195da](https://github.com/ckeditor/ckeditor5-editor-inline/commit/f8195da))
|
89
|
+
|
90
|
+
### BREAKING CHANGES
|
91
|
+
|
92
|
+
* Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
|
93
|
+
* The second argument of `InlineEditorUIView.constructor()` is an editing view instance now.
|
94
|
+
* The `editor#dataReady` event was removed. The `editor.data#ready` event has been introduced and should be used instead.
|
95
|
+
* The `editor#pluginsReady` event was removed. Use plugin `afterInit()` method instead.
|
96
|
+
* Removed `InlineEditor#element` property. The `InlineEditorUI#element` property should be used instead.
|
97
|
+
* Removed `InlineEditorUIView#editableElement`. Instead `InlineEditorUI#getEditableElement()` method should be used.
|
98
|
+
|
99
|
+
|
100
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v11.0.1...v11.0.2) (2018-12-05)
|
101
|
+
|
102
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
103
|
+
|
104
|
+
|
105
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v11.0.0...v11.0.1) (2018-10-08)
|
106
|
+
|
107
|
+
### Bug fixes
|
108
|
+
|
109
|
+
* Child views should be added in `InlineEditorUIView#render()` instead of `#constructor()` to allow early template manipulation. Closes [ckeditor/ckeditor5#1150](https://github.com/ckeditor/ckeditor5/issues/1150). ([b0be713](https://github.com/ckeditor/ckeditor5-editor-inline/commit/b0be713))
|
110
|
+
|
111
|
+
Huge thanks to [Alex Eckermann](https://github.com/alexeckermann) for this contribution!
|
112
|
+
|
113
|
+
|
114
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v10.0.1...v11.0.0) (2018-07-18)
|
115
|
+
|
116
|
+
### Features
|
117
|
+
|
118
|
+
* Editor can now be created with initial data passed to the constructor. Closes [#37](https://github.com/ckeditor/ckeditor5-editor-inline/issues/37). ([cfd8c53](https://github.com/ckeditor/ckeditor5-editor-inline/commit/cfd8c53))
|
119
|
+
|
120
|
+
### Other changes
|
121
|
+
|
122
|
+
* Used the `EditorUI` as a parent class for the `InlineEditorUI` (see [ckeditor/ckeditor5-core#130](https://github.com/ckeditor/ckeditor5-core/issues/130)). ([c148346](https://github.com/ckeditor/ckeditor5-editor-inline/commit/c148346))
|
123
|
+
|
124
|
+
### BREAKING CHANGES
|
125
|
+
|
126
|
+
* The `InlineEditor#element` property was renamed to `InlineEditor#sourceElement` and `InlineEditor#updateElement()` method to `InlineEditor#updateSourceElement()`. See [ckeditor/ckeditor5-core#64](https://github.com/ckeditor/ckeditor5-core/issues/64).
|
127
|
+
|
128
|
+
|
129
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v10.0.0...v10.0.1) (2018-06-21)
|
130
|
+
|
131
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
132
|
+
|
133
|
+
|
134
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
|
135
|
+
|
136
|
+
### Other changes
|
137
|
+
|
138
|
+
* Changed the license to GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991). ([4a6d43a](https://github.com/ckeditor/ckeditor5-editor-inline/commit/4a6d43a))
|
139
|
+
|
140
|
+
### BREAKING CHANGES
|
141
|
+
|
142
|
+
* The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
|
143
|
+
|
144
|
+
|
145
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
|
146
|
+
|
147
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
148
|
+
|
149
|
+
|
150
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
|
151
|
+
|
152
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
153
|
+
|
154
|
+
|
155
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
|
156
|
+
|
157
|
+
### Other changes
|
158
|
+
|
159
|
+
* Migrated the editor styles to PostCSS (see [ckeditor/ckeditor5-ui#144](https://github.com/ckeditor/ckeditor5-ui/issues/144)). ([9fbecae](https://github.com/ckeditor/ckeditor5-editor-inline/commit/9fbecae))
|
160
|
+
* Removed the `.ck-editor-toolbar` class from the toolbar (see [ckeditor/ckeditor5-theme-lark#135](https://github.com/ckeditor/ckeditor5-theme-lark/issues/135)). ([213ddfd](https://github.com/ckeditor/ckeditor5-editor-inline/commit/213ddfd))
|
161
|
+
|
162
|
+
|
163
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
|
164
|
+
|
165
|
+
### Other changes
|
166
|
+
|
167
|
+
* Aligned UI library usage to the [changes in the UI framework](https://github.com/ckeditor/ckeditor5-ui/pull/332).
|
168
|
+
|
169
|
+
|
170
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v0.2.0...v1.0.0-alpha.1) (2017-10-03)
|
171
|
+
|
172
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
173
|
+
|
174
|
+
|
175
|
+
## [0.2.0](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v0.1.1...v0.2.0) (2017-09-03)
|
176
|
+
|
177
|
+
### Bug fixes
|
178
|
+
|
179
|
+
* `InlineEditor.create()` should be able to create an instance of its subclass. Closes [#25](https://github.com/ckeditor/ckeditor5-editor-inline/issues/25). ([1da0563](https://github.com/ckeditor/ckeditor5-editor-inline/commit/1da0563))
|
180
|
+
* Editor element should be filled up with data once the editor is destroyed. Closes [#19](https://github.com/ckeditor/ckeditor5-editor-inline/issues/19). ([fe7d27b](https://github.com/ckeditor/ckeditor5-editor-inline/commit/fe7d27b))
|
181
|
+
* The toolbar should not collapse when the window is narrow. Closes [#11](https://github.com/ckeditor/ckeditor5-editor-inline/issues/11). ([705dbe5](https://github.com/ckeditor/ckeditor5-editor-inline/commit/705dbe5))
|
182
|
+
|
183
|
+
### Features
|
184
|
+
|
185
|
+
* The toolbar should support a vertical offset from the top of the web page. Closes [#23](https://github.com/ckeditor/ckeditor5-editor-inline/issues/23). ([01e29d5](https://github.com/ckeditor/ckeditor5-editor-inline/commit/01e29d5))
|
186
|
+
|
187
|
+
### Other changes
|
188
|
+
|
189
|
+
* Renamed the InlineEditor file to "inlineeditor.js" to match the naming convention. Closes [#6](https://github.com/ckeditor/ckeditor5-editor-inline/issues/6). ([dac7551](https://github.com/ckeditor/ckeditor5-editor-inline/commit/dac7551))
|
190
|
+
|
191
|
+
### BREAKING CHANGES
|
192
|
+
|
193
|
+
* The `inline.js` file containing `InlineEditor` class has been renamed to `inlineeditor.js`.
|
194
|
+
|
195
|
+
|
196
|
+
## [0.1.1](https://github.com/ckeditor/ckeditor5-editor-inline/compare/v0.1.0...v0.1.1) (2017-05-07)
|
197
|
+
|
198
|
+
### Bug fixes
|
199
|
+
|
200
|
+
* The position of the floating toolbar should be updated after the editable has grown. Closes [#4](https://github.com/ckeditor/ckeditor5-editor-inline/issues/4). ([ae578b3](https://github.com/ckeditor/ckeditor5-editor-inline/commit/ae578b3))
|
201
|
+
|
202
|
+
|
203
|
+
## 0.1.0 (2017-04-05)
|
204
|
+
|
205
|
+
### Features
|
206
|
+
|
207
|
+
* Introduced the inline editor. Closes: [#1](https://github.com/ckeditor/ckeditor5-editor-inline/issues/1). ([30c999f](https://github.com/ckeditor/ckeditor5-editor-inline/commit/30c999f))
|
package/LICENSE.md
CHANGED
@@ -11,6 +11,10 @@ Sources of Intellectual Property Included in CKEditor
|
|
11
11
|
|
12
12
|
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
|
13
13
|
|
14
|
+
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
15
|
+
|
16
|
+
* lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
|
17
|
+
|
14
18
|
Trademarks
|
15
19
|
----------
|
16
20
|
|
package/README.md
CHANGED
@@ -10,7 +10,7 @@ The inline editor implementation for CKEditor 5.
|
|
10
10
|
|
11
11
|
This package exposes the [`InlineEditor`](https://ckeditor.com/docs/ckeditor5/latest/api/module_editor-inline_inlineeditor-InlineEditor.html) class. Follow there to learn more about this type of editor and how to initialize it.
|
12
12
|
|
13
|
-
This package contains the source version of the inline editor. This editor implementation is also available
|
13
|
+
This package contains the source version of the inline editor. This kind of editor implementation is also available as a ready-to-use [inline build](https://www.npmjs.com/package/@ckeditor/ckeditor5-build-inline). Read more about [CKEditor 5 predefined builds](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alternative-setups/predefined-builds.html) in the CKEditor 5 documentation.
|
14
14
|
|
15
15
|
## Documentation
|
16
16
|
|
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:()=>
|
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 v=Function.prototype,m=Object.prototype,y=v.toString,O=m.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),this.focusTracker.add(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=t.editing.view,r=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})})),r.fillFromConfig(this._toolbarConfig,this.componentFactory),(0,P.enableToolbarKeyboardFocus)({origin:i,originFocusTracker:this.focusTracker,originKeystrokeHandler:t.keystrokes,toolbar:r})}_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": "
|
3
|
+
"version": "35.0.1",
|
4
4
|
"description": "Inline editor implementation for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,22 +11,22 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"ckeditor5": "^
|
14
|
+
"ckeditor5": "^35.0.1",
|
15
15
|
"lodash-es": "^4.17.15"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
18
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
19
|
-
"@ckeditor/ckeditor5-core": "^
|
18
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.0.1",
|
19
|
+
"@ckeditor/ckeditor5-core": "^35.0.1",
|
20
20
|
"@ckeditor/ckeditor5-dev-utils": "^30.0.0",
|
21
|
-
"@ckeditor/ckeditor5-engine": "^
|
22
|
-
"@ckeditor/ckeditor5-enter": "^
|
23
|
-
"@ckeditor/ckeditor5-heading": "^
|
24
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
25
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
26
|
-
"@ckeditor/ckeditor5-typing": "^
|
27
|
-
"@ckeditor/ckeditor5-ui": "^
|
28
|
-
"@ckeditor/ckeditor5-undo": "^
|
29
|
-
"@ckeditor/ckeditor5-utils": "^
|
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",
|
30
30
|
"webpack": "^5.58.1",
|
31
31
|
"webpack-cli": "^4.9.0"
|
32
32
|
},
|
@@ -48,7 +48,8 @@
|
|
48
48
|
"src",
|
49
49
|
"theme",
|
50
50
|
"build",
|
51
|
-
"ckeditor5-metadata.json"
|
51
|
+
"ckeditor5-metadata.json",
|
52
|
+
"CHANGELOG.md"
|
52
53
|
],
|
53
54
|
"scripts": {
|
54
55
|
"dll:build": "webpack"
|
package/src/inlineeditor.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
*/
|
9
9
|
|
10
10
|
import { Editor, DataApiMixin, ElementApiMixin, attachToForm, secureSourceElement } from 'ckeditor5/src/core';
|
11
|
-
import { mix, getDataFromElement,
|
11
|
+
import { mix, getDataFromElement, CKEditorError } from 'ckeditor5/src/utils';
|
12
12
|
|
13
13
|
import { isElement } from 'lodash-es';
|
14
14
|
|
@@ -16,7 +16,7 @@ import InlineEditorUI from './inlineeditorui';
|
|
16
16
|
import InlineEditorUIView from './inlineeditoruiview';
|
17
17
|
|
18
18
|
/**
|
19
|
-
* The {@glink installation/
|
19
|
+
* The {@glink installation/getting-started/predefined-builds#inline-editor inline editor} implementation.
|
20
20
|
* It uses an inline editable and a floating toolbar.
|
21
21
|
* See the {@glink examples/builds/inline-editor demo}.
|
22
22
|
*
|
@@ -27,9 +27,9 @@ import InlineEditorUIView from './inlineeditoruiview';
|
|
27
27
|
*
|
28
28
|
* The inline editor can be used directly from source (if you installed the
|
29
29
|
* [`@ckeditor/ckeditor5-editor-inline`](https://www.npmjs.com/package/@ckeditor/ckeditor5-editor-inline) package)
|
30
|
-
* but it is also available in the {@glink installation/
|
30
|
+
* but it is also available in the {@glink installation/getting-started/predefined-builds#inline-editor inline build}.
|
31
31
|
*
|
32
|
-
* {@glink installation/
|
32
|
+
* {@glink installation/getting-started/predefined-builds Builds}
|
33
33
|
* are ready-to-use editors with plugins bundled in. When using the editor from
|
34
34
|
* source you need to take care of loading all plugins by yourself
|
35
35
|
* (through the {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`} option).
|
@@ -90,7 +90,9 @@ export default class InlineEditor extends Editor {
|
|
90
90
|
/**
|
91
91
|
* Destroys the editor instance, releasing all resources used by it.
|
92
92
|
*
|
93
|
-
* Updates the original editor element with the data
|
93
|
+
* Updates the original editor element with the data if the
|
94
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}
|
95
|
+
* configuration option is set to `true`.
|
94
96
|
*
|
95
97
|
* @returns {Promise}
|
96
98
|
*/
|
@@ -104,7 +106,7 @@ export default class InlineEditor extends Editor {
|
|
104
106
|
return super.destroy()
|
105
107
|
.then( () => {
|
106
108
|
if ( this.sourceElement ) {
|
107
|
-
|
109
|
+
this.updateSourceElement( data );
|
108
110
|
}
|
109
111
|
} );
|
110
112
|
}
|
@@ -177,7 +179,7 @@ export default class InlineEditor extends Editor {
|
|
177
179
|
* # Using the editor from source
|
178
180
|
*
|
179
181
|
* The code samples listed in the previous sections of this documentation assume that you are using an
|
180
|
-
* {@glink installation/
|
182
|
+
* {@glink installation/getting-started/predefined-builds editor build} (for example – `@ckeditor/ckeditor5-build-inline`).
|
181
183
|
*
|
182
184
|
* If you want to use the inline editor from source (`@ckeditor/ckeditor5-editor-inline/src/inlineeditor`),
|
183
185
|
* you need to define the list of
|
@@ -189,7 +191,9 @@ export default class InlineEditor extends Editor {
|
|
189
191
|
* or the editor's initial data.
|
190
192
|
*
|
191
193
|
* If a DOM element is passed, its content will be automatically loaded to the editor upon initialization.
|
192
|
-
*
|
194
|
+
* The editor data will be set back to the original element once the editor is destroyed only if the
|
195
|
+
* {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}
|
196
|
+
* option is set to `true`.
|
193
197
|
*
|
194
198
|
* If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.
|
195
199
|
* It is available under the {@link module:editor-inline/inlineeditorui~InlineEditorUI#element `editor.ui.element`} property.
|
@@ -32,6 +32,8 @@ export default class InlineEditorUIView extends EditorUIView {
|
|
32
32
|
constructor( locale, editingView, editableElement, options = {} ) {
|
33
33
|
super( locale );
|
34
34
|
|
35
|
+
const t = locale.t;
|
36
|
+
|
35
37
|
/**
|
36
38
|
* A floating toolbar view instance.
|
37
39
|
*
|
@@ -116,7 +118,7 @@ export default class InlineEditorUIView extends EditorUIView {
|
|
116
118
|
* See: {@link module:utils/dom/position~Options#positions}.
|
117
119
|
*
|
118
120
|
* @readonly
|
119
|
-
* @type {Array.<module:utils/dom/position~
|
121
|
+
* @type {Array.<module:utils/dom/position~PositioningFunction>}
|
120
122
|
*/
|
121
123
|
this.panelPositions = this._getPanelPositions();
|
122
124
|
|
@@ -132,7 +134,11 @@ export default class InlineEditorUIView extends EditorUIView {
|
|
132
134
|
* @readonly
|
133
135
|
* @member {module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}
|
134
136
|
*/
|
135
|
-
this.editable = new InlineEditableUIView( locale, editingView, editableElement
|
137
|
+
this.editable = new InlineEditableUIView( locale, editingView, editableElement, {
|
138
|
+
label: editableView => {
|
139
|
+
return t( 'Rich Text Editor. Editing area: %0', editableView.name );
|
140
|
+
}
|
141
|
+
} );
|
136
142
|
|
137
143
|
/**
|
138
144
|
* An instance of the resize observer that helps dynamically determine the geometry of the toolbar
|
@@ -207,7 +213,7 @@ export default class InlineEditorUIView extends EditorUIView {
|
|
207
213
|
* See: {@link module:utils/dom/position~Options#positions}.
|
208
214
|
*
|
209
215
|
* @private
|
210
|
-
* @returns {Array.<module:utils/dom/position~
|
216
|
+
* @returns {Array.<module:utils/dom/position~PositioningFunction>}
|
211
217
|
*/
|
212
218
|
_getPanelPositions() {
|
213
219
|
const positions = [
|