This commit is contained in:
fen
2013-10-19 19:28:02 +08:00
6 changed files with 28 additions and 12 deletions

View File

@@ -37,10 +37,10 @@ $(document).ready(function() {
.data('url', data.url)
.data('image', data.isImage)
.html('<input type="hidden" name="attachment[]" value="' + data.cid + '" />'
+ '<a class="file" target="_blank" href="<?php $options->adminUrl('media.php'); ?>?cid='
+ data.cid + '">' + data.title + '</a> ' + data.bytes
+ ' <a class="insert" href="#"><?php _e('插入'); ?></a>'
+ ' <a class="delete" href="#"><i class="i-delete"></i></a>')
+ '<a class="insert" target="_blank" href="###">' + data.title + '</a> ' + data.bytes
+ ' <a class="file" target="_blank" href="<?php $options->adminUrl('media.php'); ?>?cid='
+ data.cid + '" title="<?php _e('编辑'); ?>"><i class="i-edit"></i></a>'
+ ' <a class="delete" href="###" title="<?php _e('删除'); ?>"><i class="i-delete"></i></a>')
.effect('highlight', 1000);
attachInsertEvent(li);

View File

@@ -13,14 +13,14 @@ if (isset($post) || isset($page)) {
?>
<div id="upload-panel" class="p">
将要上传的文件拖放到这里 或者 <a href="###" class="upload-file">选择文件上传</a>
<?php _e('将要上传的文件拖放到这里 或者 %s选择文件上传%s', '<a href="###" class="upload-file">', '</a>'); ?>
<ul id="file-list">
<?php while ($attachment->next()): ?>
<li data-cid="<?php $attachment->cid(); ?>" data-url="<?php echo $attachment->attachment->url; ?>" data-image="<?php echo $attachment->attachment->isImage ? 1 : 0; ?>"><input type="hidden" name="attachment[]" value="<?php $attachment->cid(); ?>" />
<a class="insert" href=""><?php $attachment->title(); ?></a>
<a class="insert" href="###"><?php $attachment->title(); ?></a>
<?php echo number_format(ceil($attachment->attachment->size / 1024)); ?> Kb
<a class="file" target="_blank" href="<?php $options->adminUrl('media.php?cid=' . $attachment->cid); ?>" title="编辑"><i class="i-edit"></i></a>
<a href="###" class="delete" title="删除"><i class="i-delete"></i></a></li>
<a class="file" target="_blank" href="<?php $options->adminUrl('media.php?cid=' . $attachment->cid); ?>" title="<?php _e('编辑'); ?>"><i class="i-edit"></i></a>
<a href="###" class="delete" title="<?php _e('删除'); ?>"><i class="i-delete"></i></a></li>
<?php endwhile; ?>
</ul>
</div>

View File

@@ -1,6 +1,6 @@
(function (w) {
w.Typecho = {
insertFileToEditor : function () {}
insertFileToEditor : function (url, isImage) {}
};
})(window);

View File

@@ -68,7 +68,7 @@ $(document).ready(function() {
preventDuplicates : true,
animateDropdown : false,
hintText : '<?php _e('请输入标签名'); ?>',
noResultsText : '此标签不存在, 按回车创建',
noResultsText : '<?php _e('此标签不存在, 按回车创建'); ?>',
prePopulate : tagsPre,
onResult : function (result) {
@@ -208,6 +208,22 @@ $(document).ready(function () {
var editor = new Markdown.Editor(converter, '', options);
editor.run();
var imageButton = $('#wmd-image-button'),
linkButton = $('#wmd-image-button');
Typecho.insertFileToEditor = function (url, isImage) {
var button = isImage ? imageButton : linkButton;
button.trigger('click');
var checkDialog = setInterval(function () {
if ($('.wmd-prompt-dialog').length > 0) {
$('.wmd-prompt-dialog input').val(url).select();
clearInterval(checkDialog);
checkDialog = null;
}
}, 10);
};
});
</script>
<?php endif; ?>

View File

@@ -28,13 +28,13 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
<?php endif; ?>
<p>
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($page->text); ?></textarea>
<span id="auto-save-message"></span>
</p>
<?php include 'file-upload.php'; ?>
<?php Typecho_Plugin::factory('admin/write-page.php')->content($page); ?>
<p class="submit clearfix">
<span id="auto-save-message" class="left"></span>
<span class="right">
<input type="hidden" name="cid" value="<?php $page->cid(); ?>" />
<button type="submit" name="do" value="save" id="btn-save"><?php _e('保存草稿'); ?></button>

View File

@@ -29,13 +29,13 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
<p>
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($post->text); ?></textarea>
<span id="auto-save-message"></span>
</p>
<?php include 'file-upload.php'; ?>
<?php Typecho_Plugin::factory('admin/write-post.php')->content($post); ?>
<p class="submit clearfix">
<span id="auto-save-message" class="left"></span>
<span class="right">
<input type="hidden" name="cid" value="<?php $post->cid(); ?>" />
<button type="submit" name="do" value="save" id="btn-save"><?php _e('保存草稿'); ?></button>