question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] How can an action be called from within a nodeView?

See original GitHub issue

Description

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:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ifiokjrcommented, Jul 27, 2019

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.

@charlex this is a very good point. It would be difficult to add the same context as useRemirror but I see no reason why actions, manager, view and state can’t be added to a usePortalContext hook.

Let me quickly test it out and see if it would work.

0reactions
ifiokjrcommented, Jul 31, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found