From efbd0efc530d15f7990d3a82e93854aa21bb979f Mon Sep 17 00:00:00 2001 From: Arkadiy Zamaraev Date: Fri, 19 Aug 2016 17:26:31 +0500 Subject: [PATCH] add menu --- README.rst | 1 + tinymce_4/static/tinymce_4/settings/full.js | 9 +++++--- .../static/tinymce_4/settings/full/menu.js | 22 ++++++++++++++++++ .../tinymce_4/settings/full/settings.js | 23 ------------------- tinymce_4/widgets.py | 3 ++- 5 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 tinymce_4/static/tinymce_4/settings/full/menu.js diff --git a/README.rst b/README.rst index 93f211d..d172a59 100644 --- a/README.rst +++ b/README.rst @@ -47,6 +47,7 @@ Custom Settings =============== * `Base Settings`_: /tinymce_4/static/tinymce_4/settings/full/setings.js +* Menu: /tinymce_4/static/tinymce_4/settings/full/menu.js * Plugins: /tinymce_4/static/tinymce_4/settings/full/plugins.js * `External plugin`_: /tinymce_4/static/tinymce_4/settings/full/external_plugins.js * `Templates`_: /tinymce_4/static/tinymce_4/settings/full/templates.js diff --git a/tinymce_4/static/tinymce_4/settings/full.js b/tinymce_4/static/tinymce_4/settings/full.js index 509838f..15821c8 100644 --- a/tinymce_4/static/tinymce_4/settings/full.js +++ b/tinymce_4/static/tinymce_4/settings/full.js @@ -5,15 +5,18 @@ if ($ === undefined) $ = django.jQuery; if (typeof tinySettings === 'object') { + if (typeof menu === 'object') { + tinySettings.menu = menu; + } + if (typeof plugins === 'object') { + tinySettings.plugins = plugins; + } if (typeof externalPlugins === 'object') { tinySettings.external_plugins = externalPlugins; } if (typeof templates === 'object') { tinySettings.templates = templates; } - if (typeof plugins === 'object') { - tinySettings.plugins = plugins; - } tinymce.init(tinySettings); } else { console.warn('tinySettings is not exists'); diff --git a/tinymce_4/static/tinymce_4/settings/full/menu.js b/tinymce_4/static/tinymce_4/settings/full/menu.js new file mode 100644 index 0000000..b5dcbb1 --- /dev/null +++ b/tinymce_4/static/tinymce_4/settings/full/menu.js @@ -0,0 +1,22 @@ +var menu = { + edit: { + title : 'Edit', + items : 'undo redo | cut copy paste pastetext | selectall' + }, + insert : { + title : 'Insert', + items : 'link image media | template' + }, + view: { + title : 'View' , + items : 'visualaid, visualblocks' + }, + format: { + title : 'Format', + items : 'bold italic underline strikethrough superscript subscript | formats | removeformat' + }, + table: { + title : 'Table' , + items : 'inserttable tableprops deletetable | cell row column' + } +} diff --git a/tinymce_4/static/tinymce_4/settings/full/settings.js b/tinymce_4/static/tinymce_4/settings/full/settings.js index 7a9c533..5113a06 100644 --- a/tinymce_4/static/tinymce_4/settings/full/settings.js +++ b/tinymce_4/static/tinymce_4/settings/full/settings.js @@ -14,29 +14,6 @@ var tinySettings = { plugin_preview_width : '730', plugin_preview_height : '550', - menu : { - edit: { - title : 'Edit', - items : 'undo redo | cut copy paste pastetext | selectall' - }, - insert : { - title : 'Insert', - items : 'link image media | template' - }, - view: { - title : 'View' , - items : 'visualaid, visualblocks' - }, - format: { - title : 'Format', - items : 'bold italic underline strikethrough superscript subscript | formats | removeformat' - }, - table: { - title : 'Table' , - items : 'inserttable tableprops deletetable | cell row column' - }, - }, - toolbar1: 'example, insertfile undo redo | styleselect removeformat | link image media template anchor | code | preview | image_alignment', toolbar2: 'fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor', diff --git a/tinymce_4/widgets.py b/tinymce_4/widgets.py index 3270e49..49f3937 100644 --- a/tinymce_4/widgets.py +++ b/tinymce_4/widgets.py @@ -38,8 +38,9 @@ class Media: js = [ 'tinymce_4/settings/full/settings.js', 'tinymce_4/settings/full/external_plugins.js', - 'tinymce_4/settings/full/templates.js', + 'tinymce_4/settings/full/menu.js', 'tinymce_4/settings/full/plugins.js', + 'tinymce_4/settings/full/templates.js', 'tinymce_4/settings/full.js', ]