カーソルが行頭になくてもTabでインデントするUserScript
/foldrr/scrapbox-editor-indent-line
code:script.js
(() => {
$('#text-input').on('keydown', e => {
if (e.keyCode != 0x09) return true;
if ($('.cursor-line .code-block').length != 0) return true;
if ($('.cursor-line .table-block').length != 0) return true;
if ($('.popup-menu').length != 0) return true;
let keydown = document.createEvent('Events');
keydown.initEvent('keydown', true, true);
keydown.keyCode = e.which = (e.shiftKey ? 37 : 39);
keydown.ctrlKey = true;
$('#text-input')0.dispatchEvent(keydown);
return false;
});
})();
機能
Scrapboxでtabによるインデント・アンインデントがアウトライナーライクな動きになる。
カーソルが行頭にない状態でも、tabで現在行をインデントする。
tabを押すとインデント。
shift+tab を押すとアンインデント。
前提
Edit profile -> Prioritize Outline-edit key bindings が有効であること。
補足
以下の場合はタブキーはScrapbox標準の動作となる。
コードブロックの中
テーブルの中
ページ名サジェスト表示中
アウトライナー編集モードが前提だが、ONだとCtrl + →/←で単語単位のカーソル移動が出来ないyosider.icon
単語単位のカーソル移動を自前で実装すれば解決します(狂気)takker.icon
/takker/ScrapVim-lite-2/command#5fbcc76b1280f000003c1e34
コードいじっちゃってて、このままだと動きません
実装方法は参考になるかも
/icons/すごい.iconyosider.icon