@lexical/text
Advanced tools
Comparing version 0.3.11 to 0.4.0
@@ -0,1 +1,2 @@ | ||
/** @module @lexical/text */ | ||
/** | ||
@@ -23,4 +24,4 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
export declare function $rootTextContent(): string; | ||
export declare function $canShowPlaceholder(isComposing: boolean, isReadOnly?: boolean): boolean; | ||
export declare function $canShowPlaceholderCurry(isEditorComposing: boolean, isReadOnly?: boolean): () => boolean; | ||
export declare function $canShowPlaceholder(isComposing: boolean, isEditable?: boolean): boolean; | ||
export declare function $canShowPlaceholderCurry(isEditorComposing: boolean, isEditable?: boolean): () => boolean; | ||
export declare type EntityMatch = { | ||
@@ -27,0 +28,0 @@ end: number; |
@@ -11,9 +11,3 @@ /** | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
/** @module @lexical/text */ | ||
function $findTextIntersectionFromCharacters(root, targetCharacters) { | ||
@@ -172,5 +166,5 @@ let node = root.getFirstChild(); | ||
} | ||
function $canShowPlaceholder(isComposing, // TODO 0.4 make mandatory | ||
isReadOnly = false) { | ||
if (isReadOnly || !$isRootTextContentEmpty(isComposing, false)) { | ||
function $canShowPlaceholder(isComposing, // TODO 0.5 make mandatory | ||
isEditable = true) { | ||
if (!isEditable || !$isRootTextContentEmpty(isComposing, false)) { | ||
return false; | ||
@@ -214,5 +208,5 @@ } | ||
} | ||
function $canShowPlaceholderCurry(isEditorComposing, // TODO 0.4 make mandatory | ||
isReadOnly = false) { | ||
return () => $canShowPlaceholder(isEditorComposing, isReadOnly); | ||
function $canShowPlaceholderCurry(isEditorComposing, // TODO 0.5 make mandatory | ||
isEditable = true) { | ||
return () => $canShowPlaceholder(isEditorComposing, isEditable); | ||
} | ||
@@ -219,0 +213,0 @@ function registerLexicalTextEntity(editor, getMatch, targetNode, createNode) { |
@@ -7,4 +7,4 @@ /** | ||
*/ | ||
'use strict';var k=require("lexical");function r(b,f=!0){if(b)return!1;b=t();f&&(b=b.trim());return""===b}function t(){return k.$getRoot().getTextContent()}function u(b,f=!1){if(f||!r(b,!1))return!1;b=k.$getRoot().getChildren();f=b.length;if(1<f)return!1;for(let e=0;e<f;e++){var c=b[e];if(k.$isElementNode(c)){if("paragraph"!==c.__type||0!==c.__indent)return!1;c=c.getChildren();let p=c.length;for(let g=0;g<p;g++)if(!k.$isTextNode(c[e]))return!1}}return!0}exports.$canShowPlaceholder=u; | ||
exports.$canShowPlaceholderCurry=function(b,f=!1){return()=>u(b,f)};exports.$findNodeWithOffsetFromJoinedText=function(b,f,c,e){e=e.getChildren();let p=e.length,g=0,a=!1;for(let l=0;l<p&&!(g>f);++l){let m=e[l],n=k.$isTextNode(m);var d=n?m.getTextContent().length:c;d=g+d;if((!1===a&&g===b||0===g&&g===b||g<b&&b<=d)&&k.$isTextNode(m))return{node:m,offset:b-g};g=d;a=n}return null}; | ||
'use strict';var k=require("lexical");function r(b,f=!0){if(b)return!1;b=t();f&&(b=b.trim());return""===b}function t(){return k.$getRoot().getTextContent()}function u(b,f=!0){if(!f||!r(b,!1))return!1;b=k.$getRoot().getChildren();f=b.length;if(1<f)return!1;for(let e=0;e<f;e++){var c=b[e];if(k.$isElementNode(c)){if("paragraph"!==c.__type||0!==c.__indent)return!1;c=c.getChildren();let p=c.length;for(let g=0;g<p;g++)if(!k.$isTextNode(c[e]))return!1}}return!0}exports.$canShowPlaceholder=u; | ||
exports.$canShowPlaceholderCurry=function(b,f=!0){return()=>u(b,f)};exports.$findNodeWithOffsetFromJoinedText=function(b,f,c,e){e=e.getChildren();let p=e.length,g=0,a=!1;for(let l=0;l<p&&!(g>f);++l){let m=e[l],n=k.$isTextNode(m);var d=n?m.getTextContent().length:c;d=g+d;if((!1===a&&g===b||0===g&&g===b||g<b&&b<=d)&&k.$isTextNode(m))return{node:m,offset:b-g};g=d;a=n}return null}; | ||
exports.$findTextIntersectionFromCharacters=function(b,f){var c=b.getFirstChild();b=0;a:for(;null!==c;){if(k.$isElementNode(c)){var e=c.getFirstChild();if(null!==e){c=e;continue}}else if(k.$isTextNode(c)){e=c.getTextContentSize();if(b+e>f)return{node:c,offset:f-b};b+=e}e=c.getNextSibling();if(null!==e)c=e;else{for(c=c.getParent();null!==c;){e=c.getNextSibling();if(null!==e){c=e;continue a}c=c.getParent()}break}}return null};exports.$isRootTextContentEmpty=r; | ||
@@ -11,0 +11,0 @@ exports.$isRootTextContentEmptyCurry=function(b,f){return()=>r(b,f)}; |
@@ -12,6 +12,6 @@ { | ||
"license": "MIT", | ||
"version": "0.3.11", | ||
"version": "0.4.0", | ||
"main": "LexicalText.js", | ||
"peerDependencies": { | ||
"lexical": "0.3.11" | ||
"lexical": "0.4.0" | ||
}, | ||
@@ -18,0 +18,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19810
362