@lexical/text 0.6.4 → 0.7.0
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/LexicalText.dev.js +4 -4
- package/LexicalText.prod.js +6 -6
- package/index.d.ts +2 -2
- package/package.json +2 -2
    
        package/LexicalText.dev.js
    CHANGED
    
    | @@ -79,8 +79,8 @@ function $rootTextContent() { | |
| 79 79 | 
             
              const root = lexical.$getRoot();
         | 
| 80 80 | 
             
              return root.getTextContent();
         | 
| 81 81 | 
             
            }
         | 
| 82 | 
            -
            function $canShowPlaceholder(isComposing | 
| 83 | 
            -
              if ( | 
| 82 | 
            +
            function $canShowPlaceholder(isComposing) {
         | 
| 83 | 
            +
              if (!$isRootTextContentEmpty(isComposing, false)) {
         | 
| 84 84 | 
             
                return false;
         | 
| 85 85 | 
             
              }
         | 
| 86 86 |  | 
| @@ -119,8 +119,8 @@ function $canShowPlaceholder(isComposing, isEditable) { | |
| 119 119 |  | 
| 120 120 | 
             
              return true;
         | 
| 121 121 | 
             
            }
         | 
| 122 | 
            -
            function $canShowPlaceholderCurry(isEditorComposing | 
| 123 | 
            -
              return () => $canShowPlaceholder(isEditorComposing | 
| 122 | 
            +
            function $canShowPlaceholderCurry(isEditorComposing) {
         | 
| 123 | 
            +
              return () => $canShowPlaceholder(isEditorComposing);
         | 
| 124 124 | 
             
            }
         | 
| 125 125 | 
             
            function registerLexicalTextEntity(editor, getMatch, targetNode, createNode) {
         | 
| 126 126 | 
             
              const isTargetNode = node => {
         | 
    
        package/LexicalText.prod.js
    CHANGED
    
    | @@ -4,9 +4,9 @@ | |
| 4 4 | 
             
             * This source code is licensed under the MIT license found in the
         | 
| 5 5 | 
             
             * LICENSE file in the root directory of this source tree.
         | 
| 6 6 | 
             
             */
         | 
| 7 | 
            -
            'use strict';var h=require("lexical");function r(c, | 
| 8 | 
            -
            exports.$canShowPlaceholderCurry=function(c | 
| 9 | 
            -
            exports.$isRootTextContentEmpty=r;exports.$isRootTextContentEmptyCurry=function(c, | 
| 10 | 
            -
            exports.registerLexicalTextEntity=function(c, | 
| 11 | 
            -
            a.setTextContent(d));return}}else if(null=== | 
| 12 | 
            -
            if(null==m)break}}});c=c.registerNodeTransform(b,a=>{var d=a.getTextContent();const l= | 
| 7 | 
            +
            'use strict';var h=require("lexical");function r(c,g=!0){if(c)return!1;c=t();g&&(c=c.trim());return""===c}function t(){return h.$getRoot().getTextContent()}function u(c){if(!r(c,!1))return!1;c=h.$getRoot().getChildren();let g=c.length;if(1<g)return!1;for(let e=0;e<g;e++){var b=c[e];if(h.$isElementNode(b)){if("paragraph"!==b.__type||0!==b.__indent)return!1;b=b.getChildren();let n=b.length;for(let p=0;p<n;p++)if(!h.$isTextNode(b[e]))return!1}}return!0}exports.$canShowPlaceholder=u;
         | 
| 8 | 
            +
            exports.$canShowPlaceholderCurry=function(c){return()=>u(c)};exports.$findTextIntersectionFromCharacters=function(c,g){var b=c.getFirstChild();c=0;a:for(;null!==b;){if(h.$isElementNode(b)){var e=b.getFirstChild();if(null!==e){b=e;continue}}else if(h.$isTextNode(b)){e=b.getTextContentSize();if(c+e>g)return{node:b,offset:g-c};c+=e}e=b.getNextSibling();if(null!==e)b=e;else{for(b=b.getParent();null!==b;){e=b.getNextSibling();if(null!==e){b=e;continue a}b=b.getParent()}break}}return null};
         | 
| 9 | 
            +
            exports.$isRootTextContentEmpty=r;exports.$isRootTextContentEmptyCurry=function(c,g){return()=>r(c,g)};exports.$rootTextContent=t;
         | 
| 10 | 
            +
            exports.registerLexicalTextEntity=function(c,g,b,e){let n=a=>{const d=h.$createTextNode(a.getTextContent());d.setFormat(a.getFormat());a.replace(d)},p=c.registerNodeTransform(h.TextNode,a=>{if(a.isSimpleText()){var d=a.getPreviousSibling(),l=a.getTextContent(),m=a;if(h.$isTextNode(d)){var k=d.getTextContent(),f=g(k+l);if(d instanceof b){if(null===f||0!==d.getLatest().__mode){n(d);return}f=f.end-k.length;if(0<f){m=l.slice(0,f);m=k+m;d.select();d.setTextContent(m);f===l.length?a.remove():(d=l.slice(f),
         | 
| 11 | 
            +
            a.setTextContent(d));return}}else if(null===f||f.start<k.length)return}for(;;){a=g(l);l=f=null===a?"":l.slice(a.end);if(""===f){if(k=m.getNextSibling(),h.$isTextNode(k))if(f=m.getTextContent()+k.getTextContent(),f=g(f),null===f){k instanceof b?n(k):k.markDirty();break}else if(0!==f.start)break}else if(k=g(f),null!==k&&0===k.start)break;if(null===a)break;if(0===a.start&&h.$isTextNode(d)&&d.isTextEntity())continue;let q;0===a.start?[q,m]=m.splitText(a.end):[,q,m]=m.splitText(a.start,a.end);a=e(q);q.replace(a);
         | 
| 12 | 
            +
            if(null==m)break}}});c=c.registerNodeTransform(b,a=>{var d=a.getTextContent();const l=g(d);null===l||0!==l.start?n(a):d.length>l.end?a.splitText(l.end):(d=a.getPreviousSibling(),h.$isTextNode(d)&&d.isTextEntity()&&(n(d),n(a)),d=a.getNextSibling(),h.$isTextNode(d)&&d.isTextEntity()&&(n(d),a instanceof b&&n(a)))});return[p,c]}
         | 
    
        package/index.d.ts
    CHANGED
    
    | @@ -19,8 +19,8 @@ export declare function $findTextIntersectionFromCharacters(root: RootNode, targ | |
| 19 19 | 
             
            export declare function $isRootTextContentEmpty(isEditorComposing: boolean, trim?: boolean): boolean;
         | 
| 20 20 | 
             
            export declare function $isRootTextContentEmptyCurry(isEditorComposing: boolean, trim?: boolean): () => boolean;
         | 
| 21 21 | 
             
            export declare function $rootTextContent(): string;
         | 
| 22 | 
            -
            export declare function $canShowPlaceholder(isComposing: boolean | 
| 23 | 
            -
            export declare function $canShowPlaceholderCurry(isEditorComposing: boolean | 
| 22 | 
            +
            export declare function $canShowPlaceholder(isComposing: boolean): boolean;
         | 
| 23 | 
            +
            export declare function $canShowPlaceholderCurry(isEditorComposing: boolean): () => boolean;
         | 
| 24 24 | 
             
            export declare type EntityMatch = {
         | 
| 25 25 | 
             
                end: number;
         | 
| 26 26 | 
             
                start: number;
         | 
    
        package/package.json
    CHANGED