This content has been automatically translated from Ukrainian.
Trix - Rich Text Editor is created by the Basecamp team (developers of Ruby on Rails). Not a bad editor if you don't have to do any specific things. There is currently no good API for configuring options.
Many discussions on GitHub only say that Trix must be customized +/- independently using manipulations in JS and CSS code.
To disable the function of downloading files in the editor, they offer:
1. With JS, ignore trix-file-accept
document.addEventListener("trix-file-accept", function(event) {
event.preventDefault();
});
2. Using CSS to hide the button:
.trix-button-group.trix-button-group--file-tools {
display: none;
}
Or do everything in JS (ignore trix-file-accept and delete button)
(function() {
addEventListener("trix-initialize", function(e) {
const file_tools = document.querySelector(".trix-button-group--file-tools");
file_tools.remove();
})
addEventListener("trix-file-accept", function(e) {
e.preventDefault();
})
})();
In general, the concept is clear. You have to do everything yourself. Don't forget to encapsulate the code. Because this code will work for all instances of the Trix editor on the page
This post doesn't have any additions from the author yet.