mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-03 14:54:01 +01:00
This adds a markdown editor that sends HTML to the server. It uses codemirror and some custom code to show a syntax highlighted textarea and some buttons to help editing (including a preview). Drafts get marked via an internal email header that causes the markdown editor to automatically start if a message composition is continued that was started using the markdown editor.
25 lines
764 B
JavaScript
25 lines
764 B
JavaScript
export default class ToolbarPlugin {
|
|
destroy() {
|
|
this.element.remove();
|
|
}
|
|
|
|
constructor(view, buttons) {
|
|
this.view = view;
|
|
buttons.forEach((button) => {
|
|
if (typeof button.command === 'function') {
|
|
button.addEventListener('click', (ev) => {
|
|
ev.preventDefault();
|
|
if (!button.disabled) {
|
|
button.command(this.view);
|
|
}
|
|
});
|
|
button.classList.add('clickable');
|
|
}
|
|
});
|
|
this.element = document.createElement('div');
|
|
this.element.classList.add('codemirror-toolbar');
|
|
this.element.append(...buttons);
|
|
this.view.dom.prepend(this.element);
|
|
}
|
|
}
|