Skip to content

Commit f4fcef7

Browse files
authored
Merge pull request #99 from inokawa/remove-serialize-on-command
Remove unnecessary serialization on command
2 parents db37e5b + 1d14304 commit f4fcef7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/core/editable.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,13 @@ export const editable = <T>(
300300
const flushCommand = () => {
301301
if (commands.length) {
302302
const selection: Writeable<SelectionSnapshot> = [...currentSelection];
303-
const dom: Writeable<DocFragment> = takeDomSnapshot(
304-
document,
305-
element,
306-
parserConfig,
307-
serializeVoid
308-
) as Writeable<DocFragment>; // TODO improve type
303+
const doc: Writeable<DocFragment> = [...history.get()[0]];
309304

310305
let command: (typeof commands)[number] | undefined;
311306
while ((command = commands.pop())) {
312-
command[0](dom, selection, ...command[1]);
307+
command[0](doc, selection, ...command[1]);
313308
}
314-
updateState(dom, selection, currentSelection);
309+
updateState(doc, selection, currentSelection);
315310
}
316311
};
317312

0 commit comments

Comments
 (0)