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

leanote/markdown-editor-v2: Markdown Editor V2 (Support Vim & Emacs Mode) For Leanote Web & Leanote Desktop App #74

Open
yaohunzhanyue opened this issue Apr 13, 2020 · 0 comments
Labels

Comments

@yaohunzhanyue
Copy link
Owner

Markdown Editor For Leanote Web & Desktop App

Leanote's Markdown Editor originally forked from Stackedit-v3.1.14. The Stackedit source is under Apache License (http://www.apache.org/licenses/LICENSE-2.0) and the code updated by Leanote is under GPL v2.

Difference with Leanote-Markdown-Editor

  • Use Ace Editor as main editor
  • Support Vim & Emacs mode

Branches

Build

Please install node and gulp firstly.

> gulp # build & minify res-min/main-v2.js (https://github.com/leanote/leanote/blob/master/public/dist/main-v2.js), res-min/main-v2.min.js (https://github.com/leanote/leanote/blob/master/public/dist/main-v2.min.js)

Local Debug

> node server.js

See: http://localhost:3001/editor.html


Integrated With Leanote

Copy res-min/main-v2.min.js to leanote's path /public/dist/.

Update node-dev.html with:

<script>
initPage();
window.require = {
    baseUrl: '/public',
};
</script>

<!-- pro_markdown_js -->

<!-- dev -->
<script src="/js/require.js"></script>
<script src="/public/dist/main-v2.min.js"></script>
<!-- /dev -->

<script src="/public/js/plugins/main.js"></script>
</body>

Source Debug With Leanote

Replace node-dev.html with:

<script>
initPage();
window.require = {
    baseUrl: '/public/res', // link to res
};
</script>

<!-- pro_markdown_js -->

<!-- dev -->
<script src="/js/require.js"></script>
<script src="/public/res/main.js"></script>
<!-- /dev -->

<!--
<script src="/public/js/plugins/main.js"></script>
-->
</body>

Leanote-Markdown-Editor 的不同

  • 使用Ace编辑器作为主要的编辑器
  • 支持Vim和Emacs编辑模式

构建

确保在此之前安装了node, gulp

> gulp # 生成 res-min/main-v2.js (https://github.com/leanote/leanote/blob/master/public/dist/main-v2.js) 和 res-min/main-v2.min.js (https://github.com/leanote/leanote/blob/master/public/dist/main-v2.min.js)

本地调试

> node server.js

访问: http://localhost:3001/editor.html


Leanote 使用本 Markdown v2 编辑器

res-min/main-v2.min.js 复制到leanote的 /public/dist/

node-dev.html:

<script>
initPage();
// 当tinymce.dev.js时, 请注释require
window.require = {
    baseUrl: '/public',
};
</script>

<!-- pro_markdown_js -->

<!-- dev -->
<script src="/js/require.js"></script>
<script src="/public/dist/main-v2.min.js"></script>
<!-- /dev -->

<script src="/public/js/plugins/main.js"></script>
</body>

Leanote 调试 Markdown 编辑器的源码

替换node-dev.html

<script>
initPage();
window.require = {
    baseUrl: '/public/res', // res指向源码
};
</script>

<!-- pro_markdown_js -->

<!-- dev -->
<script src="/js/require.js"></script>
<script src="/public/res/main.js"></script>
<!-- /dev -->

<!--
不要
<script src="/public/js/plugins/main.js"></script>
-->
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant