Rich Text Editor is a complex widget created with Webix Jet, the MV* framework for Webix Library. It is a ready-to-use application with minimum configuration settings but has API for redefining the logic of inner modules.
You will need to study the source code to customize views and models.
Rich Text Editor is built as a Jet App and wrapped into a Webix view, so you can initialize Rich Text Editor in either of the ways.
The interface of Rich Text Editor is split into parts (views). Each view is a class that extends the JetView class and has own handlers for setting the configuration and logic.
The sources for interface parts (Jet Views) are located in the sources/views folder.
views
topbar
index.js
menubar.js
toolbar.js
editor.js
...
Go to the Class Map page to see the list of all Jet views in Rich Text Editor and where they are in the interface.
Rich Text Editor models contain the logic for working with text, uploading of images, import and export of files, They are defined as Jet Services.
The sources for models (Jet Services) are located in the sources/models folder.
models
Backend.js
Operations.js
Upload.js
Service methods are called by the UI and can be called by a programmer as:
$$("editor").getService("backend").import();
class Menu extends editor.views["topbar/menubar"] {
config(){
const menu = super.config();
menu.rows.unshift({
template: "Custom header",
type: "header"
})
return menu;
}
}
webix.ui({
view: "editor",
menubar: true,
override: new Map([
[editor.views["topbar/menubar"], Menu]
])
});
Related sample: Rich Text Editor: View Customization
Firstly, create your own service class and inherit it from one of the default services:
class Backend extends editor.services.Backend {
// initiates file dialog for importing a file
import() {
webix.confirm({
title: "Open file dialog?",
text: "Press OK for selecting a .docx file"
}).then(() => {
this.uploader.fileDialog();
})
}
}
Secondly, replace the default service via the override map:
webix.ui({
view: "editor",
upload: "https://docs.webix.com/richtext-backend/images",
override: new Map([
[editor.services.Backend, Backend]
])
});
Related sample: Rich Text Editor: Backend Customization
Rich Text Editor is extremely flexible when it comes to customizations: you can change almost anything in it. However, keep in mind the following:
Code for Edge Сhromium must be with different syntax.