diff --git a/src/Squidex/wwwroot/scripts/simple-editor.html b/src/Squidex/wwwroot/scripts/simple-editor.html index c73ada19b..e9075c248 100644 --- a/src/Squidex/wwwroot/scripts/simple-editor.html +++ b/src/Squidex/wwwroot/scripts/simple-editor.html @@ -4,6 +4,7 @@
+ @@ -26,14 +27,17 @@ console.error(error); }) .then(editor => { + // When the field is instantiated it notified the UI that it has been loaded. var field = new SquidexFormField(); + // Handle the value change event and set the text to the editor. field.onValueChanged(function (value) { if (value) { editor.setData(value); } }); + // Disable the editor when it should be disabled. field.onDisabled(function (disabled) { editor.set('isReadOnly', disabled); }); @@ -41,11 +45,13 @@ editor.model.document.on('change', function () { var data = editor.getData(); + // Notify the UI that the value has been changed. Will be used to trigger validation. field.valueChanged(data); }); editor.ui.focusTracker.on('change:isFocused', function (event, name, isFocused) { if (!isFocused) { + // Notify the UI that the value has been touched. field.touched(); } });