Skip to content

Commit 201c33c

Browse files
authored
fix: tab pointer event none, unselect on blur tab and github action
1 parent 647c828 commit 201c33c

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,19 @@ jobs:
4848
run: |
4949
sed -i 's/"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"/"version": "${{ needs.get-next-release.outputs.next-release-version }}"/' src-tauri/tauri.conf.json
5050
- name: Prepare commit changes
51+
id: current-commit
5152
run: |
5253
git config user.name "github-actions"
5354
git config user.email "github-actions@github.com"
5455
git add src-tauri/tauri.conf.json
5556
git commit -m "Bump version [skip ci]"
57+
git push --dry-run
5658
echo "last-commit-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
59+
- name: Show last commit SHA
60+
run: |
61+
echo "Last commit SHA: ${{ steps.current-commit.outputs.last-commit-sha }}"
5762
outputs:
58-
last-commit-sha: ${{ steps.prepare-commit.outputs.last-commit-sha }}
63+
last-commit-sha: ${{ steps.current-commit.outputs.last-commit-sha }}
5964

6065
build:
6166
needs:

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "pulp",
11-
"version": "1.3.1"
11+
"version": "1.3.2"
1212
},
1313
"tauri": {
1414
"allowlist": {

src/components/Tabs/Tabs.tsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,39 @@ const Tabs: FlowComponent<Props, Component<any>> = (props) => {
2222
const [getRenamingMode, setRenamingMode] = createSignal(false);
2323

2424
return (
25-
<div class="tab flex-shrink-0 flex items-center" classList={{ "tab-active": item.active }}>
26-
<label class="input-sizer" data-value={item.name}>
25+
<a
26+
ondblclick={(event) => {
27+
event.stopPropagation();
28+
setRenamingMode(true);
29+
setFocused(true);
30+
target()?.select();
31+
}}
32+
onClick={() => props.setActive(index())}
33+
class="tab flex-shrink-0"
34+
classList={{
35+
"tab-active": item.active
36+
}}
37+
>
38+
<label classList={{
39+
"cursor-pointer": !getRenamingMode()
40+
}} class="input-sizer" data-value={item.name}>
2741
<input
42+
classList={{
43+
"pointer-events-none": !getRenamingMode(),
44+
}}
2845
ref={setTarget}
2946
type="text"
3047
value={item.name}
31-
readOnly={!getRenamingMode()}
32-
class="appearance-none bg-transparent border-none focus:outline-none cursor-pointer"
33-
classList={{
34-
"cursor-text": getRenamingMode(),
35-
}}
36-
onClick={(event) => {
37-
if (!getRenamingMode()) {
38-
props.setActive(index());
39-
}
40-
}}
41-
onDblClick={(event) => {
42-
event.preventDefault();
43-
setRenamingMode(true);
44-
setFocused(true);
45-
target()?.select();
46-
}}
47-
onBlur={() => setRenamingMode(false)}
48+
disabled={!getRenamingMode()}
49+
onBlur={(event) => {
50+
window.getSelection()?.removeAllRanges(); // TODO: unselectinput
51+
setRenamingMode(false)}}
4852
onInput={(event) => {
4953
tabsStore.rename(index(), event.target.value);
5054
}}
5155
onKeyDown={(event) => {
5256
if (event.key === "Enter") {
5357
event.preventDefault();
54-
setRenamingMode(false);
5558
setFocused(false);
5659
}
5760
}}
@@ -68,7 +71,7 @@ const Tabs: FlowComponent<Props, Component<any>> = (props) => {
6871
>
6972
<Icon path={xMark} class="flex-shrink-0 w-4" />
7073
</button>
71-
</div>
74+
</a>
7275
);
7376
}}
7477
</For>

0 commit comments

Comments
 (0)