File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22
3- import type { Node } from 'prosemirror-model' ;
3+ import type { Mark , Node } from 'prosemirror-model' ;
44import type { EditorView , NodeView , NodeViewConstructor } from 'prosemirror-view' ;
55import { createPortal } from 'react-dom' ;
66
@@ -17,7 +17,7 @@ export const ReactNodeStopEventCn = 'prosemirror-stop-event';
1717export type ReactNodeViewProps < T extends object = { } > = {
1818 dom : HTMLElement ;
1919 view : EditorView ;
20- updateAttributes : ( attrs : object ) => void ;
20+ updateAttributes : ( attrs : object , marks ?: Mark [ ] ) => void ;
2121 node : Node ;
2222 getPos : ( ) => number | undefined ;
2323 serializer : Serializer ;
@@ -94,15 +94,20 @@ export class ReactNodeView<T extends object = {}> implements NodeView {
9494 return true ;
9595 }
9696
97- updateAttributes ( attributes : { } ) {
97+ updateAttributes ( attributes : { } , marks : Mark [ ] = [ ] ) {
9898 const pos = this . getPos ( ) ;
9999 if ( pos === undefined ) return ;
100100
101101 const { tr} = this . view . state ;
102- tr . setNodeMarkup ( pos , undefined , {
103- ...this . node . attrs ,
104- ...attributes ,
105- } ) ;
102+ tr . setNodeMarkup (
103+ pos ,
104+ undefined ,
105+ {
106+ ...this . node . attrs ,
107+ ...attributes ,
108+ } ,
109+ marks ,
110+ ) ;
106111 this . view . dispatch ( tr ) ;
107112 }
108113
You can’t perform that action at this time.
0 commit comments