Composing decorators
See original GitHub issueHey there. big fan š
Iām writing a small that implements a markup language that resembles to Markdown using decorators:
*text*
=><Em>{ text }</Em>
~text~
=><Strike>{ text }</Em>
It was all fine and worked great, until I tried to compose them one inside of the other:
I canāt really declare if its a bug or a feature, but it leads me to my question:
Is there a way of making decorators components composable? Or - is there another way of solving this problem?
Decorators keep the code declarative and awesome, the only real struggle will be to handle char arrays or to get children
instead of text
⦠but I donāt really care in my specific use case.
Thank you!
Technical stuff:
- Chrome Canary 54.0.2791.0 on OS X El Capitan
- Draft.js 0.7.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
How to compose multiple TypeScript class decorators?
I have a family of class decorators that I repeat over many classes. Something similar to this: @foo @bar @baz export class MyClass...
Read more >Decorators Composition in TypeScript | by Ujjwal Ojha | Medium
Decorators are an experimental feature of TypeScript that can be attached to a class declaration, method, accessor, property, or parameterĀ ...
Read more >Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >Decorators Composition in TypeScript - DEV Community ā ā
Decorators are an experimental feature of TypeScript that can be attached to a class declaration, method, accessor, property, or parameterĀ ...
Read more >Decorator - Refactoring.Guru
Decorator is a structural design pattern that lets you attach new ... The client code must be responsible for creating decorators and composing...
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
This technique I recently devised may be of some help: https://jsfiddle.net/paulyoung85/2unzgt68/
Solved by making a small modification to the
getDecorations
method, to passcontentState
through. Hereās my fullCompoundDecorator
now: