From 4ca9b47a443d6633adac4486ca0f2dc0edc45b37 Mon Sep 17 00:00:00 2001 From: pandao Date: Mon, 23 Mar 2015 08:22:12 +0800 Subject: [PATCH] Releases v1.4.0 --- .gitignore | 2 +- CHANGE.md | 73 +- Gulpfile.js | 49 +- README.md | 42 +- bower.json | 4 +- css/editormd.css | 8258 +++++++++-------- css/editormd.logo.css | 189 +- css/editormd.logo.min.css | 11 +- css/editormd.min.css | 31 +- css/editormd.preview.css | 4399 +++++++-- css/editormd.preview.min.css | 14 +- editormd.amd.js | 1117 ++- editormd.amd.min.js | 7 +- editormd.amd.min.js.map | 2 - editormd.js | 1117 ++- editormd.min.js | 8 +- editormd.min.js.map | 2 - examples/@links.html | 14 + examples/auto-height.html | 27 +- examples/delay-renderer-preview.html | 56 + examples/form-get-value.html | 27 +- examples/full.html | 24 +- examples/goto-line.html | 84 + examples/html-preview-markdown-to-html.html | 38 +- examples/index.html | 231 +- examples/on-off.html | 43 +- examples/onchange.html | 16 +- examples/onfullscreen.html | 19 +- examples/onload.html | 15 +- examples/onpreviewing-onpreviewed.html | 15 +- examples/onresize.html | 11 +- examples/onscroll-onpreviewscroll.html | 22 +- examples/onwatch-onunwatch.html | 16 +- examples/page-break.html | 87 + examples/readonly.html | 51 +- examples/resettings.html | 102 +- examples/search-replace.html | 4 +- examples/sequence-diagram.html | 16 +- examples/simple.html | 43 +- examples/test.md | 18 +- examples/toc.html | 99 +- examples/use-requirejs.html | 24 +- examples/use-seajs.html | 27 +- examples/use-zepto.html | 21 +- languages/en.js | 20 +- languages/zh-tw.js | 26 +- lib/codemirror/addons.min.js | 7 +- lib/codemirror/addons.min.js.map | 2 - lib/codemirror/modes.min.js | 17 +- lib/codemirror/modes.min.js.map | 2 - package.json | 6 +- plugins/goto-line-dialog/goto-line-dialog.js | 157 + plugins/help-dialog/help-dialog.js | 20 +- plugins/help-dialog/help.md | 4 + plugins/image-dialog/image-dialog.js | 24 +- .../reference-link-dialog.js} | 81 +- plugins/table-dialog/table-dialog.js | 4 +- scss/editormd.dialog.scss | 22 + scss/editormd.preview.scss | 155 + scss/editormd.scss | 8 +- scss/lib/prefixes.scss | 9 +- src/editormd.js | 1111 ++- 62 files changed, 11685 insertions(+), 6465 deletions(-) delete mode 100644 editormd.amd.min.js.map delete mode 100644 editormd.min.js.map create mode 100644 examples/delay-renderer-preview.html create mode 100644 examples/goto-line.html create mode 100644 examples/page-break.html delete mode 100644 lib/codemirror/addons.min.js.map delete mode 100644 lib/codemirror/modes.min.js.map create mode 100644 plugins/goto-line-dialog/goto-line-dialog.js rename plugins/{anchor-link-dialog/anchor-link-dialog.js => reference-link-dialog/reference-link-dialog.js} (60%) diff --git a/.gitignore b/.gitignore index 41f92bf..9a85439 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ node_modules/ research/ test/ backup/ -examples/uploads/ +examples/uploads/**/* *.bat *.sh .project diff --git a/CHANGE.md b/CHANGE.md index b78fa61..2938392 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -346,4 +346,75 @@ v1.2.0 主要更新: - 新增配置项`atLink`,默认为`true`; - 修复无法输入`/`的问题 [#42](https://github.com/pandao/editor.md/issues/42); - 修改使用帮助说明的错误 [#43](https://github.com/pandao/editor.md/issues/43); -- 新增配置项`pluginPath`,默认为空时,等于`settings.path + "../plugins/"`; \ No newline at end of file +- 新增配置项`pluginPath`,默认为空时,等于`settings.path + "../plugins/"`; + +### v1.4 + +#### v1.4.0 + +主要更新: + +- 新增延迟解析机制,预览更即时; +- 新增跳转到指定行的功能和对话框; +- 新增ToC下拉菜单、自定义ToC容器的功能; +- 新增跳转到行、搜索的工具栏按钮; +- 新增支持插入和解析(打印)分页符; +- 改进快捷键功能和自动高度模式等; +- 改进:将锚点链接改名为引用链接; +- 改进编辑器重建和重配置功能; +- 修复多个Bug; + +具体更新: + +- 新增延迟解析预览的机制,解决输入太多太快出现的 “延迟卡顿” 问题; + - 新增配置项`delay`,默认值为 `300`; + - 修复当输入速度太快时,解析Flowchart会抛出错误的问题; +- 修改iPad等移动终端的浏览器无法上传图片的问题[#48](https://github.com/pandao/editor.md/issues/48); +- 修复单独引用`editormd.preview.css`时无法显示Font Awesome和Editor.md logo字体的问题; +- 更新和修改Gulp构建; + - 修改了`Gulpfile.js`,并且`gulp-ruby-sass`升级到最新版本`1.0.0-alpha.3`; + - 编辑SCSS时,不再生成CSS的Source map文件; +- 执行jshint和更正一些JS写法的不规范,精简了代码; +- 新增配置项`appendMarkdown`和`appendMarkdown()`方法,用于(初始化前后)追加Markdown到Textarea; +- 改进部分预设快捷键功能,包括F9(watch)、F10(preview)、F11(fullscreen)等; +- 修复自动高度模式下出现的几个问题; + - 全屏退出时高度不正确的问题:修改了`fullscreenExit()`方法的内部实现; + - 当解析预览后的HTML内容高度高于Markdown源码编辑器高度时,无法正确预览的问题[#49](https://github.com/pandao/editor.md/issues/49); +- 修改`onscroll`和`onpreviewscroll`无法访问`this`的问题; +- 修改`init()`方法,可以只设置一个参数; +- 新增插入TeX(KaTeX)公式的快捷键`Ctrl + Shift + K`和插入方法`tex()`; +- 将锚点链接改为引用链接,引用的链接改为插入到页尾; + - 工具栏的名称`anchor`改为`reference-link`; + - 工具栏的名称`htmlEntities`改名为`html-entities`; +- 改进编辑器重建和重配置功能; + - 修改了`loadedDisplay()`方法; + - 修改了`config()`和`recreate()`方法; +- 新增跳转到指定行的功能; + - 新增方法`gotoLine()`; + - 新增跳转到行对话框插件`goto-line-dialog`; + - 新增快捷键`Ctrl + Alt + G`; + - 改进`executePlugin()`方法; + - 修改了`help-dialog/help.md`; +- 新增搜索工具栏按钮; + - 新增方法`search()`、`searchReplace()`和`searchReplaceAll()`; + - 原全屏预览HTML按钮的图标改为`fa-desktop`; + - 改为默认开启搜索替换功能; +- 更换了关于Editor.md的标语(slogan); +- 标题按钮`h`改为大写的`H`; +- `saveToTextareas()`方法更名为`save()`; +- 新增ToC下拉菜单、自定义ToC容器的功能; + - 新增Markdown扩展语法`[TOCM]`,自动生成ToC下拉菜单; + - 新增配置项`tocm`,默认为`true`,即可以使用`[TOCM]`; + - 新增配置项`tocDropdown`和`tocTitle`; + - 新增方法`editormd.tocDropdownMenu()`; + - 新增配置项`tocContainer`,值为jQuery选择器,默认为空; +- 修改了配置项`placeholder`的默认值; +- 改进对IE8的兼容支持; +- 修复Firefox下因为`Object.watch()`而出现的问题; +- 新增支持插入和解析(打印)分页符; + - 新增配置项`pageBreak`,默认值为`true`; + - 新增语法`[========]`,即括号内至少8个等号; + - 新增插入分页符的工具栏图标和方法`pagebreak()`; + - 新增插入分页符的快捷键`Shift + Alt + P`; +- 修复一些Bug,包括[#51](https://github.com/pandao/editor.md/issues/51)等; +- 新增和修改以上更新的相关示例; \ No newline at end of file diff --git a/Gulpfile.js b/Gulpfile.js index c6f5b01..a5aa4b1 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -41,24 +41,23 @@ var scssTask = function(fileName, path) { var distPath = "css"; - return gulp.src(path + fileName + ".scss") - .pipe(sass({ style: "expanded" })) //nested,compact,expanded,compressed - .pipe(gulp.dest(distPath)) - .pipe(header(headerComment, {pkg : pkg, fileName : function(file) { - var name = file.path.split(file.base); - return name[1].replace("\\", ""); - }})) - .pipe(gulp.dest(distPath)) - .pipe(rename({ suffix: ".min" })) - .pipe(gulp.dest(distPath)) - .pipe(minifycss()) - .pipe(gulp.dest(distPath)) - .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { - var name = file.path.split(file.base); - return name[1].replace("\\", ""); - }})) - .pipe(gulp.dest(distPath)) - .pipe(notify({ message: fileName + ".scss task completed!" })); + return sass(path + fileName + ".scss", { style: "expanded", sourcemap: false, noCache : true }) + .pipe(gulp.dest(distPath)) + .pipe(header(headerComment, {pkg : pkg, fileName : function(file) { + var name = file.path.split(file.base); + return name[1].replace("\\", ""); + }})) + .pipe(gulp.dest(distPath)) + .pipe(rename({ suffix: ".min" })) + .pipe(gulp.dest(distPath)) + .pipe(minifycss()) + .pipe(gulp.dest(distPath)) + .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { + var name = file.path.split(file.base); + return name[1].replace("\\", ""); + }})) + .pipe(gulp.dest(distPath)) + .pipe(notify({ message: fileName + ".scss task completed!" })); }; gulp.task("scss", function() { @@ -83,7 +82,7 @@ gulp.task("js", function() { }})) .pipe(gulp.dest("./")) .pipe(rename({ suffix: ".min" })) - .pipe(uglify({outSourceMap: true, sourceRoot: './'})) + .pipe(uglify()) // {outSourceMap: true, sourceRoot: './'} .pipe(gulp.dest("./")) .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { var name = file.path.split(file.base + ( (os.platform() === "win32") ? "\\" : "/") ); @@ -185,7 +184,7 @@ gulp.task("amd", function() { .pipe(replace("/* Require.js assignment replace */", replaceText2)) .pipe(gulp.dest('./')) .pipe(rename({ suffix: ".min" })) - .pipe(uglify({outSourceMap: true, sourceRoot: './'})) + .pipe(uglify()) //{outSourceMap: true, sourceRoot: './'} .pipe(gulp.dest("./")) .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { var name = file.path.split(file.base + ( (os.platform() === "win32") ? "\\" : "/") ); @@ -275,11 +274,11 @@ gulp.task("cm-mode", function() { return gulp.src(modes) .pipe(concat("modes.min.js")) .pipe(gulp.dest(codeMirror.path.dist)) - .pipe(uglify({outSourceMap: true, sourceRoot: codeMirror.path.dist})) + .pipe(uglify()) // {outSourceMap: true, sourceRoot: codeMirror.path.dist} .pipe(gulp.dest(codeMirror.path.dist)) .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { - var name = file.path.split(file.base + "\\"); - return name[1].replace("\\", ""); + var name = file.path.split(file.base + "\\"); + return (name[1]?name[1]:name[0]).replace(/\\/g, ""); }})) .pipe(gulp.dest(codeMirror.path.dist)) .pipe(notify({ message: "codemirror-mode task complete!" })); @@ -297,11 +296,11 @@ gulp.task("cm-addon", function() { return gulp.src(addons) .pipe(concat("addons.min.js")) .pipe(gulp.dest(codeMirror.path.dist)) - .pipe(uglify({outSourceMap: true, sourceRoot: codeMirror.path.dist})) + .pipe(uglify()) //{outSourceMap: true, sourceRoot: codeMirror.path.dist} .pipe(gulp.dest(codeMirror.path.dist)) .pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) { var name = file.path.split(file.base + "\\"); - return name[1].replace("\\", ""); + return (name[1]?name[1]:name[0]).replace(/\\/g, ""); }})) .pipe(gulp.dest(codeMirror.path.dist)) .pipe(notify({ message: "codemirror-addon.js task complete" })); diff --git a/README.md b/README.md index e9380a6..217da68 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ ![](https://img.shields.io/github/issues/pandao/editor.md.svg) ![](https://img.shields.io/bower/v/editor.md.svg) -**Editor.md** is an online markdown editor, based on CodeMirror & jQuery & Marked. +**Editor.md** is the open source online markdown editor, based on CodeMirror & jQuery & Marked. -###Features +### Features - Support Standard Markdown 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...; @@ -22,14 +22,16 @@ - 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 在线编辑器。 ![editormd-screenshot](https://pandao.github.io/editor.md/examples/images/editormd-screenshot.png "editormd-screenshot") -####主要特性 +#### 主要特性 - 支持“标准”Markdown和Github风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html); - 支持实时预览、图片(跨域)上传、预格式文本/代码/表格插入、代码折叠、搜索替换、只读模式、自定义样式主题和多语言语法高亮等功能; @@ -39,36 +41,44 @@ - 支持 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等平板设备; -####在线演示 (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下载安装](https://github.com/pandao/editor.md/archive/master.zip),或者通过 Bower 安装: bower install editor.md -####使用方法 (Usage) +#### 使用方法 (Usage) HTML: - -
- + +
+
> 提示1:如果没有Markdown源内容或者通过Ajax异步加载Markdown源文档等,可以不添加`"); + saveTo = div.find("textarea"); + } + var markdownDoc = (settings.markdown === "") ? saveTo.val() : settings.markdown; var markdownToC = []; var rendererOptions = { toc : settings.toc, + tocm : settings.tocm, tocStartLevel : settings.tocStartLevel, taskList : settings.taskList, emoji : settings.emoji, tex : settings.tex, + pageBreak : settings.pageBreak, atLink : settings.atLink, // for @link emailLink : settings.emailLink, // for mail address auto link flowChart : settings.flowChart, @@ -3264,21 +3722,20 @@ markdownDoc = editormd.filterHTMLTags(markdownDoc, settings.htmlDecode); - var markdownParsed = marked(markdownDoc, markedOptions); + var markdownParsed = marked(markdownDoc, markedOptions); - if (editormd.isIE8) - { - saveTo.val(markdownDoc); - } - else - { - saveTo.html(markdownDoc); - } + saveTo.val(markdownDoc); div.addClass("markdown-body " + this.classPrefix + "html-preview").append(markdownParsed); - if (settings.toc) { - div.tocContainer = this.markdownToCRenderer(markdownToC, div, settings.tocStartLevel); + if (settings.toc) + { + div.tocContainer = this.markdownToCRenderer(markdownToC, div, settings.tocDropdown, settings.tocStartLevel); + + if (settings.tocDropdown || div.find("." + this.classPrefix + "toc-menu").length > 0) + { + this.tocDropdownMenu(div, settings.tocTitle); + } } if (settings.previewCodeHighlight) @@ -3321,16 +3778,15 @@ } } - div.getMarkdown = function() { - return (editormd.isIE8) ? saveTo.val() : saveTo.html(); + div.getMarkdown = function() { + return saveTo.val(); }; return div; }; editormd.themes = [ - "default", - "3024-day", "3024-night", + "default", "3024-day", "3024-night", "ambiance", "ambiance-mobile", "base16-dark", "base16-light", "blackboard", "cobalt", @@ -3425,8 +3881,8 @@ script.type = "text/javascript"; script.src = fileName + ".js"; - if (editormd.isIE8) { - + if (editormd.isIE8) + { script.onreadystatechange = function() { if(script.readyState) { @@ -3519,7 +3975,7 @@ var editor = this.editor; var classPrefix = editormd.classPrefix; - var guid = (new Date).getTime(); + var guid = (new Date()).getTime(); var dialogName = ( (options.name === "") ? classPrefix + "dialog-" + guid : options.name); var mouseOrTouch = editormd.mouseOrTouch; @@ -3611,7 +4067,7 @@ dialog.hide().lockScreen(false).hideMask(); }); - if (typeof options.buttons == "object") + if (typeof options.buttons === "object") { var footer = dialog.footer = dialog.find("." + classPrefix + "dialog-footer"); @@ -3648,13 +4104,13 @@ var userCanSelect = function (obj) { obj.removeClass(classPrefix + "user-unselect").off("selectstart"); - } + }; var userUnselect = function (obj) { obj.addClass(classPrefix + "user-unselect").on("selectstart", function(event) { // selectstart for IE return false; }); - } + }; var moveAction = function (e) { e = e || window.event; //IE @@ -3689,7 +4145,7 @@ userUnselect(dialog); dialog[0].style.left = left + "px"; dialog[0].style.top = top + "px"; - } + }; document.onmouseup = function() { userCanSelect($("body")); @@ -3747,13 +4203,10 @@ var eventType = mouseEventType; - try - { + try { document.createEvent("TouchEvent"); eventType = touchEventType; - } - catch(e) { - } + } catch(e) {} return eventType; }; @@ -3773,7 +4226,7 @@ return (d < 10) ? "0" + d : d; }; - var date = new Date; + var date = new Date(); var year = date.getFullYear(); var year2 = year.toString().slice(2, 4); var month = addZero(date.getMonth() + 1); @@ -3847,7 +4300,7 @@ case "ms" : datefmt = ms; - break; + break; case "yy-mm-dd" : datefmt = ymd; @@ -3860,18 +4313,18 @@ case "yyyy-mm-dd h:i:s ms" : case "full + ms" : datefmt = fymd + " " + hms + " " + ms; - break; + break; case "full" : case "yyyy-mm-dd h:i:s" : default: datefmt = fymd + " " + hms; - break; - }; + break; + } return datefmt; }; - + return editormd; - + })); diff --git a/editormd.amd.min.js b/editormd.amd.min.js index 49d0833..8cf7abb 100644 --- a/editormd.amd.min.js +++ b/editormd.amd.min.js @@ -1,5 +1,4 @@ -/*! Editor.md v1.3.0 | editormd.amd.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-12 */ -!function(e){"use strict";if("function"==typeof require&&"object"==typeof exports&&"object"==typeof module)module.exports=e;else if("function"==typeof define)if(define.amd){var t="codemirror/mode/",i="codemirror/addon/",o=["jquery","marked","prettify","katex","raphael","underscore","flowchart","jqueryflowchart","sequenceDiagram","codemirror/lib/codemirror",t+"css/css",t+"sass/sass",t+"shell/shell",t+"sql/sql",t+"clike/clike",t+"php/php",t+"xml/xml",t+"markdown/markdown",t+"javascript/javascript",t+"htmlmixed/htmlmixed",t+"gfm/gfm",t+"http/http",t+"go/go",t+"dart/dart",t+"coffeescript/coffeescript",t+"nginx/nginx",t+"python/python",t+"perl/perl",t+"lua/lua",t+"r/r",t+"ruby/ruby",t+"rst/rst",t+"smartymixed/smartymixed",t+"vb/vb",t+"vbscript/vbscript",t+"velocity/velocity",t+"xquery/xquery",t+"yaml/yaml",t+"erlang/erlang",t+"jade/jade",i+"edit/trailingspace",i+"dialog/dialog",i+"search/searchcursor",i+"search/search",i+"scroll/annotatescrollbar",i+"search/matchesonscrollbar",i+"display/placeholder",i+"edit/closetag",i+"fold/foldcode",i+"fold/foldgutter",i+"fold/indent-fold",i+"fold/brace-fold",i+"fold/xml-fold",i+"fold/markdown-fold",i+"fold/comment-fold",i+"mode/overlay",i+"selection/active-line",i+"edit/closebrackets",i+"display/fullscreen",i+"search/match-highlighter"];define(o,e)}else define(["jquery"],e);else window.editormd=e()}(function(){"function"==typeof define&&define.amd&&(e=arguments[0],marked=arguments[1],prettify=arguments[2],katex=arguments[3],Raphael=arguments[4],_=arguments[5],flowchart=arguments[6],CodeMirror=arguments[9]);var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.3.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","anchor","image","code","preformatted-text","code-block","table","datetime","emoji","htmlEntities","|","watch","preview","fullscreen","clear","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",theme:"default",value:"",markdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",autoLoadModules:!0,watch:!0,placeholder:"now coding markdown...",codeFold:!1,autoHeight:!1,autoCloseTags:!0,searchReplace:!1,readOnly:!1,lineNumbers:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocStartLevel:1,htmlDecode:!1,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:function(){return t.toolbarModes.full},toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link",anchor:"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o",htmlEntities:"fa-copyright",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
A simple markdown doucment online editor.",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接",anchor:"锚点",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情",htmlEntities:"HTML实体字符",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(可按ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},anchor:{title:"添加锚点链接",name:"锚点名称",url:"链接地址",urlTitle:"链接标题",nameEmpty:"错误:锚点名称不能为空。",titleEmpty:"错误:请填写锚点链接标题。",urlEmpty:"错误:请填写锚点链接地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null,t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{};var r=this,a=this.classPrefix=t.classPrefix,n=this.editor=e("#"+i),s=this.settings=e.extend(!0,t.defaults,o);this.id=i,this.lang=s.lang;var l=this.classNames={textarea:{html:this.classPrefix+"html-textarea",markdown:this.classPrefix+"markdown-textarea"}};s.pluginPath=""===s.pluginPath?this.settings.path+"../plugins/":s.pluginPath,this.state.watching=s.watch?!0:!1,n.hasClass("editormd")||n.addClass("editormd"),n.css({width:"number"==typeof s.width?s.width+"px":s.width,height:"number"==typeof s.height?s.height+"px":s.height}),s.autoHeight&&n.css("height","auto");var c=this.markdownTextarea=n.children("textarea");c.length<1&&(n.append(""),c=this.markdownTextarea=n.children("textarea")),c.addClass(l.textarea.markdown).attr("name",i+"-markdown-doc").attr("placeholder",s.placeholder);var d=[s.readOnly?"":'',s.saveHTMLToTextarea?'':"",'
','
','
'].join("\n");return n.append(d).addClass(a+"vertical"),this.mask=n.children("."+a+"mask"),""!==s.markdown&&c.val(s.markdown),this.htmlTextarea=n.children("."+l.textarea.html),this.preview=n.children("."+a+"preview"),this.previewContainer=this.preview.children("."+a+"preview-container"),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),s.searchReplace&&(t.loadCSS(s.path+"codemirror/addon/dialog/dialog"),t.loadCSS(s.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!s.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),r.setCodeMirror(),r.setToolbar(),r.loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var i=this.settings;return i.theme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.theme),this.cm.setOption("theme",e),this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.theme&&t.loadCSS(e.path+"codemirror/theme/"+e.theme);var o={mode:e.mode,theme:e.theme,tabSize:4,dragDrop:!1,autofocus:!0,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:4,lineNumbers:e.lineNumbers,lineWrapping:!0,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,indentWithTabs:!0,styleActiveLine:e.styleActiveLine,styleSelectedText:!0,autoCloseBrackets:!0,showTrailingSpace:!0,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"==e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},"extends":function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;if(!i.readOnly)return i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,a=this.settings;"undefined"!=typeof t&&(a.toolbarAutoFixed=t);var n=function(){var t=e(window).scrollTop();return a.toolbarAutoFixed?void r.css(t-o.offset().top>10&&t
    '),r=this.toolbar=i.children("."+o+"toolbar")),!e.toolbar)return void r.hide();r.show();for(var a="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,n=r.find("."+this.classPrefix+"menu"),s="",l=0,c=a.length;c>l;l++){var d=a[l];if("|"!==d){var h=/h(\d)/.test(d),u=d;"watch"!==d||e.watch||(u="unwatch");var f=e.lang.toolbar[u],g=e.toolbarIconTexts[u],p=e.toolbarIconsClass[u];f="undefined"==typeof f?"":f,g="undefined"==typeof g?"":g,p="undefined"==typeof p?"":p,s+="
  • ",s+="undefined"!=typeof e.toolbarCustomIcons[d]?e.toolbarCustomIcons[d]:''+(h?d:""===p?g:"")+"",s+="
  • "}else s+='
  • |
  • '}return n.html(s),n.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),n.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this}},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(o.toolbar&&!o.readOnly){var r=(this.editor,this.preview,this.toolbar),a=this.codeEditor,n=(this.codeMirror,this.classPrefix),s=(this.previewContainer,this.toolbarIcons=r.find("."+n+"menu > li > a")),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(){var t=e(this).children(".fa"),r=t.attr("name"),n=a.getCursor(),s=a.getSelection();return""!==r?(i.activeIcon=t,"undefined"!=typeof l[r]?e.proxy(l[r],i)(a):"undefined"!=typeof o.toolbarHandlers[r]&&e.proxy(o.toolbarHandlers[r],i)(a,t,n,s),"link"!==r&&"anchor"!==r&&"image"!==r&&"code-block"!==r&&"preformatted-text"!==r&&"watch"!==r&&"preview"!==r&&"fullscreen"!==r&&"info"!==r&&a.focus(),!1):void 0}),this}},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
    ','
    ','

    '+t.title+"v"+t.version+"

    ","

    "+this.lang.description+"

    ",'

    Home page: '+t.homePage+"

    ","

    License: MIT

    ","
    ",'',"
    "].join("\n");i.append(r);var a=this.infoDialog=i.children("."+o+"dialog-info");return a.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),a.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.classPrefix,a=this.infoDialog=i.children("."+r+"dialog-info");return a.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),a.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this},recreate:function(){var e=this.editor,t=this.settings,i=t.toolbarIcons();return this.codeMirror.remove(),this.setCodeMirror(),"undefined"!=typeof this.infoDialog&&this.infoDialog.remove(),"undefined"!=typeof i.info&&createInfoDialog(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.saveToTextareas(),this.resize(),this.registerKeyMaps(),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){var i=this.previewContainer;return i.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.html(),i[0])}),this},flowChartAndSequenceDiagramRender:function(){var e=this.settings,i=this.previewContainer;return t.isIE8?void 0:(e.flowChart&&i.find(".flowchart").flowChart(),e.sequenceDiagram&&i.find(".sequence-diagram").sequenceDiagram({theme:"simple"}),this)},registerKeyMaps:function(i){i=i||null;var o=this,r=this.cm,a=this.settings;if(i){for(var n in i)if(e.inArray(n,a.disabledKeyMaps)<0){var s={};s[n]=i[n],r.addKeyMap(i)}}else{for(var n in t.keyMaps){var i=t.keyMaps[n],l="string"==typeof i?e.proxy(t.toolbarHandlers[i],o):e.proxy(i,o);if(e.inArray(n,["F9","F10","F11"])<0&&e.inArray(n,a.disabledKeyMaps)<0){var s={};s[n]=l,r.addKeyMap(s)}}e(window).keydown(function(i){var r={120:"F9",121:"F10",122:"F11"};if(e.inArray(r[i.keyCode],a.disabledKeyMaps)<0)switch(i.keyCode){case 120:return e.proxy(t.toolbarHandlers.watch,o)(),!1;case 121:return e.proxy(t.toolbarHandlers.preview,o)(),!1;case 122:e.proxy(t.toolbarHandlers.fullscreen,o)()}})}return this},loadedDisplay:function(){var i=this,o=this.editor,r=this.preview,a=this.settings,n=this.codeEditor,s=this.codeMirror,l=(this.previewContainer,t.mouseOrTouch);o.children("."+this.classPrefix+"container-mask").hide(),this.saveToTextareas(),a.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()});var c=function(){s.find(".CodeMirror-scroll").bind(l("scroll","touchmove"),function(t){var i=e(this).height(),o=e(this).scrollTop(),n=o/e(this)[0].scrollHeight;r.scrollTop(0===o?0:o+i>=e(this)[0].scrollHeight?r[0].scrollHeight:r[0].scrollHeight*n),e.proxy(a.onscroll,this)(t)})},d=function(){s.find(".CodeMirror-scroll").unbind(l("scroll","touchmove"))},h=function(){r.bind(l("scroll","touchmove"),function(){var t=e(this).height(),i=e(this).scrollTop(),o=i/e(this)[0].scrollHeight,r=s.find(".CodeMirror-scroll");r.scrollTop(0===i?0:i+t>=e(this)[0].scrollHeight?r[0].scrollHeight:r[0].scrollHeight*o),e.proxy(a.onpreviewscroll,this)(event)})},u=function(){r.unbind(l("scroll","touchmove"))};return s.bind({mouseover:c,mouseout:d,touchstart:c,touchend:d}),r.bind({mouseover:h,mouseout:u,touchstart:h,touchend:u}),n.on("change",function(){i.previewContainer.css("padding-left",a.autoHeight&&e("body").height()>e(window).height()?"30px":"20px"),i.saveToTextareas()}),e.proxy(a.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,a=this.preview,n=this.toolbar,s=this.settings,l=(this.codeEditor,this.codeMirror);return t&&r.css({width:"number"==typeof t?t+"px":t}),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css({height:"number"==typeof i?i+"px":i}),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",n.height()+1).height(r.height()-n.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),l.find(".CodeMirror-gutters").height(l.height()),s.watch?(l.width(r.width()/2),a.width(o.preview?r.width():r.width()/2),s.toolbar&&!s.readOnly?a.css("top",n.height()):a.css("top",0),a.height(!s.autoHeight||o.fullscreen||o.preview?s.toolbar&&!s.readOnly?r.height()-n.height():r.height():"auto")):(l.width(r.width()),a.hide()),o.loaded&&e.proxy(s.onresize,this)(),this},saveToTextareas:function(){var i=this,o=this.state,r=this.settings,a=this.codeEditor,n=this.previewContainer,s=a.getValue();if("gfm"!==r.mode&&"markdown"!==r.mode)return this.markdownTextarea[0].innerText=s,this;var l=t.$marked,c=this.markdownToC=[],d=this.markedRendererOptions={toc:r.toc,tocStartLevel:r.tocStartLevel,taskList:r.taskList,emoji:r.emoji,tex:r.tex,atLink:r.atLink,emailLink:r.emailLink,flowChart:r.flowChart,sequenceDiagram:r.sequenceDiagram,previewCodeHighlight:r.previewCodeHighlight},h=this.markedOptions={renderer:t.markedRenderer(c,d),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:r.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l.setOptions(h),s=t.filterHTMLTags(s,r.htmlDecode);var u=t.$marked(s,h);if(this.markdownTextarea[0].innerText=s,a.save(),r.saveHTMLToTextarea&&this.htmlTextarea.html(u),r.watch||!r.watch&&o.preview){if(n.html(u),this.previewCodeHighlight(),r.toc&&t.markdownToCRenderer(c,n,r.tocStartLevel),r.tex&&(!t.kaTeXLoaded&&r.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,i.katexRender()}):(t.$katex=katex,this.katexRender())),r.flowChart||r.sequenceDiagram)var f=setTimeout(function(){clearTimeout(f),i.flowChartAndSequenceDiagramRender()},10);o.loaded&&e.proxy(r.onchange,this)()}return this},focus:function(){return this.codeEditor.focus(),this},setCursor:function(e){return this.codeEditor.setCursor(e),this},getCursor:function(){return this.codeEditor.getCursor()},setSelection:function(e,t){return this.codeEditor.setSelection(e,t),this},getSelection:function(){return this.codeEditor.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.codeEditor.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},setMarkdown:function(e){var t=this.settings;return this.codeEditor.setValue(e||t.markdown),this},getMarkdown:function(){return this.codeEditor.getValue()},getValue:function(){return this.codeEditor.getValue()},setValue:function(e){return this.codeEditor.setValue(e),this},clear:function(){return this.codeEditor.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.html():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var i=this.settings;this.state.watching=i.watch=!0,this.preview.show();var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");return a.parent().attr("title",i.lang.toolbar.watch),a.removeClass(r).addClass(o),this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),this.saveToTextareas().resize(),i.onwatch||(i.onwatch=t||function(){}),e.proxy(i.onwatch,this)(),this},unwatch:function(t){var i=this.settings;this.state.watching=i.watch=!1,this.preview.hide();var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch;if(this.toolbar){var a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",i.lang.toolbar.unwatch),a.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,a=this.toolbar,n=this.settings,s=this.codeMirror;n.toolbar&&(a.toggle(),a.find(".fa[name=preview]").toggleClass("active")),s.toggle();var l=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),n.watch||this.saveToTextareas(),r.show().css({position:"static",top:0,width:o.width(),height:n.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(n.onpreviewing,this)(),e(window).bind("keyup",l)):(e(window).unbind("keyup",l),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,a=this.settings,n=this.codeMirror,s=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,n.show(),a.toolbar&&r.show(),this.settings.watch?o.show():o.hide(),s.hide().unbind(t.mouseOrTouch("click","touchend")),o.css({background:null,position:"absolute",width:i.width()/2,height:a.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:a.toolbar?r.height():0}),this.state.loaded&&e.proxy(a.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.editor,o=(this.preview,this.toolbar),r=this.classPrefix+"fullscreen";o&&o.find(".fa[name=fullscreen]").parent().toggleClass("active");var a=function(e){e.shiftKey||27!==e.keyCode||t.state.fullscreen&&t.fullscreenExit()};return i.hasClass(r)?(e(window).unbind("keyup",a),this.fullscreenExit()):(this.state.fullscreen=!0,e("html,body").css("overflow","hidden"),i.css({position:"fixed",top:0,left:0,margin:0,border:"none",width:e(window).width(),height:e(window).height()}).addClass(r),this.resize(),e.proxy(this.settings.onfullscreen,this)(),e(window).bind("keyup",a)),this},fullscreenExit:function(){var t=this.editor,i=this.toolbar,o=this.classPrefix+"fullscreen";return this.state.fullscreen=!0,i&&i.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({position:"",top:"",left:"",margin:"0 auto 15px",width:t.data("oldWidth"),height:t.data("oldHeight"),border:"1px solid #ddd"}).removeClass(o),this.resize(),e.proxy(this.settings.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,a=this.cm,n=this.settings;return"function"==typeof define?void this[i](a):(o=n.pluginPath+o,void(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](a)}):e.proxy(t.loadPlugins[i],this)(a)))}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings;t.dialogLockScreen&&e("html,body").css("overflow","hidden")},t.dialogShowMask=function(t){var i=this.editor,o=this.settings;t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("> "+i),e.setCursor(t.line,""===i?t.ch+2:t.ch+i.length+2)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("# "+t)},h2:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("## "+t)},h3:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("### "+t)},h4:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("#### "+t)},h5:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("##### "+t)},h6:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("###### "+t)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm;e.getCursor(),e.getSelection()}e.replaceSelection("------------")},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},anchor:function(){this.executePlugin("anchorLinkDialog","anchor-link-dialog/anchor-link-dialog")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},htmlEntities:function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-B":"bold","Ctrl-I":"italic","Ctrl-K":"code","Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Ctrl-H":"hr","Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(":"+i+":"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("@"+i),""===i&&e.setCursor(t.line,t.ch+1)},"Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3); +/*! Editor.md v1.4.0 | editormd.amd.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-23 */ +!function(e){"use strict";if("function"==typeof require&&"object"==typeof exports&&"object"==typeof module)module.exports=e;else if("function"==typeof define)if(define.amd){var t="codemirror/mode/",i="codemirror/addon/",o=["jquery","marked","prettify","katex","raphael","underscore","flowchart","jqueryflowchart","sequenceDiagram","codemirror/lib/codemirror",t+"css/css",t+"sass/sass",t+"shell/shell",t+"sql/sql",t+"clike/clike",t+"php/php",t+"xml/xml",t+"markdown/markdown",t+"javascript/javascript",t+"htmlmixed/htmlmixed",t+"gfm/gfm",t+"http/http",t+"go/go",t+"dart/dart",t+"coffeescript/coffeescript",t+"nginx/nginx",t+"python/python",t+"perl/perl",t+"lua/lua",t+"r/r",t+"ruby/ruby",t+"rst/rst",t+"smartymixed/smartymixed",t+"vb/vb",t+"vbscript/vbscript",t+"velocity/velocity",t+"xquery/xquery",t+"yaml/yaml",t+"erlang/erlang",t+"jade/jade",i+"edit/trailingspace",i+"dialog/dialog",i+"search/searchcursor",i+"search/search",i+"scroll/annotatescrollbar",i+"search/matchesonscrollbar",i+"display/placeholder",i+"edit/closetag",i+"fold/foldcode",i+"fold/foldgutter",i+"fold/indent-fold",i+"fold/brace-fold",i+"fold/xml-fold",i+"fold/markdown-fold",i+"fold/comment-fold",i+"mode/overlay",i+"selection/active-line",i+"edit/closebrackets",i+"display/fullscreen",i+"search/match-highlighter"];define(o,e)}else define(["jquery"],e);else window.editormd=e()}(function(){"function"==typeof define&&define.amd&&(e=arguments[0],marked=arguments[1],prettify=arguments[2],katex=arguments[3],Raphael=arguments[4],_=arguments[5],flowchart=arguments[6],CodeMirror=arguments[9]);var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.4.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",theme:"default",value:"",markdown:"",appendMarkdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",delay:300,autoLoadModules:!0,watch:!0,placeholder:"Enjoy Markdown! coding now...",gotoLine:!0,codeFold:!1,autoHeight:!1,autoCloseTags:!0,searchReplace:!0,readOnly:!1,lineNumbers:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocm:!1,tocTitle:"",tocDropdown:!1,tocContainer:"",tocStartLevel:1,htmlDecode:!1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:"full",toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link","reference-link":"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o","html-entities":"fa-copyright",pagebreak:"fa-newspaper-o","goto-line":"fa-terminal",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-desktop",search:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
    Open source online Markdown editor.",tocTitle:"目录",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接","reference-link":"引用链接",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情","html-entities":"HTML实体字符",pagebreak:"插入分页符","goto-line":"跳转到行",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(按 Shift + ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",search:"搜索",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},referenceLink:{title:"添加引用链接",name:"引用名称",url:"链接地址",urlId:"链接ID",urlTitle:"链接标题",nameEmpty:"错误:引用链接的名称不能为空。",idEmpty:"错误:请填写引用链接的ID。",urlEmpty:"错误:请填写引用链接的URL地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null;var i,o;t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{},"object"==typeof i&&(o=i);var r=this.classPrefix=t.classPrefix,a=this.settings=e.extend(!0,t.defaults,o);i="object"==typeof i?a.id:i;var n=this.editor=e("#"+i);this.id=i,this.lang=a.lang;var s=this.classNames={textarea:{html:r+"html-textarea",markdown:r+"markdown-textarea"}};a.pluginPath=""===a.pluginPath?a.path+"../plugins/":a.pluginPath,this.state.watching=a.watch?!0:!1,n.hasClass("editormd")||n.addClass("editormd"),n.css({width:"number"==typeof a.width?a.width+"px":a.width,height:"number"==typeof a.height?a.height+"px":a.height}),a.autoHeight&&n.css("height","auto");var l=this.markdownTextarea=n.children("textarea");l.length<1&&(n.append(""),l=this.markdownTextarea=n.children("textarea")),l.addClass(s.textarea.markdown).attr("name",i+"-markdown-doc").attr("placeholder",a.placeholder);var c=[a.readOnly?"":'',a.saveHTMLToTextarea?'':"",'
    ','
    ','
    '].join("\n");return n.append(c).addClass(r+"vertical"),this.mask=n.children("."+r+"mask"),this.containerMask=n.children("."+r+"container-mask"),""!==a.markdown&&l.val(a.markdown),""!==a.appendMarkdown&&l.val(l.val()+a.appendMarkdown),this.htmlTextarea=n.children("."+s.textarea.html),this.preview=n.children("."+r+"preview"),this.previewContainer=this.preview.children("."+r+"preview-container"),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),a.searchReplace&&!a.readOnly&&(t.loadCSS(a.path+"codemirror/addon/dialog/dialog"),t.loadCSS(a.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!a.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),this.setCodeMirror().setToolbar().loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&!i.readOnly&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var i=this.settings;return i.theme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.theme),this.cm.setOption("theme",e),this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.theme&&t.loadCSS(e.path+"codemirror/theme/"+e.theme);var o={mode:e.mode,theme:e.theme,tabSize:4,dragDrop:!1,autofocus:!0,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:4,lineNumbers:e.lineNumbers,lineWrapping:!0,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,indentWithTabs:!0,styleActiveLine:e.styleActiveLine,styleSelectedText:!0,autoCloseBrackets:!0,showTrailingSpace:!0,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"===e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},gotoLine:function(t){var i=this.settings;if(!i.gotoLine)return this;var o=this.cm,r=(this.editor,o.lineCount()),a=this.preview;if("string"==typeof t&&("last"===t&&(t=r),"first"===t&&(t=1)),"number"!=typeof t)return alert("Error: The line number must be an integer."),this;if(t=parseInt(t)-1,t>r)return alert("Error: The line number range 1-"+r),this;o.setCursor({line:t,ch:0});var n=o.getScrollInfo(),s=n.clientHeight,l=o.charCoords({line:t,ch:0},"local");if(o.scrollTo(null,(l.top+l.bottom-s)/2),i.watch){var c=this.codeMirror.find(".CodeMirror-scroll")[0],h=e(c).height(),d=c.scrollTop,u=d/c.scrollHeight;a.scrollTop(0===d?0:d+h>=a[0].scrollHeight?a[0].scrollHeight:a[0].scrollHeight*u)}return o.focus(),this},extend:function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;return i.readOnly?this:(i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this)},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,a=this.settings;"undefined"!=typeof t&&(a.toolbarAutoFixed=t);var n=function(){var t=e(window),i=t.scrollTop();return a.toolbarAutoFixed?void r.css(i-o.offset().top>10&&i
      ';i.append(a),r=this.toolbar=i.children("."+o+"toolbar")}if(!e.toolbar)return r.hide(),this;r.show();for(var n="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,s=r.find("."+this.classPrefix+"menu"),l="",c=0,h=n.length;h>c;c++){var d=n[c];if("|"!==d){var u=/h(\d)/.test(d),f=d;"watch"!==d||e.watch||(f="unwatch");var g=e.lang.toolbar[f],p=e.toolbarIconTexts[f],m=e.toolbarIconsClass[f];g="undefined"==typeof g?"":g,p="undefined"==typeof p?"":p,m="undefined"==typeof m?"":m,l+="
    • ",l+="undefined"!=typeof e.toolbarCustomIcons[d]&&"function"!=typeof e.toolbarCustomIcons[d]?e.toolbarCustomIcons[d]:''+(u?d.toUpperCase():""===m?p:"")+"",l+="
    • "}else l+='
    • |
    • '}return s.html(l),s.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),s.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(!o.toolbar||o.readOnly)return this;var r=this.toolbar,a=this.cm,n=this.classPrefix,s=this.toolbarIcons=r.find("."+n+"menu > li > a"),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(){var t=e(this).children(".fa"),r=t.attr("name"),n=a.getCursor(),s=a.getSelection();return""!==r?(i.activeIcon=t,"undefined"!=typeof l[r]?e.proxy(l[r],i)(a):"undefined"!=typeof o.toolbarHandlers[r]&&e.proxy(o.toolbarHandlers[r],i)(a,t,n,s),"link"!==r&&"reference-link"!==r&&"image"!==r&&"code-block"!==r&&"preformatted-text"!==r&&"watch"!==r&&"preview"!==r&&"search"!==r&&"fullscreen"!==r&&"info"!==r&&a.focus(),!1):void 0}),this},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
      ','
      ','

      '+t.title+"v"+t.version+"

      ","

      "+this.lang.description+"

      ",'

      '+t.homePage+'

      ','

      Copyright © 2015 Pandao, The MIT License.

      ',"
      ",'',"
      "].join("\n");i.append(r);var a=this.infoDialog=i.children("."+o+"dialog-info");return a.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),a.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.infoDialog=i.children("."+this.classPrefix+"dialog-info");return r.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),r.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this},recreate:function(){var e=this.editor,t=this.settings;return this.codeMirror.remove(),this.setCodeMirror(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.loadedDisplay(!0),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){return null===i?this:(this.previewContainer.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.html(),i[0])}),this)},flowChartAndSequenceDiagramRender:function(){var e=this.settings,i=this.previewContainer;if(t.isIE8)return this;if(e.flowChart){if(null===o)return this;i.find(".flowchart").flowChart()}return e.sequenceDiagram&&i.find(".sequence-diagram").sequenceDiagram({theme:"simple"}),this},registerKeyMaps:function(i){var o=this,r=this.cm,a=this.settings,n=t.toolbarHandlers,s=a.disabledKeyMaps;if(i=i||null){for(var l in i)if(e.inArray(l,s)<0){var c={};c[l]=i[l],r.addKeyMap(i)}}else{for(var h in t.keyMaps){var d=t.keyMaps[h],u="string"==typeof d?e.proxy(n[d],o):e.proxy(d,o);if(e.inArray(h,["F9","F10","F11"])<0&&e.inArray(h,s)<0){var f={};f[h]=u,r.addKeyMap(f)}}e(window).keydown(function(t){var i={120:"F9",121:"F10",122:"F11"};if(e.inArray(i[t.keyCode],s)<0)switch(t.keyCode){case 120:return e.proxy(n.watch,o)(),!1;case 121:return e.proxy(n.preview,o)(),!1;case 122:return e.proxy(n.fullscreen,o)(),!1}})}return this},bindScrollEvent:function(){var i=this,o=this.preview,r=this.settings,a=this.codeMirror,n=t.mouseOrTouch,s=function(){a.find(".CodeMirror-scroll").bind(n("scroll","touchmove"),function(t){var a=e(this).height(),n=e(this).scrollTop(),s=n/e(this)[0].scrollHeight;o.scrollTop(0===n?0:n+a>=e(this)[0].scrollHeight?o[0].scrollHeight:o[0].scrollHeight*s),e.proxy(r.onscroll,i)(t)})},l=function(){a.find(".CodeMirror-scroll").unbind(n("scroll","touchmove"))},c=function(){o.bind(n("scroll","touchmove"),function(t){var o=e(this).height(),n=e(this).scrollTop(),s=n/e(this)[0].scrollHeight,l=a.find(".CodeMirror-scroll");l.scrollTop(0===n?0:n+o>=e(this)[0].scrollHeight?l[0].scrollHeight:l[0].scrollHeight*s),e.proxy(r.onpreviewscroll,i)(t)})},h=function(){o.unbind(n("scroll","touchmove"))};return a.bind({mouseover:s,mouseout:l,touchstart:s,touchend:l}),o.bind({mouseover:c,mouseout:h,touchstart:c,touchend:h}),this},bindChangeEvent:function(){var e=this,t=this.cm,o=this.settings;return t.on("change",function(){o.watch&&e.previewContainer.css("padding",o.autoHeight?"20px 20px 50px 40px":"20px"),i=setTimeout(function(){clearTimeout(i),e.save(),i=null},o.delay)}),this},loadedDisplay:function(t){t=t||!1;var i=this,o=this.editor,r=this.preview,a=this.settings;return this.containerMask.hide(),this.save(),a.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()}),this.bindScrollEvent().bindChangeEvent(),t||e.proxy(a.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,a=this.preview,n=this.toolbar,s=this.settings,l=this.codeMirror;return t&&r.css("width","number"==typeof t?t+"px":t),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css("height","number"==typeof i?i+"px":i),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",n.height()+1).height(r.height()-n.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),s.watch?(l.width(r.width()/2),a.width(o.preview?r.width():r.width()/2),this.previewContainer.css("padding",s.autoHeight?"20px 20px 50px 40px":"20px"),s.toolbar&&!s.readOnly?a.css("top",n.height()):a.css("top",0),a.height(!s.autoHeight||o.fullscreen||o.preview?s.toolbar&&!s.readOnly?r.height()-n.height():r.height():"")):(l.width(r.width()),a.hide()),o.loaded&&e.proxy(s.onresize,this)(),this},save:function(){if(null===i)return this;var r=this,a=this.state,n=this.settings,s=this.cm,l=s.getValue(),c=this.previewContainer;if("gfm"!==n.mode&&"markdown"!==n.mode)return this.markdownTextarea.val(l),this;var h=t.$marked,d=this.markdownToC=[],u=this.markedRendererOptions={toc:n.toc,tocm:n.tocm,tocStartLevel:n.tocStartLevel,pageBreak:n.pageBreak,taskList:n.taskList,emoji:n.emoji,tex:n.tex,atLink:n.atLink,emailLink:n.emailLink,flowChart:n.flowChart,sequenceDiagram:n.sequenceDiagram,previewCodeHighlight:n.previewCodeHighlight},f=this.markedOptions={renderer:t.markedRenderer(d,u),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:n.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};h.setOptions(f),l=t.filterHTMLTags(l,n.htmlDecode);var g=t.$marked(l,f);if(this.markdownTextarea.val(l),s.save(),n.saveHTMLToTextarea&&this.htmlTextarea.html(g),n.watch||!n.watch&&a.preview){if(c.html(g),this.previewCodeHighlight(),n.toc){var p=""===n.tocContainer?c:e(n.tocContainer),m=p.find("."+this.classPrefix+"toc-menu");p.attr("previewContainer",""===n.tocContainer?"true":"false"),""!==n.tocContainer&&m.length>0&&m.remove(),t.markdownToCRenderer(d,p,n.tocDropdown,n.tocStartLevel),(n.tocDropdown||p.find("."+this.classPrefix+"toc-menu").length>0)&&t.tocDropdownMenu(p,""!==n.tocTitle?n.tocTitle:this.lang.tocTitle),""!==n.tocContainer&&c.find(".markdown-toc").css("border","none")}n.tex&&(!t.kaTeXLoaded&&n.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,r.katexRender()}):(t.$katex=katex,this.katexRender())),(n.flowChart||n.sequenceDiagram)&&(o=setTimeout(function(){clearTimeout(o),r.flowChartAndSequenceDiagramRender(),o=null},10)),a.loaded&&e.proxy(n.onchange,this)()}return this},focus:function(){return this.cm.focus(),this},setCursor:function(e){return this.cm.setCursor(e),this},getCursor:function(){return this.cm.getCursor()},setSelection:function(e,t){return this.cm.setSelection(e,t),this},getSelection:function(){return this.cm.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.cm.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},appendMarkdown:function(e){var t=(this.settings,this.cm);return t.setValue(t.getValue()+e),this},setMarkdown:function(e){return this.cm.setValue(e||this.settings.markdown),this},getMarkdown:function(){return this.cm.getValue()},getValue:function(){return this.cm.getValue()},setValue:function(e){return this.cm.setValue(e),this},clear:function(){return this.cm.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.html():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var o=this.settings;if(e.inArray(o.mode,["gfm","markdown"])<0)return this;if(this.state.watching=o.watch=!0,this.preview.show(),this.toolbar){var r=o.toolbarIconsClass.watch,a=o.toolbarIconsClass.unwatch,n=this.toolbar.find(".fa[name=watch]");n.parent().attr("title",o.lang.toolbar.watch),n.removeClass(a).addClass(r)}return this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),i=0,this.save().resize(),o.onwatch||(o.onwatch=t||function(){}),e.proxy(o.onwatch,this)(),this},unwatch:function(t){var i=this.settings;if(this.state.watching=i.watch=!1,this.preview.hide(),this.toolbar){var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",i.lang.toolbar.unwatch),a.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,a=this.toolbar,n=this.settings,s=this.codeMirror;if(e.inArray(n.mode,["gfm","markdown"])<0)return this;n.toolbar&&a&&(a.toggle(),a.find(".fa[name=preview]").toggleClass("active")),s.toggle();var l=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),n.watch||this.save(),r.show().css({position:"static",top:0,width:o.width(),height:n.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(n.onpreviewing,this)(),e(window).bind("keyup",l)):(e(window).unbind("keyup",l),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,a=this.settings,n=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,this.codeMirror.show(),a.toolbar&&r.show(),o[a.watch?"show":"hide"](),n.hide().unbind(t.mouseOrTouch("click","touchend")),o.css({background:null,position:"absolute",width:i.width()/2,height:a.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:a.toolbar?r.height():0}),this.state.loaded&&e.proxy(a.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.state,o=this.editor,r=(this.preview,this.toolbar),a=this.settings,n=this.classPrefix+"fullscreen";r&&r.find(".fa[name=fullscreen]").parent().toggleClass("active");var s=function(e){e.shiftKey||27!==e.keyCode||i.fullscreen&&t.fullscreenExit()};return o.hasClass(n)?(e(window).unbind("keyup",s),this.fullscreenExit()):(i.fullscreen=!0,e("html,body").css("overflow","hidden"),o.css({position:"fixed",top:0,left:0,margin:0,border:"none",width:e(window).width(),height:e(window).height()}).addClass(n),this.resize(),e.proxy(a.onfullscreen,this)(),e(window).bind("keyup",s)),this},fullscreenExit:function(){var t=this.editor,i=this.settings,o=this.toolbar,r=this.classPrefix+"fullscreen";return this.state.fullscreen=!1,o&&o.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({position:"",top:"",left:"",margin:"0 auto 15px",width:t.data("oldWidth"),height:t.data("oldHeight"),border:"1px solid #ddd"}).removeClass(r),this.resize(),e.proxy(i.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,a=this.cm,n=this.settings;return o=n.pluginPath+o,"function"==typeof define?"undefined"==typeof this[i]?(alert("Error: "+i+" plugin is not found, you are not load this plugin."),this):(this[i](a),this):(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](a)}):e.proxy(t.loadPlugins[i],this)(a),this)},search:function(e){var t=this.settings;return t.searchReplace?(t.readOnly||this.cm.execCommand(e||"find"),this):(alert("Error: settings.searchReplace == false"),this)},searchReplace:function(){return this.search("replace"),this},searchReplaceAll:function(){return this.search("replaceAll"),this}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings||{dialogLockScreen:!0};t.dialogLockScreen&&e("html,body").css("overflow","hidden")},t.dialogShowMask=function(t){var i=this.editor,o=this.settings||{dialogShowMask:!0};t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("> "+i),e.setCursor(t.line,""===i?t.ch+2:t.ch+i.length+2)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("# "+t)},h2:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("## "+t)},h3:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("### "+t)},h4:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("#### "+t)},h5:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("##### "+t)},h6:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("###### "+t)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o]; -},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"htmlEntities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table",F9:"watch",F10:"preview",F11:"fullscreen"};var i=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=i;var o=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=o;var r=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=r,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\-\w]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(o,r){var a={toc:!0,tocStartLevel:1,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},n=e.extend(a,r||{}),s=t.$marked,l=new s.Renderer;o=o||[];var c=t.regexs.atLink,d=t.regexs.emoji,h=t.regexs.email,u=t.regexs.emailLink,f=t.regexs.twemoji,g=t.regexs.fontAwesome,p=t.regexs.editormdLogo;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!n.emoji)return e;for(var o=0,r=i.length;r>o;o++)e=e.replace(new RegExp(i[o]),function(e){var i=e.match(g),o=e.replace(/:/g,"");if(i)for(var r=0,a=i.length;a>r;r++){var n=i[r].replace(/:/g,"");return''}else{var s=e.match(p),l=e.match(f);if(s)for(var c=0,d=s.length;d>c;c++){var h=s[c].replace(/:/g,"");return''}else{if(!l)return':'+o+':';for(var u=0,m=l.length;m>u;u++){var w=l[u].replace(/:/g,"").replace("tw-","");return'twemoji-'+w+''}}}});return e},l.atLink=function(e){return c.test(e)?(n.atLink&&(e=e.replace(h,function(e){return e.replace(/@/g,"_#_@_#_")}),e=e.replace(c,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),n.emailLink&&(e=e.replace(u,function(e,t){return t?e:''+e+""})),e):e},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var a=''+i.replace(/@/g,"@")+""):(t&&(a+=' title="'+t+'"'),a+=">"+i+"")},l.heading=function(e,t){var r=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var n=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var s=0,l=e.length;l>s;s++)n.push(e[s].replace(/\s*href\=\"(.*)\"\s*/g,""));e=n.join(" ")}e=i(e);var c=e.toLowerCase().replace(/[^\w]+/g,"-"),d={text:e,level:t,slug:c},h=/^[\u4e00-\u9fa5]+$/.test(e),u=h?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");o.push(d);var f="';return f+='',f+='',f+=this.atLink(a?this.emoji(r):this.emoji(e)),f+=""},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",a=/^\[TOC\]$/.test(e);return e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e,a?'
        '+e+"
      ":""+this.atLink(this.emoji(e))+"

      \n"},l.code=function(e,t){return"seq"===t||"sequence"===t?'
      '+e+"
      ":"flow"===t?'
      '+e+"
      ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return n.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
    • '+this.atLink(this.emoji(e))+"
    • "):"
    • "+this.atLink(this.emoji(e))+"
    • "},l},t.markdownToCRenderer=function(e,t,i){var o="",r=0;i=i||1;for(var a=0,n=e.length;n>a;a++){var s=e[a].text,l=e[a].level;i>l||(o+=l>r?"":r>l?new Array(r-l+2).join(""):"",o+='
    • '+s+"
        ",r=l)}var c=t.find(".markdown-toc");return c.children(".markdown-toc-list").html("").html(o),c},t.filterHTMLTags=function(e,t){if("string"==typeof t)for(var i=t.split(","),o=0,r=i.length;r>o;o++){var a=i[o];e=e.replace(new RegExp("]*)>","igm"),"").replace(new RegExp("","igm"),"")}return e},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocStartLevel:1,markdown:"",htmlDecode:!1,autoLoadKaTeX:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var a=e("#"+i),n=a.settings=e.extend(!0,r,o||{}),s=a.find("textarea"),l=""===n.markdown?s.val():n.markdown,c=[],d={toc:n.toc,tocStartLevel:n.tocStartLevel,taskList:n.taskList,emoji:n.emoji,tex:n.tex,atLink:n.atLink,emailLink:n.emailLink,flowChart:n.flowChart,sequenceDiagram:n.sequenceDiagram,previewCodeHighlight:n.previewCodeHighlight},h={renderer:t.markedRenderer(c,d),gfm:n.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:n.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=t.filterHTMLTags(l,n.htmlDecode);var u=marked(l,h);if(t.isIE8?s.val(l):s.html(l),a.addClass("markdown-body "+this.classPrefix+"html-preview").append(u),n.toc&&(a.tocContainer=this.markdownToCRenderer(c,a,n.tocStartLevel)),n.previewCodeHighlight&&(a.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(n.flowChart&&a.find(".flowchart").flowChart(),n.sequenceDiagram&&a.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),n.tex){var f=function(){a.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html(),t[0])})};!n.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?f():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,f()})}return a.getMarkdown=function(){return t.isIE8?s.val():s.html()},a},t.themes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min",js:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this.editor,a=t.classPrefix,n=(new Date).getTime(),s=""===i.name?a+"dialog-"+n:i.name,l=t.mouseOrTouch,c='
        ';""!==i.title&&(c+='
        ",c+=''+i.title+"",c+="
        "),i.closed&&(c+=''),c+='
        '+i.content,(i.footer||"string"==typeof i.footer)&&(c+='"),c+="
        ",c+='
        ',c+='
        ',c+="
        ",r.append(c);var d=r.find("."+s);d.lockScreen=function(t){return i.lockScreen&&e("html,body").css("overflow",t?"hidden":""),d},d.showMask=function(){return i.mask&&r.find("."+a+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),d},d.hideMask=function(){return i.mask&&r.find("."+a+"mask").hide(),d},d.loading=function(e){var t=d.find("."+a+"dialog-mask");return t[e?"show":"hide"](),d},d.lockScreen(!0).showMask(),d.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var h=function(){d.css({top:(e(window).height()-d.height())/2+"px",left:(e(window).width()-d.width())/2+"px"})};if(h(),e(window).resize(h),d.children("."+a+"dialog-close").bind(l("click","touchend"),function(){d.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var u=d.footer=d.find("."+a+"dialog-footer");for(var f in i.buttons){var g=i.buttons[f],p=a+f+"-btn";u.append('"),g[1]=e.proxy(g[1],d),u.children("."+p).bind(l("click","touchend"),g[1])}}if(""!==i.title&&i.drag){var m,w,v=d.children("."+a+"dialog-header");i.mask||v.bind(l("click","touchend"),function(){t.dialogZindex+=2,d.css("z-index",t.dialogZindex)}),v.mousedown(function(e){e=e||window.event,m=e.clientX-parseInt(d[0].style.left),w=e.clientY-parseInt(d[0].style.top),document.onmousemove=k});var b=function(e){e.removeClass(a+"user-unselect").off("selectstart")},x=function(e){e.addClass(a+"user-unselect").on("selectstart",function(){return!1})},k=function(t){t=t||window.event;var i,o,r=parseInt(d[0].style.left),a=parseInt(d[0].style.top);r>=0?r+d.width()<=e(window).width()?i=t.clientX-m:(i=e(window).width()-d.width(),document.onmousemove=null):(i=0,document.onmousemove=null),a>=0?o=t.clientY-w:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},x(e("body")),x(d),d[0].style.left=i+"px",d[0].style.top=o+"px"};document.onmouseup=function(){b(e("body")),b(d),document.onselectstart=null,document.onmousemove=null},v.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},v.touchDraggable()}return t.dialogZindex+=2,d},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),a=t(i.getMonth()+1),n=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),d=t(i.getSeconds()),h=t(i.getMilliseconds()),u="",f=r+"-"+a+"-"+n,g=o+"-"+a+"-"+n,p=l+":"+c+":"+d;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=a;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=n;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=d;break;case"ms":u=h;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+h;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); -//# sourceMappingURL=editormd.amd.min.js.map \ No newline at end of file +e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm;e.getCursor(),e.getSelection()}e.replaceSelection("------------")},tex:function(){if(!this.settings.tex)return alert("settings.tex === false"),this;var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("$$"+i+"$$"),""===i&&e.setCursor(t.line,t.ch+2)},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},"reference-link":function(){this.executePlugin("referenceLinkDialog","reference-link-dialog/reference-link-dialog")},pagebreak:function(){if(!this.settings.pageBreak)return alert("settings.pageBreak === false"),this;{var e=this.cm;e.getSelection()}e.replaceSelection("\r\n[========]\r\n")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},"html-entities":function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},"goto-line":function(){this.executePlugin("gotoLineDialog","goto-line-dialog/goto-line-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},search:function(){this.search()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-B":"bold","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.emoji?(e.replaceSelection(":"+i+":"),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.emoji == false")},"Ctrl-Alt-G":"goto-line","Ctrl-H":"hr","Ctrl-I":"italic","Ctrl-K":"code","Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.atLink?(e.replaceSelection("@"+i),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.atLink == false")},"Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Shift-Ctrl-K":"tex","Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"html-entities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table","Shift-Alt-P":"pagebreak",F9:"watch",F10:"preview",F11:"fullscreen"};var r=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=r;var a=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=a;var n=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=n,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\-\w]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g,pageBreak:/^\[[=]{8,}\]$/},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(i,o){var a={toc:!0,tocm:!1,tocStartLevel:1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},n=e.extend(a,o||{}),s=t.$marked,l=new s.Renderer;i=i||[];var c=t.regexs,h=c.atLink,d=c.emoji,u=c.email,f=c.emailLink,g=c.twemoji,p=c.fontAwesome,m=c.editormdLogo,w=c.pageBreak;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!n.emoji)return e;for(var o=0,r=i.length;r>o;o++)e=e.replace(new RegExp(i[o]),function(e){var i=e.match(p),o=e.replace(/:/g,"");if(i)for(var r=0,a=i.length;a>r;r++){var n=i[r].replace(/:/g,"");return''}else{var s=e.match(m),l=e.match(g);if(s)for(var c=0,h=s.length;h>c;c++){var d=s[c].replace(/:/g,"");return''}else{if(!l)return':'+o+':';for(var u=0,f=l.length;f>u;u++){var w=l[u].replace(/:/g,"").replace("tw-","");return'twemoji-'+w+''}}}});return e},l.atLink=function(i){return h.test(i)?(n.atLink&&(i=i.replace(u,function(e){return e.replace(/@/g,"_#_@_#_")}),i=i.replace(h,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),n.emailLink&&(i=i.replace(f,function(t,i,o,r,a){return!i&&e.inArray(a,"jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|"))<0?''+t+"":t})),i):i},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var a=''+i.replace(/@/g,"@")+""):(t&&(a+=' title="'+t+'"'),a+=">"+i+"")},l.heading=function(e,t){var o=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var n=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var s=0,l=e.length;l>s;s++)n.push(e[s].replace(/\s*href\=\"(.*)\"\s*/g,""));e=n.join(" ")}e=r(e);var c=e.toLowerCase().replace(/[^\w]+/g,"-"),h={text:e,level:t,slug:c},d=/^[\u4e00-\u9fa5]+$/.test(e),u=d?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");i.push(h);var f="';return f+='',f+='',f+=this.atLink(a?this.emoji(o):this.emoji(e)),f+=""},l.pageBreak=function(e){return w.test(e)&&n.pageBreak&&(e='
        '),e},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",a=n.tocm?/^(\[TOC\]|\[TOCM\])$/.test(e):/^\[TOC\]$/.test(e),s=/^\[TOCM\]$/.test(e);e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e;var l='
        '+e+"
        ";return a?s?'
        '+l+"

        ":l:w.test(e)?this.pageBreak(e):""+this.atLink(this.emoji(e))+"

        \n"},l.code=function(e,t){return"seq"===t||"sequence"===t?'
        '+e+"
        ":"flow"===t?'
        '+e+"
        ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return n.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
      • '+this.atLink(this.emoji(e))+"
      • "):"
      • "+this.atLink(this.emoji(e))+"
      • "},l},t.markdownToCRenderer=function(e,t,i,o){var r="",a=0,n=this.classPrefix;o=o||1;for(var s=0,l=e.length;l>s;s++){var c=e[s].text,h=e[s].level;o>h||(r+=h>a?"":a>h?new Array(a-h+2).join("
    • "):"",r+='
    • '+c+"
        ",a=h)}var d=t.find(".markdown-toc");if(d.length<1&&"false"===t.attr("previewContainer")){var u='
        ';u=i?'
        '+u+"
        ":u,t.html(u),d=t.find(".markdown-toc")}return i&&d.wrap('

        '),d.html('
          ').children(".markdown-toc-list").html(r.replace(/\r?\n?\\<\/ul\>/g,"")),d},t.tocDropdownMenu=function(t,i){i=i||"Table of Contents";var o=400,r=t.find("."+this.classPrefix+"toc-menu");return r.each(function(){var t=e(this),r=t.children(".markdown-toc"),a='',n=''+a+i+"",s=r.children("ul"),l=s.find("li");r.append(n),l.first().before("
        • "+i+" "+a+"

        • "),t.mouseover(function(){s.show(),l.each(function(){var t=e(this),i=t.children("ul");if(""===i.html()&&i.remove(),i.length>0&&""!==i.html()){var r=t.children("a").first();r.children(".fa").length<1&&r.append(e(a).css({"float":"right",paddingTop:"4px"}))}t.mouseover(function(){i.css("z-index",o).show(),o+=1}).mouseleave(function(){i.hide()})})}).mouseleave(function(){s.hide()})}),r},t.filterHTMLTags=function(e,t){if("string"==typeof t)for(var i=t.split(","),o=0,r=i.length;r>o;o++){var a=i[o];e=e.replace(new RegExp("]*)>","igm"),"").replace(new RegExp("","igm"),"")}return e},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocm:!1,tocStartLevel:1,tocTitle:"目录",tocDropdown:!1,markdown:"",htmlDecode:!1,autoLoadKaTeX:!0,pageBreak:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var a=e("#"+i),n=a.settings=e.extend(!0,r,o||{}),s=a.find("textarea");s.length<1&&(a.append(""),s=a.find("textarea"));var l=""===n.markdown?s.val():n.markdown,c=[],h={toc:n.toc,tocm:n.tocm,tocStartLevel:n.tocStartLevel,taskList:n.taskList,emoji:n.emoji,tex:n.tex,pageBreak:n.pageBreak,atLink:n.atLink,emailLink:n.emailLink,flowChart:n.flowChart,sequenceDiagram:n.sequenceDiagram,previewCodeHighlight:n.previewCodeHighlight},d={renderer:t.markedRenderer(c,h),gfm:n.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:n.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=t.filterHTMLTags(l,n.htmlDecode);var u=marked(l,d);if(s.val(l),a.addClass("markdown-body "+this.classPrefix+"html-preview").append(u),n.toc&&(a.tocContainer=this.markdownToCRenderer(c,a,n.tocDropdown,n.tocStartLevel),(n.tocDropdown||a.find("."+this.classPrefix+"toc-menu").length>0)&&this.tocDropdownMenu(a,n.tocTitle)),n.previewCodeHighlight&&(a.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(n.flowChart&&a.find(".flowchart").flowChart(),n.sequenceDiagram&&a.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),n.tex){var f=function(){a.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html(),t[0])})};!n.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?f():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,f()})}return a.getMarkdown=function(){return s.val()},a},t.themes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min",js:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this.editor,a=t.classPrefix,n=(new Date).getTime(),s=""===i.name?a+"dialog-"+n:i.name,l=t.mouseOrTouch,c='
          ';""!==i.title&&(c+='
          ",c+=''+i.title+"",c+="
          "),i.closed&&(c+=''),c+='
          '+i.content,(i.footer||"string"==typeof i.footer)&&(c+='"),c+="
          ",c+='
          ',c+='
          ',c+="
          ",r.append(c);var h=r.find("."+s);h.lockScreen=function(t){return i.lockScreen&&e("html,body").css("overflow",t?"hidden":""),h},h.showMask=function(){return i.mask&&r.find("."+a+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),h},h.hideMask=function(){return i.mask&&r.find("."+a+"mask").hide(),h},h.loading=function(e){var t=h.find("."+a+"dialog-mask");return t[e?"show":"hide"](),h},h.lockScreen(!0).showMask(),h.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var d=function(){h.css({top:(e(window).height()-h.height())/2+"px",left:(e(window).width()-h.width())/2+"px"})};if(d(),e(window).resize(d),h.children("."+a+"dialog-close").bind(l("click","touchend"),function(){h.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var u=h.footer=h.find("."+a+"dialog-footer");for(var f in i.buttons){var g=i.buttons[f],p=a+f+"-btn";u.append('"),g[1]=e.proxy(g[1],h),u.children("."+p).bind(l("click","touchend"),g[1])}}if(""!==i.title&&i.drag){var m,w,v=h.children("."+a+"dialog-header");i.mask||v.bind(l("click","touchend"),function(){t.dialogZindex+=2,h.css("z-index",t.dialogZindex)}),v.mousedown(function(e){e=e||window.event,m=e.clientX-parseInt(h[0].style.left),w=e.clientY-parseInt(h[0].style.top),document.onmousemove=y});var k=function(e){e.removeClass(a+"user-unselect").off("selectstart")},b=function(e){e.addClass(a+"user-unselect").on("selectstart",function(){return!1})},y=function(t){t=t||window.event;var i,o,r=parseInt(h[0].style.left),a=parseInt(h[0].style.top);r>=0?r+h.width()<=e(window).width()?i=t.clientX-m:(i=e(window).width()-h.width(),document.onmousemove=null):(i=0,document.onmousemove=null),a>=0?o=t.clientY-w:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},b(e("body")),b(h),h[0].style.left=i+"px",h[0].style.top=o+"px"};document.onmouseup=function(){k(e("body")),k(h),document.onselectstart=null,document.onmousemove=null},v.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},v.touchDraggable()}return t.dialogZindex+=2,h},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),a=t(i.getMonth()+1),n=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),h=t(i.getSeconds()),d=t(i.getMilliseconds()),u="",f=r+"-"+a+"-"+n,g=o+"-"+a+"-"+n,p=l+":"+c+":"+h;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=a;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=n;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=h;break;case"ms":u=d;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+d;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); \ No newline at end of file diff --git a/editormd.amd.min.js.map b/editormd.amd.min.js.map deleted file mode 100644 index 9c67052..0000000 --- a/editormd.amd.min.js.map +++ /dev/null @@ -1,2 +0,0 @@ -/*! Editor.md v1.3.0 | editormd.amd.min.js.map | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-12 */ -{"version":3,"file":"editormd.amd.min.js","sources":["editormd.amd.min.js"],"names":["factory","require","exports","module","define","amd","cmModePath","cmAddonPath","codeMirrorModules","window","editormd","$","arguments","marked","prettify","katex","Raphael","_","flowchart","CodeMirror","jQuery","Zepto","id","options","fn","init","title","$name","version","homePage","classPrefix","toolbarModes","full","simple","mini","defaults","mode","theme","value","markdown","width","height","path","pluginPath","autoLoadModules","watch","placeholder","codeFold","autoHeight","autoCloseTags","searchReplace","readOnly","lineNumbers","matchWordHighlight","styleActiveLine","dialogLockScreen","dialogShowMask","dialogDraggable","dialogMaskBgColor","dialogMaskOpacity","fontSize","saveHTMLToTextarea","disabledKeyMaps","onload","onresize","onchange","onwatch","onunwatch","onpreviewing","onpreviewed","onfullscreen","onfullscreenExit","onscroll","onpreviewscroll","imageUpload","imageFormats","imageUploadURL","crossDomainUpload","uploadCallbackURL","toc","tocStartLevel","htmlDecode","atLink","emailLink","taskList","emoji","tex","flowChart","sequenceDiagram","previewCodeHighlight","toolbar","toolbarAutoFixed","toolbarIcons","toolbarTitles","toolbarHandlers","ucwords","lowercase","toolbarCustomIcons","toolbarIconsClass","undo","redo","bold","del","italic","quote","uppercase","h1","h2","h3","h4","h5","h6","list-ul","list-ol","hr","link","anchor","image","code","preformatted-text","code-block","table","datetime","htmlEntities","unwatch","preview","fullscreen","clear","help","info","toolbarIconTexts","lang","name","description","buttons","enter","cancel","close","dialog","url","urlTitle","urlEmpty","nameEmpty","titleEmpty","alt","uploadButton","imageURLEmpty","uploadFileEmpty","formatNotAllowed","preformattedText","emptyAlert","codeBlock","selectLabel","selectDefaultText","otherLanguage","unselectedLanguageAlert","codeEmptyAlert","classNames","dialogZindex","$katex","$marked","$CodeMirror","$prettyPrint","prototype","state","watching","loaded","_this","this","editor","settings","extend","textarea","html","hasClass","addClass","css","markdownTextarea","children","length","append","attr","appendElements","join","mask","val","htmlTextarea","previewContainer","loadCSS","setCodeMirror","setToolbar","loadedDisplay","loadQueues","loadPath","loadFlowChartOrSequenceDiagram","isIE8","loadScript","setTheme","cm","setOption","codeMirrorConfig","tabSize","dragDrop","autofocus","indentUnit","lineWrapping","extraKeys","Ctrl-Q","foldCode","getCursor","foldGutter","gutters","matchBrackets","indentWithTabs","styleSelectedText","autoCloseBrackets","showTrailingSpace","highlightSelectionMatches","showToken","codeEditor","fromTextArea","codeMirror","cmElement","setValue","getCodeMirrorOption","key","getOption","setCodeMirrorOption","addKeyMap","map","bottom","removeKeyMap","extends","proxy","set","config","recreate","on","eventType","callback","off","showToolbar","find","show","resize","hideToolbar","hide","setToolbarAutoFixed","fixed","autoFixedHandle","top","scrollTop","offset","position","left","bind","unbind","icons","toolbarMenu","menu","i","len","isHeader","test","index","iconTexts","iconClass","setToolbarHandler","getToolbarHandles","toolbarIconHandlers","mouseOrTouch","icon","cursor","selection","getSelection","activeIcon","focus","createDialog","createInfoDialog","infoDialogHTML","infoDialog","hideInfoDialog","infoDialogPosition","_infoDialogPosition","showInfoDialog","lockScreen","opacity","backgroundColor","lock","remove","saveToTextareas","registerKeyMaps","prettyPrint","katexRender","each","render","flowChartAndSequenceDiagramRender","keyMap","inArray","keyMaps","handle","keydown","event","keymaps","120","121","122","keyCode","data","codeEditorBindScroll","percent","scrollHeight","codeEditorUnbindScroll","previewBindScroll","codeView","previewUnbindScroll","mouseover","mouseout","touchstart","touchend","codeMirrorValue","getValue","innerText","markdownToC","rendererOptions","markedRendererOptions","markedOptions","renderer","markedRenderer","gfm","tables","breaks","pedantic","sanitize","smartLists","smartypants","setOptions","filterHTMLTags","newMarkdownDoc","save","markdownToCRenderer","kaTeXLoaded","loadKaTeX","timer","setTimeout","clearTimeout","setCursor","setSelection","from","to","setSelections","ranges","getSelections","replaceSelection","insertValue","setMarkdown","md","getMarkdown","getHTML","alert","getTextareaSavedHTML","getPreviewedHTML","watchIcon","unWatchIcon","parent","removeClass","previewing","toggle","toggleClass","escHandle","shiftKey","previewed","previewCloseBtn","background","fullscreenClass","fullscreenExit","margin","border","executePlugin","loadFiles","plugin","loadPlugin","loadPlugins","parseInt","line","ch","ucfirst","selections","listSelections","firstUpperCase","wordsFirstUpperCase","toUpperCase","toLowerCase","selectionText","split","langName","Date","datefmt","dateFormat","Ctrl-B","Ctrl-I","Ctrl-K","Shift-Ctrl-C","Shift-Ctrl-Q","Shift-Ctrl-S","Ctrl-H","Ctrl-1","Ctrl-2","Ctrl-3","Ctrl-4","Ctrl-5","Ctrl-6","Ctrl-D","Ctrl-E","Ctrl-L","Ctrl-U","Shift-Ctrl-A","Shift-Alt-C","Shift-Ctrl-Alt-C","Shift-Ctrl-H","Shift-Alt-H","Shift-Ctrl-E","Shift-Ctrl-U","Shift-Alt-U","Shift-Ctrl-Alt-U","Shift-Alt-L","Shift-Ctrl-I","Shift-Ctrl-Alt-I","Shift-Ctrl-L","Shift-Ctrl-O","Shift-Ctrl-P","Shift-Ctrl-T","F9","F10","F11","trim","str","String","replace","$1","urls","atLinkBase","regexs","email","emojiDatetime","twemoji","fontAwesome","editormdLogo","ext","Renderer","atLinkReg","emojiReg","emailReg","emailLinkReg","twemojiReg","faIconReg","editormdLogoReg","text","matchs","match","RegExp","faMatchs","fa","len1","faName","emdlogoMathcs","twemojiMatchs","x","len2","logoName","t","len3","twe","$2","href","prot","decodeURIComponent","unescape","e","indexOf","out","heading","level","linkText","hasLinkReg","tempText","push","escapedText","slug","isChinese","escape","headingHTML","headerPrefix","paragraph","isTeXInline","isTeXLine","isTeXAddClass","isToC","apply","tablecell","content","flags","type","tag","align","listitem","container","startLevel","lastLevel","Array","tocContainer","filters","filterTags","markdownToHTML","autoLoadKaTeX","div","saveTo","markdownDoc","markdownParsed","katexHandle","themes","js","fileName","into","document","createElement","rel","onreadystatechange","getElementsByTagName","appendChild","body","isIE","navigator","appName","appVersion","script","src","readyState","katexURL","drag","closed","maskStyle","footer","guid","getTime","dialogName","showMask","hideMask","loading","zIndex","dialogPosition","btn","btnClassName","posX","posY","dialogHeader","mousedown","clientX","style","clientY","onmousemove","moveAction","userCanSelect","obj","userUnselect","nowLeft","nowTop","onselectstart","onmouseup","touchDraggable","start","orig","originalEvent","pos","changedTouches","pageX","y","pageY","move","preventDefault","mouseEventType","touchEventType","createEvent","format","addZero","d","date","year","getFullYear","year2","toString","slice","month","getMonth","day","getDate","weekDay","getDay","hour","getHours","min","getMinutes","second","getSeconds","ms","getMilliseconds","ymd","fymd","hms","toUTCString","cnWeekDays","weekDays"],"mappings":"CAYE,SAASA,GACP,YAGH,IAAuB,kBAAZC,UAA6C,gBAAZC,UAA0C,gBAAXC,QAEpEA,OAAOD,QAAUF,MAEnB,IAAsB,kBAAXI,QAET,GAAIA,OAAOC,IACX,CACI,GAAIC,GAAc,mBACdC,EAAc,oBAEdC,GACA,SAAU,SAAU,WACpB,QAAS,UAAW,aAAc,YAAc,kBAAoB,kBAEpE,4BACAF,EAAa,UACbA,EAAa,YACbA,EAAa,cACbA,EAAa,UACbA,EAAa,cACbA,EAAa,UACbA,EAAa,UACbA,EAAa,oBACbA,EAAa,wBACbA,EAAa,sBACbA,EAAa,UACbA,EAAa,YACbA,EAAa,QACbA,EAAa,YACbA,EAAa,4BACbA,EAAa,cACbA,EAAa,gBACbA,EAAa,YACbA,EAAa,UACbA,EAAa,MACbA,EAAa,YACbA,EAAa,UACbA,EAAa,0BACbA,EAAa,QACbA,EAAa,oBACbA,EAAa,oBACbA,EAAa,gBACbA,EAAa,YACbA,EAAa,gBACbA,EAAa,YAEbC,EAAc,qBACdA,EAAc,gBACdA,EAAc,sBACdA,EAAc,gBACdA,EAAc,2BACdA,EAAc,4BACdA,EAAc,sBACdA,EAAc,gBACdA,EAAc,gBACdA,EAAc,kBACdA,EAAc,mBACdA,EAAc,kBACdA,EAAc,gBACdA,EAAc,qBACdA,EAAc,oBACdA,EAAc,eACdA,EAAc,wBACdA,EAAc,qBACdA,EAAc,qBACdA,EAAc,2BAGlBH,QAAOI,EA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AInC,MAAOnN,IAGJnY","sourceRoot":"./"} \ No newline at end of file diff --git a/editormd.js b/editormd.js index eb5e21b..40fe9c2 100644 --- a/editormd.js +++ b/editormd.js @@ -2,12 +2,12 @@ * Editor.md * * @file editormd.js - * @version v1.3.0 - * @description A simple online markdown editor. + * @version v1.4.0 + * @description Open source online markdown editor. * @license MIT License * @author Pandao * {@link https://github.com/pandao/editor.md} - * @updateTime 2015-03-12 + * @updateTime 2015-03-23 */ ;(function(factory) { @@ -35,14 +35,6 @@ } }(function() { - - /** - * editormd - * - * @param {String} id 编辑器的ID - * @param {Object} options 配置选项 Key/Value - * @returns {Object} editormd 返回editormd对象 - */ /* Require.js assignment replace */ @@ -54,12 +46,20 @@ return ; } + /** + * editormd + * + * @param {String} id 编辑器的ID + * @param {Object} options 配置选项 Key/Value + * @returns {Object} editormd 返回editormd对象 + */ + var editormd = function (id, options) { return new editormd.fn.init(id, options); }; editormd.title = editormd.$name = "Editor.md"; - editormd.version = "1.3.0"; + editormd.version = "1.4.0"; editormd.homePage = "https://pandao.github.io/editor.md/"; editormd.classPrefix = "editormd-"; @@ -69,8 +69,8 @@ "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|", "h1", "h2", "h3", "h4", "h5", "h6", "|", "list-ul", "list-ol", "hr", "|", - "link", "anchor", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "htmlEntities", "|", - "watch", "preview", "fullscreen", "clear", "|", + "link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|", + "goto-line", "watch", "preview", "fullscreen", "clear", "search", "|", "help", "info" ], simple : [ @@ -93,17 +93,20 @@ theme : "default", value : "", // value for CodeMirror, if mode not gfm/markdown markdown : "", + appendMarkdown : "", // if in init textarea value not empty, append markdown to textarea width : "100%", height : "100%", path : "./lib/", // Dependents module file directory - pluginPath : "", // If this empty, default use settings.path + "../plugins/" - autoLoadModules : true, // Automatic load dependent module files + pluginPath : "", // If this empty, default use settings.path + "../plugins/" + delay : 300, + autoLoadModules : true, // Automatic load dependent module files watch : true, - placeholder : "now coding markdown...", + placeholder : "Enjoy Markdown! coding now...", + gotoLine : true, codeFold : false, autoHeight : false, autoCloseTags : true, - searchReplace : false, + searchReplace : true, readOnly : false, lineNumbers : true, matchWordHighlight : true, // options: true, false, "onselected" @@ -136,8 +139,13 @@ uploadCallbackURL : "", toc : true, // Table of contents + tocm : false, // Using [TOCM], auto create ToC dropdown menu + tocTitle : "", // for ToC dropdown menu btn + tocDropdown : false, + tocContainer : "", tocStartLevel : 1, // Said from H1 to create ToC - htmlDecode : false, // Open the HTML tag identification + htmlDecode : false, // Open the HTML tag identification + pageBreak : true, // Enable parse page break [========] atLink : true, // for @link emailLink : true, // for email address auto link taskList : false, // Enable Github Flavored Markdown task lists @@ -151,9 +159,7 @@ toolbar : true, // show/hide toolbar toolbarAutoFixed : true, // on window scroll auto fixed position - toolbarIcons : function() { - return editormd.toolbarModes.full; // return array - }, + toolbarIcons : "full", toolbarTitles : {}, toolbarHandlers : { ucwords : function() { @@ -185,7 +191,7 @@ "list-ol" : "fa-list-ol", hr : "fa-minus", link : "fa-link", - anchor : "fa-anchor", + "reference-link" : "fa-anchor", image : "fa-picture-o", code : "fa-code", "preformatted-text" : "fa-file-code-o", @@ -193,10 +199,13 @@ table : "fa-table", datetime : "fa-clock-o", emoji : "fa-smile-o", - htmlEntities : "fa-copyright", + "html-entities" : "fa-copyright", + pagebreak : "fa-newspaper-o", + "goto-line" : "fa-terminal", // fa-crosshairs watch : "fa-eye-slash", unwatch : "fa-eye", - preview : "fa-search", + preview : "fa-desktop", + search : "fa-search", fullscreen : "fa-arrows-alt", clear : "fa-eraser", help : "fa-question-circle", @@ -206,7 +215,8 @@ lang : { name : "zh-cn", - description : "开源在线Markdown编辑器
          A simple markdown doucment online editor.", + description : "开源在线Markdown编辑器
          Open source online Markdown editor.", + tocTitle : "目录", toolbar : { undo : "撤销(Ctrl+Z)", redo : "重做(Ctrl+Y)", @@ -227,7 +237,7 @@ "list-ol" : "有序列表", hr : "横线", link : "链接", - anchor : "锚点", + "reference-link" : "引用链接", image : "添加图片", code : "行内代码", "preformatted-text" : "预格式文本 / 代码块(缩进风格)", @@ -235,12 +245,15 @@ table : "添加表格", datetime : "日期时间", emoji : "Emoji表情", - htmlEntities : "HTML实体字符", + "html-entities" : "HTML实体字符", + pagebreak : "插入分页符", + "goto-line" : "跳转到行", watch : "关闭实时预览", unwatch : "开启实时预览", - preview : "全窗口预览HTML(可按ESC还原)", + preview : "全窗口预览HTML(按 Shift + ESC还原)", fullscreen : "全屏(按ESC还原)", clear : "清空", + search : "搜索", help : "使用帮助", info : "关于" + editormd.title }, @@ -256,14 +269,15 @@ urlTitle : "链接标题", urlEmpty : "错误:请填写链接地址。" }, - anchor : { - title : "添加锚点链接", - name : "锚点名称", + referenceLink : { + title : "添加引用链接", + name : "引用名称", url : "链接地址", + urlId : "链接ID", urlTitle : "链接标题", - nameEmpty: "错误:锚点名称不能为空。", - titleEmpty : "错误:请填写锚点链接标题。", - urlEmpty : "错误:请填写锚点链接地址。" + nameEmpty: "错误:引用链接的名称不能为空。", + idEmpty : "错误:请填写引用链接的ID。", + urlEmpty : "错误:请填写引用链接的URL地址。" }, image : { title : "添加图片", @@ -307,6 +321,8 @@ editormd.$marked = null; editormd.$CodeMirror = null; editormd.$prettyPrint = null; + + var timer, flowchartTimer; editormd.prototype = editormd.fn = { state : { @@ -329,22 +345,30 @@ options = options || {}; + if (typeof id === "object") + { + options = id; + } + var _this = this; - var classPrefix = this.classPrefix = editormd.classPrefix; - var editor = this.editor = $("#" + id); + var classPrefix = this.classPrefix = editormd.classPrefix; var settings = this.settings = $.extend(true, editormd.defaults, options); + id = (typeof id === "object") ? settings.id : id; + + var editor = this.editor = $("#" + id); + this.id = id; this.lang = settings.lang; var classNames = this.classNames = { textarea : { - html : this.classPrefix + "html-textarea", - markdown : this.classPrefix + "markdown-textarea" + html : classPrefix + "html-textarea", + markdown : classPrefix + "markdown-textarea" } }; - settings.pluginPath = (settings.pluginPath === "") ? this.settings.path + "../plugins/" : settings.pluginPath; + settings.pluginPath = (settings.pluginPath === "") ? settings.path + "../plugins/" : settings.pluginPath; this.state.watching = (settings.watch) ? true : false; @@ -382,16 +406,22 @@ editor.append(appendElements).addClass(classPrefix + "vertical"); - this.mask = editor.children("." + classPrefix + "mask"); + this.mask = editor.children("." + classPrefix + "mask"); + this.containerMask = editor.children("." + classPrefix + "container-mask"); if (settings.markdown !== "") { markdownTextarea.val(settings.markdown); } - this.htmlTextarea = editor.children("." + classNames.textarea.html); - this.preview = editor.children("." + classPrefix + "preview"); - this.previewContainer = this.preview.children("." + classPrefix + "preview-container"); + if (settings.appendMarkdown !== "") + { + markdownTextarea.val(markdownTextarea.val() + settings.appendMarkdown); + } + + this.htmlTextarea = editor.children("." + classNames.textarea.html); + this.preview = editor.children("." + classPrefix + "preview"); + this.previewContainer = this.preview.children("." + classPrefix + "preview-container"); if (typeof define === "function" && define.amd) { @@ -400,7 +430,7 @@ editormd.$katex = katex; } - if (settings.searchReplace) + if (settings.searchReplace && !settings.readOnly) { editormd.loadCSS(settings.path + "codemirror/addon/dialog/dialog"); editormd.loadCSS(settings.path + "codemirror/addon/search/matchesonscrollbar"); @@ -409,12 +439,15 @@ if ((typeof define === "function" && define.amd) || !settings.autoLoadModules) { - if (typeof CodeMirror !== "undefined") editormd.$CodeMirror = CodeMirror; - if (typeof marked !== "undefined") editormd.$marked = marked; + if (typeof CodeMirror !== "undefined") { + editormd.$CodeMirror = CodeMirror; + } - _this.setCodeMirror(); - _this.setToolbar(); - _this.loadedDisplay(); + if (typeof marked !== "undefined") { + editormd.$marked = marked; + } + + this.setCodeMirror().setToolbar().loadedDisplay(); } else { @@ -487,7 +520,7 @@ editormd.loadCSS(loadPath + "codemirror/codemirror.min"); - if (settings.searchReplace) + if (settings.searchReplace && !settings.readOnly) { editormd.loadCSS(loadPath + "codemirror/addon/dialog/dialog"); editormd.loadCSS(loadPath + "codemirror/addon/search/matchesonscrollbar"); @@ -589,7 +622,11 @@ indentUnit : 4, lineNumbers : settings.lineNumbers, lineWrapping : true, - extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }}, + extraKeys : { + "Ctrl-Q": function(cm) { + cm.foldCode(cm.getCursor()); + } + }, foldGutter : settings.codeFold, gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], matchBrackets : true, @@ -598,7 +635,7 @@ styleSelectedText : true, autoCloseBrackets : true, showTrailingSpace : true, - highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight == "onselected") ? false : /\w/ } ) + highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } ) }; this.codeEditor = this.cm = editormd.$CodeMirror.fromTextArea(this.markdownTextarea[0], codeMirrorConfig); @@ -648,18 +685,116 @@ return this; }, + /** + * 添加 CodeMirror 键盘快捷键 + * Add CodeMirror keyboard shortcuts key map + * + * @returns {editormd} 返回editormd的实例对象 + */ + addKeyMap : function(map, bottom) { this.cm.addKeyMap(map, bottom); return this; }, + /** + * 移除 CodeMirror 键盘快捷键 + * Remove CodeMirror keyboard shortcuts key map + * + * @returns {editormd} 返回editormd的实例对象 + */ + removeKeyMap : function(map) { this.cm.removeKeyMap(map); return this; }, + /** + * 跳转到指定的行 + * Goto CodeMirror line + * + * @param {String|Intiger} line line number or "first"|"last" + * @returns {editormd} 返回editormd的实例对象 + */ + + gotoLine : function (line) { + + var settings = this.settings; + + if (!settings.gotoLine) + { + return this; + } + + var cm = this.cm; + var editor = this.editor; + var count = cm.lineCount(); + var preview = this.preview; + + if (typeof line === "string") + { + if(line === "last") + { + line = count; + } + + if (line === "first") + { + line = 1; + } + } + + if (typeof line !== "number") + { + alert("Error: The line number must be an integer."); + return this; + } + + line = parseInt(line) - 1; + + if (line > count) + { + alert("Error: The line number range 1-" + count); + + return this; + } + + cm.setCursor( {line : line, ch : 0} ); + + var scrollInfo = cm.getScrollInfo(); + var clientHeight = scrollInfo.clientHeight; + var coords = cm.charCoords({line : line, ch : 0}, "local"); + + cm.scrollTo(null, (coords.top + coords.bottom - clientHeight) / 2); + + if (settings.watch) + { + var cmScroll = this.codeMirror.find(".CodeMirror-scroll")[0]; + var height = $(cmScroll).height(); + var scrollTop = cmScroll.scrollTop; + var percent = (scrollTop / cmScroll.scrollHeight); + + if (scrollTop === 0) + { + preview.scrollTop(0); + } + else if (scrollTop + height >= preview[0].scrollHeight) + { + preview.scrollTop(preview[0].scrollHeight); + } + else + { + preview.scrollTop(preview[0].scrollHeight * percent); + } + } + + cm.focus(); + + return this; + }, + /** * 扩展当前实例对象,可同时设置多个或者只设置一个 * Extend editormd instance object, can mutil setting. @@ -667,10 +802,10 @@ * @returns {editormd} this(editormd instance object.) */ - extends : function() { + extend : function() { if (typeof arguments[1] !== "undefined") { - if (typeof arguments[1] == "function") + if (typeof arguments[1] === "function") { arguments[1] = $.proxy(arguments[1], this); } @@ -697,7 +832,7 @@ set : function (key, value) { - if (typeof value !== "undefined" && typeof value == "function") + if (typeof value !== "undefined" && typeof value === "function") { value = $.proxy(value, this); } @@ -719,12 +854,12 @@ config : function(key, value) { var settings = this.settings; - if (typeof key == "object") + if (typeof key === "object") { settings = $.extend(true, settings, key); } - if (typeof key == "string") + if (typeof key === "string") { settings[key] = value; } @@ -785,7 +920,9 @@ showToolbar : function(callback) { var settings = this.settings; - if(settings.readOnly) return ; + if(settings.readOnly) { + return this; + } if (settings.toolbar && (this.toolbar.length < 1 || this.toolbar.find("." + this.classPrefix + "menu").html() === "") ) { @@ -842,7 +979,8 @@ } var autoFixedHandle = function(){ - var top = $(window).scrollTop(); + var $window = $(window); + var top = $window.scrollTop(); if (!settings.toolbarAutoFixed) { @@ -854,7 +992,7 @@ toolbar.css({ position : "fixed", width : editor.width() + "px", - left : ($(window).width() - editor.width()) / 2 + "px" + left : ($window.width() - editor.width()) / 2 + "px" }); } else @@ -871,11 +1009,6 @@ { $(window).bind("scroll", autoFixedHandle); } - - if (!settings.toolbarAutoFixed) - { - $(window).unbind("scroll", autoFixedHandle); - } return this; }, @@ -890,7 +1023,9 @@ setToolbar : function() { var settings = this.settings; - if(settings.readOnly) return ; + if(settings.readOnly) { + return this; + } var editor = this.editor; var preview = this.preview; @@ -900,15 +1035,17 @@ if (settings.toolbar && toolbar.length < 1) { - editor.append('
            '); - toolbar = this.toolbar = editor.children("." + classPrefix + "toolbar"); + var toolbarHTML = "
              "; + + editor.append(toolbarHTML); + toolbar = this.toolbar = editor.children("." + classPrefix + "toolbar"); } if (!settings.toolbar) { toolbar.hide(); - return ; + return this; } toolbar.show(); @@ -941,14 +1078,14 @@ menu += "
            • "; - if (typeof settings.toolbarCustomIcons[name] !== "undefined") + if (typeof settings.toolbarCustomIcons[name] !== "undefined" && typeof settings.toolbarCustomIcons[name] !== "function") { menu += settings.toolbarCustomIcons[name]; } else { menu += "" + - ""+((isHeader) ? name : ( (iconClass === "") ? iconTexts : "") ) + "" + + ""+((isHeader) ? name.toUpperCase() : ( (iconClass === "") ? iconTexts : "") ) + "" + ""; } @@ -1010,16 +1147,12 @@ var settings = this.settings; if (!settings.toolbar || settings.readOnly) { - return ; + return this; } - var editor = this.editor; - var preview = this.preview; var toolbar = this.toolbar; - var codeEditor = this.codeEditor; - var codeMirror = this.codeMirror; - var classPrefix = this.classPrefix; - var previewContainer = this.previewContainer; + var cm = this.cm; + var classPrefix = this.classPrefix; var toolbarIcons = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a"); var toolbarIconHandlers = this.getToolbarHandles(); @@ -1027,8 +1160,8 @@ var icon = $(this).children(".fa"); var name = icon.attr("name"); - var cursor = codeEditor.getCursor(); - var selection = codeEditor.getSelection(); + var cursor = cm.getCursor(); + var selection = cm.getSelection(); if (name === "") { return ; @@ -1038,20 +1171,20 @@ if (typeof toolbarIconHandlers[name] !== "undefined") { - $.proxy(toolbarIconHandlers[name], _this)(codeEditor); + $.proxy(toolbarIconHandlers[name], _this)(cm); } else { if (typeof settings.toolbarHandlers[name] !== "undefined") { - $.proxy(settings.toolbarHandlers[name], _this)(codeEditor, icon, cursor, selection); + $.proxy(settings.toolbarHandlers[name], _this)(cm, icon, cursor, selection); } } - if (name !== "link" && name !== "anchor" && name !== "image" && name !== "code-block" && - name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "fullscreen" && name !== "info") + if (name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && + name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info") { - codeEditor.focus(); + cm.focus(); } return false; @@ -1090,8 +1223,8 @@ "
              ", "

              " + editormd.title + "v" + editormd.version + "

              ", "

              " + this.lang.description + "

              ", - "

              Home page: " + editormd.homePage + "

              ", - "

              License: MIT

              ", + "

              " + editormd.homePage + "

              ", + "

              Copyright © 2015 Pandao, The MIT License.

              ", "
              ", "", "" @@ -1149,9 +1282,8 @@ var _this = this; var editor = this.editor; - var settings = this.settings; - var classPrefix = this.classPrefix; - var infoDialog = this.infoDialog = editor.children("." + classPrefix + "dialog-info"); + var settings = this.settings; + var infoDialog = this.infoDialog = editor.children("." + this.classPrefix + "dialog-info"); if (infoDialog.length < 1) { @@ -1213,22 +1345,13 @@ var _this = this; var editor = this.editor; var settings = this.settings; - var toolbarIcons = settings.toolbarIcons(); this.codeMirror.remove(); this.setCodeMirror(); - - if (typeof this.infoDialog !== "undefined") { - this.infoDialog.remove(); - } - - if (typeof toolbarIcons["info"] !== "undefined") { - createInfoDialog(); - } if (!settings.readOnly) - { + { if (editor.find(".editormd-dialog").length > 0) { editor.find(".editormd-dialog").remove(); } @@ -1240,9 +1363,7 @@ } } - this.saveToTextareas(); - this.resize(); - this.registerKeyMaps(); + this.loadedDisplay(true); return this; }, @@ -1280,9 +1401,12 @@ katexRender : function() { - var previewContainer = this.previewContainer; + if (timer === null) + { + return this; + } - previewContainer.find("." + editormd.classNames.tex).each(function(){ + this.previewContainer.find("." + editormd.classNames.tex).each(function(){ var tex = $(this); editormd.$katex.render(tex.html(), tex[0]); }); @@ -1302,9 +1426,15 @@ var settings = this.settings; var previewContainer = this.previewContainer; - if (editormd.isIE8) return ; + if (editormd.isIE8) { + return this; + } if (settings.flowChart) { + if (flowchartTimer === null) { + return this; + } + previewContainer.find(".flowchart").flowChart(); } @@ -1324,17 +1454,20 @@ */ registerKeyMaps : function(keyMap) { - keyMap = keyMap || null; - var _this = this; - var cm = this.cm; - var settings = this.settings; + var _this = this; + var cm = this.cm; + var settings = this.settings; + var toolbarHandlers = editormd.toolbarHandlers; + var disabledKeyMaps = settings.disabledKeyMaps; + + keyMap = keyMap || null; if (keyMap) { for (var i in keyMap) { - if ($.inArray(i, settings.disabledKeyMaps) < 0) + if ($.inArray(i, disabledKeyMaps) < 0) { var map = {}; map[i] = keyMap[i]; @@ -1345,17 +1478,17 @@ } else { - for (var i in editormd.keyMaps) + for (var k in editormd.keyMaps) { - var keyMap = editormd.keyMaps[i]; - var handle = (typeof keyMap === "string") ? $.proxy(editormd.toolbarHandlers[keyMap], _this) : $.proxy(keyMap, _this); + var _keyMap = editormd.keyMaps[k]; + var handle = (typeof _keyMap === "string") ? $.proxy(toolbarHandlers[_keyMap], _this) : $.proxy(_keyMap, _this); - if ($.inArray(i, ["F9", "F10", "F11"]) < 0 && $.inArray(i, settings.disabledKeyMaps) < 0) + if ($.inArray(k, ["F9", "F10", "F11"]) < 0 && $.inArray(k, disabledKeyMaps) < 0) { - var map = {}; - map[i] = handle; + var _map = {}; + _map[k] = handle; - cm.addKeyMap(map); + cm.addKeyMap(_map); } } @@ -1367,22 +1500,23 @@ "122" : "F11" }; - if ( $.inArray(keymaps[event.keyCode], settings.disabledKeyMaps) < 0 ) + if ( $.inArray(keymaps[event.keyCode], disabledKeyMaps) < 0 ) { switch (event.keyCode) { case 120: - $.proxy(editormd.toolbarHandlers["watch"], _this)(); + $.proxy(toolbarHandlers["watch"], _this)(); return false; break; case 121: - $.proxy(editormd.toolbarHandlers["preview"], _this)(); + $.proxy(toolbarHandlers["preview"], _this)(); return false; break; case 122: - $.proxy(editormd.toolbarHandlers["fullscreen"], _this)(); + $.proxy(toolbarHandlers["fullscreen"], _this)(); + return false; break; default: @@ -1395,42 +1529,15 @@ return this; }, - /** - * 加载队列完成之后的显示处理 - * Display handle of the module queues loaded after. - * - * @returns {editormd} 返回editormd的实例对象 - */ - - loadedDisplay : function() { + bindScrollEvent : function() { var _this = this; - var editor = this.editor; var preview = this.preview; var settings = this.settings; - var codeEditor = this.codeEditor; var codeMirror = this.codeMirror; - var previewContainer = this.previewContainer; var mouseOrTouch = editormd.mouseOrTouch; - - editor.children("." + this.classPrefix + "container-mask").hide(); - - this.saveToTextareas(); - - if(settings.watch) { - preview.show(); - } - - editor.data("oldWidth", editor.width()).data("oldHeight", editor.height()); // 为了兼容Zepto - - this.resize(); - this.registerKeyMaps(); - - $(window).resize(function(){ - _this.resize(); - }); - var codeEditorBindScroll = function() { + var cmBindScroll = function() { codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function(event) { var height = $(this).height(); var scrollTop = $(this).scrollTop(); @@ -1449,36 +1556,38 @@ preview.scrollTop(preview[0].scrollHeight * percent); } - $.proxy(settings.onscroll, this)(event); + $.proxy(settings.onscroll, _this)(event); }); }; - var codeEditorUnbindScroll = function() { + var cmUnbindScroll = function() { codeMirror.find(".CodeMirror-scroll").unbind(mouseOrTouch("scroll", "touchmove")); }; var previewBindScroll = function() { - preview.bind(mouseOrTouch("scroll", "touchmove"), function() { + + preview.bind(mouseOrTouch("scroll", "touchmove"), function(event) { var height = $(this).height(); - var scrollTop = $(this).scrollTop(); + var scrollTop = $(this).scrollTop(); var percent = (scrollTop / $(this)[0].scrollHeight); var codeView = codeMirror.find(".CodeMirror-scroll"); if(scrollTop === 0) { codeView.scrollTop(0); - } + } else if (scrollTop + height >= $(this)[0].scrollHeight) - { + { codeView.scrollTop(codeView[0].scrollHeight); - } + } else - { + { codeView.scrollTop(codeView[0].scrollHeight * percent); } - $.proxy(settings.onpreviewscroll, this)(event); + $.proxy(settings.onpreviewscroll, _this)(event); }); + }; var previewUnbindScroll = function() { @@ -1486,10 +1595,10 @@ }; codeMirror.bind({ - mouseover : codeEditorBindScroll, - mouseout : codeEditorUnbindScroll, - touchstart : codeEditorBindScroll, - touchend : codeEditorUnbindScroll + mouseover : cmBindScroll, + mouseout : cmUnbindScroll, + touchstart : cmBindScroll, + touchend : cmUnbindScroll }); preview.bind({ @@ -1499,12 +1608,72 @@ touchend : previewUnbindScroll }); - codeEditor.on("change", function(cm, changeObj) { - _this.previewContainer.css("padding-left", settings.autoHeight && $("body").height() > $(window).height() ? "30px" : "20px"); - _this.saveToTextareas(); + return this; + }, + + bindChangeEvent : function() { + + var _this = this; + var cm = this.cm; + var settings = this.settings; + + cm.on("change", function(_cm, changeObj) { + + if (settings.watch) + { + _this.previewContainer.css("padding", settings.autoHeight ? "20px 20px 50px 40px" : "20px"); + } + + timer = setTimeout(function() { + clearTimeout(timer); + _this.save(); + timer = null; + }, settings.delay); }); + + return this; + }, + + /** + * 加载队列完成之后的显示处理 + * Display handle of the module queues loaded after. + * + * @param {Boolean} recreate 是否为重建编辑器 + * @returns {editormd} 返回editormd的实例对象 + */ + + loadedDisplay : function(recreate) { + + recreate = recreate || false; + + var _this = this; + var editor = this.editor; + var preview = this.preview; + var settings = this.settings; - $.proxy(settings.onload, this)(); + this.containerMask.hide(); + + this.save(); + + if (settings.watch) { + preview.show(); + } + + editor.data("oldWidth", editor.width()).data("oldHeight", editor.height()); // 为了兼容Zepto + + this.resize(); + this.registerKeyMaps(); + + $(window).resize(function(){ + _this.resize(); + }); + + this.bindScrollEvent().bindChangeEvent(); + + if (!recreate) + { + $.proxy(settings.onload, this)(); + } this.state.loaded = true; @@ -1562,14 +1731,11 @@ var preview = this.preview; var toolbar = this.toolbar; var settings = this.settings; - var codeEditor = this.codeEditor; var codeMirror = this.codeMirror; - if(width) - { - editor.css({ - width : (typeof width === "number") ? width + "px" : width - }); + if (width) + { + editor.css("width", (typeof width === "number") ? width + "px" : width); } if (settings.autoHeight && !state.fullscreen && !state.preview) @@ -1578,12 +1744,10 @@ codeMirror.css("height", "auto"); } else - { - if(height) - { - editor.css({ - height : (typeof height === "number") ? height + "px" : height - }); + { + if (height) + { + editor.css("height", (typeof height === "number") ? height + "px" : height); } if (state.fullscreen) @@ -1591,20 +1755,23 @@ editor.height($(window).height()); } - if (settings.toolbar && !settings.readOnly) { + if (settings.toolbar && !settings.readOnly) + { codeMirror.css("margin-top", toolbar.height() + 1).height(editor.height() - toolbar.height()); - } else { + } + else + { codeMirror.css("margin-top", 0).height(editor.height()); } } - codeMirror.find(".CodeMirror-gutters").height(codeMirror.height()); - if(settings.watch) { codeMirror.width(editor.width() / 2); preview.width((!state.preview) ? editor.width() / 2 : editor.width()); + this.previewContainer.css("padding", settings.autoHeight ? "20px 20px 50px 40px" : "20px"); + if (settings.toolbar && !settings.readOnly) { preview.css("top", toolbar.height()); @@ -1616,18 +1783,11 @@ if (settings.autoHeight && !state.fullscreen && !state.preview) { - preview.height("auto"); + preview.height(""); } else { - if (settings.toolbar && !settings.readOnly) - { - preview.height(editor.height() - toolbar.height()); - } - else - { - preview.height(editor.height()); - } + preview.height((settings.toolbar && !settings.readOnly) ? editor.height() - toolbar.height() : editor.height()); } } else @@ -1645,24 +1805,29 @@ }, /** - * 分别将Markdown源码和解析的HTML源码保存到对应的textarea - * Saving Markdown and HTML source code to Textarea + * 解析和保存Markdown代码 + * Parse & Saving Markdown source code * - * @returns {editormd} 返回editormd的实例对象 + * @returns {editormd} 返回editormd的实例对象 */ - saveToTextareas : function() { + save : function() { + + if (timer === null) + { + return this; + } + var _this = this; var state = this.state; var settings = this.settings; - var codeEditor = this.codeEditor; + var cm = this.cm; + var cmValue = cm.getValue(); var previewContainer = this.previewContainer; - - var codeMirrorValue = codeEditor.getValue(); if (settings.mode !== "gfm" && settings.mode !== "markdown") { - this.markdownTextarea[0].innerText = codeMirrorValue; + this.markdownTextarea.val(cmValue); return this; } @@ -1671,7 +1836,9 @@ var markdownToC = this.markdownToC = []; var rendererOptions = this.markedRendererOptions = { toc : settings.toc, + tocm : settings.tocm, tocStartLevel : settings.tocStartLevel, + pageBreak : settings.pageBreak, taskList : settings.taskList, emoji : settings.emoji, tex : settings.tex, @@ -1695,13 +1862,13 @@ marked.setOptions(markedOptions); - codeMirrorValue = editormd.filterHTMLTags(codeMirrorValue, settings.htmlDecode); + cmValue = editormd.filterHTMLTags(cmValue, settings.htmlDecode); - var newMarkdownDoc = editormd.$marked(codeMirrorValue, markedOptions); + var newMarkdownDoc = editormd.$marked(cmValue, markedOptions); - this.markdownTextarea[0].innerText = codeMirrorValue; + this.markdownTextarea.val(cmValue); - codeEditor.save(); + cm.save(); if (settings.saveHTMLToTextarea) { @@ -1713,9 +1880,30 @@ previewContainer.html(newMarkdownDoc); this.previewCodeHighlight(); + + if (settings.toc) + { + var tocContainer = (settings.tocContainer === "") ? previewContainer : $(settings.tocContainer); + var tocMenu = tocContainer.find("." + this.classPrefix + "toc-menu"); + + tocContainer.attr("previewContainer", (settings.tocContainer === "") ? "true" : "false"); + + if (settings.tocContainer !== "" && tocMenu.length > 0) + { + tocMenu.remove(); + } + + editormd.markdownToCRenderer(markdownToC, tocContainer, settings.tocDropdown, settings.tocStartLevel); + + if (settings.tocDropdown || tocContainer.find("." + this.classPrefix + "toc-menu").length > 0) + { + editormd.tocDropdownMenu(tocContainer, (settings.tocTitle !== "") ? settings.tocTitle : this.lang.tocTitle); + } - if (settings.toc) { - editormd.markdownToCRenderer(markdownToC, previewContainer, settings.tocStartLevel); + if (settings.tocContainer !== "") + { + previewContainer.find(".markdown-toc").css("border", "none"); + } } if (settings.tex) @@ -1737,9 +1925,10 @@ if (settings.flowChart || settings.sequenceDiagram) { - var timer = setTimeout(function(){ - clearTimeout(timer); + flowchartTimer = setTimeout(function(){ + clearTimeout(flowchartTimer); _this.flowChartAndSequenceDiagramRender(); + flowchartTimer = null; }, 10); } @@ -1760,7 +1949,7 @@ */ focus : function() { - this.codeEditor.focus(); + this.cm.focus(); return this; }, @@ -1774,7 +1963,7 @@ */ setCursor : function(cursor) { - this.codeEditor.setCursor(cursor); + this.cm.setCursor(cursor); return this; }, @@ -1787,7 +1976,7 @@ */ getCursor : function() { - return this.codeEditor.getCursor(); + return this.cm.getCursor(); }, /** @@ -1801,7 +1990,7 @@ setSelection : function(from, to) { - this.codeEditor.setSelection(from, to); + this.cm.setSelection(from, to); return this; }, @@ -1814,7 +2003,7 @@ */ getSelection : function() { - return this.codeEditor.getSelection(); + return this.cm.getSelection(); }, /** @@ -1851,7 +2040,7 @@ */ replaceSelection : function(value) { - this.codeEditor.replaceSelection(value); + this.cm.replaceSelection(value); return this; }, @@ -1873,6 +2062,23 @@ return this; }, + /** + * 追加markdown + * append Markdown to editor + * + * @param {String} md 要追加的markdown源文档 + * @returns {editormd} 返回editormd的实例对象 + */ + + appendMarkdown : function(md) { + var settings = this.settings; + var cm = this.cm; + + cm.setValue(cm.getValue() + md); + + return this; + }, + /** * 设置和传入编辑器的markdown源文档 * Set Markdown source document @@ -1881,10 +2087,8 @@ * @returns {editormd} 返回editormd的实例对象 */ - setMarkdown : function(md) { - var settings = this.settings; - - this.codeEditor.setValue(md || settings.markdown); + setMarkdown : function(md) { + this.cm.setValue(md || this.settings.markdown); return this; }, @@ -1897,7 +2101,7 @@ */ getMarkdown : function() { - return this.codeEditor.getValue(); + return this.cm.getValue(); }, /** @@ -1908,7 +2112,7 @@ */ getValue : function() { - return this.codeEditor.getValue(); + return this.cm.getValue(); }, /** @@ -1920,7 +2124,7 @@ */ setValue : function(value) { - this.codeEditor.setValue(value); + this.cm.setValue(value); return this; }, @@ -1933,7 +2137,7 @@ */ clear : function() { - this.codeEditor.setValue(""); + this.cm.setValue(""); return this; }, @@ -1993,19 +2197,31 @@ */ watch : function(callback) { - var settings = this.settings; + var settings = this.settings; + + if ($.inArray(settings.mode, ["gfm", "markdown"]) < 0) + { + return this; + } + this.state.watching = settings.watch = true; this.preview.show(); - var watchIcon = settings.toolbarIconsClass.watch; - var unWatchIcon = settings.toolbarIconsClass.unwatch; - var icon = this.toolbar.find(".fa[name=watch]"); - icon.parent().attr("title", settings.lang.toolbar.watch); - icon.removeClass(unWatchIcon).addClass(watchIcon); + if (this.toolbar) + { + var watchIcon = settings.toolbarIconsClass.watch; + var unWatchIcon = settings.toolbarIconsClass.unwatch; + + var icon = this.toolbar.find(".fa[name=watch]"); + icon.parent().attr("title", settings.lang.toolbar.watch); + icon.removeClass(unWatchIcon).addClass(watchIcon); + } this.codeMirror.css("border-right", "1px solid #ddd").width(this.editor.width() / 2); - this.saveToTextareas().resize(); + timer = 0; + + this.save().resize(); if (!settings.onwatch) { @@ -2029,11 +2245,11 @@ this.state.watching = settings.watch = false; this.preview.hide(); - var watchIcon = settings.toolbarIconsClass.watch; - var unWatchIcon = settings.toolbarIconsClass.unwatch; - if (this.toolbar) { + var watchIcon = settings.toolbarIconsClass.watch; + var unWatchIcon = settings.toolbarIconsClass.unwatch; + var icon = this.toolbar.find(".fa[name=watch]"); icon.parent().attr("title", settings.lang.toolbar.unwatch); icon.removeClass(watchIcon).addClass(unWatchIcon); @@ -2107,7 +2323,11 @@ var settings = this.settings; var codeMirror = this.codeMirror; - if (settings.toolbar) { + if ($.inArray(settings.mode, ["gfm", "markdown"]) < 0) { + return this; + } + + if (settings.toolbar && toolbar) { toolbar.toggle(); toolbar.find(".fa[name=preview]").toggleClass("active"); } @@ -2120,11 +2340,11 @@ } }; - if(codeMirror.css("display") === "none") // 为了兼容Zepto,而不使用codeMirror.is(":hidden") + if (codeMirror.css("display") === "none") // 为了兼容Zepto,而不使用codeMirror.is(":hidden") { this.state.preview = true; - if(this.state.fullscreen) { + if (this.state.fullscreen) { preview.css("background", "#fff"); } @@ -2132,9 +2352,9 @@ _this.previewed(); }); - if(!settings.watch) + if (!settings.watch) { - this.saveToTextareas(); + this.save(); } preview.show().css({ @@ -2171,22 +2391,17 @@ var preview = this.preview; var toolbar = this.toolbar; var settings = this.settings; - var codeMirror = this.codeMirror; var previewCloseBtn = editor.find("." + this.classPrefix + "preview-close-btn"); this.state.preview = false; - codeMirror.show(); + this.codeMirror.show(); if (settings.toolbar) { toolbar.show(); } - - if(this.settings.watch) { - preview.show(); - } else { - preview.hide(); - } + + preview[(settings.watch) ? "show" : "hide"](); previewCloseBtn.hide().unbind(editormd.mouseOrTouch("click", "touchend")); @@ -2216,9 +2431,11 @@ fullscreen : function() { var _this = this; + var state = this.state; var editor = this.editor; var preview = this.preview; var toolbar = this.toolbar; + var settings = this.settings; var fullscreenClass = this.classPrefix + "fullscreen"; if (toolbar) { @@ -2228,7 +2445,7 @@ var escHandle = function(event) { if (!event.shiftKey && event.keyCode === 27) { - if (_this.state.fullscreen) + if (state.fullscreen) { _this.fullscreenExit(); } @@ -2237,7 +2454,7 @@ if (!editor.hasClass(fullscreenClass)) { - this.state.fullscreen = true; + state.fullscreen = true; $("html,body").css("overflow", "hidden"); @@ -2253,7 +2470,7 @@ this.resize(); - $.proxy(this.settings.onfullscreen, this)(); + $.proxy(settings.onfullscreen, this)(); $(window).bind("keyup", escHandle); } @@ -2276,9 +2493,11 @@ fullscreenExit : function() { var editor = this.editor; + var settings = this.settings; var toolbar = this.toolbar; - var fullscreenClass = this.classPrefix + "fullscreen"; - this.state.fullscreen = true; + var fullscreenClass = this.classPrefix + "fullscreen"; + + this.state.fullscreen = false; if (toolbar) { toolbar.find(".fa[name=fullscreen]").parent().removeClass("active"); @@ -2298,26 +2517,42 @@ this.resize(); - $.proxy(this.settings.onfullscreenExit, this)(); + $.proxy(settings.onfullscreenExit, this)(); return this; }, + /** + * 加载并执行插件 + * Load and execute the plugin + * + * @param {String} name plugin name / function name + * @param {String} path plugin load path + * @returns {editormd} 返回editormd的实例对象 + */ + executePlugin : function(name, path) { var _this = this; var cm = this.cm; var settings = this.settings; - if (typeof define == "function") { + path = settings.pluginPath + path; + + if (typeof define === "function") + { + if (typeof this[name] === "undefined") + { + alert("Error: " + name + " plugin is not found, you are not load this plugin."); + + return this; + } this[name](cm); - return ; + return this; } - path = settings.pluginPath + path; - if ($.inArray(path, editormd.loadFiles.plugin) < 0) { editormd.loadPlugin(path, function() { @@ -2329,23 +2564,77 @@ { $.proxy(editormd.loadPlugins[name], this)(cm); } + + return this; + }, + + /** + * 搜索替换 + * Search & replace + * + * @param {String} command CodeMirror serach commands, "find, fintNext, fintPrev, clearSearch, replace, replaceAll" + * @returns {editormd} return this + */ + + search : function(command) { + var settings = this.settings; + + if (!settings.searchReplace) + { + alert("Error: settings.searchReplace == false"); + return this; + } + + if (!settings.readOnly) + { + this.cm.execCommand(command || "find"); + } + + return this; + }, + + searchReplace : function() { + this.search("replace"); + + return this; + }, + + searchReplaceAll : function() { + this.search("replaceAll"); + + return this; } }; editormd.fn.init.prototype = editormd.fn; - + + /** + * 锁屏 + * lock screen when dialog opening + * + * @returns {void} + */ + editormd.dialogLockScreen = function() { - var settings = this.settings; + var settings = this.settings || {dialogLockScreen : true}; if (settings.dialogLockScreen) { $("html,body").css("overflow", "hidden"); } }; - + + /** + * 显示透明背景层 + * Display mask layer when dialog opening + * + * @param {Object} dialog dialog jQuery object + * @returns {void} + */ + editormd.dialogShowMask = function(dialog) { var editor = this.editor; - var settings = this.settings; + var settings = this.settings || {dialogShowMask : true}; dialog.css({ top : ($(window).height() - dialog.height()) / 2 + "px", @@ -2356,7 +2645,7 @@ editor.children("." + this.classPrefix + "mask").css("z-index", parseInt(dialog.css("z-index")) - 1).show(); } }; - + editormd.toolbarHandlers = { undo : function() { this.cm.undo(); @@ -2542,12 +2831,43 @@ cm.replaceSelection("------------"); }, + tex : function() { + if (!this.settings.tex) + { + alert("settings.tex === false"); + return this; + } + + var cm = this.cm; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + + cm.replaceSelection("$$" + selection + "$$"); + + if(selection === "") { + cm.setCursor(cursor.line, cursor.ch + 2); + } + }, + link : function() { this.executePlugin("linkDialog", "link-dialog/link-dialog"); }, - anchor : function() { - this.executePlugin("anchorLinkDialog", "anchor-link-dialog/anchor-link-dialog"); + "reference-link" : function() { + this.executePlugin("referenceLinkDialog", "reference-link-dialog/reference-link-dialog"); + }, + + pagebreak : function() { + if (!this.settings.pageBreak) + { + alert("settings.pageBreak === false"); + return this; + } + + var cm = this.cm; + var selection = cm.getSelection(); + + cm.replaceSelection("\r\n[========]\r\n"); }, image : function() { @@ -2592,9 +2912,13 @@ this.executePlugin("emojiDialog", "emoji-dialog/emoji-dialog"); }, - htmlEntities : function() { + "html-entities" : function() { this.executePlugin("htmlEntitiesDialog", "html-entities-dialog/html-entities-dialog"); }, + + "goto-line" : function() { + this.executePlugin("gotoLineDialog", "goto-line-dialog/goto-line-dialog"); + }, watch : function() { this[this.settings.watch ? "unwatch" : "watch"](); @@ -2611,6 +2935,10 @@ clear : function() { this.clear(); }, + + search : function() { + this.search(); + }, help : function() { this.executePlugin("helpDialog", "help-dialog/help-dialog"); @@ -2622,25 +2950,25 @@ }; editormd.keyMaps = { - "Ctrl-B" : "bold", // if this is string == editormd.toolbarHandlers.xxxx - "Ctrl-I" : "italic", - "Ctrl-K" : "code", - "Shift-Ctrl-C" : "code", - "Shift-Ctrl-Q" : "quote", - "Shift-Ctrl-S" : "del", - "Ctrl-H" : "hr", "Ctrl-1" : "h1", "Ctrl-2" : "h2", "Ctrl-3" : "h3", "Ctrl-4" : "h4", "Ctrl-5" : "h5", "Ctrl-6" : "h6", + "Ctrl-B" : "bold", // if this is string == editormd.toolbarHandlers.xxxx "Ctrl-D" : "datetime", "Ctrl-E" : function() { // emoji var cm = this.cm; var cursor = cm.getCursor(); var selection = cm.getSelection(); + + if (!this.settings.emoji) + { + alert("Error: settings.emoji == false"); + return ; + } cm.replaceSelection(":" + selection + ":"); @@ -2648,6 +2976,10 @@ cm.setCursor(cursor.line, cursor.ch + 1); } }, + "Ctrl-Alt-G" : "goto-line", + "Ctrl-H" : "hr", + "Ctrl-I" : "italic", + "Ctrl-K" : "code", "Ctrl-L" : function() { var cm = this.cm; @@ -2668,6 +3000,12 @@ var cm = this.cm; var cursor = cm.getCursor(); var selection = cm.getSelection(); + + if (!this.settings.atLink) + { + alert("Error: settings.atLink == false"); + return ; + } cm.replaceSelection("@" + selection); @@ -2676,6 +3014,11 @@ } }, + "Shift-Ctrl-C" : "code", + "Shift-Ctrl-Q" : "quote", + "Shift-Ctrl-S" : "del", + "Shift-Ctrl-K" : "tex", // KaTeX + "Shift-Alt-C" : function() { var cm = this.cm; var cursor = cm.getCursor(); @@ -2689,7 +3032,7 @@ }, "Shift-Ctrl-Alt-C" : "code-block", - "Shift-Ctrl-H" : "htmlEntities", + "Shift-Ctrl-H" : "html-entities", "Shift-Alt-H" : "help", "Shift-Ctrl-E" : "emoji", "Shift-Ctrl-U" : "uppercase", @@ -2716,6 +3059,7 @@ "Shift-Ctrl-O" : "list-ol", "Shift-Ctrl-P" : "preformatted-text", "Shift-Ctrl-T" : "table", + "Shift-Alt-P" : "pagebreak", "F9" : "watch", "F10" : "preview", "F11" : "fullscreen", @@ -2730,7 +3074,7 @@ */ var trim = function(str) { - return (!String.prototype.trim) ? str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') : str.trim(); + return (!String.prototype.trim) ? str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "") : str.trim(); }; editormd.trim = trim; @@ -2781,7 +3125,8 @@ emojiDatetime : /(\d{2}:\d{2}:\d{2})/g, twemoji : /:(tw-([\w]+)-?(\w+)?):/g, fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g, - editormdLogo : /:(editormd-logo-?(\w+)?):/g + editormdLogo : /:(editormd-logo-?(\w+)?):/g, + pageBreak : /^\[[=]{8,}\]$/ }; // Emoji graphics files url path @@ -2807,7 +3152,9 @@ editormd.markedRenderer = function(markdownToC, options) { var defaults = { toc : true, // Table of contents + tocm : false, tocStartLevel : 1, // Said from H1 to create ToC + pageBreak : true, atLink : true, // for @link emailLink : true, // for mail address auto link taskList : false, // Enable Github Flavored Markdown task lists @@ -2821,14 +3168,16 @@ var marked = editormd.$marked; var markedRenderer = new marked.Renderer(); markdownToC = markdownToC || []; - - var atLinkReg = editormd.regexs.atLink; - var emojiReg = editormd.regexs.emoji; - var emailReg = editormd.regexs.email; - var emailLinkReg = editormd.regexs.emailLink; - var twemojiReg = editormd.regexs.twemoji; - var faIconReg = editormd.regexs.fontAwesome; - var editormdLogoReg = editormd.regexs.editormdLogo; + + var regexs = editormd.regexs; + var atLinkReg = regexs.atLink; + var emojiReg = regexs.emoji; + var emailReg = regexs.email; + var emailLinkReg = regexs.emailLink; + var twemojiReg = regexs.twemoji; + var faIconReg = regexs.fontAwesome; + var editormdLogoReg = regexs.editormdLogo; + var pageBreakReg = regexs.pageBreak; markedRenderer.emoji = function(text) { @@ -2906,8 +3255,8 @@ if (settings.emailLink) { - text = text.replace(emailLinkReg, function($1, $2) { - return (!$2) ? ""+$1+"" : $1; + text = text.replace(emailLinkReg, function($1, $2, $3, $4, $5) { + return (!$2 && $.inArray($5, "jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|")) < 0) ? ""+$1+"" : $1; }); } @@ -2950,7 +3299,7 @@ out += ">" + text + ""; return out; - } + }; markedRenderer.heading = function(text, level, raw) { @@ -2987,19 +3336,29 @@ var headingHTML = ""; - headingHTML += ""; + headingHTML += ""; headingHTML += ""; headingHTML += (hasLinkReg) ? this.atLink(this.emoji(linkText)) : this.atLink(this.emoji(text)); headingHTML += ""; return headingHTML; }; + + markedRenderer.pageBreak = function(text) { + if (pageBreakReg.test(text) && settings.pageBreak) + { + text = "
              "; + } + + return text; + }; markedRenderer.paragraph = function(text) { var isTeXInline = /\$\$(.*)\$\$/g.test(text); var isTeXLine = /^\$\$(.*)\$\$$/.test(text); - var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : ""; - var isToC = /^\[TOC\]$/.test(text); + var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : ""; + var isToC = (settings.tocm) ? /^(\[TOC\]|\[TOCM\])$/.test(text) : /^\[TOC\]$/.test(text); + var isToCMenu = /^\[TOCM\]$/.test(text); if (!isTeXLine && isTeXInline) { @@ -3012,8 +3371,10 @@ text = (isTeXLine) ? text.replace(/\$/g, "") : text; } - return (isToC) ? "
                " + text + "
              " - : "" + this.atLink(this.emoji(text)) + "

              \n"; + var tocHTML = "
              " + text + "
              "; + + return (isToC) ? ( (isToCMenu) ? "
              " + tocHTML + "

              " : tocHTML ) + : ( (pageBreakReg.test(text)) ? this.pageBreak(text) : "" + this.atLink(this.emoji(text)) + "

              \n" ); }; markedRenderer.code = function (code, lang, escaped) { @@ -3068,11 +3429,13 @@ * @returns {Object} tocContainer 返回ToC列表容器层的jQuery对象元素 */ - editormd.markdownToCRenderer = function(toc, container, startLevel) { + editormd.markdownToCRenderer = function(toc, container, tocDropdown, startLevel) { + + var html = ""; + var lastLevel = 0; + var classPrefix = this.classPrefix; - var html = ""; - var lastLevel = 0; - startLevel = startLevel || 1; + startLevel = startLevel || 1; for (var i = 0, len = toc.length; i < len; i++) { @@ -3100,13 +3463,95 @@ lastLevel = level; } - var tocContainer = container.find('.markdown-toc'); + var tocContainer = container.find(".markdown-toc"); - tocContainer.children('.markdown-toc-list').html("").html(html); + if (tocContainer.length < 1 && container.attr("previewContainer") === "false") + { + var tocHTML = "
              "; + + tocHTML = (tocDropdown) ? "
              " + tocHTML + "
              " : tocHTML; + + container.html(tocHTML); + + tocContainer = container.find(".markdown-toc"); + } + + if (tocDropdown) + { + tocContainer.wrap("

              "); + } + + tocContainer.html("
                ").children(".markdown-toc-list").html(html.replace(/\r?\n?\\<\/ul\>/g, "")); return tocContainer; }; + /** + * + * 生成TOC下拉菜单 + * Creating ToC dropdown menu + * + * @param {Object} container 插入TOC的容器jQuery对象元素 + * @param {String} tocTitle ToC title + * @returns {Object} return toc-menu object + */ + + editormd.tocDropdownMenu = function(container, tocTitle) { + + tocTitle = tocTitle || "Table of Contents"; + + var zindex = 400; + var tocMenus = container.find("." + this.classPrefix + "toc-menu"); + + tocMenus.each(function() { + var $this = $(this); + var toc = $this.children(".markdown-toc"); + var icon = ""; + var btn = "" + icon + tocTitle + ""; + var menu = toc.children("ul"); + var list = menu.find("li"); + + toc.append(btn); + + list.first().before("
              • " + tocTitle + " " + icon + "

              • "); + + $this.mouseover(function(){ + menu.show(); + + list.each(function(){ + var li = $(this); + var ul = li.children("ul"); + + if (ul.html() === "") + { + ul.remove(); + } + + if (ul.length > 0 && ul.html() !== "") + { + var firstA = li.children("a").first(); + + if (firstA.children(".fa").length < 1) + { + firstA.append( $(icon).css({ float:"right", paddingTop:"4px" }) ); + } + } + + li.mouseover(function(){ + ul.css("z-index", zindex).show(); + zindex += 1; + }).mouseleave(function(){ + ul.hide(); + }); + }); + }).mouseleave(function(){ + menu.hide(); + }); + }); + + return tocMenus; + }; + /** * 简单地过滤指定的HTML标签 * Filter custom html tags @@ -3142,14 +3587,18 @@ * @returns {Object} div 返回jQuery对象元素 */ - editormd.markdownToHTML = function(id, options) { + editormd.markdownToHTML = function(id, options) { var defaults = { gfm : true, toc : true, + tocm : false, tocStartLevel : 1, + tocTitle : "目录", + tocDropdown : false, markdown : "", htmlDecode : false, autoLoadKaTeX : true, + pageBreak : true, atLink : true, // for @link emailLink : true, // for mail address auto link tex : false, @@ -3165,15 +3614,24 @@ var div = $("#" + id); var settings = div.settings = $.extend(true, defaults, options || {}); var saveTo = div.find("textarea"); + + if (saveTo.length < 1) + { + div.append(""); + saveTo = div.find("textarea"); + } + var markdownDoc = (settings.markdown === "") ? saveTo.val() : settings.markdown; var markdownToC = []; var rendererOptions = { toc : settings.toc, + tocm : settings.tocm, tocStartLevel : settings.tocStartLevel, taskList : settings.taskList, emoji : settings.emoji, tex : settings.tex, + pageBreak : settings.pageBreak, atLink : settings.atLink, // for @link emailLink : settings.emailLink, // for mail address auto link flowChart : settings.flowChart, @@ -3194,21 +3652,20 @@ markdownDoc = editormd.filterHTMLTags(markdownDoc, settings.htmlDecode); - var markdownParsed = marked(markdownDoc, markedOptions); + var markdownParsed = marked(markdownDoc, markedOptions); - if (editormd.isIE8) - { - saveTo.val(markdownDoc); - } - else - { - saveTo.html(markdownDoc); - } + saveTo.val(markdownDoc); div.addClass("markdown-body " + this.classPrefix + "html-preview").append(markdownParsed); - if (settings.toc) { - div.tocContainer = this.markdownToCRenderer(markdownToC, div, settings.tocStartLevel); + if (settings.toc) + { + div.tocContainer = this.markdownToCRenderer(markdownToC, div, settings.tocDropdown, settings.tocStartLevel); + + if (settings.tocDropdown || div.find("." + this.classPrefix + "toc-menu").length > 0) + { + this.tocDropdownMenu(div, settings.tocTitle); + } } if (settings.previewCodeHighlight) @@ -3251,16 +3708,15 @@ } } - div.getMarkdown = function() { - return (editormd.isIE8) ? saveTo.val() : saveTo.html(); + div.getMarkdown = function() { + return saveTo.val(); }; return div; }; editormd.themes = [ - "default", - "3024-day", "3024-night", + "default", "3024-day", "3024-night", "ambiance", "ambiance-mobile", "base16-dark", "base16-light", "blackboard", "cobalt", @@ -3355,8 +3811,8 @@ script.type = "text/javascript"; script.src = fileName + ".js"; - if (editormd.isIE8) { - + if (editormd.isIE8) + { script.onreadystatechange = function() { if(script.readyState) { @@ -3449,7 +3905,7 @@ var editor = this.editor; var classPrefix = editormd.classPrefix; - var guid = (new Date).getTime(); + var guid = (new Date()).getTime(); var dialogName = ( (options.name === "") ? classPrefix + "dialog-" + guid : options.name); var mouseOrTouch = editormd.mouseOrTouch; @@ -3541,7 +3997,7 @@ dialog.hide().lockScreen(false).hideMask(); }); - if (typeof options.buttons == "object") + if (typeof options.buttons === "object") { var footer = dialog.footer = dialog.find("." + classPrefix + "dialog-footer"); @@ -3578,13 +4034,13 @@ var userCanSelect = function (obj) { obj.removeClass(classPrefix + "user-unselect").off("selectstart"); - } + }; var userUnselect = function (obj) { obj.addClass(classPrefix + "user-unselect").on("selectstart", function(event) { // selectstart for IE return false; }); - } + }; var moveAction = function (e) { e = e || window.event; //IE @@ -3619,7 +4075,7 @@ userUnselect(dialog); dialog[0].style.left = left + "px"; dialog[0].style.top = top + "px"; - } + }; document.onmouseup = function() { userCanSelect($("body")); @@ -3677,13 +4133,10 @@ var eventType = mouseEventType; - try - { + try { document.createEvent("TouchEvent"); eventType = touchEventType; - } - catch(e) { - } + } catch(e) {} return eventType; }; @@ -3703,7 +4156,7 @@ return (d < 10) ? "0" + d : d; }; - var date = new Date; + var date = new Date(); var year = date.getFullYear(); var year2 = year.toString().slice(2, 4); var month = addZero(date.getMonth() + 1); @@ -3777,7 +4230,7 @@ case "ms" : datefmt = ms; - break; + break; case "yy-mm-dd" : datefmt = ymd; @@ -3790,18 +4243,18 @@ case "yyyy-mm-dd h:i:s ms" : case "full + ms" : datefmt = fymd + " " + hms + " " + ms; - break; + break; case "full" : case "yyyy-mm-dd h:i:s" : default: datefmt = fymd + " " + hms; - break; - }; + break; + } return datefmt; }; - + return editormd; - + })); diff --git a/editormd.min.js b/editormd.min.js index 5a8b941..6bfa97f 100644 --- a/editormd.min.js +++ b/editormd.min.js @@ -1,4 +1,4 @@ -/*! Editor.md v1.3.0 | editormd.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-12 */ -!function(e){"use strict";"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd||define(["jquery"],e):window.editormd=e()}(function(){"use strict";var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.3.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","anchor","image","code","preformatted-text","code-block","table","datetime","emoji","htmlEntities","|","watch","preview","fullscreen","clear","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",theme:"default",value:"",markdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",autoLoadModules:!0,watch:!0,placeholder:"now coding markdown...",codeFold:!1,autoHeight:!1,autoCloseTags:!0,searchReplace:!1,readOnly:!1,lineNumbers:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocStartLevel:1,htmlDecode:!1,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:function(){return t.toolbarModes.full},toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link",anchor:"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o",htmlEntities:"fa-copyright",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
                A simple markdown doucment online editor.",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接",anchor:"锚点",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情",htmlEntities:"HTML实体字符",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(可按ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},anchor:{title:"添加锚点链接",name:"锚点名称",url:"链接地址",urlTitle:"链接标题",nameEmpty:"错误:锚点名称不能为空。",titleEmpty:"错误:请填写锚点链接标题。",urlEmpty:"错误:请填写锚点链接地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null,t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{};var r=this,a=this.classPrefix=t.classPrefix,n=this.editor=e("#"+i),s=this.settings=e.extend(!0,t.defaults,o);this.id=i,this.lang=s.lang;var l=this.classNames={textarea:{html:this.classPrefix+"html-textarea",markdown:this.classPrefix+"markdown-textarea"}};s.pluginPath=""===s.pluginPath?this.settings.path+"../plugins/":s.pluginPath,this.state.watching=s.watch?!0:!1,n.hasClass("editormd")||n.addClass("editormd"),n.css({width:"number"==typeof s.width?s.width+"px":s.width,height:"number"==typeof s.height?s.height+"px":s.height}),s.autoHeight&&n.css("height","auto");var c=this.markdownTextarea=n.children("textarea");c.length<1&&(n.append(""),c=this.markdownTextarea=n.children("textarea")),c.addClass(l.textarea.markdown).attr("name",i+"-markdown-doc").attr("placeholder",s.placeholder);var d=[s.readOnly?"":'',s.saveHTMLToTextarea?'':"",'
                ','
                ','
                '].join("\n");return n.append(d).addClass(a+"vertical"),this.mask=n.children("."+a+"mask"),""!==s.markdown&&c.val(s.markdown),this.htmlTextarea=n.children("."+l.textarea.html),this.preview=n.children("."+a+"preview"),this.previewContainer=this.preview.children("."+a+"preview-container"),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),s.searchReplace&&(t.loadCSS(s.path+"codemirror/addon/dialog/dialog"),t.loadCSS(s.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!s.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),r.setCodeMirror(),r.setToolbar(),r.loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var i=this.settings;return i.theme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.theme),this.cm.setOption("theme",e),this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.theme&&t.loadCSS(e.path+"codemirror/theme/"+e.theme);var o={mode:e.mode,theme:e.theme,tabSize:4,dragDrop:!1,autofocus:!0,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:4,lineNumbers:e.lineNumbers,lineWrapping:!0,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,indentWithTabs:!0,styleActiveLine:e.styleActiveLine,styleSelectedText:!0,autoCloseBrackets:!0,showTrailingSpace:!0,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"==e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},"extends":function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;if(!i.readOnly)return i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,a=this.settings;"undefined"!=typeof t&&(a.toolbarAutoFixed=t);var n=function(){var t=e(window).scrollTop();return a.toolbarAutoFixed?void r.css(t-o.offset().top>10&&t
                  '),r=this.toolbar=i.children("."+o+"toolbar")),!e.toolbar)return void r.hide();r.show();for(var a="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,n=r.find("."+this.classPrefix+"menu"),s="",l=0,c=a.length;c>l;l++){var d=a[l];if("|"!==d){var h=/h(\d)/.test(d),u=d;"watch"!==d||e.watch||(u="unwatch");var f=e.lang.toolbar[u],g=e.toolbarIconTexts[u],p=e.toolbarIconsClass[u];f="undefined"==typeof f?"":f,g="undefined"==typeof g?"":g,p="undefined"==typeof p?"":p,s+="
                • ",s+="undefined"!=typeof e.toolbarCustomIcons[d]?e.toolbarCustomIcons[d]:''+(h?d:""===p?g:"")+"",s+="
                • "}else s+='
                • |
                • '}return n.html(s),n.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),n.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this}},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(o.toolbar&&!o.readOnly){var r=(this.editor,this.preview,this.toolbar),a=this.codeEditor,n=(this.codeMirror,this.classPrefix),s=(this.previewContainer,this.toolbarIcons=r.find("."+n+"menu > li > a")),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(){var t=e(this).children(".fa"),r=t.attr("name"),n=a.getCursor(),s=a.getSelection();return""!==r?(i.activeIcon=t,"undefined"!=typeof l[r]?e.proxy(l[r],i)(a):"undefined"!=typeof o.toolbarHandlers[r]&&e.proxy(o.toolbarHandlers[r],i)(a,t,n,s),"link"!==r&&"anchor"!==r&&"image"!==r&&"code-block"!==r&&"preformatted-text"!==r&&"watch"!==r&&"preview"!==r&&"fullscreen"!==r&&"info"!==r&&a.focus(),!1):void 0}),this}},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
                  ','
                  ','

                  '+t.title+"v"+t.version+"

                  ","

                  "+this.lang.description+"

                  ",'

                  Home page: '+t.homePage+"

                  ","

                  License: MIT

                  ","
                  ",'',"
                  "].join("\n");i.append(r);var a=this.infoDialog=i.children("."+o+"dialog-info");return a.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),a.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.classPrefix,a=this.infoDialog=i.children("."+r+"dialog-info");return a.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),a.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this},recreate:function(){var e=this.editor,t=this.settings,i=t.toolbarIcons();return this.codeMirror.remove(),this.setCodeMirror(),"undefined"!=typeof this.infoDialog&&this.infoDialog.remove(),"undefined"!=typeof i.info&&createInfoDialog(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.saveToTextareas(),this.resize(),this.registerKeyMaps(),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){var i=this.previewContainer;return i.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.html(),i[0])}),this},flowChartAndSequenceDiagramRender:function(){var e=this.settings,i=this.previewContainer;return t.isIE8?void 0:(e.flowChart&&i.find(".flowchart").flowChart(),e.sequenceDiagram&&i.find(".sequence-diagram").sequenceDiagram({theme:"simple"}),this)},registerKeyMaps:function(i){i=i||null;var o=this,r=this.cm,a=this.settings;if(i){for(var n in i)if(e.inArray(n,a.disabledKeyMaps)<0){var s={};s[n]=i[n],r.addKeyMap(i)}}else{for(var n in t.keyMaps){var i=t.keyMaps[n],l="string"==typeof i?e.proxy(t.toolbarHandlers[i],o):e.proxy(i,o);if(e.inArray(n,["F9","F10","F11"])<0&&e.inArray(n,a.disabledKeyMaps)<0){var s={};s[n]=l,r.addKeyMap(s)}}e(window).keydown(function(i){var r={120:"F9",121:"F10",122:"F11"};if(e.inArray(r[i.keyCode],a.disabledKeyMaps)<0)switch(i.keyCode){case 120:return e.proxy(t.toolbarHandlers.watch,o)(),!1;case 121:return e.proxy(t.toolbarHandlers.preview,o)(),!1;case 122:e.proxy(t.toolbarHandlers.fullscreen,o)()}})}return this},loadedDisplay:function(){var i=this,o=this.editor,r=this.preview,a=this.settings,n=this.codeEditor,s=this.codeMirror,l=(this.previewContainer,t.mouseOrTouch);o.children("."+this.classPrefix+"container-mask").hide(),this.saveToTextareas(),a.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()});var c=function(){s.find(".CodeMirror-scroll").bind(l("scroll","touchmove"),function(t){var i=e(this).height(),o=e(this).scrollTop(),n=o/e(this)[0].scrollHeight;r.scrollTop(0===o?0:o+i>=e(this)[0].scrollHeight?r[0].scrollHeight:r[0].scrollHeight*n),e.proxy(a.onscroll,this)(t)})},d=function(){s.find(".CodeMirror-scroll").unbind(l("scroll","touchmove"))},h=function(){r.bind(l("scroll","touchmove"),function(){var t=e(this).height(),i=e(this).scrollTop(),o=i/e(this)[0].scrollHeight,r=s.find(".CodeMirror-scroll");r.scrollTop(0===i?0:i+t>=e(this)[0].scrollHeight?r[0].scrollHeight:r[0].scrollHeight*o),e.proxy(a.onpreviewscroll,this)(event)})},u=function(){r.unbind(l("scroll","touchmove"))};return s.bind({mouseover:c,mouseout:d,touchstart:c,touchend:d}),r.bind({mouseover:h,mouseout:u,touchstart:h,touchend:u}),n.on("change",function(){i.previewContainer.css("padding-left",a.autoHeight&&e("body").height()>e(window).height()?"30px":"20px"),i.saveToTextareas()}),e.proxy(a.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,a=this.preview,n=this.toolbar,s=this.settings,l=(this.codeEditor,this.codeMirror);return t&&r.css({width:"number"==typeof t?t+"px":t}),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css({height:"number"==typeof i?i+"px":i}),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",n.height()+1).height(r.height()-n.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),l.find(".CodeMirror-gutters").height(l.height()),s.watch?(l.width(r.width()/2),a.width(o.preview?r.width():r.width()/2),s.toolbar&&!s.readOnly?a.css("top",n.height()):a.css("top",0),a.height(!s.autoHeight||o.fullscreen||o.preview?s.toolbar&&!s.readOnly?r.height()-n.height():r.height():"auto")):(l.width(r.width()),a.hide()),o.loaded&&e.proxy(s.onresize,this)(),this},saveToTextareas:function(){var i=this,o=this.state,r=this.settings,a=this.codeEditor,n=this.previewContainer,s=a.getValue();if("gfm"!==r.mode&&"markdown"!==r.mode)return this.markdownTextarea[0].innerText=s,this;var l=t.$marked,c=this.markdownToC=[],d=this.markedRendererOptions={toc:r.toc,tocStartLevel:r.tocStartLevel,taskList:r.taskList,emoji:r.emoji,tex:r.tex,atLink:r.atLink,emailLink:r.emailLink,flowChart:r.flowChart,sequenceDiagram:r.sequenceDiagram,previewCodeHighlight:r.previewCodeHighlight},h=this.markedOptions={renderer:t.markedRenderer(c,d),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:r.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l.setOptions(h),s=t.filterHTMLTags(s,r.htmlDecode);var u=t.$marked(s,h);if(this.markdownTextarea[0].innerText=s,a.save(),r.saveHTMLToTextarea&&this.htmlTextarea.html(u),r.watch||!r.watch&&o.preview){if(n.html(u),this.previewCodeHighlight(),r.toc&&t.markdownToCRenderer(c,n,r.tocStartLevel),r.tex&&(!t.kaTeXLoaded&&r.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,i.katexRender()}):(t.$katex=katex,this.katexRender())),r.flowChart||r.sequenceDiagram)var f=setTimeout(function(){clearTimeout(f),i.flowChartAndSequenceDiagramRender()},10);o.loaded&&e.proxy(r.onchange,this)()}return this},focus:function(){return this.codeEditor.focus(),this},setCursor:function(e){return this.codeEditor.setCursor(e),this},getCursor:function(){return this.codeEditor.getCursor()},setSelection:function(e,t){return this.codeEditor.setSelection(e,t),this},getSelection:function(){return this.codeEditor.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.codeEditor.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},setMarkdown:function(e){var t=this.settings;return this.codeEditor.setValue(e||t.markdown),this},getMarkdown:function(){return this.codeEditor.getValue()},getValue:function(){return this.codeEditor.getValue()},setValue:function(e){return this.codeEditor.setValue(e),this},clear:function(){return this.codeEditor.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.html():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var i=this.settings;this.state.watching=i.watch=!0,this.preview.show();var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");return a.parent().attr("title",i.lang.toolbar.watch),a.removeClass(r).addClass(o),this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),this.saveToTextareas().resize(),i.onwatch||(i.onwatch=t||function(){}),e.proxy(i.onwatch,this)(),this},unwatch:function(t){var i=this.settings;this.state.watching=i.watch=!1,this.preview.hide();var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch;if(this.toolbar){var a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",i.lang.toolbar.unwatch),a.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,a=this.toolbar,n=this.settings,s=this.codeMirror;n.toolbar&&(a.toggle(),a.find(".fa[name=preview]").toggleClass("active")),s.toggle();var l=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),n.watch||this.saveToTextareas(),r.show().css({position:"static",top:0,width:o.width(),height:n.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(n.onpreviewing,this)(),e(window).bind("keyup",l)):(e(window).unbind("keyup",l),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,a=this.settings,n=this.codeMirror,s=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,n.show(),a.toolbar&&r.show(),this.settings.watch?o.show():o.hide(),s.hide().unbind(t.mouseOrTouch("click","touchend")),o.css({background:null,position:"absolute",width:i.width()/2,height:a.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:a.toolbar?r.height():0}),this.state.loaded&&e.proxy(a.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.editor,o=(this.preview,this.toolbar),r=this.classPrefix+"fullscreen";o&&o.find(".fa[name=fullscreen]").parent().toggleClass("active");var a=function(e){e.shiftKey||27!==e.keyCode||t.state.fullscreen&&t.fullscreenExit()};return i.hasClass(r)?(e(window).unbind("keyup",a),this.fullscreenExit()):(this.state.fullscreen=!0,e("html,body").css("overflow","hidden"),i.css({position:"fixed",top:0,left:0,margin:0,border:"none",width:e(window).width(),height:e(window).height()}).addClass(r),this.resize(),e.proxy(this.settings.onfullscreen,this)(),e(window).bind("keyup",a)),this},fullscreenExit:function(){var t=this.editor,i=this.toolbar,o=this.classPrefix+"fullscreen";return this.state.fullscreen=!0,i&&i.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({position:"",top:"",left:"",margin:"0 auto 15px",width:t.data("oldWidth"),height:t.data("oldHeight"),border:"1px solid #ddd"}).removeClass(o),this.resize(),e.proxy(this.settings.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,a=this.cm,n=this.settings;return"function"==typeof define?void this[i](a):(o=n.pluginPath+o,void(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](a)}):e.proxy(t.loadPlugins[i],this)(a)))}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings;t.dialogLockScreen&&e("html,body").css("overflow","hidden")},t.dialogShowMask=function(t){var i=this.editor,o=this.settings;t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("> "+i),e.setCursor(t.line,""===i?t.ch+2:t.ch+i.length+2)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("# "+t)},h2:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("## "+t)},h3:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("### "+t)},h4:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("#### "+t)},h5:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("##### "+t)},h6:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("###### "+t)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm;e.getCursor(),e.getSelection()}e.replaceSelection("------------")},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},anchor:function(){this.executePlugin("anchorLinkDialog","anchor-link-dialog/anchor-link-dialog")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},htmlEntities:function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-B":"bold","Ctrl-I":"italic","Ctrl-K":"code","Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Ctrl-H":"hr","Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(":"+i+":"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("@"+i),""===i&&e.setCursor(t.line,t.ch+1)},"Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"htmlEntities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table",F9:"watch",F10:"preview",F11:"fullscreen"};var i=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=i;var o=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=o;var r=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=r,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\-\w]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/", -ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(o,r){var a={toc:!0,tocStartLevel:1,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},n=e.extend(a,r||{}),s=t.$marked,l=new s.Renderer;o=o||[];var c=t.regexs.atLink,d=t.regexs.emoji,h=t.regexs.email,u=t.regexs.emailLink,f=t.regexs.twemoji,g=t.regexs.fontAwesome,p=t.regexs.editormdLogo;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!n.emoji)return e;for(var o=0,r=i.length;r>o;o++)e=e.replace(new RegExp(i[o]),function(e){var i=e.match(g),o=e.replace(/:/g,"");if(i)for(var r=0,a=i.length;a>r;r++){var n=i[r].replace(/:/g,"");return''}else{var s=e.match(p),l=e.match(f);if(s)for(var c=0,d=s.length;d>c;c++){var h=s[c].replace(/:/g,"");return''}else{if(!l)return':'+o+':';for(var u=0,m=l.length;m>u;u++){var w=l[u].replace(/:/g,"").replace("tw-","");return'twemoji-'+w+''}}}});return e},l.atLink=function(e){return c.test(e)?(n.atLink&&(e=e.replace(h,function(e){return e.replace(/@/g,"_#_@_#_")}),e=e.replace(c,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),n.emailLink&&(e=e.replace(u,function(e,t){return t?e:''+e+""})),e):e},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var a=''+i.replace(/@/g,"@")+""):(t&&(a+=' title="'+t+'"'),a+=">"+i+"")},l.heading=function(e,t){var r=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var n=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var s=0,l=e.length;l>s;s++)n.push(e[s].replace(/\s*href\=\"(.*)\"\s*/g,""));e=n.join(" ")}e=i(e);var c=e.toLowerCase().replace(/[^\w]+/g,"-"),d={text:e,level:t,slug:c},h=/^[\u4e00-\u9fa5]+$/.test(e),u=h?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");o.push(d);var f="';return f+='',f+='',f+=this.atLink(a?this.emoji(r):this.emoji(e)),f+=""},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",a=/^\[TOC\]$/.test(e);return e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e,a?'
                    '+e+"
                  ":""+this.atLink(this.emoji(e))+"

                  \n"},l.code=function(e,t){return"seq"===t||"sequence"===t?'
                  '+e+"
                  ":"flow"===t?'
                  '+e+"
                  ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return n.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
                • '+this.atLink(this.emoji(e))+"
                • "):"
                • "+this.atLink(this.emoji(e))+"
                • "},l},t.markdownToCRenderer=function(e,t,i){var o="",r=0;i=i||1;for(var a=0,n=e.length;n>a;a++){var s=e[a].text,l=e[a].level;i>l||(o+=l>r?"":r>l?new Array(r-l+2).join("
              • "):"",o+='
              • '+s+"
                  ",r=l)}var c=t.find(".markdown-toc");return c.children(".markdown-toc-list").html("").html(o),c},t.filterHTMLTags=function(e,t){if("string"==typeof t)for(var i=t.split(","),o=0,r=i.length;r>o;o++){var a=i[o];e=e.replace(new RegExp("]*)>","igm"),"").replace(new RegExp("","igm"),"")}return e},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocStartLevel:1,markdown:"",htmlDecode:!1,autoLoadKaTeX:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var a=e("#"+i),n=a.settings=e.extend(!0,r,o||{}),s=a.find("textarea"),l=""===n.markdown?s.val():n.markdown,c=[],d={toc:n.toc,tocStartLevel:n.tocStartLevel,taskList:n.taskList,emoji:n.emoji,tex:n.tex,atLink:n.atLink,emailLink:n.emailLink,flowChart:n.flowChart,sequenceDiagram:n.sequenceDiagram,previewCodeHighlight:n.previewCodeHighlight},h={renderer:t.markedRenderer(c,d),gfm:n.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:n.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=t.filterHTMLTags(l,n.htmlDecode);var u=marked(l,h);if(t.isIE8?s.val(l):s.html(l),a.addClass("markdown-body "+this.classPrefix+"html-preview").append(u),n.toc&&(a.tocContainer=this.markdownToCRenderer(c,a,n.tocStartLevel)),n.previewCodeHighlight&&(a.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(n.flowChart&&a.find(".flowchart").flowChart(),n.sequenceDiagram&&a.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),n.tex){var f=function(){a.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html(),t[0])})};!n.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?f():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,f()})}return a.getMarkdown=function(){return t.isIE8?s.val():s.html()},a},t.themes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min",js:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this.editor,a=t.classPrefix,n=(new Date).getTime(),s=""===i.name?a+"dialog-"+n:i.name,l=t.mouseOrTouch,c='
                  ';""!==i.title&&(c+='
                  ",c+=''+i.title+"",c+="
                  "),i.closed&&(c+=''),c+='
                  '+i.content,(i.footer||"string"==typeof i.footer)&&(c+='"),c+="
                  ",c+='
                  ',c+='
                  ',c+="
                  ",r.append(c);var d=r.find("."+s);d.lockScreen=function(t){return i.lockScreen&&e("html,body").css("overflow",t?"hidden":""),d},d.showMask=function(){return i.mask&&r.find("."+a+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),d},d.hideMask=function(){return i.mask&&r.find("."+a+"mask").hide(),d},d.loading=function(e){var t=d.find("."+a+"dialog-mask");return t[e?"show":"hide"](),d},d.lockScreen(!0).showMask(),d.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var h=function(){d.css({top:(e(window).height()-d.height())/2+"px",left:(e(window).width()-d.width())/2+"px"})};if(h(),e(window).resize(h),d.children("."+a+"dialog-close").bind(l("click","touchend"),function(){d.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var u=d.footer=d.find("."+a+"dialog-footer");for(var f in i.buttons){var g=i.buttons[f],p=a+f+"-btn";u.append('"),g[1]=e.proxy(g[1],d),u.children("."+p).bind(l("click","touchend"),g[1])}}if(""!==i.title&&i.drag){var m,w,v=d.children("."+a+"dialog-header");i.mask||v.bind(l("click","touchend"),function(){t.dialogZindex+=2,d.css("z-index",t.dialogZindex)}),v.mousedown(function(e){e=e||window.event,m=e.clientX-parseInt(d[0].style.left),w=e.clientY-parseInt(d[0].style.top),document.onmousemove=k});var b=function(e){e.removeClass(a+"user-unselect").off("selectstart")},x=function(e){e.addClass(a+"user-unselect").on("selectstart",function(){return!1})},k=function(t){t=t||window.event;var i,o,r=parseInt(d[0].style.left),a=parseInt(d[0].style.top);r>=0?r+d.width()<=e(window).width()?i=t.clientX-m:(i=e(window).width()-d.width(),document.onmousemove=null):(i=0,document.onmousemove=null),a>=0?o=t.clientY-w:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},x(e("body")),x(d),d[0].style.left=i+"px",d[0].style.top=o+"px"};document.onmouseup=function(){b(e("body")),b(d),document.onselectstart=null,document.onmousemove=null},v.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},v.touchDraggable()}return t.dialogZindex+=2,d},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),a=t(i.getMonth()+1),n=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),d=t(i.getSeconds()),h=t(i.getMilliseconds()),u="",f=r+"-"+a+"-"+n,g=o+"-"+a+"-"+n,p=l+":"+c+":"+d;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=a;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=n;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=d;break;case"ms":u=h;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+h;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); -//# sourceMappingURL=editormd.min.js.map \ No newline at end of file +/*! Editor.md v1.4.0 | editormd.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-23 */ +!function(e){"use strict";"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd||define(["jquery"],e):window.editormd=e()}(function(){"use strict";var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.4.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",theme:"default",value:"",markdown:"",appendMarkdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",delay:300,autoLoadModules:!0,watch:!0,placeholder:"Enjoy Markdown! coding now...",gotoLine:!0,codeFold:!1,autoHeight:!1,autoCloseTags:!0,searchReplace:!0,readOnly:!1,lineNumbers:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocm:!1,tocTitle:"",tocDropdown:!1,tocContainer:"",tocStartLevel:1,htmlDecode:!1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:"full",toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link","reference-link":"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o","html-entities":"fa-copyright",pagebreak:"fa-newspaper-o","goto-line":"fa-terminal",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-desktop",search:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
                  Open source online Markdown editor.",tocTitle:"目录",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接","reference-link":"引用链接",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情","html-entities":"HTML实体字符",pagebreak:"插入分页符","goto-line":"跳转到行",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(按 Shift + ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",search:"搜索",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},referenceLink:{title:"添加引用链接",name:"引用名称",url:"链接地址",urlId:"链接ID",urlTitle:"链接标题",nameEmpty:"错误:引用链接的名称不能为空。",idEmpty:"错误:请填写引用链接的ID。",urlEmpty:"错误:请填写引用链接的URL地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null;var i,o;t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{},"object"==typeof i&&(o=i);var r=this.classPrefix=t.classPrefix,n=this.settings=e.extend(!0,t.defaults,o);i="object"==typeof i?n.id:i;var a=this.editor=e("#"+i);this.id=i,this.lang=n.lang;var s=this.classNames={textarea:{html:r+"html-textarea",markdown:r+"markdown-textarea"}};n.pluginPath=""===n.pluginPath?n.path+"../plugins/":n.pluginPath,this.state.watching=n.watch?!0:!1,a.hasClass("editormd")||a.addClass("editormd"),a.css({width:"number"==typeof n.width?n.width+"px":n.width,height:"number"==typeof n.height?n.height+"px":n.height}),n.autoHeight&&a.css("height","auto");var l=this.markdownTextarea=a.children("textarea");l.length<1&&(a.append(""),l=this.markdownTextarea=a.children("textarea")),l.addClass(s.textarea.markdown).attr("name",i+"-markdown-doc").attr("placeholder",n.placeholder);var c=[n.readOnly?"":'',n.saveHTMLToTextarea?'':"",'
                  ','
                  ','
                  '].join("\n");return a.append(c).addClass(r+"vertical"),this.mask=a.children("."+r+"mask"),this.containerMask=a.children("."+r+"container-mask"),""!==n.markdown&&l.val(n.markdown),""!==n.appendMarkdown&&l.val(l.val()+n.appendMarkdown),this.htmlTextarea=a.children("."+s.textarea.html),this.preview=a.children("."+r+"preview"),this.previewContainer=this.preview.children("."+r+"preview-container"),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),n.searchReplace&&!n.readOnly&&(t.loadCSS(n.path+"codemirror/addon/dialog/dialog"),t.loadCSS(n.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!n.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),this.setCodeMirror().setToolbar().loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&!i.readOnly&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var i=this.settings;return i.theme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.theme),this.cm.setOption("theme",e),this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.theme&&t.loadCSS(e.path+"codemirror/theme/"+e.theme);var o={mode:e.mode,theme:e.theme,tabSize:4,dragDrop:!1,autofocus:!0,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:4,lineNumbers:e.lineNumbers,lineWrapping:!0,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,indentWithTabs:!0,styleActiveLine:e.styleActiveLine,styleSelectedText:!0,autoCloseBrackets:!0,showTrailingSpace:!0,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"===e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},gotoLine:function(t){var i=this.settings;if(!i.gotoLine)return this;var o=this.cm,r=(this.editor,o.lineCount()),n=this.preview;if("string"==typeof t&&("last"===t&&(t=r),"first"===t&&(t=1)),"number"!=typeof t)return alert("Error: The line number must be an integer."),this;if(t=parseInt(t)-1,t>r)return alert("Error: The line number range 1-"+r),this;o.setCursor({line:t,ch:0});var a=o.getScrollInfo(),s=a.clientHeight,l=o.charCoords({line:t,ch:0},"local");if(o.scrollTo(null,(l.top+l.bottom-s)/2),i.watch){var c=this.codeMirror.find(".CodeMirror-scroll")[0],h=e(c).height(),d=c.scrollTop,u=d/c.scrollHeight;n.scrollTop(0===d?0:d+h>=n[0].scrollHeight?n[0].scrollHeight:n[0].scrollHeight*u)}return o.focus(),this},extend:function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;return i.readOnly?this:(i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this)},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,n=this.settings;"undefined"!=typeof t&&(n.toolbarAutoFixed=t);var a=function(){var t=e(window),i=t.scrollTop();return n.toolbarAutoFixed?void r.css(i-o.offset().top>10&&i
                    ';i.append(n),r=this.toolbar=i.children("."+o+"toolbar")}if(!e.toolbar)return r.hide(),this;r.show();for(var a="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,s=r.find("."+this.classPrefix+"menu"),l="",c=0,h=a.length;h>c;c++){var d=a[c];if("|"!==d){var u=/h(\d)/.test(d),f=d;"watch"!==d||e.watch||(f="unwatch");var g=e.lang.toolbar[f],p=e.toolbarIconTexts[f],m=e.toolbarIconsClass[f];g="undefined"==typeof g?"":g,p="undefined"==typeof p?"":p,m="undefined"==typeof m?"":m,l+="
                  • ",l+="undefined"!=typeof e.toolbarCustomIcons[d]&&"function"!=typeof e.toolbarCustomIcons[d]?e.toolbarCustomIcons[d]:''+(u?d.toUpperCase():""===m?p:"")+"",l+="
                  • "}else l+='
                  • |
                  • '}return s.html(l),s.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),s.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(!o.toolbar||o.readOnly)return this;var r=this.toolbar,n=this.cm,a=this.classPrefix,s=this.toolbarIcons=r.find("."+a+"menu > li > a"),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(){var t=e(this).children(".fa"),r=t.attr("name"),a=n.getCursor(),s=n.getSelection();return""!==r?(i.activeIcon=t,"undefined"!=typeof l[r]?e.proxy(l[r],i)(n):"undefined"!=typeof o.toolbarHandlers[r]&&e.proxy(o.toolbarHandlers[r],i)(n,t,a,s),"link"!==r&&"reference-link"!==r&&"image"!==r&&"code-block"!==r&&"preformatted-text"!==r&&"watch"!==r&&"preview"!==r&&"search"!==r&&"fullscreen"!==r&&"info"!==r&&n.focus(),!1):void 0}),this},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
                    ','
                    ','

                    '+t.title+"v"+t.version+"

                    ","

                    "+this.lang.description+"

                    ",'

                    '+t.homePage+'

                    ','

                    Copyright © 2015 Pandao, The MIT License.

                    ',"
                    ",'',"
                    "].join("\n");i.append(r);var n=this.infoDialog=i.children("."+o+"dialog-info");return n.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),n.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.infoDialog=i.children("."+this.classPrefix+"dialog-info");return r.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),r.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this},recreate:function(){var e=this.editor,t=this.settings;return this.codeMirror.remove(),this.setCodeMirror(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.loadedDisplay(!0),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){return null===i?this:(this.previewContainer.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.html(),i[0])}),this)},flowChartAndSequenceDiagramRender:function(){var e=this.settings,i=this.previewContainer;if(t.isIE8)return this;if(e.flowChart){if(null===o)return this;i.find(".flowchart").flowChart()}return e.sequenceDiagram&&i.find(".sequence-diagram").sequenceDiagram({theme:"simple"}),this},registerKeyMaps:function(i){var o=this,r=this.cm,n=this.settings,a=t.toolbarHandlers,s=n.disabledKeyMaps;if(i=i||null){for(var l in i)if(e.inArray(l,s)<0){var c={};c[l]=i[l],r.addKeyMap(i)}}else{for(var h in t.keyMaps){var d=t.keyMaps[h],u="string"==typeof d?e.proxy(a[d],o):e.proxy(d,o);if(e.inArray(h,["F9","F10","F11"])<0&&e.inArray(h,s)<0){var f={};f[h]=u,r.addKeyMap(f)}}e(window).keydown(function(t){var i={120:"F9",121:"F10",122:"F11"};if(e.inArray(i[t.keyCode],s)<0)switch(t.keyCode){case 120:return e.proxy(a.watch,o)(),!1;case 121:return e.proxy(a.preview,o)(),!1;case 122:return e.proxy(a.fullscreen,o)(),!1}})}return this},bindScrollEvent:function(){var i=this,o=this.preview,r=this.settings,n=this.codeMirror,a=t.mouseOrTouch,s=function(){n.find(".CodeMirror-scroll").bind(a("scroll","touchmove"),function(t){var n=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight;o.scrollTop(0===a?0:a+n>=e(this)[0].scrollHeight?o[0].scrollHeight:o[0].scrollHeight*s),e.proxy(r.onscroll,i)(t)})},l=function(){n.find(".CodeMirror-scroll").unbind(a("scroll","touchmove"))},c=function(){o.bind(a("scroll","touchmove"),function(t){var o=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight,l=n.find(".CodeMirror-scroll");l.scrollTop(0===a?0:a+o>=e(this)[0].scrollHeight?l[0].scrollHeight:l[0].scrollHeight*s),e.proxy(r.onpreviewscroll,i)(t)})},h=function(){o.unbind(a("scroll","touchmove"))};return n.bind({mouseover:s,mouseout:l,touchstart:s,touchend:l}),o.bind({mouseover:c,mouseout:h,touchstart:c,touchend:h}),this},bindChangeEvent:function(){var e=this,t=this.cm,o=this.settings;return t.on("change",function(){o.watch&&e.previewContainer.css("padding",o.autoHeight?"20px 20px 50px 40px":"20px"),i=setTimeout(function(){clearTimeout(i),e.save(),i=null},o.delay)}),this},loadedDisplay:function(t){t=t||!1;var i=this,o=this.editor,r=this.preview,n=this.settings;return this.containerMask.hide(),this.save(),n.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()}),this.bindScrollEvent().bindChangeEvent(),t||e.proxy(n.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,n=this.preview,a=this.toolbar,s=this.settings,l=this.codeMirror;return t&&r.css("width","number"==typeof t?t+"px":t),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css("height","number"==typeof i?i+"px":i),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",a.height()+1).height(r.height()-a.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),s.watch?(l.width(r.width()/2),n.width(o.preview?r.width():r.width()/2),this.previewContainer.css("padding",s.autoHeight?"20px 20px 50px 40px":"20px"),s.toolbar&&!s.readOnly?n.css("top",a.height()):n.css("top",0),n.height(!s.autoHeight||o.fullscreen||o.preview?s.toolbar&&!s.readOnly?r.height()-a.height():r.height():"")):(l.width(r.width()),n.hide()),o.loaded&&e.proxy(s.onresize,this)(),this},save:function(){if(null===i)return this;var r=this,n=this.state,a=this.settings,s=this.cm,l=s.getValue(),c=this.previewContainer;if("gfm"!==a.mode&&"markdown"!==a.mode)return this.markdownTextarea.val(l),this;var h=t.$marked,d=this.markdownToC=[],u=this.markedRendererOptions={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,pageBreak:a.pageBreak,taskList:a.taskList,emoji:a.emoji,tex:a.tex,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},f=this.markedOptions={renderer:t.markedRenderer(d,u),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};h.setOptions(f),l=t.filterHTMLTags(l,a.htmlDecode);var g=t.$marked(l,f);if(this.markdownTextarea.val(l),s.save(),a.saveHTMLToTextarea&&this.htmlTextarea.html(g),a.watch||!a.watch&&n.preview){if(c.html(g),this.previewCodeHighlight(),a.toc){var p=""===a.tocContainer?c:e(a.tocContainer),m=p.find("."+this.classPrefix+"toc-menu");p.attr("previewContainer",""===a.tocContainer?"true":"false"),""!==a.tocContainer&&m.length>0&&m.remove(),t.markdownToCRenderer(d,p,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||p.find("."+this.classPrefix+"toc-menu").length>0)&&t.tocDropdownMenu(p,""!==a.tocTitle?a.tocTitle:this.lang.tocTitle),""!==a.tocContainer&&c.find(".markdown-toc").css("border","none")}a.tex&&(!t.kaTeXLoaded&&a.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,r.katexRender()}):(t.$katex=katex,this.katexRender())),(a.flowChart||a.sequenceDiagram)&&(o=setTimeout(function(){clearTimeout(o),r.flowChartAndSequenceDiagramRender(),o=null},10)),n.loaded&&e.proxy(a.onchange,this)()}return this},focus:function(){return this.cm.focus(),this},setCursor:function(e){return this.cm.setCursor(e),this},getCursor:function(){return this.cm.getCursor()},setSelection:function(e,t){return this.cm.setSelection(e,t),this},getSelection:function(){return this.cm.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.cm.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},appendMarkdown:function(e){var t=(this.settings,this.cm);return t.setValue(t.getValue()+e),this},setMarkdown:function(e){return this.cm.setValue(e||this.settings.markdown),this},getMarkdown:function(){return this.cm.getValue()},getValue:function(){return this.cm.getValue()},setValue:function(e){return this.cm.setValue(e),this},clear:function(){return this.cm.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.html():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var o=this.settings;if(e.inArray(o.mode,["gfm","markdown"])<0)return this;if(this.state.watching=o.watch=!0,this.preview.show(),this.toolbar){var r=o.toolbarIconsClass.watch,n=o.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",o.lang.toolbar.watch),a.removeClass(n).addClass(r)}return this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),i=0,this.save().resize(),o.onwatch||(o.onwatch=t||function(){}),e.proxy(o.onwatch,this)(),this},unwatch:function(t){var i=this.settings;if(this.state.watching=i.watch=!1,this.preview.hide(),this.toolbar){var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,n=this.toolbar.find(".fa[name=watch]");n.parent().attr("title",i.lang.toolbar.unwatch),n.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,n=this.toolbar,a=this.settings,s=this.codeMirror;if(e.inArray(a.mode,["gfm","markdown"])<0)return this;a.toolbar&&n&&(n.toggle(),n.find(".fa[name=preview]").toggleClass("active")),s.toggle();var l=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),a.watch||this.save(),r.show().css({position:"static",top:0,width:o.width(),height:a.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(a.onpreviewing,this)(),e(window).bind("keyup",l)):(e(window).unbind("keyup",l),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,n=this.settings,a=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,this.codeMirror.show(),n.toolbar&&r.show(),o[n.watch?"show":"hide"](),a.hide().unbind(t.mouseOrTouch("click","touchend")),o.css({background:null,position:"absolute",width:i.width()/2,height:n.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:n.toolbar?r.height():0}),this.state.loaded&&e.proxy(n.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.state,o=this.editor,r=(this.preview,this.toolbar),n=this.settings,a=this.classPrefix+"fullscreen";r&&r.find(".fa[name=fullscreen]").parent().toggleClass("active");var s=function(e){e.shiftKey||27!==e.keyCode||i.fullscreen&&t.fullscreenExit()};return o.hasClass(a)?(e(window).unbind("keyup",s),this.fullscreenExit()):(i.fullscreen=!0,e("html,body").css("overflow","hidden"),o.css({position:"fixed",top:0,left:0,margin:0,border:"none",width:e(window).width(),height:e(window).height()}).addClass(a),this.resize(),e.proxy(n.onfullscreen,this)(),e(window).bind("keyup",s)),this},fullscreenExit:function(){var t=this.editor,i=this.settings,o=this.toolbar,r=this.classPrefix+"fullscreen";return this.state.fullscreen=!1,o&&o.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({position:"",top:"",left:"",margin:"0 auto 15px",width:t.data("oldWidth"),height:t.data("oldHeight"),border:"1px solid #ddd"}).removeClass(r),this.resize(),e.proxy(i.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,n=this.cm,a=this.settings;return o=a.pluginPath+o,"function"==typeof define?"undefined"==typeof this[i]?(alert("Error: "+i+" plugin is not found, you are not load this plugin."),this):(this[i](n),this):(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](n)}):e.proxy(t.loadPlugins[i],this)(n),this)},search:function(e){var t=this.settings;return t.searchReplace?(t.readOnly||this.cm.execCommand(e||"find"),this):(alert("Error: settings.searchReplace == false"),this)},searchReplace:function(){return this.search("replace"),this},searchReplaceAll:function(){return this.search("replaceAll"),this}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings||{dialogLockScreen:!0};t.dialogLockScreen&&e("html,body").css("overflow","hidden")},t.dialogShowMask=function(t){var i=this.editor,o=this.settings||{dialogShowMask:!0};t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("> "+i),e.setCursor(t.line,""===i?t.ch+2:t.ch+i.length+2)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("# "+t)},h2:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("## "+t)},h3:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("### "+t)},h4:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("#### "+t)},h5:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("##### "+t)},h6:function(){var e=this.cm,t=e.getSelection();e.replaceSelection("###### "+t)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm;e.getCursor(),e.getSelection()}e.replaceSelection("------------")},tex:function(){if(!this.settings.tex)return alert("settings.tex === false"),this;var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("$$"+i+"$$"),""===i&&e.setCursor(t.line,t.ch+2)},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},"reference-link":function(){this.executePlugin("referenceLinkDialog","reference-link-dialog/reference-link-dialog")},pagebreak:function(){if(!this.settings.pageBreak)return alert("settings.pageBreak === false"),this;{var e=this.cm;e.getSelection()}e.replaceSelection("\r\n[========]\r\n")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day"); + +e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},"html-entities":function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},"goto-line":function(){this.executePlugin("gotoLineDialog","goto-line-dialog/goto-line-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},search:function(){this.search()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-B":"bold","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.emoji?(e.replaceSelection(":"+i+":"),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.emoji == false")},"Ctrl-Alt-G":"goto-line","Ctrl-H":"hr","Ctrl-I":"italic","Ctrl-K":"code","Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.atLink?(e.replaceSelection("@"+i),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.atLink == false")},"Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Shift-Ctrl-K":"tex","Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"html-entities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table","Shift-Alt-P":"pagebreak",F9:"watch",F10:"preview",F11:"fullscreen"};var r=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=r;var n=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=n;var a=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=a,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\-\w]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g,pageBreak:/^\[[=]{8,}\]$/},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(i,o){var n={toc:!0,tocm:!1,tocStartLevel:1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},a=e.extend(n,o||{}),s=t.$marked,l=new s.Renderer;i=i||[];var c=t.regexs,h=c.atLink,d=c.emoji,u=c.email,f=c.emailLink,g=c.twemoji,p=c.fontAwesome,m=c.editormdLogo,w=c.pageBreak;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!a.emoji)return e;for(var o=0,r=i.length;r>o;o++)e=e.replace(new RegExp(i[o]),function(e){var i=e.match(p),o=e.replace(/:/g,"");if(i)for(var r=0,n=i.length;n>r;r++){var a=i[r].replace(/:/g,"");return''}else{var s=e.match(m),l=e.match(g);if(s)for(var c=0,h=s.length;h>c;c++){var d=s[c].replace(/:/g,"");return''}else{if(!l)return':'+o+':';for(var u=0,f=l.length;f>u;u++){var w=l[u].replace(/:/g,"").replace("tw-","");return'twemoji-'+w+''}}}});return e},l.atLink=function(i){return h.test(i)?(a.atLink&&(i=i.replace(u,function(e){return e.replace(/@/g,"_#_@_#_")}),i=i.replace(h,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),a.emailLink&&(i=i.replace(f,function(t,i,o,r,n){return!i&&e.inArray(n,"jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|"))<0?''+t+"":t})),i):i},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var n=''+i.replace(/@/g,"@")+""):(t&&(n+=' title="'+t+'"'),n+=">"+i+"")},l.heading=function(e,t){var o=e,n=/\s*\]*)\>(.*)\<\/a\>\s*/;if(n.test(e)){var a=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var s=0,l=e.length;l>s;s++)a.push(e[s].replace(/\s*href\=\"(.*)\"\s*/g,""));e=a.join(" ")}e=r(e);var c=e.toLowerCase().replace(/[^\w]+/g,"-"),h={text:e,level:t,slug:c},d=/^[\u4e00-\u9fa5]+$/.test(e),u=d?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");i.push(h);var f="';return f+='',f+='',f+=this.atLink(n?this.emoji(o):this.emoji(e)),f+=""},l.pageBreak=function(e){return w.test(e)&&a.pageBreak&&(e='
                    '),e},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",n=a.tocm?/^(\[TOC\]|\[TOCM\])$/.test(e):/^\[TOC\]$/.test(e),s=/^\[TOCM\]$/.test(e);e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e;var l='
                    '+e+"
                    ";return n?s?'
                    '+l+"

                    ":l:w.test(e)?this.pageBreak(e):""+this.atLink(this.emoji(e))+"

                    \n"},l.code=function(e,t){return"seq"===t||"sequence"===t?'
                    '+e+"
                    ":"flow"===t?'
                    '+e+"
                    ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return a.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
                  • '+this.atLink(this.emoji(e))+"
                  • "):"
                  • "+this.atLink(this.emoji(e))+"
                  • "},l},t.markdownToCRenderer=function(e,t,i,o){var r="",n=0,a=this.classPrefix;o=o||1;for(var s=0,l=e.length;l>s;s++){var c=e[s].text,h=e[s].level;o>h||(r+=h>n?"":n>h?new Array(n-h+2).join("
                • "):"",r+='
                • '+c+"
                    ",n=h)}var d=t.find(".markdown-toc");if(d.length<1&&"false"===t.attr("previewContainer")){var u='
                    ';u=i?'
                    '+u+"
                    ":u,t.html(u),d=t.find(".markdown-toc")}return i&&d.wrap('

                    '),d.html('
                      ').children(".markdown-toc-list").html(r.replace(/\r?\n?\\<\/ul\>/g,"")),d},t.tocDropdownMenu=function(t,i){i=i||"Table of Contents";var o=400,r=t.find("."+this.classPrefix+"toc-menu");return r.each(function(){var t=e(this),r=t.children(".markdown-toc"),n='',a=''+n+i+"",s=r.children("ul"),l=s.find("li");r.append(a),l.first().before("
                    • "+i+" "+n+"

                    • "),t.mouseover(function(){s.show(),l.each(function(){var t=e(this),i=t.children("ul");if(""===i.html()&&i.remove(),i.length>0&&""!==i.html()){var r=t.children("a").first();r.children(".fa").length<1&&r.append(e(n).css({"float":"right",paddingTop:"4px"}))}t.mouseover(function(){i.css("z-index",o).show(),o+=1}).mouseleave(function(){i.hide()})})}).mouseleave(function(){s.hide()})}),r},t.filterHTMLTags=function(e,t){if("string"==typeof t)for(var i=t.split(","),o=0,r=i.length;r>o;o++){var n=i[o];e=e.replace(new RegExp("]*)>","igm"),"").replace(new RegExp("","igm"),"")}return e},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocm:!1,tocStartLevel:1,tocTitle:"目录",tocDropdown:!1,markdown:"",htmlDecode:!1,autoLoadKaTeX:!0,pageBreak:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var n=e("#"+i),a=n.settings=e.extend(!0,r,o||{}),s=n.find("textarea");s.length<1&&(n.append(""),s=n.find("textarea"));var l=""===a.markdown?s.val():a.markdown,c=[],h={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,taskList:a.taskList,emoji:a.emoji,tex:a.tex,pageBreak:a.pageBreak,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},d={renderer:t.markedRenderer(c,h),gfm:a.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=t.filterHTMLTags(l,a.htmlDecode);var u=marked(l,d);if(s.val(l),n.addClass("markdown-body "+this.classPrefix+"html-preview").append(u),a.toc&&(n.tocContainer=this.markdownToCRenderer(c,n,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||n.find("."+this.classPrefix+"toc-menu").length>0)&&this.tocDropdownMenu(n,a.tocTitle)),a.previewCodeHighlight&&(n.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(a.flowChart&&n.find(".flowchart").flowChart(),a.sequenceDiagram&&n.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),a.tex){var f=function(){n.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html(),t[0])})};!a.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?f():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,f()})}return n.getMarkdown=function(){return s.val()},n},t.themes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min",js:"http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this.editor,n=t.classPrefix,a=(new Date).getTime(),s=""===i.name?n+"dialog-"+a:i.name,l=t.mouseOrTouch,c='
                      ';""!==i.title&&(c+='
                      ",c+=''+i.title+"",c+="
                      "),i.closed&&(c+=''),c+='
                      '+i.content,(i.footer||"string"==typeof i.footer)&&(c+='"),c+="
                      ",c+='
                      ',c+='
                      ',c+="
                      ",r.append(c);var h=r.find("."+s);h.lockScreen=function(t){return i.lockScreen&&e("html,body").css("overflow",t?"hidden":""),h},h.showMask=function(){return i.mask&&r.find("."+n+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),h},h.hideMask=function(){return i.mask&&r.find("."+n+"mask").hide(),h},h.loading=function(e){var t=h.find("."+n+"dialog-mask");return t[e?"show":"hide"](),h},h.lockScreen(!0).showMask(),h.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var d=function(){h.css({top:(e(window).height()-h.height())/2+"px",left:(e(window).width()-h.width())/2+"px"})};if(d(),e(window).resize(d),h.children("."+n+"dialog-close").bind(l("click","touchend"),function(){h.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var u=h.footer=h.find("."+n+"dialog-footer");for(var f in i.buttons){var g=i.buttons[f],p=n+f+"-btn";u.append('"),g[1]=e.proxy(g[1],h),u.children("."+p).bind(l("click","touchend"),g[1])}}if(""!==i.title&&i.drag){var m,w,v=h.children("."+n+"dialog-header");i.mask||v.bind(l("click","touchend"),function(){t.dialogZindex+=2,h.css("z-index",t.dialogZindex)}),v.mousedown(function(e){e=e||window.event,m=e.clientX-parseInt(h[0].style.left),w=e.clientY-parseInt(h[0].style.top),document.onmousemove=x});var k=function(e){e.removeClass(n+"user-unselect").off("selectstart")},b=function(e){e.addClass(n+"user-unselect").on("selectstart",function(){return!1})},x=function(t){t=t||window.event;var i,o,r=parseInt(h[0].style.left),n=parseInt(h[0].style.top);r>=0?r+h.width()<=e(window).width()?i=t.clientX-m:(i=e(window).width()-h.width(),document.onmousemove=null):(i=0,document.onmousemove=null),n>=0?o=t.clientY-w:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},b(e("body")),b(h),h[0].style.left=i+"px",h[0].style.top=o+"px"};document.onmouseup=function(){k(e("body")),k(h),document.onselectstart=null,document.onmousemove=null},v.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},v.touchDraggable()}return t.dialogZindex+=2,h},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),n=t(i.getMonth()+1),a=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),h=t(i.getSeconds()),d=t(i.getMilliseconds()),u="",f=r+"-"+n+"-"+a,g=o+"-"+n+"-"+a,p=l+":"+c+":"+h;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=n;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=a;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=h;break;case"ms":u=d;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+d;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); \ No newline at end of file diff --git a/editormd.min.js.map b/editormd.min.js.map deleted file mode 100644 index b063530..0000000 --- a/editormd.min.js.map +++ /dev/null @@ -1,2 +0,0 @@ -/*! Editor.md v1.3.0 | editormd.min.js.map | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-12 */ -{"version":3,"file":"editormd.min.js","sources":["editormd.min.js"],"names":["factory","require","exports","module","define","amd","window","editormd","$","jQuery","Zepto","id","options","fn","init","title","$name","version","homePage","classPrefix","toolbarModes","full","simple","mini","defaults","mode","theme","value","markdown","width","height","path","pluginPath","autoLoadModules","watch","placeholder","codeFold","autoHeight","autoCloseTags","searchReplace","readOnly","lineNumbers","matchWordHighlight","styleActiveLine","dialogLockScreen","dialogShowMask","dialogDraggable","dialogMaskBgColor","dialogMaskOpacity","fontSize","saveHTMLToTextarea","disabledKeyMaps","onload","onresize","onchange","onwatch","onunwatch","onpreviewing","onpreviewed","onfullscreen","onfullscreenExit","onscroll","onpreviewscroll","imageUpload","imageFormats","imageUploadURL","crossDomainUpload","uploadCallbackURL","toc","tocStartLevel","htmlDecode","atLink","emailLink","taskList","emoji","tex","flowChart","sequenceDiagram","previewCodeHighlight","toolbar","toolbarAutoFixed","toolbarIcons","toolbarTitles","toolbarHandlers","ucwords","lowercase","toolbarCustomIcons","toolbarIconsClass","undo","redo","bold","del","italic","quote","uppercase","h1","h2","h3","h4","h5","h6","list-ul","list-ol","hr","link","anchor","image","code","preformatted-text","code-block","table","datetime","htmlEntities","unwatch","preview","fullscreen","clear","help","info","toolbarIconTexts","lang","name","description","buttons","enter","cancel","close","dialog","url","urlTitle","urlEmpty","nameEmpty","titleEmpty","alt","uploadButton","imageURLEmpty","uploadFileEmpty","formatNotAllowed","preformattedText","emptyAlert","codeBlock","selectLabel","selectDefaultText","otherLanguage","unselectedLanguageAlert","codeEmptyAlert","classNames","dialogZindex","$katex","$marked","$CodeMirror","$prettyPrint","prototype","state","watching","loaded","_this","this","editor","settings","extend","textarea","html","hasClass","addClass","css","markdownTextarea","children","length","append","attr","appendElements","join","mask","val","htmlTextarea","previewContainer","katex","loadCSS","CodeMirror","marked","setCodeMirror","setToolbar","loadedDisplay","loadQueues","loadPath","loadFlowChartOrSequenceDiagram","isIE8","loadScript","setTheme","cm","setOption","codeMirrorConfig","tabSize","dragDrop","autofocus","indentUnit","lineWrapping","extraKeys","Ctrl-Q","foldCode","getCursor","foldGutter","gutters","matchBrackets","indentWithTabs","styleSelectedText","autoCloseBrackets","showTrailingSpace","highlightSelectionMatches","showToken","codeEditor","fromTextArea","codeMirror","cmElement","setValue","getCodeMirrorOption","key","getOption","setCodeMirrorOption","addKeyMap","map","bottom","removeKeyMap","extends","arguments","proxy","set","config","recreate","on","eventType","callback","off","showToolbar","find","show","resize","hideToolbar","hide","setToolbarAutoFixed","fixed","autoFixedHandle","top","scrollTop","offset","position","left","bind","unbind","icons","toolbarMenu","menu","i","len","isHeader","test","index","iconTexts","iconClass","setToolbarHandler","getToolbarHandles","toolbarIconHandlers","mouseOrTouch","icon","cursor","selection","getSelection","activeIcon","focus","createDialog","createInfoDialog","infoDialogHTML","infoDialog","hideInfoDialog","infoDialogPosition","_infoDialogPosition","showInfoDialog","lockScreen","opacity","backgroundColor","lock","remove","saveToTextareas","registerKeyMaps","prettyPrint","katexRender","each","render","flowChartAndSequenceDiagramRender","keyMap","inArray","keyMaps","handle","keydown","event","keymaps","120","121","122","keyCode","data","codeEditorBindScroll","percent","scrollHeight","codeEditorUnbindScroll","previewBindScroll","codeView","previewUnbindScroll","mouseover","mouseout","touchstart","touchend","codeMirrorValue","getValue","innerText","markdownToC","rendererOptions","markedRendererOptions","markedOptions","renderer","markedRenderer","gfm","tables","breaks","pedantic","sanitize","smartLists","smartypants","setOptions","filterHTMLTags","newMarkdownDoc","save","markdownToCRenderer","kaTeXLoaded","loadKaTeX","timer","setTimeout","clearTimeout","setCursor","setSelection","from","to","setSelections","ranges","getSelections","replaceSelection","insertValue","setMarkdown","md","getMarkdown","getHTML","alert","getTextareaSavedHTML","getPreviewedHTML","watchIcon","unWatchIcon","parent","removeClass","previewing","toggle","toggleClass","escHandle","shiftKey","previewed","previewCloseBtn","background","fullscreenClass","fullscreenExit","margin","border","executePlugin","loadFiles","plugin","loadPlugin","loadPlugins","parseInt","line","ch","ucfirst","selections","listSelections","firstUpperCase","wordsFirstUpperCase","toUpperCase","toLowerCase","selectionText","split","langName","Date","datefmt","dateFormat","Ctrl-B","Ctrl-I","Ctrl-K","Shift-Ctrl-C","Shift-Ctrl-Q","Shift-Ctrl-S","Ctrl-H","Ctrl-1","Ctrl-2","Ctrl-3","Ctrl-4","Ctrl-5","Ctrl-6","Ctrl-D","Ctrl-E","Ctrl-L","Ctrl-U","Shift-Ctrl-A","Shift-Alt-C","Shift-Ctrl-Alt-C","Shift-Ctrl-H","Shift-Alt-H","Shift-Ctrl-E","Shift-Ctrl-U","Shift-Alt-U","Shift-Ctrl-Alt-U","Shift-Alt-L","Shift-Ctrl-I","Shift-Ctrl-Alt-I","Shift-Ctrl-L","Shift-Ctrl-O","Shift-Ctrl-P","Shift-Ctrl-T","F9","F10","F11","trim","str","String","replace","$1","urls","atLinkBase","regexs","email","emojiDatetime","twemoji","fontAwesome","editormdLogo","ext","Renderer","atLinkReg","emojiReg","emailReg","emailLinkReg","twemojiReg","faIconReg","editormdLogoReg","text","matchs","match","RegExp","faMatchs","fa","len1","faName","emdlogoMathcs","twemojiMatchs","x","len2","logoName","t","len3","twe","$2","href","prot","decodeURIComponent","unescape","e","indexOf","out","heading","level","linkText","hasLinkReg","tempText","push","escapedText","slug","isChinese","escape","headingHTML","headerPrefix","paragraph","isTeXInline","isTeXLine","isTeXAddClass","isToC","apply","tablecell","content","flags","type","tag","align","listitem","container","startLevel","lastLevel","Array","tocContainer","filters","filterTags","markdownToHTML","autoLoadKaTeX","div","saveTo","markdownDoc","markdownParsed","katexHandle","themes","js","fileName","into","document","createElement","rel","onreadystatechange","getElementsByTagName","appendChild","body","isIE","navigator","appName","appVersion","script","src","readyState","katexURL","drag","closed","maskStyle","footer","guid","getTime","dialogName","showMask","hideMask","loading","zIndex","dialogPosition","btn","btnClassName","posX","posY","dialogHeader","mousedown","clientX","style","clientY","onmousemove","moveAction","userCanSelect","obj","userUnselect","nowLeft","nowTop","onselectstart","onmouseup","touchDraggable","start","orig","originalEvent","pos","changedTouches","pageX","y","pageY","move","preventDefault","mouseEventType","touchEventType","createEvent","format","addZero","d","date","year","getFullYear","year2","toString","slice","month","getMonth","day","getDate","weekDay","getDay","hour","getHours","min","getMinutes","second","getSeconds","ms","getMilliseconds","ymd","fymd","hms","toUTCString","cnWeekDays","weekDays"],"mappings":"CAYE,SAASA,GACP,YAGoB,mBAAZC,UAA6C,gBAAZC,UAA0C,gBAAXC,QAEpEA,OAAOD,QAAUF,EAEG,kBAAXI,QAELA,OAAOC,KAMbD,QAAQ,UAAWJ,GAKjBM,OAAOC,SAAWP,KAGxB,WAYE,YAEA,IAAIQ,GAAyB,mBAAb,QAA4BC,OAASC,KAExD,IAAmB,mBAAR,GAAX,CAIG,GAAIH,GAAmB,SAAUI,EAAIC,GACjC,MAAO,IAAIL,GAASM,GAAGC,KAAKH,EAAIC,GAGpCL,GAASQ,MAAeR,EAASS,MAAQ,YACzCT,EAASU,QAAe,QACxBV,EAASW,SAAe,sCACxBX,EAASY,YAAe,YAExBZ,EAASa,cACLC,MACI,OAAQ,OAAQ,IAChB,OAAQ,MAAO,SAAU,QAAS,UAAW,YAAa,YAAa,IACvE,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,IACpC,UAAW,UAAW,KAAM,IAC5B,OAAQ,SAAU,QAAS,OAAQ,oBAAqB,aAAc,QAAS,WAAY,QAAS,eAAgB,IACpH,QAAS,UAAW,aAAc,QAAS,IAC3C,OAAQ,QAEZC,QACI,OAAQ,OAAQ,IAChB,OAAQ,MAAO,SAAU,QAAS,YAAa,YAAa,IAC5D,KAAM,KAA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L,IAAK,KACGvM,EAAUqM,CACd,MAEJ,KAAK,OACL,IAAK,KACGrM,EAAUyM,CACd,MAEJ,KAAK,MACL,IAAK,KACGzM,EAAU2M,CACd,MAEJ,KAAK,SACL,IAAK,KACG3M,EAAU6M,CACd,MAEJ,KAAK,KACG7M,EAAU+M,CACd,MAEJ,KAAK,WACG/M,EAAUiN,CACd,MAEJ,KAAK,aACGjN,EAAUkN,CACd,MAEJ,KAAK,sBACL,IAAK,YACGlN,EAAUkN,EAAO,IAAMC,EAAM,IAAMJ,CACvC,MAEJ,KAAK,OACL,IAAK,mBACD,QACI/M,EAAUkN,EAAO,IAAMC,EAInC,MAAOnN,IAGJ/X","sourceRoot":"./"} \ No newline at end of file diff --git a/examples/@links.html b/examples/@links.html index 91ed77c..63eadc0 100644 --- a/examples/@links.html +++ b/examples/@links.html @@ -94,6 +94,20 @@ This is an H1 @pandao This @pandao an H2 @pandao ------------- + +http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png + +http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png + +http://socialpro.demo.ipandao.com/app/images/welcom-logo@4x.png + +[![http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png)](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png) + + +[http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png) +[http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png) + +![http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png) diff --git a/examples/auto-height.html b/examples/auto-height.html index aa372a6..2346930 100644 --- a/examples/auto-height.html +++ b/examples/auto-height.html @@ -10,16 +10,17 @@
                      -

                      Auto height

                      +

                      Auto height test

                      +
                      + +
                      @@ -32,9 +33,21 @@ var testEditor = editormd("test-editormd", { $(function() { testEditor = editormd("test-editormd", { - width : "90%", - autoHeight : true, - path : '../lib/' + width : "90%", + autoHeight : true, + path : "../lib/", + htmlDecode : "style,script,iframe", + tex : true, + emoji : true, + taskList : true, + flowChart : true, + sequenceDiagram : true + }); + + $("#append-btn").click(function(){ + $.get("./test.md", function(md){ + testEditor.appendMarkdown(md); + }); }); }); diff --git a/examples/delay-renderer-preview.html b/examples/delay-renderer-preview.html new file mode 100644 index 0000000..8b52cce --- /dev/null +++ b/examples/delay-renderer-preview.html @@ -0,0 +1,56 @@ + + + + + Delay Rerender & Preview - Editor.md examples + + + + + +
                      +
                      +

                      Delay Rerender & Preview

                      +

                      P.S. If you input the content too much and too fast, You can setting the delay value.

                      +

                      P.S. 适用于输入内容太多太快的情形,但要是一个合理的值,不然会显得预览太慢。打字慢会相对显得慢,打字快时则相对显得快。

                      +
                      +
                      + +
                      +
                      + + + + + \ No newline at end of file diff --git a/examples/form-get-value.html b/examples/form-get-value.html index e61f73c..e5d9711 100644 --- a/examples/form-get-value.html +++ b/examples/form-get-value.html @@ -15,7 +15,7 @@
                      - +``` + +
                      @@ -70,11 +72,14 @@ testEditor.getPreviewedHTML(); // 获取预览窗口里的HTML,在开启watch diff --git a/examples/goto-line.html b/examples/goto-line.html new file mode 100644 index 0000000..e853502 --- /dev/null +++ b/examples/goto-line.html @@ -0,0 +1,84 @@ + + + + + Goto line - Editor.md examples + + + + + +
                      +
                      +

                      Goto line

                      +
                      +
                      + + + + + + + +
                      +
                      +
                      + + + + + \ No newline at end of file diff --git a/examples/html-preview-markdown-to-html.html b/examples/html-preview-markdown-to-html.html index 77753b5..050f999 100644 --- a/examples/html-preview-markdown-to-html.html +++ b/examples/html-preview-markdown-to-html.html @@ -21,11 +21,11 @@

                      HTML Preview(markdown to html)

                      - +
                      +
                      @@ -27,7 +65,7 @@ testEditor = editormd("test-editormd", { width : "90%", height : 720, - markdown : md, + appendMarkdown : md, path : '../lib/', onscroll : function(event) { console.clear(); @@ -46,6 +84,7 @@ console.log("on() => Override settings.onpreviewscroll =>", this, this.id, event, (new Date).getTime()); }); + // defined event bind this.on("resize", function(){ console.clear(); console.log("onresize =>", this, this.id, event, (new Date).getTime()); diff --git a/examples/onchange.html b/examples/onchange.html index 68d1f8d..de2ccc6 100644 --- a/examples/onchange.html +++ b/examples/onchange.html @@ -11,10 +11,21 @@

                      Onchange event

                      -

                      Plaese press F12, open the develop tools.

                      +

                      Plaese press F12, open the develop tools.

                      +

                      - +
                      @@ -28,6 +39,7 @@ height : 720, path : '../lib/', onchange : function() { + $("#output").html("onchange : this.id =>" + this.id + ", markdown =>" + this.getValue()); console.log("onchange =>", this, this.id, this.settings, this.state); } }); diff --git a/examples/onfullscreen.html b/examples/onfullscreen.html index 3e0bdcc..e971f22 100644 --- a/examples/onfullscreen.html +++ b/examples/onfullscreen.html @@ -14,14 +14,29 @@

                      Plaese press F12, open the develop tools.

                      - +
                      @@ -30,7 +41,7 @@ onload : function() { //this.watch(); //this.setMarkdown("###test onloaded"); - testEditor.setMarkdown("###Test onloaded"); + //testEditor.setMarkdown("###Test onloaded"); alert("onloaded"); console.log("onloaded =>", this, this.id, this.settings); } diff --git a/examples/onpreviewing-onpreviewed.html b/examples/onpreviewing-onpreviewed.html index 20c80f4..afb49b8 100644 --- a/examples/onpreviewing-onpreviewed.html +++ b/examples/onpreviewing-onpreviewed.html @@ -14,7 +14,20 @@

                      Plaese press F12, open the develop tools.

                      - +
                      diff --git a/examples/onresize.html b/examples/onresize.html index 11128bf..fc2b5f8 100644 --- a/examples/onresize.html +++ b/examples/onresize.html @@ -14,7 +14,16 @@

                      Plaese press F12, open the develop tools.

                      - +
                      @@ -27,7 +45,7 @@ testEditor = editormd("test-editormd", { width : "90%", height : 720, - markdown : md, + appendMarkdown : md, path : '../lib/', onscroll : function(event) { console.clear(); diff --git a/examples/onwatch-onunwatch.html b/examples/onwatch-onunwatch.html index ca30413..bcba513 100644 --- a/examples/onwatch-onunwatch.html +++ b/examples/onwatch-onunwatch.html @@ -14,11 +14,19 @@

                      Plaese press F12, open the develop tools.

                      -
                      diff --git a/examples/page-break.html b/examples/page-break.html new file mode 100644 index 0000000..9cb9034 --- /dev/null +++ b/examples/page-break.html @@ -0,0 +1,87 @@ + + + + + Page break - Editor.md examples + + + + + +
                      +
                      +

                      Page break

                      +
                      +
                      + + + +
                      +
                      + +
                      +
                      + + + + + \ No newline at end of file diff --git a/examples/readonly.html b/examples/readonly.html index e110f82..fcb7b20 100644 --- a/examples/readonly.html +++ b/examples/readonly.html @@ -2,7 +2,7 @@ - 只读模式 - Editor.md examples + Read only mode - Editor.md examples @@ -11,25 +11,22 @@

                      只读模式

                      -

                      Editor.md read only

                      +

                      Read only mode

                      +
                      + + +
                      -
                      @@ -41,13 +38,21 @@ $(function() { $(function() { testEditor = editormd("test-editormd", { - width: "90%", - height: 540, - path : '../lib/', - //watch : false, // 禁用实时预览 - readOnly : true, - styleActiveLine : false, // 禁止高亮显示当前行 - //lineNumbers : false // 隐藏行号 + width : "90%", + height : 540, + path : "../lib/", + //watch : false, // disable watch + readOnly : true, + styleActiveLine : false, // disable active line + //lineNumbers : false // hide line numbers + }); + + $("#watch-btn").click(function(){ + testEditor.watch(); + }); + + $("#unwatch-btn").click(function(){ + testEditor.unwatch(); }); }); diff --git a/examples/resettings.html b/examples/resettings.html index 1dfbe88..a61c277 100644 --- a/examples/resettings.html +++ b/examples/resettings.html @@ -26,28 +26,28 @@
                      -
                      -