From 201c33c8c63fed34de940af1329256445d7d1240 Mon Sep 17 00:00:00 2001 From: VinceHi <souricevincent@icloud.com> Date: Fri, 28 Jun 2024 15:05:52 +0200 Subject: [PATCH] fix: tab pointer event none, unselect on blur tab and github action --- .github/workflows/main.yml | 7 +++++- src-tauri/tauri.conf.json | 2 +- src/components/Tabs/Tabs.tsx | 45 +++++++++++++++++++----------------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9eb1f05..4958716 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,14 +48,19 @@ jobs: run: | sed -i 's/"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"/"version": "${{ needs.get-next-release.outputs.next-release-version }}"/' src-tauri/tauri.conf.json - name: Prepare commit changes + id: current-commit run: | git config user.name "github-actions" git config user.email "github-actions@github.com" git add src-tauri/tauri.conf.json git commit -m "Bump version [skip ci]" + git push --dry-run echo "last-commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Show last commit SHA + run: | + echo "Last commit SHA: ${{ steps.current-commit.outputs.last-commit-sha }}" outputs: - last-commit-sha: ${{ steps.prepare-commit.outputs.last-commit-sha }} + last-commit-sha: ${{ steps.current-commit.outputs.last-commit-sha }} build: needs: diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index bd6c48a..e4a5374 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "pulp", - "version": "1.3.1" + "version": "1.3.2" }, "tauri": { "allowlist": { diff --git a/src/components/Tabs/Tabs.tsx b/src/components/Tabs/Tabs.tsx index 530ed85..946771f 100644 --- a/src/components/Tabs/Tabs.tsx +++ b/src/components/Tabs/Tabs.tsx @@ -22,36 +22,39 @@ const Tabs: FlowComponent<Props, Component<any>> = (props) => { const [getRenamingMode, setRenamingMode] = createSignal(false); return ( - <div class="tab flex-shrink-0 flex items-center" classList={{ "tab-active": item.active }}> - <label class="input-sizer" data-value={item.name}> + <a + ondblclick={(event) => { + event.stopPropagation(); + setRenamingMode(true); + setFocused(true); + target()?.select(); + }} + onClick={() => props.setActive(index())} + class="tab flex-shrink-0" + classList={{ + "tab-active": item.active + }} + > + <label classList={{ + "cursor-pointer": !getRenamingMode() + }} class="input-sizer" data-value={item.name}> <input + classList={{ + "pointer-events-none": !getRenamingMode(), + }} ref={setTarget} type="text" value={item.name} - readOnly={!getRenamingMode()} - class="appearance-none bg-transparent border-none focus:outline-none cursor-pointer" - classList={{ - "cursor-text": getRenamingMode(), - }} - onClick={(event) => { - if (!getRenamingMode()) { - props.setActive(index()); - } - }} - onDblClick={(event) => { - event.preventDefault(); - setRenamingMode(true); - setFocused(true); - target()?.select(); - }} - onBlur={() => setRenamingMode(false)} + disabled={!getRenamingMode()} + onBlur={(event) => { + window.getSelection()?.removeAllRanges(); // TODO: unselectinput + setRenamingMode(false)}} onInput={(event) => { tabsStore.rename(index(), event.target.value); }} onKeyDown={(event) => { if (event.key === "Enter") { event.preventDefault(); - setRenamingMode(false); setFocused(false); } }} @@ -68,7 +71,7 @@ const Tabs: FlowComponent<Props, Component<any>> = (props) => { > <Icon path={xMark} class="flex-shrink-0 w-4" /> </button> - </div> + </a> ); }} </For>