Decorators are designed to make it easier to work with UI components. Adding event handlers, state changes, and component status.
import { component, watch, hook } from 'jodit/core/decorators';import { UIElement } from 'jodit/ui';@componentclass UISomeReactElement extends UIElement { state = { color: 'red', counter: 1 }; render(): string { return `<div> This text must be colored <span class="&__counter"></span> </div>`; } @hook('ready') @watch('state.color') onChangeColor(): void { this.container.style.color = this.state.color; } @hook('ready') @watch('state.counter') onChangeColor(): void { this.getElm('counter').innerText = this.state.counter.toString(); }}const elm = new UISomeReactElement(jodit);elm.state.color = 'yellow';elm.state.counter = 55; Copy
import { component, watch, hook } from 'jodit/core/decorators';import { UIElement } from 'jodit/ui';@componentclass UISomeReactElement extends UIElement { state = { color: 'red', counter: 1 }; render(): string { return `<div> This text must be colored <span class="&__counter"></span> </div>`; } @hook('ready') @watch('state.color') onChangeColor(): void { this.container.style.color = this.state.color; } @hook('ready') @watch('state.counter') onChangeColor(): void { this.getElm('counter').innerText = this.state.counter.toString(); }}const elm = new UISomeReactElement(jodit);elm.state.color = 'yellow';elm.state.counter = 55;
If you like Jodit - try Jodit PRO
Jodit component UI decorators
Decorators are designed to make it easier to work with UI components. Adding event handlers, state changes, and component status.