lexxy 0.1.11.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: 72557f2f915d20c07de190adaad818d1900728371f65482d8f01a51b3b4c5f24
4
- data.tar.gz: 0fabe3de15525414a0e7e548f4d8e5c605bff3e26074bc79541c20bbcb92946c
3
+ metadata.gz: 263e76081a9e0910c9d470ef6c6252af14fd78d3e05905b0170a4641e2854433
4
+ data.tar.gz: 5868f9ef392f984b4254d06561fd3305d962ceac71ebbd69a422b6a651be1cc6
5
5
  SHA512:
6
- metadata.gz: 31d13d76af610866ca92fc340c90f71d3b8a44e6a27f616feb76c2f56cf6f074f22323edd67258054982386f480ab37b9d7b32ff7d7e946be3ec2fc8cb7371bd
7
- data.tar.gz: 73f85f0ed7d75452cc6d0c28cc3cfd45d0f1bb544068287b25822b060c14926410d09d7923738879c6f15164a644daea3b3097cfff0cd4a34fbbd3a76f0c5c74
6
+ metadata.gz: fd7111fead7f70799d1e6c8fd3fbc3f6b3996dabc29cc17aa51d5e595050045e8d4cdf353f2f0210a5672d5343964df0a5a2515b1a96cd5fff4b56c06a842c19
7
+ data.tar.gz: d5f72056d6be21b3005da384a3c026f6675398ed09faf2da46502e6b4cb8f457736d0fcaa4af76bc22fabe6a0ac3404c0d86a0d20f884503eaee4c34209540aa
@@ -5562,6 +5562,7 @@ class ActionTextAttachmentNode extends gi {
5562
5562
  conversion: () => ({
5563
5563
  node: new ActionTextAttachmentNode({
5564
5564
  src: img.getAttribute("src"),
5565
+ caption: img.getAttribute("alt") || "",
5565
5566
  contentType: "image/*",
5566
5567
  width: img.getAttribute("width"),
5567
5568
  height: img.getAttribute("height")
@@ -5582,7 +5583,7 @@ class ActionTextAttachmentNode extends gi {
5582
5583
  this.altText = altText || "";
5583
5584
  this.caption = caption || "";
5584
5585
  this.contentType = contentType || "";
5585
- this.fileName = fileName;
5586
+ this.fileName = fileName || "";
5586
5587
  this.fileSize = fileSize;
5587
5588
  this.width = width;
5588
5589
  this.height = height;
@@ -7101,38 +7102,25 @@ class Contents {
7101
7102
  }, { tag: Ti });
7102
7103
  }
7103
7104
 
7104
- deleteSelectedNodes() {
7105
+ async deleteSelectedNodes() {
7106
+ let focusNode = null;
7107
+
7105
7108
  this.editor.update(() => {
7106
7109
  if (ur(this.#selection.current)) {
7107
7110
  const nodesToRemove = this.#selection.current.getNodes();
7108
7111
  if (nodesToRemove.length === 0) return
7109
7112
 
7110
- // Use splice() instead of node.remove() for proper removal and
7111
- // reconciliation. Would have issues with removing unintended decorator nodes
7112
- // with node.remove()
7113
- nodesToRemove.forEach((node) => {
7114
- const parent = node.getParent();
7115
- if (!di(parent)) return
7116
-
7117
- const children = parent.getChildren();
7118
- const index = children.indexOf(node);
7119
-
7120
- if (index >= 0) {
7121
- parent.splice(index, 1, []);
7122
- }
7123
- });
7124
-
7125
- // Check if root is empty after all removals
7126
- const root = ps();
7127
- if (root.getChildrenSize() === 0) {
7128
- root.append(Pi());
7129
- }
7113
+ focusNode = this.#findAdjacentNodeTo(nodesToRemove);
7114
+ this.#deleteNodes(nodesToRemove);
7115
+ }
7116
+ });
7130
7117
 
7131
- this.#selection.clear();
7132
- this.editor.focus();
7118
+ await nextFrame();
7133
7119
 
7134
- return true
7135
- }
7120
+ this.editor.update(() => {
7121
+ this.#selectAfterDeletion(focusNode);
7122
+ this.#selection.clear();
7123
+ this.editor.focus();
7136
7124
  });
7137
7125
  }
7138
7126
 
@@ -7267,6 +7255,45 @@ class Contents {
7267
7255
  nodesToDelete.forEach((node) => node.remove());
7268
7256
  }
7269
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
+
7270
7297
  #collectSelectedListItems(selection) {
7271
7298
  const nodes = selection.getNodes();
7272
7299
  const listItems = new Set();
@@ -7590,6 +7617,9 @@ class Clipboard {
7590
7617
  #handlePastedFiles(clipboardData) {
7591
7618
  if (!this.editorElement.supportsAttachments) return
7592
7619
 
7620
+ const html = clipboardData.getData('text/html');
7621
+ if (html) return // Ignore if image copied from browser since we will load it as a remote image
7622
+
7593
7623
  this.#preservingScrollPosition(() => {
7594
7624
  for (const item of clipboardData.items) {
7595
7625
  const file = item.getAsFile();
Binary file
Binary file