File tree Expand file tree Collapse file tree
packages/super-editor/src/core/super-converter/v2/importer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,10 +6,28 @@ import { parseProperties } from './importerHelpers.js';
66 */
77export const handleTrackChangeNode = ( params ) => {
88 const { nodes, nodeListHandler } = params ;
9- if ( nodes . length === 0 || ! ( nodes [ 0 ] . name === 'w:del' || nodes [ 0 ] . name === 'w:ins' ) ) {
9+ if (
10+ nodes . length === 0 ||
11+ ! ( nodes [ 0 ] . name === 'w:del' || nodes [ 0 ] . name === 'w:ins' || nodes [ 0 ] . name === 'w:sdt' )
12+ ) {
1013 return { nodes : [ ] , consumed : 0 } ;
1114 }
12- const node = nodes [ 0 ] ;
15+
16+ const mainNode = nodes [ 0 ] ;
17+ let node ;
18+
19+ if ( [ 'w:ins' , 'w:del' ] . includes ( mainNode . name ) ) {
20+ node = mainNode ;
21+ } else {
22+ const sdtContent = mainNode . elements . find ( ( el ) => el . name === 'w:sdtContent' ) ;
23+ const trackedChange = sdtContent ?. elements . find ( ( el ) => [ 'w:ins' , 'w:del' ] . includes ( el . name ) ) ;
24+ if ( trackedChange ) node = trackedChange ;
25+ }
26+
27+ if ( ! node ) {
28+ return { nodes : [ ] , consumed : 0 } ;
29+ }
30+
1331 const { name } = node ;
1432 const { attributes, elements } = parseProperties ( node ) ;
1533
You can’t perform that action at this time.
0 commit comments