1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: highlithg sql in notes, history and console

This commit is contained in:
2023-12-22 18:06:27 +01:00
parent 08e5a13f72
commit bfa3924d57
8 changed files with 82 additions and 10 deletions

View File

@ -75,7 +75,7 @@
<code
class="cut-text"
:title="query.sql"
v-html="highlightWord(query.sql)"
v-html="highlight(highlightWord(query.sql), {html: true})"
/>
</div>
<div class="tile-bottom-content">
@ -126,7 +126,19 @@
<script setup lang="ts">
import { ConnectionParams } from 'common/interfaces/antares';
import { Component, computed, ComputedRef, onBeforeUnmount, onMounted, onUpdated, Prop, Ref, ref, watch } from 'vue';
import { highlight } from 'sql-highlight';
import {
Component,
computed,
ComputedRef,
onBeforeUnmount,
onMounted,
onUpdated,
Prop,
Ref,
ref,
watch
} from 'vue';
import { useI18n } from 'vue-i18n';
import BaseIcon from '@/components/BaseIcon.vue';

View File

@ -43,7 +43,11 @@
</div>
</div>
<div class="form-group">
<label class="form-label">{{ t('general.content') }}</label>
<label class="form-label">{{ t('general.content') }} <small
v-if="localNote.type !== 'query'"
style="line-height: 1;"
class="text-gray"
>({{ t('application.markdownSupported') }})</small></label>
<BaseTextEditor
v-model="localNote.note"
:mode="editorMode"
@ -110,7 +114,7 @@ watch(() => localNote.value.type, () => {
});
onBeforeMount(() => {
localNote.value = props.note;
localNote.value = JSON.parse(JSON.stringify(props.note));
});
</script>

View File

@ -43,7 +43,11 @@
</div>
</div>
<div class="form-group">
<label class="form-label">{{ t('general.content') }}</label>
<label class="form-label">{{ t('general.content') }} <small
v-if="newNote.type !== 'query'"
style="line-height: 1;"
class="text-gray"
>({{ t('application.markdownSupported') }})</small></label>
<BaseTextEditor
v-model="newNote.note"
:mode="editorMode"

View File

@ -31,8 +31,8 @@
<code
v-if="note.type === 'query'"
ref="noteParagraph"
class="tile-paragraph"
v-html="highlightWord(note.note)"
class="tile-paragraph sql"
v-html="highlight(highlightWord(note.note), {html: true})"
/>
<div
v-else
@ -104,6 +104,7 @@
<script setup lang="ts">
import { useElementBounding } from '@vueuse/core';
import { marked } from 'marked';
import { highlight } from 'sql-highlight';
import { computed, PropType, Ref, ref } from 'vue';
import { useI18n } from 'vue-i18n';

View File

@ -24,7 +24,7 @@
tabindex="0"
@contextmenu.prevent="contextMenu($event, wLog)"
>
<span class="type-datetime">{{ moment(wLog.date).format('HH:mm:ss') }}</span>: <code class="query-console-log-sql">{{ wLog.sql }}</code>
<span class="type-datetime">{{ moment(wLog.date).format('HH:mm:ss') }}</span>: <code class="query-console-log-sql" v-html="highlight(wLog.sql, {html: true})" />
</div>
</div>
</div>
@ -47,6 +47,7 @@
<script setup lang="ts">
import * as moment from 'moment';
import { storeToRefs } from 'pinia';
import { highlight } from 'sql-highlight';
import { computed, nextTick, onMounted, Ref, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';