@lexical/html 0.32.2-nightly.20250620.0 → 0.32.2-nightly.20250624.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/LexicalHtml.dev.js +1 -1
- package/LexicalHtml.dev.mjs +2 -2
- package/LexicalHtml.prod.js +1 -1
- package/LexicalHtml.prod.mjs +1 -1
- package/package.json +4 -4
package/LexicalHtml.dev.js
CHANGED
|
@@ -65,7 +65,7 @@ function $appendNodesToHTML(editor, currentNode, parentElement, selection$1 = nu
|
|
|
65
65
|
target = clone;
|
|
66
66
|
}
|
|
67
67
|
const children = lexical.$isElementNode(target) ? target.getChildren() : [];
|
|
68
|
-
const registeredNode =
|
|
68
|
+
const registeredNode = lexical.getRegisteredNode(editor, target.getType());
|
|
69
69
|
let exportOutput;
|
|
70
70
|
|
|
71
71
|
// Use HTMLConfig overrides, if available.
|
package/LexicalHtml.dev.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { $sliceSelectedTextNodeContent } from '@lexical/selection';
|
|
10
10
|
import { isHTMLElement, isBlockDomNode } from '@lexical/utils';
|
|
11
|
-
import { $getRoot, $isElementNode, $cloneWithProperties, $isTextNode, isDocumentFragment, $isRootOrShadowRoot, $isBlockElementNode, $createLineBreakNode, ArtificialNode__DO_NOT_USE, isInlineDomNode, $createParagraphNode } from 'lexical';
|
|
11
|
+
import { $getRoot, $isElementNode, $cloneWithProperties, $isTextNode, getRegisteredNode, isDocumentFragment, $isRootOrShadowRoot, $isBlockElementNode, $createLineBreakNode, ArtificialNode__DO_NOT_USE, isInlineDomNode, $createParagraphNode } from 'lexical';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -63,7 +63,7 @@ function $appendNodesToHTML(editor, currentNode, parentElement, selection = null
|
|
|
63
63
|
target = clone;
|
|
64
64
|
}
|
|
65
65
|
const children = $isElementNode(target) ? target.getChildren() : [];
|
|
66
|
-
const registeredNode = editor
|
|
66
|
+
const registeredNode = getRegisteredNode(editor, target.getType());
|
|
67
67
|
let exportOutput;
|
|
68
68
|
|
|
69
69
|
// Use HTMLConfig overrides, if available.
|
package/LexicalHtml.prod.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/selection"),
|
|
9
|
+
"use strict";var e=require("@lexical/selection"),t=require("@lexical/utils"),n=require("lexical");function o(l,i,r,s=null){let c=null===s||i.isSelected(s);const d=n.$isElementNode(i)&&i.excludeFromCopy("html");let u=i;if(null!==s){let t=n.$cloneWithProperties(i);t=n.$isTextNode(t)&&null!==s?e.$sliceSelectedTextNodeContent(s,t):t,u=t}const a=n.$isElementNode(u)?u.getChildren():[],f=n.getRegisteredNode(l,u.getType());let m;m=f&&void 0!==f.exportDOM?f.exportDOM(l,u):u.exportDOM(l);const{element:h,after:p}=m;if(!h)return!1;const g=document.createDocumentFragment();for(let e=0;e<a.length;e++){const t=a[e],r=o(l,t,g,s);!c&&n.$isElementNode(i)&&r&&i.extractWithChild(t,s,"html")&&(c=!0)}if(c&&!d){if((t.isHTMLElement(h)||n.isDocumentFragment(h))&&h.append(g),r.append(h),p){const e=p.call(u,h);e&&(n.isDocumentFragment(h)?h.replaceChildren(e):h.replaceWith(e))}}else r.append(g);return c}const l=new Set(["STYLE","SCRIPT"]);function i(e,o,s,c,d=new Map,u){let a=[];if(l.has(e.nodeName))return a;let f=null;const m=function(e,t){const{nodeName:n}=e,o=t._htmlConversions.get(n.toLowerCase());let l=null;if(void 0!==o)for(const t of o){const n=t(e);null!==n&&(null===l||(l.priority||0)<=(n.priority||0))&&(l=n)}return null!==l?l.conversion:null}(e,o),h=m?m(e):null;let p=null;if(null!==h){p=h.after;const t=h.node;if(f=Array.isArray(t)?t[t.length-1]:t,null!==f){for(const[,e]of d)if(f=e(f,u),!f)break;f&&a.push(...Array.isArray(t)?t:[f])}null!=h.forChild&&d.set(e.nodeName,h.forChild)}const g=e.childNodes;let N=[];const $=(null==f||!n.$isRootOrShadowRoot(f))&&(null!=f&&n.$isBlockElementNode(f)||c);for(let e=0;e<g.length;e++)N.push(...i(g[e],o,s,$,new Map(d),f));return null!=p&&(N=p(N)),t.isBlockDomNode(e)&&(N=r(e,N,$?()=>{const e=new n.ArtificialNode__DO_NOT_USE;return s.push(e),e}:n.$createParagraphNode)),null==f?N.length>0?a=a.concat(N):t.isBlockDomNode(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return!1;return n.isInlineDomNode(e.nextSibling)&&n.isInlineDomNode(e.previousSibling)}(e)&&(a=a.concat(n.$createLineBreakNode())):n.$isElementNode(f)&&f.append(...N),a}function r(e,t,o){const l=e.style.textAlign,i=[];let r=[];for(let e=0;e<t.length;e++){const s=t[e];if(n.$isBlockElementNode(s))l&&!s.getFormat()&&s.setFormat(l),i.push(s);else if(r.push(s),e===t.length-1||e<t.length-1&&n.$isBlockElementNode(t[e+1])){const e=o();e.setFormat(l),e.append(...r),i.push(e),r=[]}}return i}exports.$generateHtmlFromNodes=function(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const l=document.createElement("div"),i=n.$getRoot().getChildren();for(let n=0;n<i.length;n++){o(e,i[n],l,t)}return l.innerHTML},exports.$generateNodesFromDOM=function(e,t){const o=t.body?t.body.childNodes:[];let r=[];const s=[];for(let t=0;t<o.length;t++){const n=o[t];if(!l.has(n.nodeName)){const t=i(n,e,s,!1);null!==t&&(r=r.concat(t))}}return function(e){for(const t of e)t.getNextSibling()instanceof n.ArtificialNode__DO_NOT_USE&&t.insertAfter(n.$createLineBreakNode());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(s),r};
|
package/LexicalHtml.prod.mjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{$sliceSelectedTextNodeContent as e}from"@lexical/selection";import{isHTMLElement as n,isBlockDomNode as t}from"@lexical/utils";import{$getRoot as o,$isElementNode as l,$cloneWithProperties as r,$isTextNode as i,isDocumentFragment as
|
|
9
|
+
import{$sliceSelectedTextNodeContent as e}from"@lexical/selection";import{isHTMLElement as n,isBlockDomNode as t}from"@lexical/utils";import{$getRoot as o,$isElementNode as l,$cloneWithProperties as r,$isTextNode as i,getRegisteredNode as s,isDocumentFragment as c,$isRootOrShadowRoot as u,$isBlockElementNode as f,$createLineBreakNode as a,ArtificialNode__DO_NOT_USE as d,isInlineDomNode as p,$createParagraphNode as h}from"lexical";function m(e,n){const t=n.body?n.body.childNodes:[];let o=[];const l=[];for(let n=0;n<t.length;n++){const r=t[n];if(!y.has(r.nodeName)){const n=w(r,e,l,!1);null!==n&&(o=o.concat(n))}}return function(e){for(const n of e)n.getNextSibling()instanceof d&&n.insertAfter(a());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove()}}(l),o}function g(e,n){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),l=o().getChildren();for(let o=0;o<l.length;o++){x(e,l[o],t,n)}return t.innerHTML}function x(t,o,u,f=null){let a=null===f||o.isSelected(f);const d=l(o)&&o.excludeFromCopy("html");let p=o;if(null!==f){let n=r(o);n=i(n)&&null!==f?e(f,n):n,p=n}const h=l(p)?p.getChildren():[],m=s(t,p.getType());let g;g=m&&void 0!==m.exportDOM?m.exportDOM(t,p):p.exportDOM(t);const{element:y,after:w}=g;if(!y)return!1;const b=document.createDocumentFragment();for(let e=0;e<h.length;e++){const n=h[e],r=x(t,n,b,f);!a&&l(o)&&r&&o.extractWithChild(n,f,"html")&&(a=!0)}if(a&&!d){if((n(y)||c(y))&&y.append(b),u.append(y),w){const e=w.call(p,y);e&&(c(y)?y.replaceChildren(e):y.replaceWith(e))}}else u.append(b);return a}const y=new Set(["STYLE","SCRIPT"]);function w(e,n,o,r,i=new Map,s){let c=[];if(y.has(e.nodeName))return c;let m=null;const g=function(e,n){const{nodeName:t}=e,o=n._htmlConversions.get(t.toLowerCase());let l=null;if(void 0!==o)for(const n of o){const t=n(e);null!==t&&(null===l||(l.priority||0)<=(t.priority||0))&&(l=t)}return null!==l?l.conversion:null}(e,n),x=g?g(e):null;let C=null;if(null!==x){C=x.after;const n=x.node;if(m=Array.isArray(n)?n[n.length-1]:n,null!==m){for(const[,e]of i)if(m=e(m,s),!m)break;m&&c.push(...Array.isArray(n)?n:[m])}null!=x.forChild&&i.set(e.nodeName,x.forChild)}const S=e.childNodes;let v=[];const N=(null==m||!u(m))&&(null!=m&&f(m)||r);for(let e=0;e<S.length;e++)v.push(...w(S[e],n,o,N,new Map(i),m));return null!=C&&(v=C(v)),t(e)&&(v=b(e,v,N?()=>{const e=new d;return o.push(e),e}:h)),null==m?v.length>0?c=c.concat(v):t(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return!1;return p(e.nextSibling)&&p(e.previousSibling)}(e)&&(c=c.concat(a())):l(m)&&m.append(...v),c}function b(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e<n.length;e++){const i=n[e];if(f(i))o&&!i.getFormat()&&i.setFormat(o),l.push(i);else if(r.push(i),e===n.length-1||e<n.length-1&&f(n[e+1])){const e=t();e.setFormat(o),e.append(...r),l.push(e),r=[]}}return l}export{g as $generateHtmlFromNodes,m as $generateNodesFromDOM};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"html"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.32.2-nightly.
|
|
11
|
+
"version": "0.32.2-nightly.20250624.0",
|
|
12
12
|
"main": "LexicalHtml.js",
|
|
13
13
|
"types": "index.d.ts",
|
|
14
14
|
"repository": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"directory": "packages/lexical-html"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@lexical/selection": "0.32.2-nightly.
|
|
21
|
-
"@lexical/utils": "0.32.2-nightly.
|
|
22
|
-
"lexical": "0.32.2-nightly.
|
|
20
|
+
"@lexical/selection": "0.32.2-nightly.20250624.0",
|
|
21
|
+
"@lexical/utils": "0.32.2-nightly.20250624.0",
|
|
22
|
+
"lexical": "0.32.2-nightly.20250624.0"
|
|
23
23
|
},
|
|
24
24
|
"module": "LexicalHtml.mjs",
|
|
25
25
|
"sideEffects": false,
|