From 2b472f65cb54534f8fcef9d1314b1369353cd92c Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 15 Mar 2017 12:38:35 +0100 Subject: [PATCH] Modify TinyMCE editor setup for mobile (#10) --- skins/elastic/ui.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index b4d953ad4..56d7cee20 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -206,6 +206,7 @@ function rcube_elastic_ui() .addEventListener('message', message_displayed) .addEventListener('menu-open', menu_toggle) .addEventListener('menu-close', menu_toggle) + .addEventListener('editor-init', tinymce_init) .addEventListener('init', init); }; @@ -295,6 +296,25 @@ function rcube_elastic_ui() .addEventListener('afterlistsearch', list_handler); }; + /** + * Handler for editor-init event + */ + function tinymce_init(o) + { + // FIXME: only for mobile? + if (mode == 'phone') { + // Enable autoresize plugin + // TODO: autoresize for plain text editor area + o.config.plugins += ' autoresize'; + + // Make the toolbar icons bigger + o.config.toolbar_items_size = null; + + // Use minimalistic toolbar + o.config.toolbar = 'undo redo | insert | styleselect'; + } + }; + /** * Window resize handler * Does layout reflows e.g. on screen orientation change