Skip to content

Commit

Permalink
Merge pull request #8 from twig1337/main
Browse files Browse the repository at this point in the history
Do not dispatch value change even on selection only changes.
  • Loading branch information
nathanfaucett committed Mar 24, 2023
2 parents 0e33bb1 + 1328c1a commit fdcc9c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/components/Slate.svelte
Expand Up @@ -141,7 +141,13 @@
function onChange() {
selection = editor.selection;
value = editor.children;
dispatch('value', value);
const isValueChange = editor.operations.some(op => 'set_selection' !== op.type);
if (isValueChange) {
dispatch('value', value);
}
dispatch('selection', selection);
}
EDITOR_TO_ON_CHANGE.set(editor, onChange);
Expand Down

0 comments on commit fdcc9c2

Please sign in to comment.