DraftPad用エディタのDarkRoomをリニューアルしました

屋上屋を架す状態になっていたので、作り直してみました。


新しいDraftPad用DarkRoomはリアルタイムで文字数が出ます
覚えたてのテクニックを組み込んでみました。DraftPadで文章を書くとき、カーソル移動を韋駄天に変えます。他のエディタ・アプリとは違い、指のスライドに応じてカーソルが動く距離が伸び縮みする。ただ、シ...
ただでさえエディタのDraftPadにエディタ機能を追加するDarkRoom。指でスライドするとカーソルが動くのが特徴。長い文章を推敲するときに結構重宝します。小刻みに改良を重ねてきて、後からみると不要に思われる部分が溜まっていたので整理してみました。

draftpad://self/web?source=<meta name=viewport content=initial-scale=1><script>function main(x){s=%22<body style=margin:0;background:%22+x.bgcolor+%22;><textarea id=wine rows=999 style=\"border:0;width:100%25;background:%22+x.bgcolor+%22;color:%22+x.color+%22;font-size:%22+x.fontsize+%22;font-family:%22+x.font+%22;\" tabindex=2 onkeyup=dispTitle()>%22+x.whole.replace(/%26/g,%22%26amp;%22).replace(/>/g,%22%26gt;%22)+%22</textarea><input style=border:0;width:70;background:%22+x.bgcolor+%22; onFocus=document.execCommand(\"undo\") placeholder=取り消す tabindex=1><input style=border:0;width:70;background:%22+x.bgcolor+%22; onFocus=document.execCommand(\"redo\") placeholder=やり直す tabindex=3></body>%22;document.write(s);wine.selectionStart=x.loc;wine.selectionEnd=Number(x.loc)+Number(x.len);wine.focus();dispTitle();document.ontouchmove=touchMove;document.ontouchstart=touchStart;document.ongesturechange=function(){mode=0};}var p;mode=1;function touchMove(e){t=e.touches[0].clientX;if(t-p>4){wine.setSelectionRange(wine.selectionStart+mode,wine.selectionEnd+1);p=t;dispTitle();}if(p-t>4){wine.setSelectionRange(wine.selectionStart-mode,wine.selectionEnd-1);p=t;dispTitle();}}function touchStart(e){p=e.touches[0].clientX;mode=(wine.selectionStart==wine.selectionEnd);dispTitle();}function dispTitle(){s=wine.selectionStart;s=(mode)? s:s+%22 + %22+(wine.selectionEnd-s);draftpad.title(s+%22 / %22+wine.value.length);}location=%22draftpad:///webdelegate?load=main%26unload=draftpad.replace(wine.value,wine.selectionStart,wine.selectionEnd-wine.selectionStart)%22;</script>&whole=<@@>&loc=<#LOC>&len=<#LEN>&font=Hiragino Kaku Gothic ProN&color=sienna&bgcolor=ivory&fontsize=22

登録リンクはこちら→ http://tinyurl.com/clz9w5e



アシストの末尾でフォントのサイズや色を変えられるのは従来通り。以前ピンチインでフォント・サイズを切り替える機能を付けていたのですが、それを外した後を考えてなかった。そこで、普通に画面の拡大が有効になるようにしました。ペーストで貼り付ける場所を選ぶとき便利。ただしスライド・カーソルは、通常画面に戻さないと使いづらいです。



二本指でスライドすると範囲選択になります。このとき、タイトルバーの表示を「始点 + 文字数」にしてみました。たまにコピー用のメニューが出なくなりますが、そのときは下方向に軽くスライド。解除は、範囲外のところを二度タップしてください。



キーボード左上の「Previous / Next」ボタン。つい忘れがちですが、履歴を管理してます。Undo/Redoに対応。動作が少し遅いのは愛嬌ということで。
DraftPad用の自作アシスト集