[question] How can an action be called from within a nodeView?
See original GitHub issueDescription
I’ve successfully set up a react nodeView (see https://github.com/ifiokjr/remirror/issues/129), but I cannot figure out how to call an action from within the nodeView.
The problem I’m having is that the Remirror context is not found (useRemirror
throws an error), so I cannot get the actions from the context.
Checklist
- I have read the [contributing][contributing] document.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
On node view page show a link or button that executes an action ...
I am familiar with creating VBO Actions, but not sure how to create it for a node operation. Such as a link or...
Read more >Enter within node views breaks node on iOS · Issue #1162
Issue details When pressing enter within a simple node view with contentDOM, iOS duplicates nodes. This only happens if I add a class...
Read more >RFC: 'Node views' to manage the representation of nodes
When a node view is created, it is passed an action-sending function that it can use to find out its current position in...
Read more >jstree toggle actions for each level - Stack Overflow
However, I can't figure out how to apply them to my problem. My tree has five levels. When I toggle a node on...
Read more >Using Unity's Graph View. Adding and Deleting Nodes
Next I need a Behavior Tree Node that I can use in the Node View. ... For the Name I will Use the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@charlex this is a very good point. It would be difficult to add the same context as
useRemirror
but I see no reason whyactions
,manager
,view
andstate
can’t be added to ausePortalContext
hook.Let me quickly test it out and see if it would work.
@charlex it turns out that
useRemirrorManager
will currently not work since the Portals were broken. I’ve fixed them in the branch I’m working on and once I’ve untangled the code I’ll submit a PR.For the curious:
The issue is to do with the following line.
https://github.com/ifiokjr/remirror/blob/c2fe2de0b5cfc51963f3a27c6e454a3a8f33210a/%40remirror/react/src/components/node-view-portal.tsx#L31
Changing
renderFunction()
to<renderFunction />
allows for hooks and context to be used from within the component.