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.

useDecorate return default method,not the override in custom in some case

See original GitHub issue

Description user can add decorate method on Editable,and it’s not work with editor’s children because it will use default.

Recording you can add console.log in use-decorate.ts like this: export const DecorateContext = createContext<(entry: NodeEntry) => Range[]>( () => { console.log("editor's children call.") return [] } )

Sandbox no Steps no Expectation no Environment

  • Slate Version: [e.g. 0.63]

Context not need

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jakedcommented, Jul 26, 2021

Another possible fix would be to change useChildren so it wraps each child in a Child component, and call useDecorate etc. inside this component. This would still achieve the goal of https://github.com/ianstormtaylor/slate/issues/3966 since a separate component would be returned for each child; but useDecorate would be called at the right time.

As far as re-rendering goes, it seem like this approach would be the same as the original Children component.

0reactions
jakedcommented, Jul 25, 2021

Thanks for the explanations!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can We Override Default Method in Java? - GeeksforGeeks
So at that time, one must override either one both the default method otherwise it will result in an error. Case 1: When...
Read more >
java - Protect "default" methods from overriding - Stack Overflow
You seem to want a way to write your interface so that implementing classes cannot provide their own implementations of its default methods....
Read more >
RRWM reloading system [1.3.0a] [ZS/DEC/SBARINFO] - ZDoom
For advanced coders, ReloadableWeapon provides several virtual methods that can be overridden in derived classes. Code: Select all protected ...
Read more >
Idea: allow traits to define un-overridable default methods
The Iterator trait has a bunch of useful default methods. Implementors of the trait can choose to override these default methods to the...
Read more >
Extending AngularJS services with the Decorate method - Xebia
“A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned...
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