diff --git a/examples/03_switch_mode.html b/examples/03_switch_mode.html index f080ae2..26218a9 100644 --- a/examples/03_switch_mode.html +++ b/examples/03_switch_mode.html @@ -42,7 +42,7 @@ var options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/examples/15_selection_api.html b/examples/15_selection_api.html index 7516ca8..3785789 100644 --- a/examples/15_selection_api.html +++ b/examples/15_selection_api.html @@ -64,7 +64,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/examples/17_on_event_api.html b/examples/17_on_event_api.html index 64cf89c..59fd65b 100644 --- a/examples/17_on_event_api.html +++ b/examples/17_on_event_api.html @@ -43,7 +43,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes name: "jsonContent", onError: function (err) { alert(err.toString()); diff --git a/src/js/ModeSwitcher.js b/src/js/ModeSwitcher.js index da1a71c..d749daa 100644 --- a/src/js/ModeSwitcher.js +++ b/src/js/ModeSwitcher.js @@ -6,8 +6,8 @@ var translate = require('./i18n').translate; /** * Create a select box to be used in the editor menu's, which allows to switch mode * @param {HTMLElement} container - * @param {String[]} modes Available modes: 'code', 'form', 'text', 'tree', 'view' - * @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view' + * @param {String[]} modes Available modes: 'code', 'form', 'text', 'tree', 'view', 'preview' + * @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view', 'preview' * @param {function(mode: string)} onSwitch Callback invoked on switch * @constructor */ diff --git a/src/js/previewmode.js b/src/js/previewmode.js index d245287..6c8b781 100644 --- a/src/js/previewmode.js +++ b/src/js/previewmode.js @@ -427,6 +427,9 @@ previewmode.set = function(json) { this.json = json; this.renderPreview(); + + // validate JSON schema + this._debouncedValidate(); }; /** diff --git a/test/test_build.html b/test/test_build.html index 1f5bcd0..95e468f 100644 --- a/test/test_build.html +++ b/test/test_build.html @@ -44,7 +44,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/test/test_build_min.html b/test/test_build_min.html index d281aa6..b27d526 100644 --- a/test/test_build_min.html +++ b/test/test_build_min.html @@ -41,7 +41,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); } diff --git a/test/test_code_mode.html b/test/test_code_mode.html index c849fdb..25fc12d 100644 --- a/test/test_code_mode.html +++ b/test/test_code_mode.html @@ -44,7 +44,7 @@ options = { mode: 'code', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/test/test_destroy.html b/test/test_destroy.html index a6bb2e9..7602acf 100644 --- a/test/test_destroy.html +++ b/test/test_destroy.html @@ -48,7 +48,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/test/test_large_array.html b/test/test_large_array.html index 3219a77..1deaa4b 100644 --- a/test/test_large_array.html +++ b/test/test_large_array.html @@ -40,7 +40,7 @@ var options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { console.error(err); alert(err.toString()); diff --git a/test/test_materialize.html b/test/test_materialize.html index 5000707..bfaca6e 100644 --- a/test/test_materialize.html +++ b/test/test_materialize.html @@ -48,7 +48,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); }, diff --git a/test/test_minimalist_min.html b/test/test_minimalist_min.html index cfeaed1..569b1f4 100644 --- a/test/test_minimalist_min.html +++ b/test/test_minimalist_min.html @@ -41,7 +41,7 @@ options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { alert(err.toString()); } diff --git a/test/test_schema.html b/test/test_schema.html index 71c429b..99483b6 100644 --- a/test/test_schema.html +++ b/test/test_schema.html @@ -73,7 +73,7 @@ var options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes onError: function (err) { console.error(err); }, diff --git a/test/test_update.html b/test/test_update.html index d19b1c3..2354304 100644 --- a/test/test_update.html +++ b/test/test_update.html @@ -55,7 +55,7 @@ var options = { mode: 'tree', - modes: ['code', 'form', 'text', 'tree', 'view'] // allowed modes + modes: ['code', 'form', 'text', 'tree', 'view', 'preview'] // allowed modes }; var json = {