lakelib 0.1.3 → 0.1.4

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/lib/lake.css CHANGED
@@ -37,7 +37,7 @@
37
37
  font-family: var(--font-family);
38
38
  font-size: 16px;
39
39
  font-weight: normal;
40
- line-height: normal;
40
+ line-height: 1.45;
41
41
  padding: 16px 24px;
42
42
  }
43
43
  .lake-container:focus {
package/lib/lake.js CHANGED
@@ -4613,7 +4613,7 @@ class Dropdown {
4613
4613
  }
4614
4614
  }
4615
4615
 
4616
- var version = "0.1.3";
4616
+ var version = "0.1.4";
4617
4617
 
4618
4618
  // Inserts a box into the specified range.
4619
4619
  function insertBox(range, boxName, boxValue) {
@@ -5470,13 +5470,13 @@ class Editor {
5470
5470
  this.emitChangeEvent(value);
5471
5471
  });
5472
5472
  }
5473
- bindFocusEvents() {
5474
- this.container.on('focus', () => {
5475
- this.root.addClass('lake-root-focused');
5476
- });
5477
- this.container.on('blur', () => {
5478
- this.root.removeClass('lake-root-focused');
5479
- });
5473
+ // Returns a boolean value indicating whether the editor has focus.
5474
+ get hasFocus() {
5475
+ const activeElement = document.activeElement;
5476
+ if (!activeElement) {
5477
+ return false;
5478
+ }
5479
+ return query(activeElement).closest('.lake-container').get(0) === this.container.get(0);
5480
5480
  }
5481
5481
  // Returns translation functions by the specified lang.
5482
5482
  get locale() {
@@ -5595,7 +5595,6 @@ class Editor {
5595
5595
  this.container.append(fragment);
5596
5596
  Editor.plugin.loadAll(this);
5597
5597
  if (!this.readonly) {
5598
- this.bindFocusEvents();
5599
5598
  this.selection.synByBookmark();
5600
5599
  this.history.save();
5601
5600
  }
@@ -9255,7 +9254,7 @@ var escapeKey = (editor) => {
9255
9254
  selection.addRangeToNativeSelection();
9256
9255
  return;
9257
9256
  }
9258
- if (editor.root.hasClass('lake-root-focused')) {
9257
+ if (editor.hasFocus) {
9259
9258
  event.preventDefault();
9260
9259
  editor.blur();
9261
9260
  }