Skip to content

Commit

Permalink
fix: contenteditable on webkit bs
Browse files Browse the repository at this point in the history
  • Loading branch information
invm authored and Michael Ionov committed Jul 9, 2023
1 parent c88ad26 commit bd9726c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/main/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { Store } from "tauri-plugin-store-api";

const store = new Store(".console.dat");

let TIMEOUT: NodeJS.Timeout | null = null

type QueryTab = {
query: string
}
Expand All @@ -25,7 +23,10 @@ export const Console = (props: { connection: ConnectionConfig }) => {

onMount(async () => {
const tabStr = await store.get(CONNECTION_STORE_STORAGE_KEY)
if (!tabStr) return
if (!tabStr) {
setTabs(() => [{ query: '' }])
return;
}
setTabs(() => tabStr as QueryTab[])
})

Expand Down Expand Up @@ -109,7 +110,7 @@ export const Console = (props: { connection: ConnectionConfig }) => {
</For>
<div onClick={() => addTab()} class="tab py-2 tab-sm tab-lifted tab-active" ><AddIcon /></div>
</div>
<QueryTextArea query={""} {...{ updateQueryText }} />
<QueryTextArea query={tabs[activeTab()]?.query} {...{ updateQueryText }} />
</div>
</div>
<div id="results" class="bg-base-200 rounded-tl-lg p-3">
Expand Down
5 changes: 5 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ input::-webkit-inner-spin-button {
margin: 0;
}

[contenteditable] {
-webkit-user-select: text;
user-select: text;
}

/* Firefox */
input[type=number] {
-moz-appearance: textfield;
Expand Down

0 comments on commit bd9726c

Please sign in to comment.