Deploy Ladill Woo Manager / deploy (push) Successful in 1m16s
Stop stripping tags on sync so paragraphs and bold book titles round-trip to Woo. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
540 B
JavaScript
22 lines
540 B
JavaScript
export function registerWooRichText(Alpine) {
|
|
Alpine.data('wooRichText', (initial = '') => ({
|
|
html: initial,
|
|
|
|
init() {
|
|
this.$refs.editor.innerHTML = this.html || '';
|
|
this.sync();
|
|
},
|
|
|
|
sync() {
|
|
this.html = this.$refs.editor.innerHTML.trim();
|
|
this.$refs.input.value = this.html;
|
|
},
|
|
|
|
format(command) {
|
|
document.execCommand(command, false, null);
|
|
this.sync();
|
|
this.$refs.editor.focus();
|
|
},
|
|
}));
|
|
}
|