Skip to content

Commit

Permalink
Allow editing context using Shift+`
Browse files Browse the repository at this point in the history
  • Loading branch information
danny0838 committed Apr 21, 2024
1 parent bb6d882 commit eda3497
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion sts/data/htmlpage.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,13 @@
const target = event.target.closest('a');
if (!target) { return; }

// special combinations
if (event.shiftKey && event.key === "~" && !target.matches('.editing')) {
event.preventDefault();
editContext(target);
return;
}

if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) {
return;
}
Expand Down Expand Up @@ -747,7 +754,8 @@ <h3>操作鍵</h3>
<li><kbd>Z</kbd><kbd>C</kbd>:移至上/下一個相同字。</li>
<li><kbd>W</kbd><kbd>S</kbd>:套用前/後一個候選字。</li>
<li><kbd>0</kbd>-<kbd>9</kbd>:套用對應的候選字(<kbd>0</kbd>對應轉換前的字)。</li>
<li><kbd>`</kbd> (<kbd>1</kbd>左邊的反引號):將此字切換為編輯模式,可自由編輯。編輯模式下可用此鍵或<kbd>Esc</kbd>關閉編輯模式,其餘操作鍵無效。</li>
<li><kbd title='"1"左邊的反引號'>`</kbd>:將此字切換為編輯模式,可自由編輯。編輯模式下可用此鍵或<kbd>Esc</kbd>關閉編輯模式,其餘操作鍵無效。</li>
<li><kbd>Shift</kbd>+<kbd>`</kbd>:將前後未轉換文字切換為可點選操作。</li>
<li><kbd>Enter</kbd>:開啟選單執行指令。</li>
</ul>
</details>
Expand Down
3 changes: 2 additions & 1 deletion sts/data/htmlpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ <h3>操作鍵</h3>
<li><kbd>Z</kbd><kbd>C</kbd>:移至上/下一個相同字。</li>
<li><kbd>W</kbd><kbd>S</kbd>:套用前/後一個候選字。</li>
<li><kbd>0</kbd>-<kbd>9</kbd>:套用對應的候選字(<kbd>0</kbd>對應轉換前的字)。</li>
<li><kbd>`</kbd> (<kbd>1</kbd>左邊的反引號):將此字切換為編輯模式,可自由編輯。編輯模式下可用此鍵或<kbd>Esc</kbd>關閉編輯模式,其餘操作鍵無效。</li>
<li><kbd title='"1"左邊的反引號'>`</kbd>:將此字切換為編輯模式,可自由編輯。編輯模式下可用此鍵或<kbd>Esc</kbd>關閉編輯模式,其餘操作鍵無效。</li>
<li><kbd>Shift</kbd>+<kbd>`</kbd>:將前後未轉換文字切換為可點選操作。</li>
<li><kbd>Enter</kbd>:開啟選單執行指令。</li>
</ul>
</details>
Expand Down
7 changes: 7 additions & 0 deletions sts/data/htmlpage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,13 @@ function onKeyDown(event) {
const target = event.target.closest('a');
if (!target) { return; }

// special combinations
if (event.shiftKey && event.key === "~" && !target.matches('.editing')) {
event.preventDefault();
editContext(target);
return;
}

if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) {
return;
}
Expand Down

0 comments on commit eda3497

Please sign in to comment.