Browse Source

Releases v1.4.3

master
pandao 10 years ago
parent
commit
c4083b733d
  1. 16
      CHANGE.md
  2. 46
      README.md
  3. 2
      bower.json
  4. 18
      css/editormd.css
  5. 4
      css/editormd.logo.css
  6. 2
      css/editormd.logo.min.css
  7. 6
      css/editormd.min.css
  8. 12
      css/editormd.preview.css
  9. 6
      css/editormd.preview.min.css
  10. 36
      editormd.amd.js
  11. 7
      editormd.amd.min.js
  12. 36
      editormd.js
  13. 7
      editormd.min.js
  14. 24
      examples/custom-keyboard-shortcuts.html
  15. 2
      examples/simple.html
  16. 2
      lib/codemirror/addons.min.js
  17. 2
      lib/codemirror/modes.min.js
  18. 4
      package.json
  19. 6
      scss/editormd.codemirror.scss
  20. 6
      scss/editormd.preview.scss
  21. 2
      scss/editormd.scss
  22. 3
      scss/github-markdown.scss
  23. 32
      src/editormd.js
  24. 4248
      src/editormd.js~

16
CHANGE.md

@ -428,10 +428,22 @@ v1.2.0 主要更新:
- 修改示例文件`examples/katex.html`;
- 修复Bug [#66](https://github.com/pandao/editor.md/issues/66);
- 修复编辑器工具栏按钮`:hover` CSS3 transition无效的问题;
- 修改`README.md`;
- 修改`README.md`
####v1.4.2
- 改进和增强自定义工具栏功能,支持图标按钮右对齐[#69](https://github.com/pandao/editor.md/issues/69);
- 改进和增强HTML标签的解析过滤功能,支持过滤指定的属性等[#70](https://github.com/pandao/editor.md/issues/70);
- 删除分支`mathjax-version`和`v1.1.9`;
- 删除分支 `mathjax-version``v1.1.9`
####v1.4.3
- 改进:可配置是否自动聚焦编辑器 [#74](https://github.com/pandao/editor.md/issues/74);
- 新增配置项 `autoFocus`,默认值为 `true`;
- 修改 Bug [#77](https://github.com/pandao/editor.md/issues/77);
- 改进和完善编辑器配置项;
- 新增配置项 `tabSize`、`indentUnit` 和 `lineWrapping`
- 新增配置项 `autoCloseBrackets``showTrailingSpace`
- 新增配置项 `matchBrackets`、`indentWithTabs` 和 `styleSelectedText`
- 改进:修改 CSS `font-family`,改进跨平台中英文字体显示;
- 修改了 `README.md`

46
README.md

@ -9,49 +9,50 @@
![](https://img.shields.io/github/issues/pandao/editor.md.svg)
![](https://img.shields.io/bower/v/editor.md.svg)
**Editor.md** : The open source online markdown editor (component), based on CodeMirror & jQuery & Marked.
**Editor.md** : The open source embeddable online markdown editor (component), based on CodeMirror & jQuery & Marked.
### Features
- Support Standard Markdown / CommonMark and GFM(GitHub Flavored Markdown);
- Support Standard Markdown / CommonMark and GFM (GitHub Flavored Markdown);
- Full-featured: Real-time Preview, Image (cross-domain) upload, Preformatted text/Code blocks/Tables insert, Code fold, Search replace, Read only, Themes, Multi-languages, L18n, HTML entities, Code syntax highlighting...;
- Markdown Extras : Support [ToC (Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html), [Emoji](https://pandao.github.io/editor.md/examples/emoji.html), [Task lists](https://pandao.github.io/editor.md/examples/task-lists.html), [@Links](https://pandao.github.io/editor.md/examples/@links.html)...;
- Compatible with all major browsers (IE8+), compatible Zepto.js and iPad;
- Support identification, interpretation, fliter of the [HTML tags](https://pandao.github.io/editor.md/examples/html-tags-decode.html);
- Support TeX (LaTeX expressions, Based on KaTeX), Flowchart and Sequence Diagram of Markdown extended syntax;
- Support [decode & fliter of the HTML tags & attributes](https://pandao.github.io/editor.md/examples/html-tags-decode.html);
- Support [TeX (LaTeX expressions, Based on KaTeX)](https://pandao.github.io/editor.md/examples/katex.html), [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) and [Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html) of Markdown extended syntax;
- Support AMD/CMD (Require.js & Sea.js) Module Loader, and Custom/define editor plugins;
[README & Examples (English)](https://pandao.github.io/editor.md/en.html)
--------
**Editor.md** 是一个基于CodeMirror、jQuery 和 Marked 构建的开源 Markdown 在线编辑器(组件)
**Editor.md** 是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建
![editormd-screenshot](https://pandao.github.io/editor.md/examples/images/editormd-screenshot.png "editormd-screenshot")
#### 主要特性
- 支持通用Markdown / CommonMark 和Github风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html);
- 支持通用 Markdown / CommonMark 和 GFM (GitHub Flavored Markdown) 风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html);
- 支持实时预览、图片(跨域)上传、预格式文本/代码/表格插入、代码折叠、跳转到行、搜索替换、只读模式、自定义样式主题和多语言语法高亮等功能;
- 支持[ToC(Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html)、[Emoji表情](https://pandao.github.io/editor.md/examples/emoji.html)、[Task lists](https://pandao.github.io/editor.md/examples/task-lists.html)、[@链接](https://pandao.github.io/editor.md/examples/@links.html)等Markdown扩展语法;
- 支持TeX科学公式(基于[KaTeX](https://pandao.github.io/editor.md/examples/katex.html))、流程图 [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) 和 [时序图 Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html);
- 支持[识别和解析HTML标签,并且支持自定义过滤标签解析](https://pandao.github.io/editor.md/examples/html-tags-decode.html),具有可靠的安全性和几乎无限的扩展性;
- 支持 [ToC(Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html)、[Emoji表情](https://pandao.github.io/editor.md/examples/emoji.html)、[Task lists](https://pandao.github.io/editor.md/examples/task-lists.html)、[@链接](https://pandao.github.io/editor.md/examples/@links.html)等 Markdown 扩展语法;
- 支持 TeX 科学公式(基于 [KaTeX](https://pandao.github.io/editor.md/examples/katex.html))、流程图 [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) 和 [时序图 Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html);
- 支持[识别和解析 HTML 标签,并且支持自定义过滤标签及属性解析](https://pandao.github.io/editor.md/examples/html-tags-decode.html),具有可靠的安全性和几乎无限的扩展性;
- 支持 AMD / CMD 模块化加载(支持 [Require.js](https://pandao.github.io/editor.md/examples/use-requirejs.html) & [Sea.js](https://pandao.github.io/editor.md/examples/use-seajs.html)),并且支持[自定义扩展插件](https://pandao.github.io/editor.md/examples/define-plugin.html);
- 兼容主流的浏览器(IE8+)和[Zepto.js](https://pandao.github.io/editor.md/examples/use-zepto.html),且支持iPad等平板设备;
- 兼容主流的浏览器(IE8+)和 [Zepto.js](https://pandao.github.io/editor.md/examples/use-zepto.html),且支持 iPad 等平板设备;
#### 在线演示 (Examples)
#### Examples
[https://pandao.github.io/editor.md/examples/index.html](https://pandao.github.io/editor.md/examples/index.html)
#### 下载和安装 (Download & install)
#### Download & install
[Github download](https://github.com/pandao/editor.md/archive/master.zip)
通过 [Github下载安装](https://github.com/pandao/editor.md/archive/master.zip),或者通过 Bower 安装:
Bower install :
bower install editor.md
#### 使用方法 (Usage)
#### Usages
HTML:
@ -60,7 +61,7 @@ HTML:
<textarea style="display:none;">### Hello world!</textarea>
</div>
> 提示1:如果没有Markdown源内容或者通过Ajax异步加载Markdown源文档等,可以不添加`<textarea>`,会自动添加;
> Tip: Editor.md can auto append `<textarea>` tag;
javascript:
@ -69,7 +70,7 @@ javascript:
<script type="text/javascript">
$(function() {
var editor = editormd("editormd", {
path : "../lib/" // codemirror, marked等依赖的库的路径
path : "../lib/" // Autoload modules mode, codemirror, marked... dependents libs path
});
/*
@ -81,12 +82,13 @@ javascript:
*/
});
</script>
Using modular script loader :
> Require.js的使用方法:[https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html](https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html)
> Sea.js的使用方法:[https://github.com/pandao/editor.md/tree/master/examples/use-seajs.html](https://github.com/pandao/editor.md/tree/master/examples/use-seajs.html)
- [Using Require.js](https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html)
- [Using Sea.js](https://github.com/pandao/editor.md/tree/master/examples/use-seajs.html)
#### 依赖项目及感谢 (Dependents)
#### Dependents
- [CodeMirror](http://codemirror.net/ "CodeMirror")
- [marked](https://github.com/chjj/marked "marked")
@ -102,7 +104,7 @@ javascript:
#### Changes
[更新日志 Change logs](https://github.com/pandao/editor.md/blob/master/CHANGE.md)
[Change logs](https://github.com/pandao/editor.md/blob/master/CHANGE.md)
#### License

2
bower.json

@ -1,6 +1,6 @@
{
"name": "editor.md",
"version": "1.4.2",
"version": "1.4.3",
"homepage": "https://github.com/pandao/editor.md",
"authors": [
"Pandao <pandao@vip.qq.com>"

18
css/editormd.css

@ -2,12 +2,12 @@
* Editor.md
*
* @file editormd.css
* @version v1.4.2
* @version v1.4.3
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-04-22
* @updateTime 2015-05-05
*/
@charset "UTF-8";
@ -24,7 +24,7 @@
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", Helvetica, Tahoma, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
}
.editormd a {
text-decoration: none;
@ -648,11 +648,14 @@
z-index: 10;
float: left;
border-right: 1px solid #ddd;
font-size: 13px;
font-size: 14px;
font-family: Consolas, 'Monaco', courier, monospace;
line-height: 1.6;
margin-top: 35px;
}
.editormd .CodeMirror pre {
font-size: 14px;
}
.editormd .CodeMirror-selected {
background: #70B7FF;
}
@ -3134,7 +3137,7 @@
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-family: "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Helvetica, "Segoe UI", Tahoma, STXihei, "华文细黑", STHeiti, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;
@ -3817,7 +3820,7 @@
background: #f6f6f6;
padding: 3px;
border-radius: 3px;
font-size: 13px;
font-size: 14px;
font-family: Consolas, 'Monaco', courier, monospace;
}
.editormd-preview-container pre, .editormd-html-preview pre {
@ -4157,6 +4160,9 @@ li.L9 {
.markdown-body .editormd-toc-menu ul {
padding-left: 0;
}
.markdown-body .highlight pre, .markdown-body pre {
line-height: 1.6;
}
hr.editormd-page-break {
border: 1px dotted #ccc;

4
css/editormd.logo.css

@ -2,12 +2,12 @@
* Editor.md
*
* @file editormd.logo.css
* @version v1.4.2
* @version v1.4.3
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-04-22
* @updateTime 2015-05-05
*/
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */

2
css/editormd.logo.min.css

@ -1,2 +1,2 @@
/*! Editor.md v1.4.2 | editormd.logo.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-04-22 */
/*! Editor.md v1.4.3 | editormd.logo.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-05-05 */
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */@font-face{font-family:editormd-logo;src:url(../fonts/editormd-logo.eot?-5y8q6h);src:url(.../fonts/editormd-logo.eot?#iefix-5y8q6h)format("embedded-opentype"),url(../fonts/editormd-logo.woff?-5y8q6h)format("woff"),url(../fonts/editormd-logo.ttf?-5y8q6h)format("truetype"),url(../fonts/editormd-logo.svg?-5y8q6h#icomoon)format("svg");font-weight:400;font-style:normal}.editormd-logo,.editormd-logo-1x,.editormd-logo-2x,.editormd-logo-3x,.editormd-logo-4x,.editormd-logo-5x,.editormd-logo-6x,.editormd-logo-7x,.editormd-logo-8x{font-family:editormd-logo;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;font-size:inherit;line-height:1;display:inline-block;text-rendering:auto;vertical-align:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.editormd-logo-1x:before,.editormd-logo-2x:before,.editormd-logo-3x:before,.editormd-logo-4x:before,.editormd-logo-5x:before,.editormd-logo-6x:before,.editormd-logo-7x:before,.editormd-logo-8x:before,.editormd-logo:before{content:"\e1987"}.editormd-logo-1x{font-size:1em}.editormd-logo-lg{font-size:1.2em}.editormd-logo-2x{font-size:2em}.editormd-logo-3x{font-size:3em}.editormd-logo-4x{font-size:4em}.editormd-logo-5x{font-size:5em}.editormd-logo-6x{font-size:6em}.editormd-logo-7x{font-size:7em}.editormd-logo-8x{font-size:8em}.editormd-logo-color{color:#2196F3}

6
css/editormd.min.css

File diff suppressed because one or more lines are too long

12
css/editormd.preview.css

@ -2,14 +2,15 @@
* Editor.md
*
* @file editormd.preview.css
* @version v1.4.2
* @version v1.4.3
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-04-22
* @updateTime 2015-05-05
*/
@charset "UTF-8";
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */
/*!
* Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
@ -2457,7 +2458,7 @@
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-family: "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Helvetica, "Segoe UI", Tahoma, STXihei, "华文细黑", STHeiti, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;
@ -3140,7 +3141,7 @@
background: #f6f6f6;
padding: 3px;
border-radius: 3px;
font-size: 13px;
font-size: 14px;
font-family: Consolas, 'Monaco', courier, monospace;
}
.editormd-preview-container pre, .editormd-html-preview pre {
@ -3480,6 +3481,9 @@ li.L9 {
.markdown-body .editormd-toc-menu ul {
padding-left: 0;
}
.markdown-body .highlight pre, .markdown-body pre {
line-height: 1.6;
}
hr.editormd-page-break {
border: 1px dotted #ccc;

6
css/editormd.preview.min.css

File diff suppressed because one or more lines are too long

36
editormd.amd.js

@ -2,12 +2,12 @@
* Editor.md
*
* @file editormd.amd.js
* @version v1.4.2
* @version v1.4.3
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-04-22
* @updateTime 2015-05-05
*/
;(function(factory) {
@ -129,7 +129,7 @@
};
editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.4.2";
editormd.version = "1.4.3";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";
@ -168,18 +168,27 @@
height : "100%",
path : "./lib/", // Dependents module file directory
pluginPath : "", // If this empty, default use settings.path + "../plugins/"
delay : 300,
delay : 300, // Delay parse markdown to html, Uint : ms
autoLoadModules : true, // Automatic load dependent module files
watch : true,
placeholder : "Enjoy Markdown! coding now...",
gotoLine : true,
codeFold : false,
autoHeight : false,
autoFocus : true,
autoCloseTags : true,
searchReplace : true,
syncScrolling : true,
readOnly : false,
tabSize : 4,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
autoCloseBrackets : true,
showTrailingSpace : true,
matchBrackets : true,
indentWithTabs : true,
styleSelectedText : true,
matchWordHighlight : true, // options: true, false, "onselected"
styleActiveLine : true, // Highlight the current line
dialogLockScreen : true,
@ -685,14 +694,14 @@
var codeMirrorConfig = {
mode : settings.mode,
theme : settings.theme,
tabSize : 4,
tabSize : settings.tabSize,
dragDrop : false,
autofocus : true,
autofocus : settings.autoFocus,
autoCloseTags : settings.autoCloseTags,
readOnly : (settings.readOnly) ? "nocursor" : false,
indentUnit : 4,
indentUnit : settings.indentUnit,
lineNumbers : settings.lineNumbers,
lineWrapping : true,
lineWrapping : settings.lineWrapping,
extraKeys : {
"Ctrl-Q": function(cm) {
cm.foldCode(cm.getCursor());
@ -700,12 +709,12 @@
},
foldGutter : settings.codeFold,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
matchBrackets : settings.matchBrackets,
indentWithTabs : settings.indentWithTabs,
styleActiveLine : settings.styleActiveLine,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
styleSelectedText : settings.styleSelectedText,
autoCloseBrackets : settings.autoCloseBrackets,
showTrailingSpace : settings.showTrailingSpace,
highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } )
};
@ -3787,6 +3796,7 @@
smartypants : true
};
markdownDoc = new String(markdownDoc);
markdownDoc = editormd.filterHTMLTags(markdownDoc, settings.htmlDecode);
var markdownParsed = marked(markdownDoc, markedOptions);

7
editormd.amd.min.js

File diff suppressed because one or more lines are too long

36
editormd.js

@ -2,12 +2,12 @@
* Editor.md
*
* @file editormd.js
* @version v1.4.2
* @version v1.4.3
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-04-22
* @updateTime 2015-05-05
*/
;(function(factory) {
@ -59,7 +59,7 @@
};
editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.4.2";
editormd.version = "1.4.3";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";
@ -98,18 +98,27 @@
height : "100%",
path : "./lib/", // Dependents module file directory
pluginPath : "", // If this empty, default use settings.path + "../plugins/"
delay : 300,
delay : 300, // Delay parse markdown to html, Uint : ms
autoLoadModules : true, // Automatic load dependent module files
watch : true,
placeholder : "Enjoy Markdown! coding now...",
gotoLine : true,
codeFold : false,
autoHeight : false,
autoFocus : true,
autoCloseTags : true,
searchReplace : true,
syncScrolling : true,
readOnly : false,
tabSize : 4,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
autoCloseBrackets : true,
showTrailingSpace : true,
matchBrackets : true,
indentWithTabs : true,
styleSelectedText : true,
matchWordHighlight : true, // options: true, false, "onselected"
styleActiveLine : true, // Highlight the current line
dialogLockScreen : true,
@ -615,14 +624,14 @@
var codeMirrorConfig = {
mode : settings.mode,
theme : settings.theme,
tabSize : 4,
tabSize : settings.tabSize,
dragDrop : false,
autofocus : true,
autofocus : settings.autoFocus,
autoCloseTags : settings.autoCloseTags,
readOnly : (settings.readOnly) ? "nocursor" : false,
indentUnit : 4,
indentUnit : settings.indentUnit,
lineNumbers : settings.lineNumbers,
lineWrapping : true,
lineWrapping : settings.lineWrapping,
extraKeys : {
"Ctrl-Q": function(cm) {
cm.foldCode(cm.getCursor());
@ -630,12 +639,12 @@
},
foldGutter : settings.codeFold,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
matchBrackets : settings.matchBrackets,
indentWithTabs : settings.indentWithTabs,
styleActiveLine : settings.styleActiveLine,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
styleSelectedText : settings.styleSelectedText,
autoCloseBrackets : settings.autoCloseBrackets,
showTrailingSpace : settings.showTrailingSpace,
highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } )
};
@ -3717,6 +3726,7 @@
smartypants : true
};
markdownDoc = new String(markdownDoc);
markdownDoc = editormd.filterHTMLTags(markdownDoc, settings.htmlDecode);
var markdownParsed = marked(markdownDoc, markedOptions);

7
editormd.min.js

File diff suppressed because one or more lines are too long

24
examples/custom-keyboard-shortcuts.html

@ -61,7 +61,9 @@ var testEditor = editormd("test-editormd", {
<script type="text/javascript">
var testEditor;
$(function() {
$(function() {
var widgets = [];
testEditor = editormd("test-editormd", {
width: "90%",
height: 720,
@ -69,6 +71,16 @@ var testEditor = editormd("test-editormd", {
disabledKeyMaps : [
"Ctrl-B", "F11", "F10" // disable some default keyboard shortcuts handle
],
onchange : function() {
$("#test").remove();
var cm = this.cm;
var cursor = cm.getCursor();
//cm.replaceSelection("@");
widgets.push(cm.addWidget({line : cursor.line, ch : cursor.ch}, $("<p style='z-index:100000;background:red;color:#fff;padding:5px;' id='test'>fsdfsdfsdf</p>")[0], true));
console.log(cm.getCursor(), cm.getLine(cursor.line), cm.getLineTokens(cursor.line));
},
onload : function() {
var keyMap = {
"Ctrl-S": function(cm) {
@ -79,9 +91,15 @@ var testEditor = editormd("test-editormd", {
// custom
alert("Ctrl+A");
cm.execCommand("selectAll");
}
},
//"Shift-2" : function(cm){
//}
};
this.cm.on("keyup", function(cm){
//$("#test").remove();
});
// setting signle key
var keyMap2 = {
"Ctrl-T": function(cm) {
@ -93,7 +111,7 @@ var testEditor = editormd("test-editormd", {
this.addKeyMap(keyMap2);
this.removeKeyMap(keyMap2); // remove signle key
}
});
});
});
</script>
</body>

2
examples/simple.html

@ -34,7 +34,7 @@
images/
plugins/
examples/
languages/
languages/
editormd.js
...

2
lib/codemirror/addons.min.js

File diff suppressed because one or more lines are too long

2
lib/codemirror/modes.min.js

File diff suppressed because one or more lines are too long

4
package.json

@ -1,6 +1,6 @@
{
"name": "editor.md",
"version": "1.4.2",
"version": "1.4.3",
"description": "Open source online markdown editor.",
"directories": {
"doc": "docs",
@ -27,7 +27,7 @@
"homepage": "https://github.com/pandao/editor.md",
"devDependencies": {
"dateformatter": "^0.1.0",
"gulp": "^3.8.10",
"gulp": "^3.8.11",
"gulp-concat": "^2.4.2",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.9.0",

6
scss/editormd.codemirror.scss

@ -26,10 +26,14 @@
z-index: 10;
float: left;
border-right: 1px solid $borderColor;
font-size: 13px;
font-size: 14px;
font-family: Consolas, 'Monaco', courier, monospace;
line-height: 1.6;
margin-top: 35px;
pre {
font-size: 14px;
}
}
.CodeMirror-selected {

6
scss/editormd.preview.scss

@ -44,7 +44,7 @@
background: #f6f6f6;
padding: 3px;
border-radius: 3px;
font-size: 13px;
font-size: 14px;
font-family: Consolas, 'Monaco', courier, monospace;
}
@ -248,6 +248,10 @@
padding-left: 0;
}
}
.highlight pre, pre {
line-height: 1.6;
}
}
hr.editormd-page-break {

2
scss/editormd.scss

@ -13,7 +13,7 @@
margin-bottom: 15px;
border: 1px solid $borderColor;
@include box-sizing(border-box);
font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", Helvetica, Tahoma, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
a {
text-decoration: none;

3
scss/github-markdown.scss

@ -11,7 +11,8 @@
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
//font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-family: "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Helvetica, "Segoe UI", Tahoma, STXihei, "华文细黑", STHeiti, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;

32
src/editormd.js

@ -47,7 +47,7 @@
};
editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.4.2";
editormd.version = "1.4.3";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";
@ -86,18 +86,27 @@
height : "100%",
path : "./lib/", // Dependents module file directory
pluginPath : "", // If this empty, default use settings.path + "../plugins/"
delay : 300,
delay : 300, // Delay parse markdown to html, Uint : ms
autoLoadModules : true, // Automatic load dependent module files
watch : true,
placeholder : "Enjoy Markdown! coding now...",
gotoLine : true,
codeFold : false,
autoHeight : false,
autoFocus : true,
autoCloseTags : true,
searchReplace : true,
syncScrolling : true,
readOnly : false,
tabSize : 4,
indentUnit : 4,
lineNumbers : true,
lineWrapping : true,
autoCloseBrackets : true,
showTrailingSpace : true,
matchBrackets : true,
indentWithTabs : true,
styleSelectedText : true,
matchWordHighlight : true, // options: true, false, "onselected"
styleActiveLine : true, // Highlight the current line
dialogLockScreen : true,
@ -603,14 +612,14 @@
var codeMirrorConfig = {
mode : settings.mode,
theme : settings.theme,
tabSize : 4,
tabSize : settings.tabSize,
dragDrop : false,
autofocus : true,
autofocus : settings.autoFocus,
autoCloseTags : settings.autoCloseTags,
readOnly : (settings.readOnly) ? "nocursor" : false,
indentUnit : 4,
indentUnit : settings.indentUnit,
lineNumbers : settings.lineNumbers,
lineWrapping : true,
lineWrapping : settings.lineWrapping,
extraKeys : {
"Ctrl-Q": function(cm) {
cm.foldCode(cm.getCursor());
@ -618,12 +627,12 @@
},
foldGutter : settings.codeFold,
gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets : true,
indentWithTabs : true,
matchBrackets : settings.matchBrackets,
indentWithTabs : settings.indentWithTabs,
styleActiveLine : settings.styleActiveLine,
styleSelectedText : true,
autoCloseBrackets : true,
showTrailingSpace : true,
styleSelectedText : settings.styleSelectedText,
autoCloseBrackets : settings.autoCloseBrackets,
showTrailingSpace : settings.showTrailingSpace,
highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } )
};
@ -3705,6 +3714,7 @@
smartypants : true
};
markdownDoc = new String(markdownDoc);
markdownDoc = editormd.filterHTMLTags(markdownDoc, settings.htmlDecode);
var markdownParsed = marked(markdownDoc, markedOptions);

4248
src/editormd.js~

File diff suppressed because it is too large
Loading…
Cancel
Save