@lexical/text 0.9.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LexicalText.dev.js +1 -0
- package/LexicalText.prod.js +5 -5
- package/package.json +2 -2
package/LexicalText.dev.js
CHANGED
@@ -294,6 +294,7 @@ function registerLexicalTextEntity(editor, getMatch, targetNode, createNode) {
|
|
294
294
|
}
|
295
295
|
|
296
296
|
const replacementNode = createNode(nodeToReplace);
|
297
|
+
replacementNode.setFormat(nodeToReplace.getFormat());
|
297
298
|
nodeToReplace.replace(replacementNode);
|
298
299
|
|
299
300
|
if (currentNode == null) {
|
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 g=require("lexical");function r(c,h=!0){if(c)return!1;c=t();h&&(c=c.trim());return""===c}function t(){return g.$getRoot().getTextContent()}function u(c){if(!r(c,!1))return!1;c=g.$getRoot().getChildren();let h=c.length;if(1<h)return!1;for(let e=0;e<h;e++){var
|
8
|
-
exports.$canShowPlaceholder=u;exports.$canShowPlaceholderCurry=function(c){return()=>u(c)};exports.$findTextIntersectionFromCharacters=function(c,h){var
|
7
|
+
'use strict';var g=require("lexical");function r(c,h=!0){if(c)return!1;c=t();h&&(c=c.trim());return""===c}function t(){return g.$getRoot().getTextContent()}function u(c){if(!r(c,!1))return!1;c=g.$getRoot().getChildren();let h=c.length;if(1<h)return!1;for(let e=0;e<h;e++){var b=c[e];if(g.$isDecoratorNode(b))return!1;if(g.$isElementNode(b)){if(!g.$isParagraphNode(b)||0!==b.__indent)return!1;b=b.getChildren();let n=b.length;for(let q=0;q<n;q++)if(!g.$isTextNode(b[e]))return!1}}return!0}
|
8
|
+
exports.$canShowPlaceholder=u;exports.$canShowPlaceholderCurry=function(c){return()=>u(c)};exports.$findTextIntersectionFromCharacters=function(c,h){var b=c.getFirstChild();c=0;a:for(;null!==b;){if(g.$isElementNode(b)){var e=b.getFirstChild();if(null!==e){b=e;continue}}else if(g.$isTextNode(b)){e=b.getTextContentSize();if(c+e>h)return{node:b,offset:h-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
9
|
exports.$isRootTextContentEmpty=r;exports.$isRootTextContentEmptyCurry=function(c,h){return()=>r(c,h)};exports.$rootTextContent=t;
|
10
|
-
exports.registerLexicalTextEntity=function(c,h,
|
11
|
-
|
12
|
-
if(null==m)break}}});c=c.registerNodeTransform(a
|
10
|
+
exports.registerLexicalTextEntity=function(c,h,b,e){let n=a=>{const d=g.$createTextNode(a.getTextContent());d.setFormat(a.getFormat());a.replace(d)},q=c.registerNodeTransform(g.TextNode,a=>{if(a.isSimpleText()){var d=a.getPreviousSibling(),l=a.getTextContent(),m=a;if(g.$isTextNode(d)){var k=d.getTextContent(),f=h(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=h(l);l=f=null===a?"":l.slice(a.end);if(""===f){if(k=m.getNextSibling(),g.$isTextNode(k))if(f=m.getTextContent()+k.getTextContent(),f=h(f),null===f){k instanceof b?n(k):k.markDirty();break}else if(0!==f.start)break}else if(k=h(f),null!==k&&0===k.start)break;if(null===a)break;if(0===a.start&&g.$isTextNode(d)&&d.isTextEntity())continue;let p;0===a.start?[p,m]=m.splitText(a.end):[,p,m]=m.splitText(a.start,a.end);a=e(p);a.setFormat(p.getFormat());
|
12
|
+
p.replace(a);if(null==m)break}}});c=c.registerNodeTransform(b,a=>{var d=a.getTextContent();const l=h(d);null===l||0!==l.start?n(a):d.length>l.end?a.splitText(l.end):(d=a.getPreviousSibling(),g.$isTextNode(d)&&d.isTextEntity()&&(n(d),n(a)),d=a.getNextSibling(),g.$isTextNode(d)&&d.isTextEntity()&&(n(d),a instanceof b&&n(a)))});return[q,c]}
|
package/package.json
CHANGED