修正插入文件bug

This commit is contained in:
joyqi
2013-10-19 19:46:29 +08:00
parent 279c44e8e0
commit 44aabf9769
5 changed files with 15 additions and 7 deletions
+12
View File
@@ -101,6 +101,18 @@ $(document).ready(function() {
}
}).width();
// 原始的插入图片和文件
Typecho.insertFileToEditor = function (url, isImage) {
var textarea = $('#text'), sel = textarea.getSelection(),
file = url.split('/').pop(),
html = isImage ? '<img src="' + url + '" alt="' + file + '" />'
: '<a href="' + url + '">' + file + '</a>',
offset = (sel ? sel.start : 0) + html.length;
textarea.replaceSelection(html);
textarea.setSelection(offset, offset);
};
// 自动保存
<?php if ($options->autoSave): ?>
var savedData = null, locked = false,