Add `'preview'` to the list with allowed modes in all examples

This commit is contained in:
jos 2019-07-08 20:00:34 +02:00
parent 102b6d2b0c
commit df386b6f1b
14 changed files with 17 additions and 14 deletions

View File

@ -42,7 +42,7 @@
var options = { var options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -64,7 +64,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -43,7 +43,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
name: "jsonContent", name: "jsonContent",
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());

View File

@ -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 * Create a select box to be used in the editor menu's, which allows to switch mode
* @param {HTMLElement} container * @param {HTMLElement} container
* @param {String[]} modes 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' * @param {String} current Available modes: 'code', 'form', 'text', 'tree', 'view', 'preview'
* @param {function(mode: string)} onSwitch Callback invoked on switch * @param {function(mode: string)} onSwitch Callback invoked on switch
* @constructor * @constructor
*/ */

View File

@ -427,6 +427,9 @@ previewmode.set = function(json) {
this.json = json; this.json = json;
this.renderPreview(); this.renderPreview();
// validate JSON schema
this._debouncedValidate();
}; };
/** /**

View File

@ -44,7 +44,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -41,7 +41,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
} }

View File

@ -44,7 +44,7 @@
options = { options = {
mode: 'code', mode: 'code',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -48,7 +48,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -40,7 +40,7 @@
var options = { var options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
console.error(err); console.error(err);
alert(err.toString()); alert(err.toString());

View File

@ -48,7 +48,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
}, },

View File

@ -41,7 +41,7 @@
options = { options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
alert(err.toString()); alert(err.toString());
} }

View File

@ -73,7 +73,7 @@
var options = { var options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'], // allowed modes
onError: function (err) { onError: function (err) {
console.error(err); console.error(err);
}, },

View File

@ -55,7 +55,7 @@
var options = { var options = {
mode: 'tree', mode: 'tree',
modes: ['code', 'form', 'text', 'tree', 'view'] // allowed modes modes: ['code', 'form', 'text', 'tree', 'view', 'preview'] // allowed modes
}; };
var json = { var json = {