How to pass custom metadata to decorator strategy?
See original GitHub issueLet’s say my wrapper component that renders Draft Editor has property wordsToHighlight
. Basing on that I want Draft strategy to use custom element to highlight selected words. List may change over time.
How could I access this property inside Decorator strategy function?
Is it possible to pass some metadata to contentState? (contentState is one of arguments passed to startegy function)
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
Defining Metadata with a Decorator in Angular | Pluralsight
In this guide, you will learn about different decorators and their corresponding properties to understand how Angular identifies a simple ...
Read more >Use decorator to add meta data to interface properties
Is it possible to use decorators to mark certain properties of an interface with some custom info. No. Interfaces cannot be used with...
Read more >Use change sets to deploy custom metadata types and ...
Select the Custom Metadata Type component type. · Select the custom metadata type you want to add to your outbound change set. ·...
Read more >Custom decorators | NestJS - A progressive Node.js framework
Passing data# ... Let's define a decorator that takes a property name as key, and returns the associated value if it exists (or...
Read more >Decorators - Draft.js
The decorator concept is based on scanning the contents of a given ContentBlock for ranges of text that match a defined strategy, then...
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 FreeTop 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
Top GitHub Comments
@roundrobin not yet, but here’s the code
You can use it exactly like the
CompositeDecorator
, just with he added third argument in the callback:callback(start, end, props)
.Will put this into a repo when I have time, and post it here, this is in ES6-Syntax, you might have to adapt it.
PS: I removed the “wrapping” logic I had additionally since I haven’t tested it on other usecases yet and it might conflict with whatever you’re trying to do…
@AlexandreKilian would love to take a look at your custom decorator. Do you have a repo for it?