a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add undo for adding inline link via pasting

+17 -2
+17 -2
components/Blocks/TextBlock/useHandlePaste.ts
··· 40 40 let tr = view.state.tr; 41 41 let { from, to } = selection; 42 42 tr.addMark(from, to, schema.marks.link.create({ href: text })); 43 - 43 + let oldState = view.state; 44 + let newState = view.state.apply(tr); 45 + undoManager.add({ 46 + undo: () => { 47 + if (!view?.hasFocus()) view?.focus(); 48 + setEditorState(entityID, { 49 + editor: oldState, 50 + }); 51 + }, 52 + redo: () => { 53 + if (!view?.hasFocus()) view?.focus(); 54 + setEditorState(entityID, { 55 + editor: newState, 56 + }); 57 + }, 58 + }); 44 59 setEditorState(entityID, { 45 - editor: view.state.apply(tr), 60 + editor: newState, 46 61 }); 47 62 return true; 48 63 }