Skip to content
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

fix(core): make setEditable trigger onUpdate function #2935

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

bdbch
Copy link
Contributor

@bdbch bdbch commented Jun 27, 2022

This emits the onUpdate function when the editable state of the editor is changed via setEditable

should help with #2850

@bdbch bdbch self-assigned this Jun 27, 2022
@netlify
Copy link

netlify bot commented Jun 27, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 01843f3
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/62b96a25b3af6d000952febb
😎 Deploy Preview https://deploy-preview-2935--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@bdbch bdbch mentioned this pull request Jun 27, 2022
2 tasks
@github-actions github-actions bot added the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Aug 12, 2022
@github-actions github-actions bot closed this Aug 19, 2022
@svenadlung svenadlung reopened this Aug 19, 2022
@svenadlung svenadlung removed the Info: Stale The issue or pullrequest has not been updated in a while and might be stale label Aug 19, 2022
@bdbch bdbch merged commit de1253a into main Aug 22, 2022
@bdbch bdbch deleted the fix/set-editable-update branch August 22, 2022 12:24
@Rhys-T
Copy link
Contributor

Rhys-T commented Aug 30, 2022

I just ran into #2850, and tried to watch for the update event to detect changes to isEditable. (I hadn't yet realized that the current release didn't fire this yet.) However, since I'm trying to detect this change from each instance of a node view (to enable/disable its fields), I was trying to use editor.on('update', myCallback); rather than changing the onUpdate function in the editor's main options. Unfortunately, it looks like this change is calling the options.onUpdate function directly, and won't trigger callbacks added afterwards through .on(). If I'm reading the code correctly, the line that fires the event should be something like:

this.emit('update', { editor: this, transaction: this.state.tr })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants