From bfa3924d57c2ea2cc2857006d6bd6279865dbc99 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Fri, 22 Dec 2023 18:06:27 +0100 Subject: [PATCH] feat: highlithg sql in notes, history and console --- package-lock.json | 21 ++++++++++++ package.json | 1 + src/renderer/components/ModalHistory.vue | 16 ++++++++-- src/renderer/components/ModalNoteEdit.vue | 8 +++-- src/renderer/components/ModalNoteNew.vue | 6 +++- src/renderer/components/ScratchpadNote.vue | 5 +-- .../components/WorkspaceQueryConsole.vue | 3 +- src/renderer/scss/main.scss | 32 +++++++++++++++++-- 8 files changed, 82 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 02afdcbc..8b9c0c23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "source-map-support": "~0.5.20", "spectre.css": "~0.5.9", "sql-formatter": "~13.0.0", + "sql-highlight": "~4.4.0", "v-mask": "~2.3.0", "vue": "~3.3.4", "vue-i18n": "~9.2.2", @@ -14252,6 +14253,21 @@ "sql-formatter": "bin/sql-formatter-cli.cjs" } }, + "node_modules/sql-highlight": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/sql-highlight/-/sql-highlight-4.4.0.tgz", + "integrity": "sha512-/DeHb9IkH7Le5PDOXaF3+QuclZTvzEo7H99o7qlTncPJCpCZEBBGqmreIv7tRVIofoXA+2gRl2an6bzk/n2jNA==", + "funding": [ + "https://github.com/scriptcoded/sql-highlight?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/scriptcoded" + } + ], + "engines": { + "node": ">=14" + } + }, "node_modules/sqlstring": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", @@ -27952,6 +27968,11 @@ "nearley": "^2.20.1" } }, + "sql-highlight": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/sql-highlight/-/sql-highlight-4.4.0.tgz", + "integrity": "sha512-/DeHb9IkH7Le5PDOXaF3+QuclZTvzEo7H99o7qlTncPJCpCZEBBGqmreIv7tRVIofoXA+2gRl2an6bzk/n2jNA==" + }, "sqlstring": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", diff --git a/package.json b/package.json index a68da709..26bac77c 100644 --- a/package.json +++ b/package.json @@ -147,6 +147,7 @@ "source-map-support": "~0.5.20", "spectre.css": "~0.5.9", "sql-formatter": "~13.0.0", + "sql-highlight": "~4.4.0", "v-mask": "~2.3.0", "vue": "~3.3.4", "vue-i18n": "~9.2.2", diff --git a/src/renderer/components/ModalHistory.vue b/src/renderer/components/ModalHistory.vue index 27decea0..2a98ac19 100644 --- a/src/renderer/components/ModalHistory.vue +++ b/src/renderer/components/ModalHistory.vue @@ -75,7 +75,7 @@
@@ -126,7 +126,19 @@ diff --git a/src/renderer/components/ModalNoteNew.vue b/src/renderer/components/ModalNoteNew.vue index b819b66b..00903986 100644 --- a/src/renderer/components/ModalNoteNew.vue +++ b/src/renderer/components/ModalNoteNew.vue @@ -43,7 +43,11 @@
- +
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'; diff --git a/src/renderer/components/WorkspaceQueryConsole.vue b/src/renderer/components/WorkspaceQueryConsole.vue index bc40c2d1..76b6aba9 100644 --- a/src/renderer/components/WorkspaceQueryConsole.vue +++ b/src/renderer/components/WorkspaceQueryConsole.vue @@ -24,7 +24,7 @@ tabindex="0" @contextmenu.prevent="contextMenu($event, wLog)" > - {{ moment(wLog.date).format('HH:mm:ss') }}: {{ wLog.sql }} + {{ moment(wLog.date).format('HH:mm:ss') }}:
@@ -47,6 +47,7 @@