trix: Custom color-tool formatting is lost after load
when I create a custom text-color button:
Trix.config.textAttributes.red = {
style: { color: "red" },
parser: function(element) {
return element.style.color === "red"
},
inheritable: true
};
addEventListener("trix-initialize", function(event) {
var buttonHTML = '<button type="button" data-trix-attribute="red">RED</button>';
event.target.toolbarElement.
querySelector(".trix-button-group.trix-button-group--text-tools").
insertAdjacentHTML("beforeend", buttonHTML)
});
everything works fine, but when I try to load this text again, it loads only plain text into editor, without formatting <span>s with “red” color.
What I should please do?
- Trix version: 1.1.1
- Browser name and version: Chrome
- Operating system: Windows
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (4 by maintainers)
The likely problem here is the order in which the scripts are loaded.
These 2 scripts before the
<trix-editor input="trix-input"></trix-editor>This does not work