Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown编辑和预览能否左右分屏 #9

Open
rockliuxn opened this issue Apr 13, 2016 · 1 comment
Open

Markdown编辑和预览能否左右分屏 #9

rockliuxn opened this issue Apr 13, 2016 · 1 comment

Comments

@rockliuxn
Copy link

�如题, 编辑时上下分屏,这样不能实时看到编辑结果,要来回的上下滚屏才能预览,这样非常不方便,左右分屏的话就很好,希望采纳!

@rockliuxn rockliuxn changed the title Markdown编辑和阅览能否左右分屏 Markdown编辑和预览能否左右分屏 Apr 13, 2016
@iamroma
Copy link

iamroma commented May 27, 2016

可以的。 @rockliuxn
官方好像是不支持,不过可以通过自己修改源码实现Markdown编辑左右分屏。

以下是我的个人实践,在 simditor-markdown.js 文件中添加如下代码:

SimditorMarkdown.prototype.command = function() {
var button, i, len, ref;

    $(".markdown-editor").css("display", "inline-block")
        .css("width", "50%")
        .css("height", "100%")
        .css("min-height", "500px")
        .css("float", "left");
    $(".simditor .markdown-editor textarea").css("min-height", "500px");

    $(".simditor-body").css("display", "inline-block")
        .css("width", "50%")
        .css("height", "100%")
        .css("min-height", "500px")
        .css("float", "right");

this.editor.blur();

......

} else {
this.textarea.val('');
this.editor.body.attr('contenteditable', 'true');

      $(".markdown-editor").removeAttr("style");
      $(".simditor-body").removeAttr("style");

}

下面是源码修改后的效果图:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants