|
@@ -26,6 +26,7 @@ import 'apps/notebook2/components/ko.snippetResults';
|
|
|
import 'apps/notebook2/components/ko.queryHistory';
|
|
import 'apps/notebook2/components/ko.queryHistory';
|
|
|
|
|
|
|
|
import './components/ExecutableActionsKoBridge.vue';
|
|
import './components/ExecutableActionsKoBridge.vue';
|
|
|
|
|
+import './components/EditorResizerKoBridge.vue';
|
|
|
import './components/aceEditor/AceEditorKoBridge.vue';
|
|
import './components/aceEditor/AceEditorKoBridge.vue';
|
|
|
|
|
|
|
|
import AceAutocompleteWrapper from 'apps/notebook/aceAutocompleteWrapper';
|
|
import AceAutocompleteWrapper from 'apps/notebook/aceAutocompleteWrapper';
|
|
@@ -236,7 +237,15 @@ export default class Snippet {
|
|
|
this.parentNotebook.isHistory() ? snippetRaw.aceCursorPosition : null
|
|
this.parentNotebook.isHistory() ? snippetRaw.aceCursorPosition : null
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- this.aceEditor = null;
|
|
|
|
|
|
|
+ this.ace = ko.observable();
|
|
|
|
|
+
|
|
|
|
|
+ this.ace.subscribe(newVal => {
|
|
|
|
|
+ if (newVal) {
|
|
|
|
|
+ if (!this.parentNotebook.isPresentationMode()) {
|
|
|
|
|
+ newVal.focus();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
this.errors = ko.observableArray([]);
|
|
this.errors = ko.observableArray([]);
|
|
|
|
|
|
|
@@ -340,7 +349,7 @@ export default class Snippet {
|
|
|
this.associatedDocumentUuid.subscribe(val => {
|
|
this.associatedDocumentUuid.subscribe(val => {
|
|
|
if (val !== '') {
|
|
if (val !== '') {
|
|
|
this.getExternalStatement();
|
|
this.getExternalStatement();
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (this.ace()) {
|
|
|
this.statement_raw('');
|
|
this.statement_raw('');
|
|
|
this.ace().setValue('', 1);
|
|
this.ace().setValue('', 1);
|
|
|
}
|
|
}
|
|
@@ -444,7 +453,7 @@ export default class Snippet {
|
|
|
this.properties(komapping.fromJS(getDefaultSnippetProperties(newValue)));
|
|
this.properties(komapping.fromJS(getDefaultSnippetProperties(newValue)));
|
|
|
}
|
|
}
|
|
|
window.setTimeout(() => {
|
|
window.setTimeout(() => {
|
|
|
- if (this.ace() !== null) {
|
|
|
|
|
|
|
+ if (this.ace()) {
|
|
|
this.ace().focus();
|
|
this.ace().focus();
|
|
|
}
|
|
}
|
|
|
}, 100);
|
|
}, 100);
|
|
@@ -697,10 +706,12 @@ export default class Snippet {
|
|
|
this.hasSuggestion('error');
|
|
this.hasSuggestion('error');
|
|
|
this.complexity({ hints: [] });
|
|
this.complexity({ hints: [] });
|
|
|
}
|
|
}
|
|
|
- huePubSub.publish('editor.active.risks', {
|
|
|
|
|
- editor: this.ace(),
|
|
|
|
|
- risks: this.complexity() || {}
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (this.ace()) {
|
|
|
|
|
+ huePubSub.publish('editor.active.risks', {
|
|
|
|
|
+ editor: this.ace(),
|
|
|
|
|
+ risks: this.complexity() || {}
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
lastCheckedComplexityStatement = this.statement();
|
|
lastCheckedComplexityStatement = this.statement();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -713,7 +724,7 @@ export default class Snippet {
|
|
|
this.suggestion('');
|
|
this.suggestion('');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this.complexity() !== {}) {
|
|
|
|
|
|
|
+ if (this.complexity() !== {} && this.ace()) {
|
|
|
this.complexity(undefined);
|
|
this.complexity(undefined);
|
|
|
huePubSub.publish('editor.active.risks', {
|
|
huePubSub.publish('editor.active.risks', {
|
|
|
editor: this.ace(),
|
|
editor: this.ace(),
|
|
@@ -831,16 +842,6 @@ export default class Snippet {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ace(newVal) {
|
|
|
|
|
- if (newVal) {
|
|
|
|
|
- this.aceEditor = newVal;
|
|
|
|
|
- if (!this.parentNotebook.isPresentationMode()) {
|
|
|
|
|
- this.aceEditor.focus();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return this.aceEditor;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
checkCompatibility() {
|
|
checkCompatibility() {
|
|
|
this.hasSuggestion(null);
|
|
this.hasSuggestion(null);
|
|
|
this.compatibilitySourcePlatform(COMPATIBILITY_SOURCE_PLATFORMS[this.dialect()]);
|
|
this.compatibilitySourcePlatform(COMPATIBILITY_SOURCE_PLATFORMS[this.dialect()]);
|
|
@@ -891,7 +892,9 @@ export default class Snippet {
|
|
|
if (data.status === 0) {
|
|
if (data.status === 0) {
|
|
|
this.externalStatementLoaded(true);
|
|
this.externalStatementLoaded(true);
|
|
|
this.statement_raw(data.statement);
|
|
this.statement_raw(data.statement);
|
|
|
- this.ace().setValue(this.statement_raw(), 1);
|
|
|
|
|
|
|
+ if (this.ace()) {
|
|
|
|
|
+ this.ace().setValue(this.statement_raw(), 1);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
this.handleAjaxError(data);
|
|
this.handleAjaxError(data);
|
|
|
}
|
|
}
|
|
@@ -1040,6 +1043,9 @@ export default class Snippet {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onKeydownInVariable(context, e) {
|
|
onKeydownInVariable(context, e) {
|
|
|
|
|
+ if (!this.ace()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if ((e.ctrlKey || e.metaKey) && e.which === 13) {
|
|
if ((e.ctrlKey || e.metaKey) && e.which === 13) {
|
|
|
// Ctrl-enter
|
|
// Ctrl-enter
|
|
|
this.ace().commands.commands['execute'].exec();
|
|
this.ace().commands.commands['execute'].exec();
|