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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8294fbf164b9b8fb87be2f8025cc8fd563e3fd5bb61daaf1415ff93f39a588bc
4
- data.tar.gz: f40f1aa544f74bf7e0c2fb5fdd7b6a0850426eeb30861d2631f08c4bfefe7ec9
3
+ metadata.gz: fb166e590d74646ee8cbb992f3dd36774f5cfc84f4552f1ed13b08acad1ad383
4
+ data.tar.gz: dc6638a1acae7c2ff1289790621f80bab042d9f77fe301df34960010878cc23e
5
5
  SHA512:
6
- metadata.gz: 5d032f3f71e366385c22ce4cfbd0e5c48d3af49aa28001d6c7d13a931e62d9df57c9549728ccbd4bf105c1cb3d24e21e0693754726887f7c8db248677b2de23f
7
- data.tar.gz: 1877815c54a4436a398f471eb0277e7fc68526e0f24ad6680902fd2ebdde198cc450889d279d17bbea7811524ea9716eaea750f0560063f03ed1d50226e3510b
6
+ metadata.gz: 1056b0125923bf36c8114a01e39295d42de1e26aeb207cac301ee974e7183655e4025ca430a4b40c1d5418f9ce38cd9e7fd2fec549d24eeb49f4c0bed7aa856a
7
+ data.tar.gz: 3230d626e983c5bff9727515ddf2af0f2037bb2351241821975011601911758721a0aa5df042cf63934ccaaaddabe9609a847c18a1012d5d645b5e900a956600
@@ -10711,7 +10711,8 @@ class Contents {
10711
10711
  }
10712
10712
 
10713
10713
  #splitParagraphsAtLineBreaks(selection) {
10714
- const selectedNodeKeys = new Set(selection.getNodes().map(n => n.getKey()));
10714
+ const anchorKey = selection.anchor.getNode().getKey();
10715
+ const focusKey = selection.focus.getNode().getKey();
10715
10716
  const topLevelElements = this.#topLevelElementsInSelection(selection);
10716
10717
 
10717
10718
  for (const element of topLevelElements) {
@@ -10720,6 +10721,14 @@ class Contents {
10720
10721
  const children = element.getChildren();
10721
10722
  if (!children.some(Zn)) continue
10722
10723
 
10724
+ // Check whether this paragraph needs splitting: skip only if neither
10725
+ // selection endpoint is inside it (meaning it's a middle paragraph
10726
+ // fully between anchor and focus with no partial lines to split off).
10727
+ const hasEndpoint = children.some(child =>
10728
+ child.getKey() === anchorKey || child.getKey() === focusKey
10729
+ );
10730
+ if (!hasEndpoint) continue
10731
+
10723
10732
  const groups = [ [] ];
10724
10733
  for (const child of children) {
10725
10734
  if (Zn(child)) {
@@ -10730,8 +10739,6 @@ class Contents {
10730
10739
  }
10731
10740
  }
10732
10741
 
10733
- if (groups.every(group => group.some(child => selectedNodeKeys.has(child.getKey())))) continue
10734
-
10735
10742
  for (const group of groups) {
10736
10743
  if (group.length === 0) continue
10737
10744
  const paragraph = Vi();
@@ -11019,7 +11026,9 @@ class Clipboard {
11019
11026
  return true
11020
11027
  }
11021
11028
 
11022
- return this.#handlePastedFiles(clipboardData)
11029
+ const handled = this.#handlePastedFiles(clipboardData);
11030
+ if (handled) event.preventDefault();
11031
+ return handled
11023
11032
  }
11024
11033
 
11025
11034
  #isPlainTextOrURLPasted(clipboardData) {
@@ -11117,14 +11126,21 @@ class Clipboard {
11117
11126
  return true
11118
11127
  }
11119
11128
 
11120
- if (html) {
11129
+ if (html && !this.#isLexicalClipboardData(clipboardData)) {
11121
11130
  this.contents.insertHtml(html, { tag: Jn });
11122
11131
  return true
11123
11132
  }
11124
11133
 
11125
- this.#uploadFilesPreservingScroll(files);
11134
+ if (files.length) {
11135
+ this.#uploadFilesPreservingScroll(files);
11136
+ return true
11137
+ }
11138
+
11139
+ return false
11140
+ }
11126
11141
 
11127
- return true
11142
+ #isLexicalClipboardData(clipboardData) {
11143
+ return Array.from(clipboardData.types).includes("application/x-lexical-editor")
11128
11144
  }
11129
11145
 
11130
11146
  #isCopiedImageHTML(html) {
Binary file
Binary file