mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-12 13:33:46 +08:00
7c692ec588
- Ensures padding works across FF & Chrome, was only working on FF before. - Fixes sketchy editor positioning focus on FF, since tinyMCE would add a hidden element to the bottom of the body which would remove/add our body padding causing unstable positioning.
34 lines
884 B
JavaScript
34 lines
884 B
JavaScript
/**
|
|
* @param {Editor} editor
|
|
*/
|
|
export function listen(editor) {
|
|
|
|
// Replace editor content
|
|
window.$events.listen('editor::replace', ({html}) => {
|
|
editor.setContent(html);
|
|
});
|
|
|
|
// Append editor content
|
|
window.$events.listen('editor::append', ({html}) => {
|
|
const content = editor.getContent() + html;
|
|
editor.setContent(content);
|
|
});
|
|
|
|
// Prepend editor content
|
|
window.$events.listen('editor::prepend', ({html}) => {
|
|
const content = html + editor.getContent();
|
|
editor.setContent(content);
|
|
});
|
|
|
|
// Insert editor content at the current location
|
|
window.$events.listen('editor::insert', ({html}) => {
|
|
editor.insertContent(html);
|
|
});
|
|
|
|
// Focus on the editor
|
|
window.$events.listen('editor::focus', () => {
|
|
if (editor.initialized) {
|
|
editor.focus();
|
|
}
|
|
});
|
|
} |