lakelib 0.1.3 → 0.1.5
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/dist/lake.css +1 -1
- package/dist/lake.min.js +3 -3
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +1 -1
- package/lib/lake.js +20 -20
- package/lib/lake.js.map +1 -1
- package/lib/types/editor.d.ts +2 -2
- package/lib/types/types/object.d.ts +1 -1
- package/lib/types/types/toolbar.d.ts +2 -2
- package/lib/types/ui/toolbar.d.ts +2 -2
- package/package.json +1 -1
package/lib/lake.css
CHANGED
package/lib/lake.js
CHANGED
|
@@ -3441,7 +3441,8 @@ function deleteContents(range) {
|
|
|
3441
3441
|
if (range.isCollapsed) {
|
|
3442
3442
|
return;
|
|
3443
3443
|
}
|
|
3444
|
-
range.
|
|
3444
|
+
range.adaptBox();
|
|
3445
|
+
range.adaptTable();
|
|
3445
3446
|
if (range.isInoperative) {
|
|
3446
3447
|
return;
|
|
3447
3448
|
}
|
|
@@ -4613,7 +4614,7 @@ class Dropdown {
|
|
|
4613
4614
|
}
|
|
4614
4615
|
}
|
|
4615
4616
|
|
|
4616
|
-
var version = "0.1.
|
|
4617
|
+
var version = "0.1.5";
|
|
4617
4618
|
|
|
4618
4619
|
// Inserts a box into the specified range.
|
|
4619
4620
|
function insertBox(range, boxName, boxValue) {
|
|
@@ -5210,7 +5211,7 @@ class Plugin {
|
|
|
5210
5211
|
}
|
|
5211
5212
|
|
|
5212
5213
|
const defaultConfig = {
|
|
5213
|
-
value: '<p><br
|
|
5214
|
+
value: '<p><br /></p>',
|
|
5214
5215
|
readonly: false,
|
|
5215
5216
|
spellcheck: false,
|
|
5216
5217
|
tabIndex: 0,
|
|
@@ -5221,7 +5222,7 @@ const defaultConfig = {
|
|
|
5221
5222
|
class Editor {
|
|
5222
5223
|
constructor(config) {
|
|
5223
5224
|
this.unsavedInputData = '';
|
|
5224
|
-
this.
|
|
5225
|
+
this.state = {
|
|
5225
5226
|
appliedItems: [],
|
|
5226
5227
|
disabledNameMap: new Map(),
|
|
5227
5228
|
selectedNameMap: new Map(),
|
|
@@ -5321,20 +5322,20 @@ class Editor {
|
|
|
5321
5322
|
}
|
|
5322
5323
|
}
|
|
5323
5324
|
}
|
|
5324
|
-
const
|
|
5325
|
+
const state = {
|
|
5325
5326
|
appliedItems,
|
|
5326
5327
|
disabledNameMap,
|
|
5327
5328
|
selectedNameMap,
|
|
5328
5329
|
selectedValuesMap,
|
|
5329
5330
|
};
|
|
5330
|
-
if (isEqual(
|
|
5331
|
+
if (isEqual(state, this.state)) {
|
|
5331
5332
|
return;
|
|
5332
5333
|
}
|
|
5333
5334
|
if (this.toolbar) {
|
|
5334
|
-
this.toolbar.updateState(
|
|
5335
|
+
this.toolbar.updateState(state);
|
|
5335
5336
|
}
|
|
5336
|
-
this.event.emit('statechange',
|
|
5337
|
-
this.
|
|
5337
|
+
this.event.emit('statechange', state);
|
|
5338
|
+
this.state = state;
|
|
5338
5339
|
}, 100, {
|
|
5339
5340
|
leading: false,
|
|
5340
5341
|
trailing: true,
|
|
@@ -5470,13 +5471,13 @@ class Editor {
|
|
|
5470
5471
|
this.emitChangeEvent(value);
|
|
5471
5472
|
});
|
|
5472
5473
|
}
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5474
|
+
// Returns a boolean value indicating whether the editor has focus.
|
|
5475
|
+
get hasFocus() {
|
|
5476
|
+
const activeElement = document.activeElement;
|
|
5477
|
+
if (!activeElement) {
|
|
5478
|
+
return false;
|
|
5479
|
+
}
|
|
5480
|
+
return query(activeElement).closest('.lake-container').get(0) === this.container.get(0);
|
|
5480
5481
|
}
|
|
5481
5482
|
// Returns translation functions by the specified lang.
|
|
5482
5483
|
get locale() {
|
|
@@ -5595,7 +5596,6 @@ class Editor {
|
|
|
5595
5596
|
this.container.append(fragment);
|
|
5596
5597
|
Editor.plugin.loadAll(this);
|
|
5597
5598
|
if (!this.readonly) {
|
|
5598
|
-
this.bindFocusEvents();
|
|
5599
5599
|
this.selection.synByBookmark();
|
|
5600
5600
|
this.history.save();
|
|
5601
5601
|
}
|
|
@@ -6417,9 +6417,9 @@ class Toolbar {
|
|
|
6417
6417
|
});
|
|
6418
6418
|
}
|
|
6419
6419
|
// Updates state of each item such as disabled, selected.
|
|
6420
|
-
updateState(
|
|
6420
|
+
updateState(state) {
|
|
6421
6421
|
var _a;
|
|
6422
|
-
const { appliedItems, disabledNameMap, selectedNameMap, selectedValuesMap } =
|
|
6422
|
+
const { appliedItems, disabledNameMap, selectedNameMap, selectedValuesMap } = state;
|
|
6423
6423
|
for (const item of this.buttonItemList) {
|
|
6424
6424
|
const selectedClass = 'lake-button-selected';
|
|
6425
6425
|
const buttonNode = this.container.find(`button[name="${item.name}"]`);
|
|
@@ -9255,7 +9255,7 @@ var escapeKey = (editor) => {
|
|
|
9255
9255
|
selection.addRangeToNativeSelection();
|
|
9256
9256
|
return;
|
|
9257
9257
|
}
|
|
9258
|
-
if (editor.
|
|
9258
|
+
if (editor.hasFocus) {
|
|
9259
9259
|
event.preventDefault();
|
|
9260
9260
|
editor.blur();
|
|
9261
9261
|
}
|