-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
force state to trigger update. #14182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What if you first assign it to |
it will only work for 1 time and then nothing. onTransaction is called every time something is changed on editor (click somewhere, select something, write/delete something...) so it needs to update everything that comes from editor. so class:active={editor.isActive("bold")} check will run every time something changes. |
Maybe $state.raw + spread works for you |
tried spread but editor is class instance and spreading removes methods. for normal objects yes spreading causes update. But overall i don't know how good is spreading as it introduces cloning overhead? |
I didn't mean to spread the class directly, use a box object |
yes it works but almost same as my current approach, I am returning underlying editor calling a function which is changed, in this case its object that has editor inside. So almost same. also i believe that raw in this case does not do anything since class is not deeply reactive at least for now. |
What I meant was doing something like this. |
Oh yes this is best so far. thanks. actually trigger can work like this but it should not trigger if value is null as it cycles? |
Not sure what you mean, but the value never becomes |
Issue sounds like a duplicate of this to me: |
oh yes this is totally right thank you again. |
Describe the problem
For example usign Tip-Tap editor
`<script>
import { onMount, onDestroy } from 'svelte';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
</script>`
editor = editor;
this no longer does anything.
if anyone is in the same boat my current approach is
Describe the proposed solution
trigger(editor)
so it calls update on everywhere where it is used. on DOM, $derived,$effect and so on.
Importance
nice to have
The text was updated successfully, but these errors were encountered: