@@ -10,7 +10,6 @@ import {
1010 COMMAND_PRIORITY_EDITOR ,
1111 LexicalEditor ,
1212 LexicalNode ,
13- createCommand ,
1413} from 'lexical' ;
1514
1615import { $closest } from '@/editor-kernel' ;
@@ -19,6 +18,12 @@ import { createDebugLogger } from '@/utils/debug';
1918import type LitexmlDataSource from '../data-source/litexml-data-source' ;
2019import { $createDiffNode , DiffNode } from '../node/DiffNode' ;
2120import { $cloneNode , $parseSerializedNodeImpl , charToId } from '../utils' ;
21+ import {
22+ LITEXML_APPLY_COMMAND ,
23+ LITEXML_INSERT_COMMAND ,
24+ LITEXML_MODIFY_COMMAND ,
25+ LITEXML_REMOVE_COMMAND ,
26+ } from './symbols' ;
2227
2328const logger = createDebugLogger ( 'plugin' , 'litexml' ) ;
2429
@@ -138,48 +143,6 @@ function wrapBlockModify(oldBlock: LexicalNode, editor: LexicalEditor, changeFn:
138143 newBlock . replace ( diffNode , false ) ;
139144}
140145
141- export const LITEXML_MODIFY_COMMAND = createCommand <
142- Array <
143- | {
144- action : 'insert' ;
145- beforeId : string ;
146- litexml : string ;
147- }
148- | {
149- action : 'insert' ;
150- afterId : string ;
151- litexml : string ;
152- }
153- | {
154- action : 'remove' ;
155- id : string ;
156- }
157- | {
158- action : 'modify' ;
159- litexml : string | string [ ] ;
160- }
161- >
162- > ( 'LITEXML_MODIFY_COMMAND' ) ;
163-
164- export const LITEXML_APPLY_COMMAND = createCommand < { delay ?: boolean ; litexml : string | string [ ] } > (
165- 'LITEXML_APPLY_COMMAND' ,
166- ) ;
167- export const LITEXML_REMOVE_COMMAND = createCommand < { delay ?: boolean ; id : string } > (
168- 'LITEXML_REMOVE_COMMAND' ,
169- ) ;
170- export const LITEXML_INSERT_COMMAND = createCommand <
171- | {
172- beforeId : string ;
173- delay ?: boolean ;
174- litexml : string ;
175- }
176- | {
177- afterId : string ;
178- delay ?: boolean ;
179- litexml : string ;
180- }
181- > ( 'LITEXML_INSERT_COMMAND' ) ;
182-
183146export function registerLiteXMLCommand ( editor : LexicalEditor , dataSource : LitexmlDataSource ) {
184147 return mergeRegister (
185148 editor . registerCommand (
@@ -570,3 +533,12 @@ function handleInsert(
570533 }
571534 } ) ;
572535}
536+
537+ // Command identities live in the side-effect-free `./symbols` module so they
538+ // keep a single runtime identity across the package's browser/node bundles.
539+ export {
540+ LITEXML_APPLY_COMMAND ,
541+ LITEXML_INSERT_COMMAND ,
542+ LITEXML_MODIFY_COMMAND ,
543+ LITEXML_REMOVE_COMMAND ,
544+ } from './symbols' ;
0 commit comments