增加more按钮

This commit is contained in:
joyqi 2013-11-03 20:33:38 +08:00
parent 11e6f9846b
commit de162eea47
2 changed files with 24 additions and 3 deletions

View File

@ -36,12 +36,13 @@ $(document).ready(function () {
headingexample: '<?php _e('标题文字'); ?>',
hr: '<?php _e('分割线'); ?> <hr> Ctrl+R',
more: '<?php _e('摘要分割线'); ?> <!--more--> Ctrl+M',
undo: '<?php _e('撤销'); ?> - Ctrl+Z',
redo: '<?php _e('重做'); ?> - Ctrl+Y',
redomac: '<?php _e('重做'); ?> - Ctrl+Shift+Z',
fullscreen: '<?php _e('全屏'); ?> - Ctrl+M',
fullscreen: '<?php _e('全屏'); ?> - Ctrl+J',
exitFullscreen: '<?php _e('退出全屏'); ?> - Ctrl+E',
fullscreenUnsupport: '<?php _e('此浏览器不支持全屏操作'); ?>',

View File

@ -225,6 +225,15 @@ this.makeHtml = function(text) {
return all;
});
if (text.indexOf('<!--more-->')) {
var parts = text.split(/\s*<\!\-\-more\-\->\s*/),
summary = parts.shift(),
details = parts.join('');
text = '<div class="summary">' + summary + '</div>'
+ '<div class="details">' + details + '</div>';
}
if (self.postConversion) {
text = self.postConversion(text);
}
@ -3066,8 +3075,9 @@ else
heading: "Heading <h1>/<h2> Ctrl+H",
headingexample: "Heading",
more: "More contents <!--more--> Ctrl+M",
fullscreen: 'FullScreen Ctrl+M',
fullscreen: 'FullScreen Ctrl+J',
exitFullscreen: 'Exit FullScreen Ctrl+E',
fullscreenUnsupport: 'Sorry, the browser dont support fullscreen api',
@ -4317,6 +4327,9 @@ else
doClick(buttons.ulist);
break;
case 'm':
doClick(buttons.more);
break;
case 'j':
doClick(buttons.fullscreen);
break;
case 'e':
@ -4558,6 +4571,7 @@ else
}));
buttons.heading = makeButton("wmd-heading-button", getString("heading"), "-160px", bindCommand("doHeading"));
buttons.hr = makeButton("wmd-hr-button", getString("hr"), "-180px", bindCommand("doHorizontalRule"));
buttons.more = makeButton("wmd-more-button", getString("more"), "-280px", bindCommand("doMore"));
makeSpacer(3);
buttons.undo = makeButton("wmd-undo-button", getString("undo"), "-200px", null);
buttons.undo.execute = function (manager) { if (manager) manager.undo(); };
@ -4580,7 +4594,7 @@ else
helpButton.appendChild(helpButtonImage);
helpButton.className = "wmd-button wmd-help-button";
helpButton.id = "wmd-help-button" + postfix;
helpButton.XShift = "-280px";
helpButton.XShift = "-300px";
helpButton.isHelp = true;
helpButton.style.right = "0px";
helpButton.title = getString("help");
@ -5290,6 +5304,12 @@ else
chunk.skipLines(2, 1, true);
}
commandProto.doMore = function (chunk, postProcessing) {
chunk.startTag = "<!--more-->\n\n";
chunk.selection = "";
chunk.skipLines(2, 1, true);
}
commandProto.doTab = function (chunk, postProcessing) {
chunk.startTag = " ";
chunk.selection = "";