Show editor in read-only mode when using runtime mode production

This commit is contained in:
Ronald Barendse
2022-07-14 23:41:17 +02:00
parent 802f2baaa0
commit 97010c2de5
2 changed files with 12 additions and 13 deletions

View File

@@ -83,9 +83,7 @@
vm.save = function (suppressNotification) {
vm.page.saveButtonState = "busy";
if (vm.editor) {
vm.template.content = vm.editor.getValue();
}
vm.template.content = vm.editor.getValue();
contentEditingHelper.contentEditorPerformSave({
saveMethod: templateResource.save,
@@ -228,7 +226,10 @@
onLoad: function (_editor) {
vm.editor = _editor;
//Update the auto-complete method to use ctrl+alt+space
// Set read-only when using runtime mode Production
_editor.setReadOnly(vm.runtimeModeProduction);
// Update the auto-complete method to use ctrl+alt+space
_editor.commands.bindKey("ctrl-alt-space", "startAutocomplete");
// Unassigns the keybinding (That was previously auto-complete)

View File

@@ -23,15 +23,13 @@
<umb-editor-container>
<umb-box>
<umb-box-content ng-if="vm.runtimeModeProduction">
<div class="umb-alert umb-alert--info">
<localize key="template_runtimeModeProduction">Template content is not editable when using runtime mode <code>Production</code>.</localize>
</div>
</umb-box-content>
<umb-box-content>
<div class="umb-alert umb-alert--info mb3" ng-if="vm.runtimeModeProduction">
<localize key="template_runtimeModeProduction">Template content is not editable when using runtime mode <code>Production</code>.</localize>
</div>
<umb-box-content ng-if="!vm.runtimeModeProduction">
<div class="flex" style="margin-bottom: 30px;">
<div class="flex mb3" ng-if="!vm.runtimeModeProduction">
<div class="flex">
@@ -99,7 +97,7 @@
<div
data-element="code-editor"
auto-scale="85"
auto-scale="90"
umb-ace-editor="vm.aceOption"
model="vm.template.content">
</div>