Skip to content

Commit

Permalink
fix: html tags searching in history or saved queries, fixes #847
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Aug 5, 2024
1 parent 72bacde commit 6cb21ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 1 addition & 12 deletions src/renderer/components/ModalHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<code
class="cut-text"
:title="query.sql"
v-html="highlight(highlightWord(query.sql), {html: true})"
v-html="highlight(query.sql, {html: true})"
/>
</div>
<div class="tile-bottom-content">
Expand Down Expand Up @@ -210,17 +210,6 @@ const resizeResults = () => {
const refreshScroller = () => resizeResults();
const closeModal = () => emit('close');
const highlightWord = (string: string) => {
string = string.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
if (searchTerm.value) {
const regexp = new RegExp(`(${searchTerm.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
return string.replace(regexp, '<span class="text-primary text-bold">$1</span>');
}
else
return string;
};
const onKey = (e: KeyboardEvent) => {
e.stopPropagation();
if (e.key === 'Escape')
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ScratchpadNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
v-if="note.type === 'query'"
ref="noteParagraph"
class="tile-paragraph sql"
v-html="highlight(highlightWord(note.note), {html: true})"
v-html="highlight(note.note, {html: true})"
/>
<div
v-else
Expand Down

0 comments on commit 6cb21ff

Please sign in to comment.