lexxy 0.1.12.beta → 0.1.13.beta

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18d165a2a610d44b12147598b0d876c26ac560805e026812b28bedf906fc79ce
4
- data.tar.gz: b7f6432b4efa2b5674186f11f408ba0d9bebad133a35e6df45b9b70d87102bc5
3
+ metadata.gz: 263e76081a9e0910c9d470ef6c6252af14fd78d3e05905b0170a4641e2854433
4
+ data.tar.gz: 5868f9ef392f984b4254d06561fd3305d962ceac71ebbd69a422b6a651be1cc6
5
5
  SHA512:
6
- metadata.gz: 7283442089ee6b769f928a9551c048da6c69e242fe5f7f7213bee79e03fb6567abaaa14319669bf3de62be571f5bbc60b825b5fa639a0ba0236f0559695498de
7
- data.tar.gz: d9e94ff8f7a1a1493c9d3073aaa6e4bb56a21431ca42f6b61d6d37d4edca3286764f613dcd4b4ab65dce9c5d515349b1d3f4bbc8d38473ab99a85d010c42a6e6
6
+ metadata.gz: fd7111fead7f70799d1e6c8fd3fbc3f6b3996dabc29cc17aa51d5e595050045e8d4cdf353f2f0210a5672d5343964df0a5a2515b1a96cd5fff4b56c06a842c19
7
+ data.tar.gz: d5f72056d6be21b3005da384a3c026f6675398ed09faf2da46502e6b4cb8f457736d0fcaa4af76bc22fabe6a0ac3404c0d86a0d20f884503eaee4c34209540aa
@@ -5583,7 +5583,7 @@ class ActionTextAttachmentNode extends gi {
5583
5583
  this.altText = altText || "";
5584
5584
  this.caption = caption || "";
5585
5585
  this.contentType = contentType || "";
5586
- this.fileName = fileName;
5586
+ this.fileName = fileName || "";
5587
5587
  this.fileSize = fileSize;
5588
5588
  this.width = width;
5589
5589
  this.height = height;
@@ -7102,38 +7102,25 @@ class Contents {
7102
7102
  }, { tag: Ti });
7103
7103
  }
7104
7104
 
7105
- deleteSelectedNodes() {
7105
+ async deleteSelectedNodes() {
7106
+ let focusNode = null;
7107
+
7106
7108
  this.editor.update(() => {
7107
7109
  if (ur(this.#selection.current)) {
7108
7110
  const nodesToRemove = this.#selection.current.getNodes();
7109
7111
  if (nodesToRemove.length === 0) return
7110
7112
 
7111
- // Use splice() instead of node.remove() for proper removal and
7112
- // reconciliation. Would have issues with removing unintended decorator nodes
7113
- // with node.remove()
7114
- nodesToRemove.forEach((node) => {
7115
- const parent = node.getParent();
7116
- if (!di(parent)) return
7117
-
7118
- const children = parent.getChildren();
7119
- const index = children.indexOf(node);
7120
-
7121
- if (index >= 0) {
7122
- parent.splice(index, 1, []);
7123
- }
7124
- });
7125
-
7126
- // Check if root is empty after all removals
7127
- const root = ps();
7128
- if (root.getChildrenSize() === 0) {
7129
- root.append(Pi());
7130
- }
7113
+ focusNode = this.#findAdjacentNodeTo(nodesToRemove);
7114
+ this.#deleteNodes(nodesToRemove);
7115
+ }
7116
+ });
7131
7117
 
7132
- this.#selection.clear();
7133
- this.editor.focus();
7118
+ await nextFrame();
7134
7119
 
7135
- return true
7136
- }
7120
+ this.editor.update(() => {
7121
+ this.#selectAfterDeletion(focusNode);
7122
+ this.#selection.clear();
7123
+ this.editor.focus();
7137
7124
  });
7138
7125
  }
7139
7126
 
@@ -7268,6 +7255,45 @@ class Contents {
7268
7255
  nodesToDelete.forEach((node) => node.remove());
7269
7256
  }
7270
7257
 
7258
+ #deleteNodes(nodes) {
7259
+ // Use splice() instead of node.remove() for proper removal and
7260
+ // reconciliation. Would have issues with removing unintended decorator nodes
7261
+ // with node.remove()
7262
+ nodes.forEach((node) => {
7263
+ const parent = node.getParent();
7264
+ if (!di(parent)) return
7265
+
7266
+ const children = parent.getChildren();
7267
+ const index = children.indexOf(node);
7268
+
7269
+ if (index >= 0) {
7270
+ parent.splice(index, 1, []);
7271
+ }
7272
+ });
7273
+ }
7274
+
7275
+ #findAdjacentNodeTo(nodes) {
7276
+ const firstNode = nodes[0];
7277
+ const lastNode = nodes[nodes.length - 1];
7278
+
7279
+ return firstNode?.getPreviousSibling() || lastNode?.getNextSibling()
7280
+ }
7281
+
7282
+ #selectAfterDeletion(focusNode) {
7283
+ const root = ps();
7284
+ if (root.getChildrenSize() === 0) {
7285
+ const newParagraph = Pi();
7286
+ root.append(newParagraph);
7287
+ newParagraph.selectStart();
7288
+ } else if (focusNode) {
7289
+ if (Qn(focusNode) || Fi(focusNode)) {
7290
+ focusNode.selectEnd();
7291
+ } else {
7292
+ focusNode.selectNext(0, 0);
7293
+ }
7294
+ }
7295
+ }
7296
+
7271
7297
  #collectSelectedListItems(selection) {
7272
7298
  const nodes = selection.getNodes();
7273
7299
  const listItems = new Set();
Binary file
Binary file