エントリー画面でエントリーの編集中に、「太字にする」などのタグを付加するボタンを押したとたん、文章の先頭にカーソルが飛ばされてしまう現象に悩まされていました。
図にするとこんな感じ。

悩んでいたのは私だけかと思っていたら、やはり他にも悩んでいた方はいたようです。
しかし、先人たちは、しっかりと対処法を見出されていました。
プラグインを入れて対処する方法もあるらしいですが、初心者らしくアナログな方法でやってみました。
参考にさせていただいたエントリーはこちら。
Project MultiBurst:Project MultiBurst:エントリー画面での挿入ボタン後、ジャンプする不具合を解消
Document_Not_Bound...:エントリー編集画面でのタグ挿入ボタンの謎の挙動、解決・・・の巻
読んでみると、edit_entry.tmplの中にある
href="#"を、href="javascript:void(0);" に変えればいいらしいです。
そういうわけで、まずはFFFTPで、mtフォルダ→tmpl→cms→edit_entry.tmpl へたどり着いてダウンロード。

ワードパットで開いて中身を見ます。
よく見ると、href="#"って結構いっぱいあります。
コレを全て変えちゃうのか?
と、思いながらよく見てみると、
Bold、Italic、Underline・・・と並んでいるところがあるじゃありませんか。
しかもEntry Bodyとか書いてある部分があります。
たぶん、ココ。たぶん(笑)。
---------------------------
<div class="field-label"><label for="text"><MT_TRANS phrase="Entry Body"></label> <a href="#" onclick="return openManual('entries', 'body')" class="help">?</a></div>
<div class="field-buttons">
<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold">" href="#" onclick="return formatStr(document.entry_form.text, \'strong\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-bold.gif" alt="<MT_TRANS phrase="Bold">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Italic">" href="#" onclick="return formatStr(document.entry_form.text, \'em\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-italic.gif" alt="<MT_TRANS phrase="Italic">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Underline">" href="#" onclick="return formatStr(document.entry_form.text, \'u\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-underline.gif" alt="<MT_TRANS phrase="Underline">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Link">" href="#" onclick="return insertLink(document.entry_form.text)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-link.gif" alt="<MT_TRANS phrase="Insert Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Email Link">" href="#" onclick="return insertLink(document.entry_form.text, 1)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-email.gif" alt="<MT_TRANS phrase="Insert Email Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Quote">" href="#" onclick="return formatStr(document.entry_form.text, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>');
}
}
// -->
</script>
</div>
</div>
---------------------------
href="#"を、href="javascript:void(0);"に変えました。
---------------------------
<div class="field-label"><label for="text"><MT_TRANS phrase="Entry Body"></label> <a href="#" onclick="return openManual('entries', 'body')" class="help">?</a></div>
<div class="field-buttons">
<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text, \'strong\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-bold.gif" alt="<MT_TRANS phrase="Bold">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Italic">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text, \'em\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-italic.gif" alt="<MT_TRANS phrase="Italic">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Underline">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text, \'u\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-underline.gif" alt="<MT_TRANS phrase="Underline">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Link">" href="javascript:void(0);" onclick="return insertLink(document.entry_form.text)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-link.gif" alt="<MT_TRANS phrase="Insert Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Email Link">" href="javascript:void(0);" onclick="return insertLink(document.entry_form.text, 1)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-email.gif" alt="<MT_TRANS phrase="Insert Email Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Quote">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>');
}
}
// -->
</script>
</div>
</div>
---------------------------
続いて、追記部分。
と言うか、たぶん、追記部分(笑)。
---------------------------
<div class="field-label"><label for="text_more"><MT_TRANS phrase="Extended Entry"></label> <a href="#" onclick="return openManual('entries', 'extended_entry')" class="help">?</a></div>
<div class="field-buttons">
<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold">" href="#" onclick="return formatStr(document.entry_form.text_more, \'strong\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-bold.gif" alt="<MT_TRANS phrase="Bold">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Italic">" href="#" onclick="return formatStr(document.entry_form.text_more, \'em\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-italic.gif" alt="<MT_TRANS phrase="Italic">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Underline">" href="#" onclick="return formatStr(document.entry_form.text_more, \'u\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-underline.gif" alt="<MT_TRANS phrase="Underline">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Link">" href="#" onclick="return insertLink(document.entry_form.text_more)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-link.gif" alt="<MT_TRANS phrase="Insert Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Email Link">" href="#" onclick="return insertLink(document.entry_form.text_more, 1)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-email.gif" alt="<MT_TRANS phrase="Insert Email Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Quote">" href="#" onclick="return formatStr(document.entry_form.text_more, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>');
}
}
// -->
</script>
</div>
</div>
---------------------------
href="#"を、href="javascript:void(0);"に変えました。
---------------------------
<div class="field-label"><label for="text_more"><MT_TRANS phrase="Extended Entry"></label> <a href="#" onclick="return openManual('entries', 'extended_entry')" class="help">?</a></div>
<div class="field-buttons">
<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text_more, \'strong\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-bold.gif" alt="<MT_TRANS phrase="Bold">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Italic">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text_more, \'em\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-italic.gif" alt="<MT_TRANS phrase="Italic">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Underline">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text_more, \'u\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-underline.gif" alt="<MT_TRANS phrase="Underline">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Link">" href="javascript:void(0);" onclick="return insertLink(document.entry_form.text_more)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-link.gif" alt="<MT_TRANS phrase="Insert Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Insert Email Link">" href="javascript:void(0);" onclick="return insertLink(document.entry_form.text_more, 1)"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-email.gif" alt="<MT_TRANS phrase="Insert Email Link">" width="22" height="16" /></a>');
write('<a title="<MT_TRANS phrase="Quote">" href="javascript:void(0);" onclick="return formatStr(document.entry_form.text_more, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>');
}
}
// -->
</script>
</div>
</div>
---------------------------
上書き保存して、上書きアップロード。
恐る恐るエントリー編集画面でタグ付加ボタンを押すと・・・ と、飛ばされない!
成功かも!
コレで飛ばされることに恐れず、タグ付加ボタンが使えます!。ありがとうございます!
今まで、全てタグを じか打ち してました(笑)。
飛ばされるのにお悩みの方は試してみては?
ですが、よくわかってなくて適当にいじったので、「超」自己責任でお願いします(笑)。
@ 2006年02月8日