@lexical/extension 0.51.1-nightly.20260925.0 → 0.52.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/dist/LexicalExtensionGetExtensionDependencyFromEditor.prod.js +1 -1
- package/dist/LexicalExtensionGetPeerDependencyFromEditor.prod.js +1 -1
- package/dist/LexicalExtensionLexicalBuilder.dev.js +3 -3
- package/dist/LexicalExtensionLexicalBuilder.prod.js +1 -1
- package/dist/LexicalExtensionNodeSelectionDataSelectedExtension.prod.js +1 -1
- package/dist/LexicalExtensionNormalizeTripleClickSelectionExtension.dev.js +3 -0
- package/package.json +5 -5
- package/src/NormalizeTripleClickSelectionExtension.ts +3 -0
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{LexicalBuilder as e}from"@lexical/extension/LexicalBuilder";function n(n,r){const o=e.fromEditor(n).getExtensionRep(r);return void 0===o&&function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of n)o.append("v",e);
|
|
9
|
+
import{LexicalBuilder as e}from"@lexical/extension/LexicalBuilder";function n(n,r){const o=e.fromEditor(n).getExtensionRep(r);return void 0===o&&function(e,...n){throw function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of n)o.append("v",e);return r.search=o.toString(),new Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...n)}(303,r.name),o.getExtensionDependency()}export{n as getExtensionDependencyFromEditor};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{LexicalBuilder as e}from"@lexical/extension/LexicalBuilder";function n(n,r){const o=e.maybeFromEditor(n);if(!o)return;const t=o.extensionNameMap.get(r);return t?t.getExtensionDependency():void 0}function r(e,r){const o=n(e,r);return void 0===o&&function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of n)o.append("v",e);
|
|
9
|
+
import{LexicalBuilder as e}from"@lexical/extension/LexicalBuilder";function n(n,r){const o=e.maybeFromEditor(n);if(!o)return;const t=o.extensionNameMap.get(r);return t?t.getExtensionDependency():void 0}function r(e,r){const o=n(e,r);return void 0===o&&function(e,...n){throw function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of n)o.append("v",e);return r.search=o.toString(),new Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...n)}(291,r),o}export{n as getPeerDependencyFromEditor,r as getPeerDependencyFromEditorOrThrow};
|
|
@@ -33,9 +33,9 @@ function formatDevErrorMessage(message) {
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* `"0.
|
|
36
|
+
* `"0.52.0+dev.esm"` is statically replaced with the build-specific
|
|
37
37
|
* version string in a Rollup build, and a consumer's bundler `define` can
|
|
38
|
-
* inject it the same way — so the exact `"0.
|
|
38
|
+
* inject it the same way — so the exact `"0.52.0+dev.esm"` member
|
|
39
39
|
* expression must be preserved for that substitution to match. Reading it
|
|
40
40
|
* inside a try/catch lets the source be consumed directly (via the `source`
|
|
41
41
|
* export condition) in a browser bundle, where `process` is undefined and
|
|
@@ -53,7 +53,7 @@ function formatDevErrorMessage(message) {
|
|
|
53
53
|
function readLexicalVersion() {
|
|
54
54
|
let envLexicalVersion;
|
|
55
55
|
try {
|
|
56
|
-
envLexicalVersion = "0.
|
|
56
|
+
envLexicalVersion = "0.52.0+dev.esm";
|
|
57
57
|
} catch {
|
|
58
58
|
// `process` is not defined in some browser bundles; use the fallback.
|
|
59
59
|
}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{shallowMergeConfig as t,createEditor as e,mergeRegister as n}from"lexical";import{getNodeConfig as i}from"@lexical/extension/config";import{InitialStateExtension as s}from"@lexical/extension/InitialStateExtension";function o(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);
|
|
9
|
+
import{shallowMergeConfig as t,createEditor as e,mergeRegister as n}from"lexical";import{getNodeConfig as i}from"@lexical/extension/config";import{InitialStateExtension as s}from"@lexical/extension/InitialStateExtension";function o(t,...e){throw function(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);return n.search=i.toString(),new Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(t,...e)}function r(){let t;try{t="0.52.0+prod.esm"}catch{}return t??'"<unknown>+source"'}const a=/* @__PURE__ */r(),c=new Set(["__proto__","constructor","prototype"]);function d(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)!c.has(t)&&Object.prototype.hasOwnProperty.call(i,t)&&(n[t]=d(n[t],i[t]));return t}return e}function g(t){return 0===t.id}function h(t){return 2===t.id}const f=new Set;class u{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):t;for(const t of this.configs)e=n(e,t);return e}init(t){const e=this.state;h(e)||o(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=function(t,e,n){return Object.assign(t,{config:e,id:3,registerState:n})}(e,this.mergeConfigs(),n);let r;this.state=s,this.extension.init&&(r=this.extension.init(t,s.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:4,initResult:e,registerState:n})}(s,r,i)}build(t){const e=this.state;let n;4!==e.id&&o(307,String(e.id),String(5)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:5,output:e,registerState:n})}(e,n,i)}register(t,e){this._signal=e;const n=this.state;5!==n.id&&o(308,String(n.id),String(5));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:6})}(n),()=>{const t=this.state;7!==t.id&&o(309,String(n.id),String(7)),this.state=function(t){return Object.assign(t,{id:5})}(t),i&&i()}}afterRegistration(t){const e=this.state;let n;return 6!==e.id&&o(310,String(e.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:7})}(e),n}getSignal(){return void 0===this._signal&&o(311),this._signal}getInitResult(){void 0===this.extension.init&&o(312,this.extension.name);const t=this.state;return function(t){return t.id>=4}(t)||o(313,String(t.id),String(4)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=3}(t)||o(314,String(t.id),String(3)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=7}(t)||o(316,String(t.id),String(7)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||f}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(t){return t.id>=5})(t)||o(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const p=Symbol.for("@lexical/extension/LexicalBuilder");function l(...t){return b.fromExtensions(t).buildEditor()}function m(){}function x(t){throw t}function E(t){return Array.isArray(t)?t:[t]}const S=a;class b{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=S,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[E(s)];for(const n of t)e.push(E(n));return new b(e)}static maybeFromEditor(t){const e=t[p];return e&&(e.PACKAGE_VERSION!==S&&o(292,e.PACKAGE_VERSION,S),e instanceof b||o(293)),e}static fromEditor(t){const e=b.maybeFromEditor(t);return void 0===e&&o(294),e}constructEditor(){const{$initialEditorState:t,onError:n,onWarn:i,...s}=this.buildCreateEditorArgs(),o=Object.assign(e({...s,...n?{onError:t=>{n(t,o)}}:{},...i?{onWarn:t=>{i(t,o)}}:{}}),{[p]:this});for(const t of this.sortedExtensionReps())t.build(o);return o}buildEditor(){let t=m;function e(){try{t()}finally{t=m}}const i=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=n(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&o(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);if(i){const t=i.get(e);t?t.push(...n):i.set(e,n)}else this.outgoingConfigEdges.set(t,new Map([[e,n]]));const s=this.incomingEdges.get(e);s?s.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&o(296);const e=E(t),[n]=e;"string"!=typeof n.name&&o(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&o(298,n.name),!i){i=new u(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&o(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&o(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=E(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let s=n.state;if(h(s))return;const r=n.extension.name;var a;g(s)||o(300,r,i||"[unknown]"),g(a=s)||o(304,String(a.id),String(0)),s=Object.assign(a,{id:1}),n.state=s;const c=this.outgoingConfigEdges.get(r);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,r)}s=function(t){return function(t){return 1===t.id}(t)||o(305,String(t.id),String(1)),Object.assign(t,{id:2})}(s),n.state=s,t.push(n)};for(const t of this.extensionNameMap.values())g(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t)}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&o(301,t.name);for(const t of e)n.configs.add(t)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),i=new AbortController,s=[()=>i.abort()],o=i.signal;for(const n of e){const e=n.register(t,o);e&&s.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&s.push(e)}return n(...s)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,s=new Map,r={},a={},c=this.sortedExtensionReps();for(const g of c){const{extension:c}=g;if(void 0!==c.onError&&(t.onError=c.onError),void 0!==c.onWarn&&(t.onWarn=c.onWarn),void 0!==c.disableEvents&&(t.disableEvents=c.disableEvents),void 0!==c.parentEditor&&(t.parentEditor=c.parentEditor),void 0!==c.editable&&(t.editable=c.editable),void 0!==c.namespace&&(t.namespace=c.namespace),void 0!==c.$initialEditorState&&(t.$initialEditorState=c.$initialEditorState),c.nodes)for(const t of i(c)){if("function"!=typeof t){const e=n.get(t.replace);e&&o(302,c.name,t.replace.name,e.extension.name),n.set(t.replace,g)}e.add(t)}if(c.html){if(c.html.export)for(const[t,e]of c.html.export.entries())s.set(t,e);c.html.import&&Object.assign(r,c.html.import)}c.theme&&d(a,c.theme)}Object.keys(a).length>0&&(t.theme=a),e.size&&(t.nodes=Array.from(e));const g=Object.keys(r).length>0,h=s.size>0;(g||h)&&(t.html={},g&&(t.html.import=r),h&&(t.html.export=s));for(const e of c)e.init(t);return t.onError||(t.onError=x),t}}export{b as LexicalBuilder,l as buildEditorFromExtensions,p as builderSymbol};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{shallowMergeConfig as e,getRegisteredSubtypeMap as t,$getSelection as o,$isNodeSelection as n}from"lexical";import{getKnownTypesAndNodes as r}from"@lexical/extension/config";function s(e,...t){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(const e of t)n.append("v",e);
|
|
9
|
+
import{shallowMergeConfig as e,getRegisteredSubtypeMap as t,$getSelection as o,$isNodeSelection as n}from"lexical";import{getKnownTypesAndNodes as r}from"@lexical/extension/config";function s(e,...t){throw function(e,...t){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(const e of t)n.append("v",e);return o.search=n.toString(),new Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}const i={config:{attribute:"data-selected",nodes:[]},init(e,o){const n=new Set,i=t(r(e).nodes);for(const e of o.nodes){const t=e.getType(),o=i.get(t);void 0===o&&s(339,e.name,t),n.add(t);for(const e of o)n.add(e)}return{matchTypes:n}},mergeConfig:(t,o)=>e(t,{...o,...o.nodes&&{nodes:[...t.nodes,...o.nodes]}}),name:"@lexical/extension/NodeSelectionDataSelected",register(e,t,r){const{attribute:s}=t,{matchTypes:i}=r.getInitResult(),a=new Map,c=t=>{const r=new Set;t.read(()=>{const e=o();if(n(e))for(const t of e.getNodes())i.has(t.getType())&&r.add(t.getKey())});for(const[e,t]of a)r.has(e)||(t.removeAttribute(s),a.delete(e));for(const t of r){const o=e.getElementByKey(t);null!==o&&(o.setAttribute(s,"true"),a.set(t,o))}};c(e.getEditorState());const d=e.registerUpdateListener(({editorState:e})=>c(e));return()=>{d();for(const e of a.values())e.removeAttribute(s);a.clear()}}};export{i as NodeSelectionDataSelectedExtension};
|
|
@@ -54,6 +54,9 @@ function $fixFocusOverselection() {
|
|
|
54
54
|
const rootElement = editor.getRootElement();
|
|
55
55
|
const domSelection = rootElement && getDOMSelection(rootElement.ownerDocument.defaultView);
|
|
56
56
|
if (domSelection) {
|
|
57
|
+
// This native triple-click correction intentionally updates the browser
|
|
58
|
+
// range synchronously on already-mounted nodes. General selection UI
|
|
59
|
+
// must defer DOM reads until reconciliation has completed.
|
|
57
60
|
$updateDOMSelection($getPreviousSelection(), sel, $getEditor(), domSelection, SKIP_TAGS, rootElement);
|
|
58
61
|
}
|
|
59
62
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"extension",
|
|
7
7
|
"plugin"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.52.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"description": "This package provides the extension functionality for Lexical.",
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lexical/internal": "0.
|
|
25
|
-
"@lexical/utils": "0.
|
|
26
|
-
"@preact/signals-core": "^1.14.
|
|
27
|
-
"lexical": "0.
|
|
24
|
+
"@lexical/internal": "0.52.0",
|
|
25
|
+
"@lexical/utils": "0.52.0",
|
|
26
|
+
"@preact/signals-core": "^1.14.4",
|
|
27
|
+
"lexical": "0.52.0"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
"./AutoFocusExtension": {
|
|
@@ -122,6 +122,9 @@ function $fixFocusOverselection() {
|
|
|
122
122
|
const domSelection =
|
|
123
123
|
rootElement && getDOMSelection(rootElement.ownerDocument.defaultView);
|
|
124
124
|
if (domSelection) {
|
|
125
|
+
// This native triple-click correction intentionally updates the browser
|
|
126
|
+
// range synchronously on already-mounted nodes. General selection UI
|
|
127
|
+
// must defer DOM reads until reconciliation has completed.
|
|
125
128
|
$updateDOMSelection(
|
|
126
129
|
$getPreviousSelection(),
|
|
127
130
|
sel,
|