升级markdown

This commit is contained in:
joyqi
2013-10-18 15:44:02 +08:00
parent 23e0d2a82a
commit e6697248ac
6 changed files with 52 additions and 21 deletions
+1 -1
View File
@@ -3314,7 +3314,7 @@ else
function PanelCollection(postfix) {
this.buttonBar = doc.getElementById("wmd-button-bar" + postfix);
this.preview = doc.getElementById("wmd-preview" + postfix);
this.input = doc.getElementById("wmd-input" + postfix);
this.input = doc.getElementById("text");
};
// Returns true if the DOM element is visible, false if it's hidden.
+49
View File
@@ -156,4 +156,53 @@ $(document).ready(function() {
});
</script>
<?php $content = !empty($post) ? $post : $page; if ($options->markdown && (!$content->have() || $content->isMarkdown)): ?>
<script src="<?php $options->adminUrl('js/markdown.js?v=' . $suffixVersion); ?>"></script>
<script>
$(document).ready(function () {
var toolbar = $('<p class="editor" id="wmd-button-bar" />').insertBefore($('#text').parent())
preview = $('<div id="wmd-preview" />').insertAfter('.submit');
var converter = new Showdown.converter(), options = {};
options.strings = {
bold: '<?php _e('加粗'); ?> <strong> Ctrl+B',
boldexample: '<?php _e('加粗文字'); ?>',
italic: '<?php _e('斜体'); ?> <em> Ctrl+I',
italicexample: '<?php _e('斜体文字'); ?>',
link: '<?php _e('链接'); ?> <a> Ctrl+L',
linkdescription: '<?php _e('请输入链接描述'); ?>',
quote: '<?php _e('引用'); ?> <blockquote> Ctrl+Q',
quoteexample: '<?php _e('引用文字'); ?>',
code: '<?php _e('代码'); ?> <pre><code> Ctrl+K',
codeexample: '<?php _e('请输入代码'); ?>',
image: '<?php _e('图片'); ?> <img> Ctrl+G',
imagedescription: '<?php _e('请输入图片描述'); ?>',
olist: '<?php _e('数字列表'); ?> <ol> Ctrl+O',
ulist: '<?php _e('普通列表'); ?> <ul> Ctrl+U',
litem: '<?php _e('列表项目'); ?>',
heading: '<?php _e('标题'); ?> <h1>/<h2> Ctrl+H',
headingexample: '<?php _e('标题文字'); ?>',
hr: '<?php _e('分割线'); ?> <hr> Ctrl+R',
undo: '<?php _e('撤销'); ?> - Ctrl+Z',
redo: '<?php _e('重做'); ?> - Ctrl+Y',
redomac: '<?php _e('重做'); ?> - Ctrl+Shift+Z',
help: '<?php _e('Markdown语法帮助'); ?>'
};
var editor = new Markdown.Editor(converter, '', options);
editor.run();
});
</script>
<?php endif; ?>
-2
View File
@@ -41,8 +41,6 @@ Typecho_Widget::widget('Widget_Contents_Page_Edit')->to($page);
<button type="submit" name="do" value="publish" class="primary" id="btn-submit"><?php _e('发布页面'); ?></button>
</span>
</p>
<div id="typecho-preview-box"></div>
</div>
<div class="col-mb-12 col-tb-3">
<section class="typecho-post-option">
-16
View File
@@ -27,21 +27,6 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
<p class="mono url-slug"><?php echo preg_replace("/\[slug:?[_0-9a-z-:]*\]/i", $input, $permalink); ?></p>
<?php endif; ?>
<p class="editor">
<span class="btnBold">bold</span><!--
--><span class="btnItalic">italic</span><!--
--><span class="btnLink">link</span><!--
--><span class="btnQuote">quote</span><!--
--><span class="btnDel">del</span><!--
--><span class="btnImg">img</span><!--
--><span class="btnUl">ul</span><!--
--><span class="btnOl">ol</span><!--
--><span class="btnHeading">title</span><!--
--><span class="btnCode">code</span><!--
--><span class="btnPre">pre</span><!--
--><span class="btnMore">more</span><!--
--><span class="btnHr">hr</span>
</p>
<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>
@@ -57,7 +42,6 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
<button type="submit" name="do" value="publish" class="primary" id="btn-submit"><?php _e('发布文章'); ?></button>
</span>
</p>
<!-- <div id="typecho-preview-box">预览</div> -->
</div>
<div class="col-mb-12 col-tb-3">
<section class="typecho-post-option">
+1 -1
View File
@@ -20,7 +20,7 @@
class Typecho_Common
{
/** 程序版本 */
const VERSION = '0.9/13.10.8';
const VERSION = '0.9/13.10.18';
/**
* 缓存的包含路径
+1 -1
View File
@@ -271,7 +271,7 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
public function updateOptions()
{
$settings['autoSave'] = $this->request->autoSave ? 1 : 0;
//$settings['useRichEditor'] = $this->request->useRichEditor;
$settings['markdown'] = $this->request->markdown ? 1 : 0;
$settings['defaultAllowComment'] = is_array($this->request->defaultAllow)
&& in_array('comment', $this->request->defaultAllow) ? 1 : 0;