From 5a7a76cf0bf31046351a0957de36ac00ad4e17e6 Mon Sep 17 00:00:00 2001 From: josdejong Date: Tue, 27 Aug 2013 22:50:20 +0200 Subject: [PATCH] Implemented option modes --- HISTORY.md | 6 ++ Jakefile.js | 2 + app/web/test.html | 1 + docs/api.md | 3 + examples/01_basic_usage.html | 18 ++-- examples/02_viewer.html | 20 +++-- examples/03_switch_mode.html | 39 ++++----- examples/requirejs_demo/scripts/main.js | 20 ++--- jsoneditor-min.css | 2 +- jsoneditor-min.js | 9 +- jsoneditor.css | 29 ++++++- jsoneditor.js | 107 +++++++++++++++++++++--- jsoneditor/css/contextmenu.css | 9 +- jsoneditor/css/menu.css | 20 ++++- jsoneditor/js/modebox.js | 79 +++++++++++++++++ jsoneditor/js/texteditor.js | 10 ++- jsoneditor/js/treeeditor.js | 13 +-- 17 files changed, 305 insertions(+), 82 deletions(-) create mode 100644 jsoneditor/js/modebox.js diff --git a/HISTORY.md b/HISTORY.md index 2db2cc8..ed31460 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ http://jsoneditoronline.org +## not yet released, version 2.3.0 + +- Implemented an option `modes`, which creates a menu in the editor + where the user can switch between the selected editor modes. + + ## 2013-08-01, version 2.2.2 - Fixed non working option `indentation`. diff --git a/Jakefile.js b/Jakefile.js index 0b701f2..e10355f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -48,6 +48,7 @@ task('build', ['clear'], function () { jsoneditorSrc + 'js/appendnode.js', jsoneditorSrc + 'js/contextmenu.js', jsoneditorSrc + 'js/history.js', + jsoneditorSrc + 'js/modebox.js', jsoneditorSrc + 'js/searchbox.js', jsoneditorSrc + 'js/highlighter.js', jsoneditorSrc + 'js/util.js', @@ -228,6 +229,7 @@ task('webapp', ['build', 'minify'], function () { jake.cpR(webAppSrc + 'robots.txt', webApp); jake.cpR(webAppSrc + 'datapolicy.txt', webApp); jake.cpR(webAppSrc + 'index.html', webApp); + jake.cpR(webAppSrc + 'chrome_app_counter.html', webApp); jake.cpR(webAppSrc + 'favicon.ico', webApp); jake.cpR(webAppSrc + 'fileretriever.php', webApp); jake.cpR(webAppSrc + 'googlea47c4a0b36d11021.html', webApp); diff --git a/app/web/test.html b/app/web/test.html index 3e380d7..9b211a7 100644 --- a/app/web/test.html +++ b/app/web/test.html @@ -64,6 +64,7 @@ + diff --git a/docs/api.md b/docs/api.md index e94e26a..b7841ce 100644 --- a/docs/api.md +++ b/docs/api.md @@ -32,6 +32,9 @@ Constructs a new JSONEditor. In 'form' mode, only the value can be changed, the datastructure is read-only. Mode 'code' requires the Ace editor to be loaded on the page. Mode 'text' shows the data as plain text. + - `{String[]} modes`. + Create a box in the editor menu where the user can switch between the specified + modes. Available values: see option `mode`. - `{String} name`. Initial field name for the root node, is undefined by default. Can also be set using `JSONEditor.setName(name)`. diff --git a/examples/01_basic_usage.html b/examples/01_basic_usage.html index d5ab4a5..eaca320 100644 --- a/examples/01_basic_usage.html +++ b/examples/01_basic_usage.html @@ -19,24 +19,24 @@ diff --git a/examples/03_switch_mode.html b/examples/03_switch_mode.html index 9d4e3e0..9dde5fc 100644 --- a/examples/03_switch_mode.html +++ b/examples/03_switch_mode.html @@ -17,12 +17,17 @@