@37signals/lexxy 0.8.6-beta → 0.9.0-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.
- package/dist/lexxy.esm.js +23 -7
- package/package.json +1 -1
package/dist/lexxy.esm.js
CHANGED
|
@@ -4432,7 +4432,8 @@ class Contents {
|
|
|
4432
4432
|
}
|
|
4433
4433
|
|
|
4434
4434
|
#splitParagraphsAtLineBreaks(selection) {
|
|
4435
|
-
const
|
|
4435
|
+
const anchorKey = selection.anchor.getNode().getKey();
|
|
4436
|
+
const focusKey = selection.focus.getNode().getKey();
|
|
4436
4437
|
const topLevelElements = this.#topLevelElementsInSelection(selection);
|
|
4437
4438
|
|
|
4438
4439
|
for (const element of topLevelElements) {
|
|
@@ -4441,6 +4442,14 @@ class Contents {
|
|
|
4441
4442
|
const children = element.getChildren();
|
|
4442
4443
|
if (!children.some($isLineBreakNode)) continue
|
|
4443
4444
|
|
|
4445
|
+
// Check whether this paragraph needs splitting: skip only if neither
|
|
4446
|
+
// selection endpoint is inside it (meaning it's a middle paragraph
|
|
4447
|
+
// fully between anchor and focus with no partial lines to split off).
|
|
4448
|
+
const hasEndpoint = children.some(child =>
|
|
4449
|
+
child.getKey() === anchorKey || child.getKey() === focusKey
|
|
4450
|
+
);
|
|
4451
|
+
if (!hasEndpoint) continue
|
|
4452
|
+
|
|
4444
4453
|
const groups = [ [] ];
|
|
4445
4454
|
for (const child of children) {
|
|
4446
4455
|
if ($isLineBreakNode(child)) {
|
|
@@ -4451,8 +4460,6 @@ class Contents {
|
|
|
4451
4460
|
}
|
|
4452
4461
|
}
|
|
4453
4462
|
|
|
4454
|
-
if (groups.every(group => group.some(child => selectedNodeKeys.has(child.getKey())))) continue
|
|
4455
|
-
|
|
4456
4463
|
for (const group of groups) {
|
|
4457
4464
|
if (group.length === 0) continue
|
|
4458
4465
|
const paragraph = $createParagraphNode();
|
|
@@ -4668,7 +4675,9 @@ class Clipboard {
|
|
|
4668
4675
|
return true
|
|
4669
4676
|
}
|
|
4670
4677
|
|
|
4671
|
-
|
|
4678
|
+
const handled = this.#handlePastedFiles(clipboardData);
|
|
4679
|
+
if (handled) event.preventDefault();
|
|
4680
|
+
return handled
|
|
4672
4681
|
}
|
|
4673
4682
|
|
|
4674
4683
|
#isPlainTextOrURLPasted(clipboardData) {
|
|
@@ -4766,14 +4775,21 @@ class Clipboard {
|
|
|
4766
4775
|
return true
|
|
4767
4776
|
}
|
|
4768
4777
|
|
|
4769
|
-
if (html) {
|
|
4778
|
+
if (html && !this.#isLexicalClipboardData(clipboardData)) {
|
|
4770
4779
|
this.contents.insertHtml(html, { tag: PASTE_TAG });
|
|
4771
4780
|
return true
|
|
4772
4781
|
}
|
|
4773
4782
|
|
|
4774
|
-
|
|
4783
|
+
if (files.length) {
|
|
4784
|
+
this.#uploadFilesPreservingScroll(files);
|
|
4785
|
+
return true
|
|
4786
|
+
}
|
|
4787
|
+
|
|
4788
|
+
return false
|
|
4789
|
+
}
|
|
4775
4790
|
|
|
4776
|
-
|
|
4791
|
+
#isLexicalClipboardData(clipboardData) {
|
|
4792
|
+
return Array.from(clipboardData.types).includes("application/x-lexical-editor")
|
|
4777
4793
|
}
|
|
4778
4794
|
|
|
4779
4795
|
#isCopiedImageHTML(html) {
|