12.31.05

因應 2.0 , ?修 Twilight AutoSave

發表於 Uncategorized 於 12:06 am 由 Joe Horn

?級 2.0 以後, 我發? Twilight AutoSave 沒辦法用了.
( ychsiao ?輩也有在 這篇 說他的也?能用. XD )

目?在 plugin 的網?是貼出了這段:

Please note: I offer no support for this plugin with WP 2.0 as of yet. The software is still beta, and works completely differently. I will see how I can upgrade this to work with 2.0 when I can (if it is possible).

於是我自己 trace 了一下 code , 發??題出在這幾行 :
add_action("save_post", "twAutoSaveDelete");
add_action("publish_post", "twAutoSaveDelete");

save_post 跟 publish_post 僅存在於 1.5 版的 wp-admin/post.php 中, 2.0 版被拿掉了.
所以必須把上?那兩行改? :
add_action("simple_edit_form", "twAutoSaveDelete");
add_action("edit_form_advanced", "twAutoSaveDelete");
add_action("edit_page_form", "twAutoSaveDelete");

?外, 我還看到一個?瑕疵, 在 tw-autosave.php 裡?有這段:
if (cookietemp.length > 100){
var endstring = "[...]";
}

?是 endstring 這個變數也沒有事先被定義, 而且這段 code 並沒有?例外處?, 所以當文章內容?於 100 字時, 我們會在文章回復框看到 undefined 的字串.
解法很簡單, 在 if (cookietemp.length > 100){ 上?加入這行就?定了 :
var endstring = "";

目?改完以後看來都正常.
晚點把這些回報給作者, 跟他討論看看好了.

tags: ,

張貼留言