feat(UI): row markers in sql editors

This commit is contained in:
Fabio Di Stasio 2021-03-08 18:11:00 +01:00
parent 0081a4167c
commit ddfb713124
2 changed files with 37 additions and 1 deletions

View File

@ -241,6 +241,24 @@ export default {
this.$emit('update:value', content); this.$emit('update:value', content);
}); });
this.editor.on('guttermousedown', e => {
const target = e.domEvent.target;
if (target.className.indexOf('ace_gutter-cell') === -1)
return;
if (!this.editor.isFocused())
return;
if (e.clientX > 25 + target.getBoundingClientRect().left)
return;
const row = e.getDocumentPosition().row;
const breakpoints = e.editor.session.getBreakpoints(row, 0);
if (typeof breakpoints[row] === typeof undefined)
e.editor.session.setBreakpoint(row);
else
e.editor.session.clearBreakpoint(row);
e.stop();
});
if (this.autoFocus) { if (this.autoFocus) {
setTimeout(() => { setTimeout(() => {
this.editor.focus(); this.editor.focus();
@ -308,4 +326,21 @@ export default {
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight { .ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight {
color: #e0d00c; color: #e0d00c;
} }
.ace_gutter-cell.ace_breakpoint {
&::before {
content: '\F0403';
position: absolute;
left: 3px;
top: 2px;
color: $primary-color;
display: inline-block;
font: normal normal normal 24px/1 "Material Design Icons", sans-serif;
font-size: inherit;
text-rendering: auto;
line-height: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
</style> </style>

View File

@ -47,7 +47,8 @@
<BaseLoader v-if="isLoading" /> <BaseLoader v-if="isLoading" />
<label class="form-label ml-2">{{ $t('message.routineBody') }}</label> <label class="form-label ml-2">{{ $t('message.routineBody') }}</label>
<QueryEditor <QueryEditor
v-if="isSelected" v-show="isSelected"
:key="`${routine}-${_uid}`"
ref="queryEditor" ref="queryEditor"
:value.sync="localRoutine.sql" :value.sync="localRoutine.sql"
:workspace="workspace" :workspace="workspace"