lakelib 0.3.8 → 0.3.9

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
@@ -870,7 +870,7 @@ button.lake-primary-button.lake-button-hovered {
870
870
  .lake-container ul {
871
871
  list-style: none;
872
872
  margin: 0;
873
- margin-bottom: 4px;
873
+ margin-bottom: 8px;
874
874
  padding: 0;
875
875
  }
876
876
 
@@ -931,8 +931,8 @@ button.lake-primary-button.lake-button-hovered {
931
931
 
932
932
  .lake-container ol li,
933
933
  .lake-container ul li {
934
- margin-left: 20px;
935
- padding-left: 4px;
934
+ margin: 0 0 0 20px;
935
+ padding: 0 0 0 4px;
936
936
  }
937
937
 
938
938
  .lake-container ol li {
@@ -1218,7 +1218,7 @@ lake-box[name="hr"] .lake-box-focused .lake-hr {
1218
1218
  border-top: 1px solid var(--lake-border-color);
1219
1219
  }
1220
1220
 
1221
- /* custom properties */
1221
+ /* variables */
1222
1222
  :root {
1223
1223
  --lake-code-highlight-keyword: #af00db;
1224
1224
  --lake-code-highlight-name: #444d56;
package/lib/lake.d.ts CHANGED
@@ -1019,7 +1019,7 @@ declare class Range$1 {
1019
1019
  */
1020
1020
  get endOffset(): number;
1021
1021
  /**
1022
- * The deepest or furthest down the document tree — node that contains both boundary points of the range.
1022
+ * The deepest node, or the lowest point in the document tree, that contains both boundary points of the range.
1023
1023
  */
1024
1024
  get commonAncestor(): Nodes;
1025
1025
  /**
@@ -1825,6 +1825,10 @@ declare class Editor {
1825
1825
  * Binds events for history.
1826
1826
  */
1827
1827
  private bindHistoryEvents;
1828
+ /**
1829
+ * Binds events for pointer.
1830
+ */
1831
+ private bindPointerEvents;
1828
1832
  /**
1829
1833
  * Returns translation functions for the specified language.
1830
1834
  */
package/lib/lake.js CHANGED
@@ -1649,7 +1649,7 @@ class Range {
1649
1649
  return this.range.endOffset;
1650
1650
  }
1651
1651
  /**
1652
- * The deepest or furthest down the document tree — node that contains both boundary points of the range.
1652
+ * The deepest node, or the lowest point in the document tree, that contains both boundary points of the range.
1653
1653
  */
1654
1654
  get commonAncestor() {
1655
1655
  return new Nodes(this.range.commonAncestorContainer);
@@ -6273,7 +6273,7 @@ function removeBox(range) {
6273
6273
  return box;
6274
6274
  }
6275
6275
 
6276
- var version = "0.3.8";
6276
+ var version = "0.3.9";
6277
6277
 
6278
6278
  // Converts the custom HTML tags to the special tags that can not be parsed by browser.
6279
6279
  function denormalizeValue(value) {
@@ -7938,6 +7938,28 @@ class Editor {
7938
7938
  }
7939
7939
  });
7940
7940
  }
7941
+ /**
7942
+ * Binds events for pointer.
7943
+ */
7944
+ bindPointerEvents() {
7945
+ this.container.on('pointerdown', event => {
7946
+ const pointerEvent = event;
7947
+ if (pointerEvent.target !== null && pointerEvent.target !== this.container.get(0)) {
7948
+ return;
7949
+ }
7950
+ const lastChild = this.container.last();
7951
+ if (lastChild.isTable || lastChild.isBlockBox) {
7952
+ const lastChildRect = lastChild.get(0).getBoundingClientRect();
7953
+ if (pointerEvent.clientY > lastChildRect.bottom) {
7954
+ pointerEvent.preventDefault();
7955
+ const paragraph = query('<p><br /></p>');
7956
+ lastChild.after(paragraph);
7957
+ this.selection.range.shrinkBefore(paragraph);
7958
+ this.selection.sync();
7959
+ }
7960
+ }
7961
+ });
7962
+ }
7941
7963
  /**
7942
7964
  * Returns translation functions for the specified language.
7943
7965
  */
@@ -8161,6 +8183,7 @@ class Editor {
8161
8183
  document.addEventListener('click', this.clickListener);
8162
8184
  this.bindInputEvents();
8163
8185
  this.bindHistoryEvents();
8186
+ this.bindPointerEvents();
8164
8187
  }
8165
8188
  }
8166
8189
  /**
@@ -11413,6 +11436,9 @@ function appendButtonGroup(box) {
11413
11436
  const editor = box.getEditor();
11414
11437
  const boxContainer = box.getContainer();
11415
11438
  const rootNode = boxContainer.find('.lake-video');
11439
+ if (rootNode.find('.lake-corner-toolbar').length > 0) {
11440
+ return;
11441
+ }
11416
11442
  new CornerToolbar({
11417
11443
  locale: editor.locale,
11418
11444
  root: rootNode,
@@ -11458,22 +11484,6 @@ function showVideo(box) {
11458
11484
  if (!editor.readonly) {
11459
11485
  iframeNode.on('load', () => {
11460
11486
  appendButtonGroup(box);
11461
- new CornerToolbar({
11462
- locale: editor.locale,
11463
- root: rootNode,
11464
- items: [
11465
- {
11466
- name: 'remove',
11467
- icon: icons.get('remove'),
11468
- tooltip: editor.locale.video.remove(),
11469
- onClick: event => {
11470
- event.stopPropagation();
11471
- editor.selection.removeBox(box);
11472
- editor.history.save();
11473
- },
11474
- },
11475
- ],
11476
- }).render();
11477
11487
  new Resizer({
11478
11488
  root: rootNode,
11479
11489
  target: boxContainer,
@@ -11492,7 +11502,7 @@ function showVideo(box) {
11492
11502
  }).render();
11493
11503
  });
11494
11504
  }
11495
- rootNode.append(iframeNode);
11505
+ rootNode.prepend(iframeNode);
11496
11506
  }
11497
11507
  var videoBox = {
11498
11508
  type: 'inline',