lakelib 0.1.17 → 0.1.18

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.js CHANGED
@@ -663,10 +663,18 @@ class Nodes {
663
663
  }
664
664
  const nodeText = this.text();
665
665
  const isEmptyText = nodeText === '' || /^[\r\n\u200B\u2060]+$/.test(nodeText);
666
- if (this.isElement && isEmptyText) {
667
- return this.find('lake-box').length === 0;
666
+ if (!isEmptyText) {
667
+ return false;
668
668
  }
669
- return isEmptyText;
669
+ if (this.isElement) {
670
+ if (this.find('lake-box').length > 0) {
671
+ return false;
672
+ }
673
+ if (this.find('br').length > 1) {
674
+ return false;
675
+ }
676
+ }
677
+ return true;
670
678
  }
671
679
  // Returns a boolean value indicating whether the node and the target node are siblings.
672
680
  isSibling(target) {
@@ -5133,7 +5141,7 @@ function removeBox(range) {
5133
5141
  return box;
5134
5142
  }
5135
5143
 
5136
- var version = "0.1.17";
5144
+ var version = "0.1.18";
5137
5145
 
5138
5146
  // Returns the attributes of the element as an key-value object.
5139
5147
  function getAttributes(node) {
@@ -5584,6 +5592,9 @@ class Keystroke {
5584
5592
  this.container = container;
5585
5593
  this.container.on('keydown', event => {
5586
5594
  const keyboardEvent = event;
5595
+ if (keyboardEvent.isComposing) {
5596
+ return;
5597
+ }
5587
5598
  for (const item of this.keydownEventList) {
5588
5599
  if (isKeyHotkey(item.type, keyboardEvent)) {
5589
5600
  if (item.listener(keyboardEvent) === false) {
@@ -5594,6 +5605,9 @@ class Keystroke {
5594
5605
  });
5595
5606
  this.container.on('keyup', event => {
5596
5607
  const keyboardEvent = event;
5608
+ if (keyboardEvent.isComposing) {
5609
+ return;
5610
+ }
5597
5611
  for (const item of this.keyupEventList) {
5598
5612
  if (isKeyHotkey(item.type, keyboardEvent)) {
5599
5613
  if (item.listener(keyboardEvent) === false) {
@@ -10139,6 +10153,12 @@ function mergeWithPreviousBlock(editor, block) {
10139
10153
  return;
10140
10154
  }
10141
10155
  removeEmptyMarks(range);
10156
+ const nextNode = range.getNextNode();
10157
+ if (nextNode.name === 'br' && prevBlock.name !== 'p') {
10158
+ nextNode.remove();
10159
+ range.shrinkAfter(prevBlock);
10160
+ return;
10161
+ }
10142
10162
  const bookmark = editor.selection.insertBookmark();
10143
10163
  mergeNodes(prevBlock, block);
10144
10164
  editor.selection.toBookmark(bookmark);