@lexical/selection 0.2.0 → 0.2.1

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.
@@ -605,7 +605,9 @@ function $wrapLeafNodesInElements(selection, createElement, wrappingElement) {
605
605
  const prevSelection = lexical.$getPreviousSelection();
606
606
 
607
607
  if (lexical.$isRangeSelection(prevSelection) && isPointAttached(prevSelection.anchor) && isPointAttached(prevSelection.focus)) {
608
- lexical.$setSelection(prevSelection);
608
+ const clonedSelection = prevSelection.clone();
609
+ clonedSelection.dirty = true;
610
+ lexical.$setSelection(clonedSelection);
609
611
  } else {
610
612
  selection.dirty = true;
611
613
  }
@@ -19,4 +19,4 @@ exports.$selectAll=function(a){const c=a.anchor;a=a.focus;var b=c.getNode().getT
19
19
  exports.$shouldOverrideDefaultCharacterSelection=function(a,c){a=l.$getDecoratorNode(a.focus,c);return l.$isDecoratorNode(a)&&!a.isIsolated()};
20
20
  exports.$wrapLeafNodesInElements=function(a,c,b){const g=a.getNodes(),h=g.length;if(0===h){a=a.anchor;a="text"===a.type?a.getNode().getParentOrThrow():a.getNode();var e=a.getChildren();let p=c();e.forEach(v=>p.append(v));b&&(p=b.append(p));a.replace(p)}else{var d=g[0],f=new Map;e=[];d=l.$isElementNode(d)?d:d.getParentOrThrow();for(d.isInline()&&(d=d.getParentOrThrow());null!==d;){var k=d.getPreviousSibling();if(null!==k){d=k;break}d=d.getParentOrThrow();if(l.$isRootNode(d))break}k=new Set;for(var m=
21
21
  0;m<h;m++){var n=g[m];l.$isElementNode(n)&&0===n.getChildrenSize()&&k.add(n.getKey())}var r=new Set;for(m=0;m<h;m++){var q=g[m];n=q.getParent();null!==n&&n.isInline()&&(n=n.getParent());if(null!==n&&l.$isLeafNode(q)&&!r.has(q.getKey())){if(q=n.getKey(),void 0===f.get(q)){const p=c();e.push(p);f.set(q,p);n.getChildren().forEach(v=>{p.append(v);r.add(v.getKey())});C(n)}}else k.has(q.getKey())&&(e.push(c()),q.remove())}if(b)for(c=0;c<e.length;c++)b.append(e[c]);if(l.$isRootNode(d))if(c=d.getFirstChild(),
22
- l.$isElementNode(c)&&(d=c),null===c)if(b)d.append(b);else for(b=0;b<e.length;b++)d.append(e[b]);else if(b)c.insertBefore(b);else for(b=0;b<e.length;b++)c.insertBefore(e[b]);else if(b)d.insertAfter(b);else for(b=e.length-1;0<=b;b--)d.insertAfter(e[b]);b=l.$getPreviousSelection();l.$isRangeSelection(b)&&b.anchor.getNode().isAttached()&&b.focus.getNode().isAttached()?l.$setSelection(b):a.dirty=!0}};exports.getStyleObjectFromCSS=y;
22
+ l.$isElementNode(c)&&(d=c),null===c)if(b)d.append(b);else for(b=0;b<e.length;b++)d.append(e[b]);else if(b)c.insertBefore(b);else for(b=0;b<e.length;b++)c.insertBefore(e[b]);else if(b)d.insertAfter(b);else for(b=e.length-1;0<=b;b--)d.insertAfter(e[b]);b=l.$getPreviousSelection();l.$isRangeSelection(b)&&b.anchor.getNode().isAttached()&&b.focus.getNode().isAttached()?(a=b.clone(),a.dirty=!0,l.$setSelection(a)):a.dirty=!0}};exports.getStyleObjectFromCSS=y;
package/package.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "selection"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.2.0",
12
+ "version": "0.2.1",
13
13
  "main": "LexicalSelection.js",
14
14
  "peerDependencies": {
15
- "lexical": "0.2.0"
15
+ "lexical": "0.2.1"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",