@ckeditor/ckeditor5-utils 34.2.0 → 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/CHANGELOG.md +324 -0
- package/LICENSE.md +1 -1
- package/package.json +19 -8
- package/src/areconnectedthroughproperties.js +54 -71
- package/src/ckeditorerror.js +92 -114
- package/src/collection.js +594 -762
- package/src/comparearrays.js +22 -28
- package/src/config.js +193 -223
- package/src/count.js +8 -12
- package/src/diff.js +85 -110
- package/src/difftochanges.js +47 -57
- package/src/dom/createelement.js +17 -25
- package/src/dom/emittermixin.js +202 -263
- package/src/dom/getancestors.js +9 -13
- package/src/dom/getborderwidths.js +10 -13
- package/src/dom/getcommonancestor.js +9 -15
- package/src/dom/getdatafromelement.js +5 -9
- package/src/dom/getpositionedancestor.js +9 -14
- package/src/dom/global.js +15 -4
- package/src/dom/indexof.js +7 -11
- package/src/dom/insertat.js +2 -4
- package/src/dom/iscomment.js +2 -5
- package/src/dom/isnode.js +10 -12
- package/src/dom/isrange.js +2 -4
- package/src/dom/istext.js +2 -4
- package/src/dom/isvisible.js +2 -4
- package/src/dom/iswindow.js +11 -16
- package/src/dom/position.js +220 -410
- package/src/dom/rect.js +335 -414
- package/src/dom/remove.js +5 -8
- package/src/dom/resizeobserver.js +109 -342
- package/src/dom/scroll.js +151 -183
- package/src/dom/setdatainelement.js +5 -9
- package/src/dom/tounit.js +10 -12
- package/src/elementreplacer.js +30 -44
- package/src/emittermixin.js +368 -634
- package/src/env.js +109 -116
- package/src/eventinfo.js +12 -65
- package/src/fastdiff.js +96 -128
- package/src/first.js +8 -12
- package/src/focustracker.js +77 -133
- package/src/index.js +0 -9
- package/src/inserttopriorityarray.js +9 -30
- package/src/isiterable.js +2 -4
- package/src/keyboard.js +117 -196
- package/src/keystrokehandler.js +72 -88
- package/src/language.js +9 -15
- package/src/locale.js +61 -158
- package/src/mapsequal.js +12 -17
- package/src/mix.js +17 -16
- package/src/nth.js +8 -11
- package/src/objecttomap.js +7 -11
- package/src/observablemixin.js +474 -778
- package/src/priorities.js +20 -32
- package/src/spy.js +3 -6
- package/src/toarray.js +2 -13
- package/src/tomap.js +8 -10
- package/src/translation-service.js +57 -93
- package/src/uid.js +34 -38
- package/src/unicode.js +28 -43
- package/src/version.js +134 -143
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
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-utils/compare/v18.0.0...v19.0.0) (2020-04-29)
|
|
9
|
+
|
|
10
|
+
### MINOR BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* The `translate` function from the `translation-service` was marked as protected. See [#334](https://github.com/ckeditor/ckeditor5-utils/issues/334).
|
|
13
|
+
* The format of stored editor translations has been changed. If you use `window.CKEDITOR_TRANSLATIONS` please see [#334](https://github.com/ckeditor/ckeditor5-utils/issues/334).
|
|
14
|
+
* The `getPositionedAncestor()` helper will no longer return the passed element when it is positioned.
|
|
15
|
+
|
|
16
|
+
### MAJOR BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* `env.isEdge` is no longer available. See [ckeditor/ckeditor5#6202](https://github.com/ckeditor/ckeditor5/issues/6202).
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* Added the support for initializing `Collection` items via the `constructor()`. Closes [ckeditor/ckeditor5#6319](https://github.com/ckeditor/ckeditor5/issues/6319). ([8846e66](https://github.com/ckeditor/ckeditor5-utils/commit/8846e66))
|
|
23
|
+
* Provided support for plural forms internalization. Part of [ckeditor/ckeditor5#6526](https://github.com/ckeditor/ckeditor5/issues/6526). ([5f6ea75](https://github.com/ckeditor/ckeditor5-utils/commit/5f6ea75))
|
|
24
|
+
|
|
25
|
+
### Bug fixes
|
|
26
|
+
|
|
27
|
+
* Do not execute `ResizeObserver` callbacks when the resized element is invisible (but still in DOM) (see [ckeditor/ckeditor5#6570](https://github.com/ckeditor/ckeditor5/issues/6570)). ([fb13d9d](https://github.com/ckeditor/ckeditor5-utils/commit/fb13d9d))
|
|
28
|
+
* Editor will now load correctly in environment with `Symbol` polyfill. Closes [ckeditor/ckeditor5#6489](https://github.com/ckeditor/ckeditor5/issues/6489). ([7cd1f48](https://github.com/ckeditor/ckeditor5-utils/commit/7cd1f48))
|
|
29
|
+
* Fixed various cases with typing multi-byte unicode sequences (e.g. emojis). Closes [ckeditor/ckeditor5#3147](https://github.com/ckeditor/ckeditor5/issues/3147). Closes [ckeditor/ckeditor5#6495](https://github.com/ckeditor/ckeditor5/issues/6495). ([6dc1ba6](https://github.com/ckeditor/ckeditor5-utils/commit/6dc1ba6))
|
|
30
|
+
* The `getOptimalPosition()` helper should prefer positions that fit inside the viewport even though there are some others that fit better into the limiter. Closes [ckeditor/ckeditor5#6181](https://github.com/ckeditor/ckeditor5/issues/6181). ([7cd1238](https://github.com/ckeditor/ckeditor5-utils/commit/7cd1238))
|
|
31
|
+
|
|
32
|
+
### Other changes
|
|
33
|
+
|
|
34
|
+
* Removed `env.isEdge` as Edge is now detected and treated as Chrome. Closes [ckeditor/ckeditor5#6202](https://github.com/ckeditor/ckeditor5/issues/6202). ([2902b30](https://github.com/ckeditor/ckeditor5-utils/commit/2902b30))
|
|
35
|
+
* The `getPositionedAncestor()` helper should use `offsetParent` instead of `getComputedStyle()` for performance reasons. Closes [ckeditor/ckeditor5#6573](https://github.com/ckeditor/ckeditor5/issues/6573). ([7939756](https://github.com/ckeditor/ckeditor5-utils/commit/7939756))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v17.0.0...v18.0.0) (2020-03-19)
|
|
39
|
+
|
|
40
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v16.0.0...v17.0.0) (2020-02-19)
|
|
44
|
+
|
|
45
|
+
### MINOR BREAKING CHANGES
|
|
46
|
+
|
|
47
|
+
* The `getResizeObserver()` helper is no longer available. We recommend using the [`ResizeObserver`](http://ckeditor.com/docs/ckeditor5/latest/api/module_utils_dom_resizeobserver-ResizeObserver.html) class instead.
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* Added iterator interface to the `Config` class. ([1fdf2f1](https://github.com/ckeditor/ckeditor5-utils/commit/1fdf2f1))
|
|
52
|
+
|
|
53
|
+
### Other changes
|
|
54
|
+
|
|
55
|
+
* Improved `toMap()` method performance. This results in improved editor data processing speed. Closes [ckeditor/ckeditor5#5854](https://github.com/ckeditor/ckeditor5/issues/5854). ([fef816e](https://github.com/ckeditor/ckeditor5-utils/commit/fef816e))
|
|
56
|
+
* Replaced the `getResizeObserver()` helper with the `ResizeObserver` class for performance reasons. See [ckeditor/ckeditor5#6145](https://github.com/ckeditor/ckeditor5/issues/6145). ([05c97f8](https://github.com/ckeditor/ckeditor5-utils/commit/05c97f8))
|
|
57
|
+
* The `uid()` helper should be a lot faster. Closes [ckeditor/ckeditor5#6188](https://github.com/ckeditor/ckeditor5/issues/6188). ([b57fc3f](https://github.com/ckeditor/ckeditor5-utils/commit/b57fc3f))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v15.0.0...v16.0.0) (2019-12-04)
|
|
61
|
+
|
|
62
|
+
### Bug fixes
|
|
63
|
+
|
|
64
|
+
* Improved error rethrowing by replacing the error stack. Closes [ckeditor/ckeditor5#5595](https://github.com/ckeditor/ckeditor5/issues/5595). ([7685c0d](https://github.com/ckeditor/ckeditor5-utils/commit/7685c0d))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v14.0.0...v15.0.0) (2019-10-23)
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* Implemented the `getResizeObserver()` helper that offers an entry to the native `ResizeObserver` API (see [ckeditor/ckeditor5#416](https://github.com/ckeditor/ckeditor5/issues/416)). ([875d5a4](https://github.com/ckeditor/ckeditor5-utils/commit/875d5a4))
|
|
72
|
+
* Introduced `assertEqualMarkup()` test util method. Closes [ckeditor/ckeditor5-paste-from-office#14](https://github.com/ckeditor/ckeditor5-paste-from-office/issues/14). ([ee1655f](https://github.com/ckeditor/ckeditor5-utils/commit/ee1655f))
|
|
73
|
+
* Introduced support for creating elements in other XML namespaces. See [ckeditor/ckeditor5#1842](https://github.com/ckeditor/ckeditor5/issues/1842). ([37fbcb9](https://github.com/ckeditor/ckeditor5-utils/commit/37fbcb9))
|
|
74
|
+
|
|
75
|
+
Thanks [@Sebobo](https://github.com/Sebobo)!
|
|
76
|
+
|
|
77
|
+
### Bug fixes
|
|
78
|
+
|
|
79
|
+
* `Rect#excludeScrollbarsAndBorders` should support RTL environments. Fixed incorrect output of the method. Closes [#297](https://github.com/ckeditor/ckeditor5-utils/issues/297). ([35f34fc](https://github.com/ckeditor/ckeditor5-utils/commit/35f34fc))
|
|
80
|
+
|
|
81
|
+
### Other changes
|
|
82
|
+
|
|
83
|
+
* Introduced the `CKEditorError.rethrowUnexpectedError()` helper. Added custom error handling for the `Emitter#fire()` function. Part of [ckeditor/ckeditor5#1304](https://github.com/ckeditor/ckeditor5/issues/1304). ([1d84705](https://github.com/ckeditor/ckeditor5-utils/commit/1d84705))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## [14.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.1...v14.0.0) (2019-08-26)
|
|
87
|
+
|
|
88
|
+
### Features
|
|
89
|
+
|
|
90
|
+
* Add feature detection of Unicode properties entities' support. ([21c0f6b](https://github.com/ckeditor/ckeditor5-utils/commit/21c0f6b))
|
|
91
|
+
* Allowed specifying editor content language in `Locale`. Implemented the (UI and content) language direction discovery in `Locale`. Implemented `Locale#uiLanguage`, `Locale#uiLanguageDirection`, `Locale#contentLanguage`, and `Locale#contentLanguageDirection` properties. See [ckeditor/ckeditor5#1151](https://github.com/ckeditor/ckeditor5/issues/1151). ([91c95f3](https://github.com/ckeditor/ckeditor5-utils/commit/91c95f3))
|
|
92
|
+
|
|
93
|
+
### Other changes
|
|
94
|
+
|
|
95
|
+
* 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). ([71469ac](https://github.com/ckeditor/ckeditor5-utils/commit/71469ac))
|
|
96
|
+
* Removed the CKEditor 5 logger and its usage. Part of [ckeditor/ckeditor5#383](https://github.com/ckeditor/ckeditor5/issues/383). ([584ef1d](https://github.com/ckeditor/ckeditor5-utils/commit/584ef1d))
|
|
97
|
+
|
|
98
|
+
### BREAKING CHANGES
|
|
99
|
+
|
|
100
|
+
* The`Locale()` constructor arguments syntax has changed. Please refer to the API documentation to learn more.
|
|
101
|
+
* The `Locale#language` property has been deprecated by `Locale#uiLanguage`. Please refer to the API documentation to learn more.
|
|
102
|
+
* Removed the CKEditor 5 logger utility.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## [13.0.1](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.0...v13.0.1) (2019-07-10)
|
|
106
|
+
|
|
107
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## [13.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.1...v13.0.0) (2019-07-04)
|
|
111
|
+
|
|
112
|
+
### Features
|
|
113
|
+
|
|
114
|
+
* Added `env.isAndroid`. ([591f641](https://github.com/ckeditor/ckeditor5-utils/commit/591f641))
|
|
115
|
+
|
|
116
|
+
### Other changes
|
|
117
|
+
|
|
118
|
+
* Added context as second required argument to the `CKEditorError`'s constructor, changed `isCKEditorError()` method to `is()`. Introduced the `areConnectedThroughProperties()` utility. See [ckeditor/ckeditor5-watchdog#1](https://github.com/ckeditor/ckeditor5-watchdog/issues/1). ([bacc764](https://github.com/ckeditor/ckeditor5-utils/commit/bacc764))
|
|
119
|
+
|
|
120
|
+
### BREAKING CHANGES
|
|
121
|
+
|
|
122
|
+
* The list of `CKEditorError()`'s parameters was changed – now it requires the message, context and then data. The `isCKEditorError()` method was renamed to `is()`.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## [12.1.1](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.0...v12.1.1) (2019-06-05)
|
|
126
|
+
|
|
127
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## [12.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.0.0...v12.1.0) (2019-04-10)
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* Added `isSafari` property and `isSafari()` helper to the `env` module. See: [ckeditor/ckeditor5#1463](https://github.com/ckeditor/ckeditor5/issues/1463). ([f1ba6ae](https://github.com/ckeditor/ckeditor5-utils/commit/f1ba6ae))
|
|
135
|
+
* Made `FocusTracker#focusedElement` observable to bring support for multi-root editors (see [ckeditor/ckeditor5#1599](https://github.com/ckeditor/ckeditor5/issues/1599)). ([952d440](https://github.com/ckeditor/ckeditor5-utils/commit/952d440))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## [12.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.1.0...v12.0.0) (2019-02-28)
|
|
139
|
+
|
|
140
|
+
### Features
|
|
141
|
+
|
|
142
|
+
* Introduce `Collection.has()` method. Closes [#266](https://github.com/ckeditor/ckeditor5-utils/issues/266). ([312d55e](https://github.com/ckeditor/ckeditor5-utils/commit/312d55e))
|
|
143
|
+
|
|
144
|
+
### Bug fixes
|
|
145
|
+
|
|
146
|
+
* Prevent infinite loops on `.once()`. Closes [#272](https://github.com/ckeditor/ckeditor5-utils/issues/272). Closes [#204](https://github.com/ckeditor/ckeditor5-utils/issues/204). ([54b8108](https://github.com/ckeditor/ckeditor5-utils/commit/54b8108))
|
|
147
|
+
* Fixed memory leaks during editor initialization and destruction (see [ckeditor/ckeditor5#1341](https://github.com/ckeditor/ckeditor5/issues/1341)). ([94bc59e](https://github.com/ckeditor/ckeditor5-utils/commit/94bc59e))
|
|
148
|
+
|
|
149
|
+
### Other changes
|
|
150
|
+
|
|
151
|
+
* Configuration options should be cloned to prevent features from altering the original values. Closes [#257](https://github.com/ckeditor/ckeditor5-utils/issues/257). ([7981d4e](https://github.com/ckeditor/ckeditor5-utils/commit/7981d4e))
|
|
152
|
+
* DOM Elements will not be cloned when returned from config.get. Closes [#264](https://github.com/ckeditor/ckeditor5-utils/issues/264). ([4ad23b1](https://github.com/ckeditor/ckeditor5-utils/commit/4ad23b1))
|
|
153
|
+
* Optimized `diff()` function to use `fastDiff()` function internally for large data sets. Closes [#269](https://github.com/ckeditor/ckeditor5-utils/issues/269). ([ee9bed0](https://github.com/ckeditor/ckeditor5-utils/commit/ee9bed0))
|
|
154
|
+
* Replaced `for..of` statement in `EventEmitter` with `Array.prototype.forEach`. This changes allows building a React application using `create-react-app@2`. Closes [ckeditor/ckeditor5-react#40](https://github.com/ckeditor/ckeditor5-react/issues/40). ([900b54b](https://github.com/ckeditor/ckeditor5-utils/commit/900b54b))
|
|
155
|
+
|
|
156
|
+
### BREAKING CHANGES
|
|
157
|
+
|
|
158
|
+
* 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))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## [11.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.0.0...v11.1.0) (2018-12-05)
|
|
162
|
+
|
|
163
|
+
### Features
|
|
164
|
+
|
|
165
|
+
* Implemented `env#isGecko()`. See [ckeditor/ckeditor5-engine#1439](https://github.com/ckeditor/ckeditor5-engine/issues/1439). ([53b7c94](https://github.com/ckeditor/ckeditor5-utils/commit/53b7c94))
|
|
166
|
+
|
|
167
|
+
### Other changes
|
|
168
|
+
|
|
169
|
+
* Various fixes in the API docs. Thanks to [@denisname](https://github.com/denisname)!
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.1...v11.0.0) (2018-10-08)
|
|
173
|
+
|
|
174
|
+
### Other changes
|
|
175
|
+
|
|
176
|
+
* Removed the `lodash` library from this package (a modular `lodash` build has been kept under `src/lib/lodash/`). We now recommend using `lodash-es` directly. Closes [#251](https://github.com/ckeditor/ckeditor5-utils/issues/251). ([637c9e3](https://github.com/ckeditor/ckeditor5-utils/commit/637c9e3))
|
|
177
|
+
|
|
178
|
+
### BREAKING CHANGES
|
|
179
|
+
|
|
180
|
+
* Removed the `lodash` library from this package (a modular `lodash` build has been kept under `src/lib/lodash/`). We now recommend using `lodash-es` directly.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
## [10.2.1](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.0...v10.2.1) (2018-07-18)
|
|
184
|
+
|
|
185
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## [10.2.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.1.0...v10.2.0) (2018-07-18)
|
|
189
|
+
|
|
190
|
+
### Features
|
|
191
|
+
|
|
192
|
+
* Implemented a module exposing the `CKEDIOR_VERSION` to the global scope. Closes [ckeditor/ckeditor5#1005](https://github.com/ckeditor/ckeditor5/issues/1005). ([3546ac4](https://github.com/ckeditor/ckeditor5-utils/commit/3546ac4))
|
|
193
|
+
* Introduced `env.isEdge`. ([13d4af4](https://github.com/ckeditor/ckeditor5-utils/commit/13d4af4))
|
|
194
|
+
|
|
195
|
+
### Bug fixes
|
|
196
|
+
|
|
197
|
+
* The `isWindow()` helper should work in the Electron environment. Closes [ckeditor/ckeditor5#879](https://github.com/ckeditor/ckeditor5/issues/879). ([d561151](https://github.com/ckeditor/ckeditor5-utils/commit/d561151))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
## [10.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.0.0...v10.1.0) (2018-06-21)
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
* Introduced `set:{property}` event in `ObservableMixin`. Closes [#171](https://github.com/ckeditor/ckeditor5-utils/issues/171). ([6ef1246](https://github.com/ckeditor/ckeditor5-utils/commit/6ef1246))
|
|
205
|
+
* Introduced `fastDiff()` function. Closes [#235](https://github.com/ckeditor/ckeditor5-utils/issues/235). ([81fefc9](https://github.com/ckeditor/ckeditor5-utils/commit/81fefc9))
|
|
206
|
+
|
|
207
|
+
### Bug fixes
|
|
208
|
+
|
|
209
|
+
* Error should not be thrown when scrolling the viewport from within an iframe in a different domain. Closes [ckeditor/ckeditor5#930](https://github.com/ckeditor/ckeditor5/issues/930). ([ad4656e](https://github.com/ckeditor/ckeditor5-utils/commit/ad4656e))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
|
|
213
|
+
|
|
214
|
+
### Other changes
|
|
215
|
+
|
|
216
|
+
* Changed the license to GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991). ([3177252](https://github.com/ckeditor/ckeditor5-utils/commit/3177252))
|
|
217
|
+
|
|
218
|
+
### BREAKING CHANGES
|
|
219
|
+
|
|
220
|
+
* 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.
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
|
|
224
|
+
|
|
225
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
|
|
229
|
+
|
|
230
|
+
Internal changes only (updated dependencies, documentation, etc.).
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
|
|
234
|
+
|
|
235
|
+
### Features
|
|
236
|
+
|
|
237
|
+
* Introduce `bind().toMany()` binding chain in `ObservableMixin`. Closes [#224](https://github.com/ckeditor/ckeditor5-utils/issues/224). ([cfa7d0e](https://github.com/ckeditor/ckeditor5-utils/commit/cfa7d0e))
|
|
238
|
+
* Introduced skipping items when binding collections. Closes [#215](https://github.com/ckeditor/ckeditor5-utils/issues/215). Closes https://github.com/ckeditor/ckeditor5-ui/issues/92. ([6e0d063](https://github.com/ckeditor/ckeditor5-utils/commit/6e0d063))
|
|
239
|
+
|
|
240
|
+
### Bug fixes
|
|
241
|
+
|
|
242
|
+
* `Rect.getDomRangeRects()` should not throw if the provided DOM range starts in a text node. Closes [ckeditor/ckeditor5-ui#317](https://github.com/ckeditor/ckeditor5-ui/issues/317). ([bfa55e9](https://github.com/ckeditor/ckeditor5-utils/commit/bfa55e9))
|
|
243
|
+
* Bulletproofed `isDomNode()` helper when used in iframes. Removed `isWindow()` logic from the helper. Closes [#201](https://github.com/ckeditor/ckeditor5-utils/issues/201). ([84ccda2](https://github.com/ckeditor/ckeditor5-utils/commit/84ccda2))
|
|
244
|
+
* Long keystrokes should be handled properly by getEnvKeystrokeText on Mac. Added support for ⇧ and ⌥ modifiers. Closes [#206](https://github.com/ckeditor/ckeditor5-utils/issues/206). ([d8443e2](https://github.com/ckeditor/ckeditor5-utils/commit/d8443e2))
|
|
245
|
+
|
|
246
|
+
### Other changes
|
|
247
|
+
|
|
248
|
+
* `ObservableMixin#unbind()` should not throw if used for an attribute which is not bound. Closes [#5](https://github.com/ckeditor/ckeditor5-utils/issues/5). ([848a818](https://github.com/ckeditor/ckeditor5-utils/commit/848a818))
|
|
249
|
+
* Aligned behaviors of `EmitterMixin` methods responsible for adding end removing listeners. Closes [#144](https://github.com/ckeditor/ckeditor5-utils/issues/144). ([460d7f4](https://github.com/ckeditor/ckeditor5-utils/commit/460d7f4))
|
|
250
|
+
|
|
251
|
+
The `emitter.on()` now has the same behavior as `emitter.listenTo( emitter )` as well as `emitter.off()` is the same as `emitter.stopListening( emitter )`. This made `emitter.stopListening()` correctly remove all listeners added in any way to it which prevents memory leaks.
|
|
252
|
+
* Aligned code to the new Translation Service ([ckeditor/ckeditor5#624](https://github.com/ckeditor/ckeditor5/issues/624)). ([a51767a](https://github.com/ckeditor/ckeditor5-utils/commit/a51767a))
|
|
253
|
+
* Introduced the `isText()` helper. Closes [#214](https://github.com/ckeditor/ckeditor5-utils/issues/214). ([a9a6bec](https://github.com/ckeditor/ckeditor5-utils/commit/a9a6bec))
|
|
254
|
+
* Renamed `env.mac` to `env.isMac`. Closes [#222](https://github.com/ckeditor/ckeditor5-utils/issues/222). ([dc6b226](https://github.com/ckeditor/ckeditor5-utils/commit/dc6b226))
|
|
255
|
+
* Renamed `isDomNode()` to `isNode()`. Closes [#219](https://github.com/ckeditor/ckeditor5-utils/issues/219). ([1823196](https://github.com/ckeditor/ckeditor5-utils/commit/1823196))
|
|
256
|
+
|
|
257
|
+
### BREAKING CHANGES
|
|
258
|
+
|
|
259
|
+
* Renamed `env.mac` to `env.isMac`.
|
|
260
|
+
* `isDomNode()` was renamed to `isNode()`.
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
|
|
264
|
+
|
|
265
|
+
### Bug fixes
|
|
266
|
+
|
|
267
|
+
* Removed a period at the end of an error message because some browsers included the period in links to errors. Closes [#193](https://github.com/ckeditor/ckeditor5-utils/issues/193). ([fdebc2f](https://github.com/ckeditor/ckeditor5-utils/commit/fdebc2f))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.10.0...v1.0.0-alpha.1) (2017-10-03)
|
|
271
|
+
|
|
272
|
+
### Features
|
|
273
|
+
|
|
274
|
+
* Scrolling DOM utilities should support multi-window scenarios. Closes [#175](https://github.com/ckeditor/ckeditor5-utils/issues/175). ([a5c27ea](https://github.com/ckeditor/ckeditor5-utils/commit/a5c27ea))
|
|
275
|
+
|
|
276
|
+
### Other changes
|
|
277
|
+
|
|
278
|
+
* `CKEditorError#message`, `log.error()` and `log.warn()` will contain a link to the error documentation. Closes [#185](https://github.com/ckeditor/ckeditor5-utils/issues/185). ([b7a00c9](https://github.com/ckeditor/ckeditor5-utils/commit/b7a00c9))
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
## [0.10.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.1...v0.10.0) (2017-09-03)
|
|
282
|
+
|
|
283
|
+
### Bug fixes
|
|
284
|
+
|
|
285
|
+
* `FocusTracker` should remain in sync when multiple `blur` events are followed by the `focus` event. Closes [#159](https://github.com/ckeditor/ckeditor5-utils/issues/159). ([0ff1b34](https://github.com/ckeditor/ckeditor5-utils/commit/0ff1b34))
|
|
286
|
+
|
|
287
|
+
### Features
|
|
288
|
+
|
|
289
|
+
* `KeystrokeHandler` should support priorities and proper keystroke cancelling. Closes [#180](https://github.com/ckeditor/ckeditor5-utils/issues/180). ([14af24c](https://github.com/ckeditor/ckeditor5-utils/commit/14af24c))
|
|
290
|
+
* Added support for `'space'` key code in the `parseKeystroke()` helper. Closes [#169](https://github.com/ckeditor/ckeditor5-utils/issues/169). ([f86b1ad](https://github.com/ckeditor/ckeditor5-utils/commit/f86b1ad))
|
|
291
|
+
* Introduced `ObservableMixin#decorate()` and support for setting `EmitterMixin#fire()`'s return value by listeners. Closes [#162](https://github.com/ckeditor/ckeditor5-utils/issues/162). ([377c875](https://github.com/ckeditor/ckeditor5-utils/commit/377c875))
|
|
292
|
+
* Introduced a static `Rect.getDomRangeRects()` method for external usage. Closes [#168](https://github.com/ckeditor/ckeditor5-utils/issues/168). ([f67aea1](https://github.com/ckeditor/ckeditor5-utils/commit/f67aea1))
|
|
293
|
+
|
|
294
|
+
### Other changes
|
|
295
|
+
|
|
296
|
+
* The `getOptimalPosition()` utility should accept the target option defined as a function. Closes [#157](https://github.com/ckeditor/ckeditor5-utils/issues/157). ([d63abae](https://github.com/ckeditor/ckeditor5-utils/commit/d63abae))
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
## [0.9.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.0...v0.9.1) (2017-05-07)
|
|
300
|
+
|
|
301
|
+
### Bug fixes
|
|
302
|
+
|
|
303
|
+
* The `Rect` utility should work for collapsed DOM Ranges. Closes [#153](https://github.com/ckeditor/ckeditor5-utils/issues/153). ([92aff35](https://github.com/ckeditor/ckeditor5-utils/commit/92aff35))
|
|
304
|
+
* The `getOptimalPosition()` utility should consider limiter ancestors with CSS overflow. Closes [#148](https://github.com/ckeditor/ckeditor5-utils/issues/148). ([6bf1741](https://github.com/ckeditor/ckeditor5-utils/commit/6bf1741))
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
## [0.9.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.8.0...v0.9.0) (2017-04-05)
|
|
308
|
+
|
|
309
|
+
### Bug fixes
|
|
310
|
+
|
|
311
|
+
* The `getOptimalPosition()` utility should work fine when the parent element has a scroll. Closes [#139](https://github.com/ckeditor/ckeditor5-utils/issues/139). ([b878949](https://github.com/ckeditor/ckeditor5-utils/commit/b878949))
|
|
312
|
+
|
|
313
|
+
### Features
|
|
314
|
+
|
|
315
|
+
* `Collection.bindTo()` method now is not only available in the `ViewCollection` but in all `Collection`s. Closes [#125](https://github.com/ckeditor/ckeditor5-utils/issues/125). ([4e299be](https://github.com/ckeditor/ckeditor5-utils/commit/4e299be))
|
|
316
|
+
* Added the `first()` function. Closes [#130](https://github.com/ckeditor/ckeditor5-utils/issues/130). ([8ab07d2](https://github.com/ckeditor/ckeditor5-utils/commit/8ab07d2))
|
|
317
|
+
* Two–way data binding between `Collection` instances. Closes [#132](https://github.com/ckeditor/ckeditor5-utils/issues/132). ([6b79624](https://github.com/ckeditor/ckeditor5-utils/commit/6b79624))
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
## [0.8.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.7.0...v0.8.0) (2017-03-06)
|
|
321
|
+
|
|
322
|
+
### Features
|
|
323
|
+
|
|
324
|
+
* Added ability to provide default configurations to `Config` constructor. Closes [#126](https://github.com/ckeditor/ckeditor5/issues/126). ([16a2a31](https://github.com/ckeditor/ckeditor5-utils/commit/16a2a31))
|
package/LICENSE.md
CHANGED
|
@@ -13,7 +13,7 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
|
13
13
|
|
|
14
14
|
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
|
|
15
15
|
|
|
16
|
-
*
|
|
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
17
|
|
|
18
18
|
Trademarks
|
|
19
19
|
----------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.1.0",
|
|
4
4
|
"description": "Miscellaneous utilities used by CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
"lodash-es": "^4.17.15"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@ckeditor/ckeditor5-build-classic": "^
|
|
18
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
19
|
-
"@ckeditor/ckeditor5-core": "^
|
|
20
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
17
|
+
"@ckeditor/ckeditor5-build-classic": "^35.1.0",
|
|
18
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.1.0",
|
|
19
|
+
"@ckeditor/ckeditor5-core": "^35.1.0",
|
|
20
|
+
"@ckeditor/ckeditor5-engine": "^35.1.0",
|
|
21
|
+
"@types/lodash-es": "^4.17.6",
|
|
22
|
+
"typescript": "^4.6.4"
|
|
21
23
|
},
|
|
24
|
+
"depcheckIgnore": [
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
22
27
|
"engines": {
|
|
23
28
|
"node": ">=14.0.0",
|
|
24
29
|
"npm": ">=5.7.1"
|
|
@@ -34,8 +39,14 @@
|
|
|
34
39
|
},
|
|
35
40
|
"files": [
|
|
36
41
|
"lang",
|
|
37
|
-
"src",
|
|
42
|
+
"src/**/*.js",
|
|
43
|
+
"src/**/*.d.ts",
|
|
38
44
|
"theme",
|
|
39
|
-
"ckeditor5-metadata.json"
|
|
40
|
-
|
|
45
|
+
"ckeditor5-metadata.json",
|
|
46
|
+
"CHANGELOG.md"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc -p ./tsconfig.release.json",
|
|
50
|
+
"postversion": "npm run build"
|
|
51
|
+
}
|
|
41
52
|
}
|
|
@@ -2,91 +2,74 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, 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
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module utils/arestructuresconnected
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/* globals EventTarget, Event */
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Traverses both structures to find out whether there is a reference that is shared between both structures.
|
|
14
11
|
*
|
|
15
12
|
* @param {Object|Array} obj1
|
|
16
13
|
* @param {Object|Array} obj2
|
|
14
|
+
* @returns {Boolean}
|
|
17
15
|
*/
|
|
18
|
-
export default function areConnectedThroughProperties(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return false;
|
|
16
|
+
export default function areConnectedThroughProperties(obj1, obj2) {
|
|
17
|
+
if (obj1 === obj2 && isObject(obj1)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const subNodes1 = getSubNodes(obj1);
|
|
21
|
+
const subNodes2 = getSubNodes(obj2);
|
|
22
|
+
for (const node of subNodes1) {
|
|
23
|
+
if (subNodes2.has(node)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
// Traverses JS structure and stores all sub-nodes, including the head node.
|
|
36
30
|
// It walks into each iterable structures with the `try catch` block to omit errors that might be thrown during
|
|
37
31
|
// tree walking. All primitives, functions and built-ins are skipped.
|
|
38
|
-
function getSubNodes(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return subNodes;
|
|
32
|
+
function getSubNodes(head) {
|
|
33
|
+
const nodes = [head];
|
|
34
|
+
// Nodes are stored to prevent infinite looping.
|
|
35
|
+
const subNodes = new Set();
|
|
36
|
+
while (nodes.length > 0) {
|
|
37
|
+
const node = nodes.shift();
|
|
38
|
+
if (subNodes.has(node) || shouldNodeBeSkipped(node)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
subNodes.add(node);
|
|
42
|
+
// Handle arrays, maps, sets, custom collections that implements `[ Symbol.iterator ]()`, etc.
|
|
43
|
+
if (node[Symbol.iterator]) {
|
|
44
|
+
// The custom editor iterators might cause some problems if the editor is crashed.
|
|
45
|
+
try {
|
|
46
|
+
nodes.push(...node);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
// eslint-disable-line no-empty
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
nodes.push(...Object.values(node));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return subNodes;
|
|
67
57
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
node === null ||
|
|
83
|
-
|
|
84
|
-
// Skip native DOM objects, e.g. Window, nodes, events, etc.
|
|
85
|
-
node instanceof EventTarget ||
|
|
86
|
-
node instanceof Event
|
|
87
|
-
);
|
|
58
|
+
function shouldNodeBeSkipped(node) {
|
|
59
|
+
const type = Object.prototype.toString.call(node);
|
|
60
|
+
return (type === '[object Number]' ||
|
|
61
|
+
type === '[object Boolean]' ||
|
|
62
|
+
type === '[object String]' ||
|
|
63
|
+
type === '[object Symbol]' ||
|
|
64
|
+
type === '[object Function]' ||
|
|
65
|
+
type === '[object Date]' ||
|
|
66
|
+
type === '[object RegExp]' ||
|
|
67
|
+
node === undefined ||
|
|
68
|
+
node === null ||
|
|
69
|
+
// Skip native DOM objects, e.g. Window, nodes, events, etc.
|
|
70
|
+
node instanceof EventTarget ||
|
|
71
|
+
node instanceof Event);
|
|
88
72
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return typeof structure === 'object' && structure !== null;
|
|
73
|
+
function isObject(structure) {
|
|
74
|
+
return typeof structure === 'object' && structure !== null;
|
|
92
75
|
}
|