@lexical/selection 0.3.3 → 0.3.6
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/LexicalSelection.dev.js +25 -12
- package/LexicalSelection.prod.js +20 -20
- package/index.d.ts +28 -0
- package/package.json +2 -2
- package/LexicalSelection.d.ts +0 -87
package/LexicalSelection.dev.js
CHANGED
|
@@ -108,7 +108,7 @@ function errGetLatestOnClone() {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function $cloneContents(selection) {
|
|
111
|
-
const clone = $cloneContentsImpl(selection);
|
|
111
|
+
const clone = $cloneContentsImpl(selection);
|
|
112
112
|
|
|
113
113
|
{
|
|
114
114
|
const nodeMap = clone.nodeMap;
|
|
@@ -228,6 +228,20 @@ function getStyleObjectFromCSS(css) {
|
|
|
228
228
|
return cssToStyles.get(css) || null;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
function getStyleObjectFromRawCSS(css) {
|
|
232
|
+
const styleObject = {};
|
|
233
|
+
const styles = css.split(';');
|
|
234
|
+
|
|
235
|
+
for (const style of styles) {
|
|
236
|
+
if (style !== '') {
|
|
237
|
+
const patch = style.split(':');
|
|
238
|
+
styleObject[patch[0].trim()] = patch[1].trim();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return styleObject;
|
|
243
|
+
}
|
|
244
|
+
|
|
231
245
|
function getCSSFromStyleObject(styles) {
|
|
232
246
|
let css = '';
|
|
233
247
|
|
|
@@ -240,6 +254,12 @@ function getCSSFromStyleObject(styles) {
|
|
|
240
254
|
return css;
|
|
241
255
|
}
|
|
242
256
|
|
|
257
|
+
function $addNodeStyle(node) {
|
|
258
|
+
const CSSText = node.getStyle();
|
|
259
|
+
const styles = getStyleObjectFromRawCSS(CSSText);
|
|
260
|
+
cssToStyles.set(CSSText, styles);
|
|
261
|
+
}
|
|
262
|
+
|
|
243
263
|
function $patchNodeStyle(node, patch) {
|
|
244
264
|
const prevStyles = getStyleObjectFromCSS(node.getStyle());
|
|
245
265
|
const newStyles = prevStyles ? { ...prevStyles,
|
|
@@ -718,11 +738,6 @@ function createRectsFromDOMRange(editor, range) {
|
|
|
718
738
|
|
|
719
739
|
return selectionRects;
|
|
720
740
|
}
|
|
721
|
-
|
|
722
|
-
function doesContainGrapheme(str) {
|
|
723
|
-
return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(str);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
741
|
function trimTextContentFromAnchor(editor, anchor, delCount) {
|
|
727
742
|
// Work from the current selection anchor point
|
|
728
743
|
let currentNode = anchor.getNode();
|
|
@@ -776,16 +791,13 @@ function trimTextContentFromAnchor(editor, anchor, delCount) {
|
|
|
776
791
|
|
|
777
792
|
const textNodeSize = text.length;
|
|
778
793
|
const offset = textNodeSize - remaining;
|
|
779
|
-
const slicedText = text.slice(0, offset);
|
|
780
|
-
// So we just remove the entire thing, rather than show a partial unicode grapheme.
|
|
781
|
-
|
|
782
|
-
const containsPartialGraphemeHeuristic = doesContainGrapheme(text) && !doesContainGrapheme(slicedText);
|
|
794
|
+
const slicedText = text.slice(0, offset);
|
|
783
795
|
|
|
784
|
-
if (!lexical.$isTextNode(currentNode) || remaining >= textNodeSize
|
|
796
|
+
if (!lexical.$isTextNode(currentNode) || remaining >= textNodeSize) {
|
|
785
797
|
const parent = currentNode.getParent();
|
|
786
798
|
currentNode.remove();
|
|
787
799
|
|
|
788
|
-
if (parent.getChildrenSize() === 0) {
|
|
800
|
+
if (parent != null && parent.getChildrenSize() === 0) {
|
|
789
801
|
parent.remove();
|
|
790
802
|
}
|
|
791
803
|
|
|
@@ -886,6 +898,7 @@ function $sliceSelectedTextNodeContent(selection, textNode) {
|
|
|
886
898
|
return textNode;
|
|
887
899
|
}
|
|
888
900
|
|
|
901
|
+
exports.$addNodeStyle = $addNodeStyle;
|
|
889
902
|
exports.$cloneContents = $cloneContents;
|
|
890
903
|
exports.$cloneWithProperties = $cloneWithProperties;
|
|
891
904
|
exports.$getSelectionStyleValueForProperty = $getSelectionStyleValueForProperty;
|
package/LexicalSelection.prod.js
CHANGED
|
@@ -5,24 +5,24 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';var l=require("lexical");let t=new Map;function u(a){a=a.getLatest();let c=a.constructor.clone(a);c.__parent=a.__parent;l.$isElementNode(a)&&l.$isElementNode(c)?(c.__children=Array.from(a.__children),c.__format=a.__format,c.__indent=a.__indent,c.__dir=a.__dir):l.$isTextNode(a)&&l.$isTextNode(c)&&(c.__format=a.__format,c.__style=a.__style,c.__mode=a.__mode,c.__detail=a.__detail);return c}
|
|
8
|
-
function w(a,c,b,
|
|
9
|
-
|
|
10
|
-
function x(a){if(l.$isRangeSelection(a)){var c=a.anchor,b=a.focus;let [
|
|
11
|
-
|
|
12
|
-
}function y(a){return t.get(a)||null}function z(a,c){var b=y(a.getStyle());c=b?{...b,...c}:c;b="";for(
|
|
13
|
-
function D(a){for(;null!=a;){if(a.nodeType===Node.TEXT_NODE)return a;a=a.firstChild}return null}function E(a){let c=a.parentNode;if(null==c)throw Error("Should never happen");return[c,Array.from(c.childNodes).indexOf(a)]}function
|
|
14
|
-
exports.$getSelectionStyleValueForProperty=function(a,c,b=""){let
|
|
15
|
-
exports.$isParentElementRTL=B;exports.$moveCaretSelection=A;exports.$moveCharacter=function(a,c,b){let
|
|
16
|
-
exports.$patchStyleText=function(a,c){var b=a.getNodes();let
|
|
17
|
-
f.splitText(
|
|
18
|
-
exports.$selectAll=function(a){let c=a.anchor;a=a.focus;var b=c.getNode().getTopLevelElementOrThrow().getParentOrThrow();let
|
|
8
|
+
function w(a,c,b,d,f,g){for(var e=c;null!==a;){for(c=a.getParent();null!==c&&c.excludeFromCopy("clone");)c=c.getParent();if(null===c)break;if(!l.$isElementNode(a)||!a.excludeFromCopy("clone")){let h=a.getKey(),k=g.get(h),m=void 0===k;m&&(k=u(a),g.set(h,k));!l.$isTextNode(k)||k.isSegmented()||k.isToken()?l.$isElementNode(k)&&(k.__children=k.__children.slice(d?e:0,d?void 0:(e||0)+1)):k.__text=k.__text.slice(d?e:0,d?b:e);if(l.$isRootNode(c)){m&&f.push(h);break}}e=g.get(c.getKey());e=l.$isElementNode(e)?
|
|
9
|
+
e.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=c}}
|
|
10
|
+
function x(a){if(l.$isRangeSelection(a)){var c=a.anchor,b=a.focus;let [k,m]=a.getCharacterOffsets();a=a.getNodes();if(0===a.length)return{nodeMap:[],range:[]};let n=a.length;var d=a[0],f=d.getParent();if(null!==f&&(!f.canBeEmpty()||l.$isRootNode(f))){var g=f.__children;if(g.length===n){var e=!0;for(var h=0;h<g.length;h++)if(g[h]!==a[h].__key){e=!1;break}e&&(n++,a.push(f))}}f=a[n-1];c=c.isBefore(b);b=new Map;g=[];e=l.$isTextNode(d)&&1===n;w(d,c?k:m,e?c?m:k:void 0,!0,g,b);for(d=0;d<n;d++){h=a[d];let p=
|
|
11
|
+
h.getKey();if(!(b.has(p)||l.$isElementNode(h)&&h.excludeFromCopy("clone"))){let q=u(h);l.$isRootNode(h.getParent())&&g.push(h.getKey());"root"!==p&&b.set(p,q)}}w(f,e?void 0:c?m:k,void 0,!1,g,b);return{nodeMap:Array.from(b.entries()),range:g}}if(l.$isGridSelection(a))return{nodeMap:a.getNodes().map(k=>{const m=k.getKey();k=u(k);return[m,k]}),range:[a.gridKey]};throw Error("Minified Lexical error #1; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
|
12
|
+
}function y(a){return t.get(a)||null}function z(a,c){var b=y(a.getStyle());c=b?{...b,...c}:c;b="";for(d in c)d&&(b+=`${d}: ${c[d]};`);var d=b;a.setStyle(d);t.set(d,c)}function A(a,c,b,d){a.modify(c?"extend":"move",b,d)}function B(a){a=a.anchor.getNode();return"rtl"===(l.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function C(a){for(;null!==a&&!l.$isRootNode(a);){let c=a.getLatest(),b=a.getParent();0===c.__children.length&&a.remove(!0);a=b}}
|
|
13
|
+
function D(a){for(;null!=a;){if(a.nodeType===Node.TEXT_NODE)return a;a=a.firstChild}return null}function E(a){let c=a.parentNode;if(null==c)throw Error("Should never happen");return[c,Array.from(c.childNodes).indexOf(a)]}exports.$addNodeStyle=function(a){a=a.getStyle();let c={};var b=a.split(";");for(let d of b)""!==d&&(b=d.split(":"),c[b[0].trim()]=b[1].trim());t.set(a,c)};exports.$cloneContents=function(a){return x(a)};exports.$cloneWithProperties=u;
|
|
14
|
+
exports.$getSelectionStyleValueForProperty=function(a,c,b=""){let d=null,f=a.getNodes();var g=a.anchor,e=a.focus,h=a.isBackward();a=h?e.offset:g.offset;g=h?e.getNode():g.getNode();for(e=0;e<f.length;e++){var k=f[e];if((0===e||0!==a||!k.is(g))&&l.$isTextNode(k)){h=c;var m=b;k=k.getStyle();k=y(k);h=null!==k?k[h]||m:m;if(null===d)d=h;else if(d!==h){d="";break}}}return null===d?b:d};exports.$isAtNodeEnd=function(a){return"text"===a.type?a.offset===a.getNode().getTextContentSize():a.offset===a.getNode().getChildrenSize()};
|
|
15
|
+
exports.$isParentElementRTL=B;exports.$moveCaretSelection=A;exports.$moveCharacter=function(a,c,b){let d=B(a);A(a,c,b?!d:d,"character")};
|
|
16
|
+
exports.$patchStyleText=function(a,c){var b=a.getNodes();let d=b.length-1,f=b[0],g=b[d];if(!a.isCollapsed()){var e=a.anchor,h=a.focus;a=f.getTextContent().length;var k=h.offset,m=e.offset;e=(h=e.isBefore(h))?m:k;h=h?k:m;if(e===f.getTextContentSize()){let n=f.getNextSibling();l.$isTextNode(n)&&(e=m=0,f=n)}if(f.is(g))l.$isTextNode(f)&&(e=m>k?k:m,h=m>k?m:k,e!==h&&(0===e&&h===a?(z(f,c),f.select(e,h)):(b=f.splitText(e,h),b=0===e?b[0]:b[1],z(b,c),b.select(0,h-e))));else for(l.$isTextNode(f)&&(0!==e&&(f=
|
|
17
|
+
f.splitText(e)[1]),z(f,c)),l.$isTextNode(g)&&(a=g.getTextContent().length,h!==a&&([g]=g.splitText(h)),0!==h&&z(g,c)),a=1;a<d;a++)k=b[a],m=k.getKey(),l.$isTextNode(k)&&m!==f.getKey()&&m!==g.getKey()&&!k.isToken()&&z(k,c)}};
|
|
18
|
+
exports.$selectAll=function(a){let c=a.anchor;a=a.focus;var b=c.getNode().getTopLevelElementOrThrow().getParentOrThrow();let d=b.getFirstDescendant();b=b.getLastDescendant();let f="element",g="element",e=0;l.$isTextNode(d)?f="text":l.$isElementNode(d)||null===d||(d=d.getParentOrThrow());l.$isTextNode(b)?(g="text",e=b.getTextContentSize()):l.$isElementNode(b)||null===b||(b=b.getParentOrThrow());d&&b&&(c.set(d.getKey(),0,f),a.set(b.getKey(),e,g))};
|
|
19
19
|
exports.$shouldOverrideDefaultCharacterSelection=function(a,c){a=l.$getDecoratorNode(a.focus,c);return l.$isDecoratorNode(a)&&!a.isIsolated()};
|
|
20
|
-
exports.$sliceSelectedTextNodeContent=function(a,c){if(c.isSelected()&&!c.isSegmented()&&!c.isToken()&&(l.$isRangeSelection(a)||l.$isGridSelection(a))){var b=a.anchor.getNode(),
|
|
21
|
-
exports.$wrapLeafNodesInElements=function(a,c,b){let
|
|
22
|
-
if(l.$isRootNode(
|
|
23
|
-
if(l.$isRootNode(
|
|
24
|
-
exports.createDOMRange=function(a,c,b,
|
|
25
|
-
b));return
|
|
26
|
-
exports.trimTextContentFromAnchor=function(a,c,b){let
|
|
27
|
-
f=
|
|
28
|
-
|
|
20
|
+
exports.$sliceSelectedTextNodeContent=function(a,c){if(c.isSelected()&&!c.isSegmented()&&!c.isToken()&&(l.$isRangeSelection(a)||l.$isGridSelection(a))){var b=a.anchor.getNode(),d=a.focus.getNode(),f=c.is(b),g=c.is(d);if(f||g){f=a.isBackward();let [e,h]=a.getCharacterOffsets();a=b.is(d);g=c.is(f?d:b);d=c.is(f?b:d);b=0;let k=void 0;a?(b=e>h?h:e,k=e>h?e:h):g?(b=f?h:e,k=void 0):d&&(f=f?e:h,b=0,k=f);c.__text=c.__text.slice(b,k)}}return c};
|
|
21
|
+
exports.$wrapLeafNodesInElements=function(a,c,b){let d=a.getNodes(),f=d.length;var g=a.anchor;if(0===f||1===f&&"element"===g.type&&0===g.getNode().getChildrenSize()){a="text"===g.type?g.getNode().getParentOrThrow():g.getNode();g=a.getChildren();let r=c();g.forEach(v=>r.append(v));b&&(r=b.append(r));a.replace(r)}else{var e=d[0],h=new Map;g=[];e=l.$isElementNode(e)?e:e.getParentOrThrow();for(e.isInline()&&(e=e.getParentOrThrow());null!==e;){var k=e.getPreviousSibling();if(null!==k){e=k;break}e=e.getParentOrThrow();
|
|
22
|
+
if(l.$isRootNode(e))break}k=new Set;for(var m=0;m<f;m++){var n=d[m];l.$isElementNode(n)&&0===n.getChildrenSize()&&k.add(n.getKey())}var p=new Set;for(m=0;m<f;m++){var q=d[m];n=q.getParent();null!==n&&n.isInline()&&(n=n.getParent());if(null!==n&&l.$isLeafNode(q)&&!p.has(q.getKey())){if(q=n.getKey(),void 0===h.get(q)){let r=c();g.push(r);h.set(q,r);n.getChildren().forEach(v=>{r.append(v);p.add(v.getKey())});C(n)}}else k.has(q.getKey())&&(g.push(c()),q.remove())}if(b)for(c=0;c<g.length;c++)b.append(g[c]);
|
|
23
|
+
if(l.$isRootNode(e))if(c=e.getFirstChild(),l.$isElementNode(c)&&(e=c),null===c)if(b)e.append(b);else for(b=0;b<g.length;b++)e.append(g[b]);else if(b)c.insertBefore(b);else for(b=0;b<g.length;b++)c.insertBefore(g[b]);else if(b)e.insertAfter(b);else for(b=g.length-1;0<=b;b--)e.insertAfter(g[b]);b=l.$getPreviousSelection();l.$isRangeSelection(b)&&b.anchor.getNode().isAttached()&&b.focus.getNode().isAttached()?l.$setSelection(b.clone()):a.dirty=!0}};
|
|
24
|
+
exports.createDOMRange=function(a,c,b,d,f){let g=c.getKey(),e=d.getKey(),h=document.createRange(),k=a.getElementByKey(g);a=a.getElementByKey(e);l.$isTextNode(c)&&(k=D(k));l.$isTextNode(d)&&(a=D(a));if(void 0===c||void 0===d||null===k||null===a)return null;"BR"===k.nodeName&&([k,b]=E(k));"BR"===a.nodeName&&([a,f]=E(a));c=k.firstChild;k===a&&null!=c&&"BR"===c.nodeName&&0===b&&0===f&&(f=1);try{h.setStart(k,b),h.setEnd(a,f)}catch(m){return null}!h.collapsed||b===f&&g===e||(h.setStart(a,f),h.setEnd(k,
|
|
25
|
+
b));return h};exports.createRectsFromDOMRange=function(a,c){var b=a.getRootElement();if(null===b)return[];a=b.getBoundingClientRect();b=getComputedStyle(b);b=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight);c=Array.from(c.getClientRects());let d=c.length,f;for(let g=0;g<d;g++){let e=c[g],h=e.width+b===a.width;f&&f.top===e.top&&f.left===e.left&&f.width===e.width&&f.height===e.height||h?(c.splice(g--,1),d--):f=e}return c};exports.getStyleObjectFromCSS=y;
|
|
26
|
+
exports.trimTextContentFromAnchor=function(a,c,b){let d=c.getNode();if(l.$isElementNode(d)){var f=d.getDescendantByIndex(c.offset);null!==f&&(d=f)}for(;0<b&&null!==d;){var g=d.getPreviousSibling(),e=0;if(null===g){f=d.getParentOrThrow();for(var h=f.getPreviousSibling();null===h;){f=f.getParent();if(null===f){g=null;break}h=f.getPreviousSibling()}null!==f&&(e=f.isInline()?0:2,g=l.$isElementNode(h)?h.getLastDescendant():h)}let k=d.getTextContent();""===k&&l.$isElementNode(d)&&!d.isInline()&&(k="\n\n");
|
|
27
|
+
f=k.length;h=f-b;let m=k.slice(0,h);if(!l.$isTextNode(d)||b>=f)h=d.getParent(),d.remove(),null!=h&&0===h.getChildrenSize()&&h.remove(),b-=f+e,d=g;else{let n=d.getKey();g=a.getEditorState().read(()=>{const p=l.$getNodeByKey(n);return l.$isTextNode(p)&&p.isSimpleText()?p.getTextContent():null});null!==g&&g!==k?(b=l.$getPreviousSelection(),f=d,d.isSimpleText()?d.setTextContent(g):(f=l.$createTextNode(g),d.replace(f)),l.$isRangeSelection(b)&&b.isCollapsed()&&(b=b.anchor.offset,f.select(b,b))):d.isSimpleText()?
|
|
28
|
+
(g=c.key===n,e=c.offset,e<b&&(e=f),b=g?e-b:0,f=g?e:h,g&&0===b?([b]=d.splitText(b,f),b.remove()):([,b]=d.splitText(b,f),b.remove())):(b=l.$createTextNode(m),d.replace(b));b=0}}}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { ElementNode, GridSelection, LexicalEditor, LexicalNode, NodeKey, NodeSelection, Point, RangeSelection, TextNode } from 'lexical';
|
|
9
|
+
export declare function $cloneWithProperties<T extends LexicalNode>(node: T): T;
|
|
10
|
+
export declare function $cloneContents(selection: RangeSelection | NodeSelection | GridSelection): {
|
|
11
|
+
nodeMap: Array<[NodeKey, LexicalNode]>;
|
|
12
|
+
range: Array<NodeKey>;
|
|
13
|
+
};
|
|
14
|
+
export declare function getStyleObjectFromCSS(css: string): Record<string, string> | null;
|
|
15
|
+
export declare function $addNodeStyle(node: TextNode): void;
|
|
16
|
+
export declare function $patchStyleText(selection: RangeSelection | GridSelection, patch: Record<string, string>): void;
|
|
17
|
+
export declare function $getSelectionStyleValueForProperty(selection: RangeSelection, styleProperty: string, defaultValue?: string): string;
|
|
18
|
+
export declare function $moveCaretSelection(selection: RangeSelection, isHoldingShift: boolean, isBackward: boolean, granularity: 'character' | 'word' | 'lineboundary'): void;
|
|
19
|
+
export declare function $isParentElementRTL(selection: RangeSelection): boolean;
|
|
20
|
+
export declare function $moveCharacter(selection: RangeSelection, isHoldingShift: boolean, isBackward: boolean): void;
|
|
21
|
+
export declare function $selectAll(selection: RangeSelection): void;
|
|
22
|
+
export declare function $wrapLeafNodesInElements(selection: RangeSelection, createElement: () => ElementNode, wrappingElement?: ElementNode): void;
|
|
23
|
+
export declare function $isAtNodeEnd(point: Point): boolean;
|
|
24
|
+
export declare function $shouldOverrideDefaultCharacterSelection(selection: RangeSelection, isBackward: boolean): boolean;
|
|
25
|
+
export declare function createDOMRange(editor: LexicalEditor, anchorNode: LexicalNode, _anchorOffset: number, focusNode: LexicalNode, _focusOffset: number): Range | null;
|
|
26
|
+
export declare function createRectsFromDOMRange(editor: LexicalEditor, range: Range): Array<ClientRect>;
|
|
27
|
+
export declare function trimTextContentFromAnchor(editor: LexicalEditor, anchor: Point, delCount: number): void;
|
|
28
|
+
export declare function $sliceSelectedTextNodeContent(selection: RangeSelection | GridSelection | NodeSelection, textNode: TextNode): LexicalNode;
|
package/package.json
CHANGED
package/LexicalSelection.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
ElementNode,
|
|
11
|
-
GridSelection,
|
|
12
|
-
LexicalEditor,
|
|
13
|
-
LexicalNode,
|
|
14
|
-
NodeKey,
|
|
15
|
-
NodeSelection,
|
|
16
|
-
Point,
|
|
17
|
-
RangeSelection,
|
|
18
|
-
TextNode,
|
|
19
|
-
} from 'lexical';
|
|
20
|
-
|
|
21
|
-
export function $cloneContents<T extends LexicalNode>(
|
|
22
|
-
selection: RangeSelection | NodeSelection | GridSelection,
|
|
23
|
-
): {
|
|
24
|
-
nodeMap: Array<[NodeKey, T]>;
|
|
25
|
-
range: Array<NodeKey>;
|
|
26
|
-
};
|
|
27
|
-
export function $cloneWithProperties<T extends LexicalNode>(node: T): T;
|
|
28
|
-
export function $sliceSelectedTextNodeContent(
|
|
29
|
-
selection: RangeSelection | GridSelection | NodeSelection,
|
|
30
|
-
node: TextNode,
|
|
31
|
-
): LexicalNode;
|
|
32
|
-
export function getStyleObjectFromCSS(css: string): {
|
|
33
|
-
[key: string]: string;
|
|
34
|
-
} | null;
|
|
35
|
-
export function $patchStyleText(
|
|
36
|
-
selection: RangeSelection | GridSelection,
|
|
37
|
-
patch: {
|
|
38
|
-
[key: string]: string;
|
|
39
|
-
},
|
|
40
|
-
): void;
|
|
41
|
-
export function $getSelectionStyleValueForProperty(
|
|
42
|
-
selection: RangeSelection,
|
|
43
|
-
styleProperty: string,
|
|
44
|
-
defaultValue: string,
|
|
45
|
-
): string;
|
|
46
|
-
export function $moveCaretSelection(
|
|
47
|
-
selection: RangeSelection,
|
|
48
|
-
isHoldingShift: boolean,
|
|
49
|
-
isBackward: boolean,
|
|
50
|
-
granularity: 'character' | 'word' | 'lineboundary',
|
|
51
|
-
): void;
|
|
52
|
-
export function $isParentElementRTL(selection: RangeSelection): boolean;
|
|
53
|
-
export function $moveCharacter(
|
|
54
|
-
selection: RangeSelection,
|
|
55
|
-
isHoldingShift: boolean,
|
|
56
|
-
isBackward: boolean,
|
|
57
|
-
): void;
|
|
58
|
-
export function $selectAll(selection: RangeSelection): void;
|
|
59
|
-
export function $wrapLeafNodesInElements(
|
|
60
|
-
selection: RangeSelection,
|
|
61
|
-
createElement: () => ElementNode,
|
|
62
|
-
wrappingElement?: ElementNode,
|
|
63
|
-
): void;
|
|
64
|
-
export function $isAtNodeEnd(point: Point): boolean;
|
|
65
|
-
export function $shouldOverrideDefaultCharacterSelection(
|
|
66
|
-
selection: RangeSelection,
|
|
67
|
-
isBackward: boolean,
|
|
68
|
-
): boolean;
|
|
69
|
-
|
|
70
|
-
export declare function createDOMRange(
|
|
71
|
-
editor: LexicalEditor,
|
|
72
|
-
anchorNode: LexicalNode,
|
|
73
|
-
anchorOffset: number,
|
|
74
|
-
focusNode: LexicalNode,
|
|
75
|
-
focusOffset: number,
|
|
76
|
-
): Range | null;
|
|
77
|
-
|
|
78
|
-
export declare function createRectsFromDOMRange(
|
|
79
|
-
editor: LexicalEditor,
|
|
80
|
-
range: Range,
|
|
81
|
-
): Array<ClientRect>;
|
|
82
|
-
|
|
83
|
-
export declare function trimTextContentFromAnchor(
|
|
84
|
-
editor: LexicalEditor,
|
|
85
|
-
anchor: Point,
|
|
86
|
-
delCount: number,
|
|
87
|
-
): void;
|