Compare commits

...

17 Commits

  1. 9
      .editorconfig
  2. 1
      .gitignore
  3. 733
      CHANGE.md
  4. 684
      Gulpfile.js
  5. 467
      README.md
  6. 9222
      css/editormd.css
  7. 178
      css/editormd.logo.css
  8. 4
      css/editormd.logo.min.css
  9. 10
      css/editormd.min.css
  10. 7414
      css/editormd.preview.css
  11. 10
      css/editormd.preview.min.css
  12. 8998
      editormd.amd.js
  13. 6
      editormd.amd.min.js
  14. 8993
      editormd.js
  15. 5
      editormd.min.js
  16. 14
      examples/dynamic-create-editormd.html
  17. 386
      examples/emoji.html
  18. 4
      examples/form-get-value.html
  19. 284
      examples/html-preview-markdown-to-html.html
  20. 255
      examples/html-tags-decode.html
  21. 22
      examples/image-cross-domain-upload.html
  22. 14
      examples/image-upload.html
  23. 17
      examples/katex.html
  24. 25
      examples/multi-editormd.html
  25. 7
      examples/php/cross-domain-upload.php
  26. 25
      examples/php/editormd.uploader.class.php
  27. 4
      examples/php/upload.php
  28. 16
      examples/php/upload_callback.html
  29. 175
      examples/sequence-diagram.html
  30. 5
      examples/task-lists.html
  31. 732
      examples/test.md
  32. 257
      examples/toolbar-auto-fixed.html
  33. 0
      examples/uploads/.gitkeep
  34. 2
      examples/use-zepto.html
  35. 4
      languages/zh-tw.js
  36. 6
      lib/codemirror/addons.min.js
  37. 12
      lib/codemirror/modes.min.js
  38. 11
      lib/marked.min.js
  39. 8
      lib/sequence-diagram.min.js
  40. 4
      package.json
  41. 4
      plugins/code-block-dialog/code-block-dialog.js
  42. 639
      plugins/emoji-dialog/emoji-dialog.js
  43. 4
      plugins/goto-line-dialog/goto-line-dialog.js
  44. 2
      plugins/help-dialog/help-dialog.js
  45. 4
      plugins/html-entities-dialog/html-entities-dialog.js
  46. 53
      plugins/image-dialog/image-dialog.js
  47. 4
      plugins/link-dialog/link-dialog.js
  48. 2
      plugins/preformatted-text-dialog/preformatted-text-dialog.js
  49. 4
      plugins/reference-link-dialog/reference-link-dialog.js
  50. 4
      plugins/table-dialog/table-dialog.js
  51. 368
      scss/editormd.dialog.scss
  52. 670
      scss/editormd.preview.scss
  53. 282
      scss/editormd.preview.themes.scss
  54. 274
      scss/editormd.scss
  55. 56
      scss/editormd.themes.scss
  56. 1008
      scss/github-markdown.scss
  57. 2
      scss/prettify.scss
  58. 8991
      src/editormd.js

9
.editorconfig

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

1
.gitignore

@ -8,6 +8,7 @@ research/
test/
backup/
examples/uploads/**/*
!.gitkeep
*.bat
*.sh
.project

733
CHANGE.md

@ -1,222 +1,244 @@
## 更新日志
# 更新日志
### v1.0.x
##### v1.0.0 beta
## 目录
预览版:基本功能完成;
[TOC]
##### v1.0.0 releases
## v1.x
发布 v1.0.0 正式版。
### v1.5.x
主要更新:
#### v1.5.0
- 新建分支 `mathjax-version`,但不打算继续对此分支进行开发;
**主要更新:**
- 移除 MathJax,改用 KaTeX [#2](https://github.com/pandao/editor.md/issues/2),解析和预览响应速度大幅度提高 [#3](https://github.com/pandao/editor.md/issues/3);
- 移除 `mathjax` 配置项;
- 移除 `mathjaxURL` 属性;
- 移除 `setMathJaxConfig()` 方法;
- 移除 `loadMathJax()` 方法;
- 移除MathJax的所有示例;
- 新增 `tex` 配置项,表示是否开启支持科学公式 TeX ,基于 KaTeX;
- 新增 `katexURL` 属性;
- 新增 `loadKaTeX` 方法;
- 新增 KaTeX 的示例;
- `setCodeEditor()` 方法更名为 `setCodeMirror()`
- 新增:编辑器黑色主题 Dark,改进自定义主题功能(即工具栏、编辑区、预览区可分别设置主题样式);
- 新增:多行公式支持;
- 新增:支持非编辑状态下的 ToC 自定义容器;
- 新增:支持设置为单向同步滚动;
- 改进:编辑器样式美化,更换了滚动条样式;
- 改进:提高同步滚动定位的精确度;
- 改进:修复和改进 HTML 标签及属性过滤功能;
- 改进:修复在 Bootstrap 下的兼容性问题;
- 修复多处 Bug;
- 合并 CodeMirror 使用到的多个 JS 模块文件,大幅减少 HTTP 请求,加快下载速度;
- 新增合并后的两个模块文件:`./lib/codemirror/modes.min.js`、`./lib/codemirror/addons.min.js` ;
- `Gulpfile.js` 新增合并 CodeMirror 模块文件的任务方法 `codemirror-mode``codemirror-addon`
- 另外在使用 Require.js 时,因为 CodeMirror 的严格模块依赖的限制,不能使用上述合并的模块文件,仍然采用动态加载多个模块文件;
- 更新 `README.md` 等相关文档和示例;
**具体更新:**
- 解决 Sea.js 环境下 Raphael.js 无法运行导致不支持流程图和时序图的问题,即必须先加载 Raphael.js ,后加载 Sea.js
- 新增:解析后的代码块自动换行;
### v1.1.x
- 新增:支持多行公式;
- 新增:新增语法:\`\`\`math | latex | katex;
- 改进:美化 KaTeX 公式,即加大字号等;
##### v1.1.0
- 新增:支持设置为单向同步滚动,即只是编辑区单向同步滚动,配置项 `syncScrolling : "single"`
- 新增:配置同步滚动示例文件 `sync-scrolling.html`
主要更新:
- 新增:增加了编辑器样式主题 Dark,即工具栏和预览区各自有一个暗黑色主题;
- 变更:自 `v1.5.0` 开始,配置项 `theme` 改为指定 Editor.md 本身的主题;
- 新增配置项 `editorTheme` ,用于指定编辑区的主题,即 CodeMirror 的主题;
- 新增配置项 `previewTheme` ,用于指定预览区的主题;
- 新增方法 `setEditorTheme()`,别名: `setCodeMirror()`
- 新增方法 `setPreviewTheme()`
- 修改了方法 `setTheme()`
- 更换了滚动条样式,Only Webkit;
- 改进全屏状态下的样式显示,去掉 JS 操作的部分,改为通过 CSS 样式类 `.editormd-fullscreen` 控制;
- 修改和增加相关的方法、SCSS 文件及示例文件 `themes.html`
- 设计并更换了 Logo;
- 新增添加图片、链接、锚点链接、代码块、预格式文本等操作弹出对话框层及示例;
- 新增支持图片(跨域)上传;
- 改用 `<textarea>` 来存放 Markdown 源文档;
- 新增支持自定义工具栏;
- 新增支持多语言;
- 新增支持 Zepto.js;
- 新增支持多个 Editor.md 并存和动态加载 Editor.md 及示例;
- 新增支持智能识别和解析 HTML 标签及示例;
- 新增多个外部操作方法接口及示例;
- 修复了一些大大小小的 Bug;
- 新增:非编辑状态下 ToC 自定义容器支持;
- 新增配置项 `markdownSourceCode`,即解析后是否保留源码,默认为不保留 `false`
- 新增配置项 `tocContainer`,值为自定义 ToC 容器的 ID 选择器 `#xxxxx`,默认为空;
- 新增和修改了相关示例文件;
具体更新如下:
- 新增:新增加了 CSS 样式类 `editormd-preview-active`,可以控制全屏HTML预览时的内容层样式;
- 修改了 `previewing()``previewed()` 方法;
- 相关 issues [#103](https://github.com/pandao/editor.md/issues/103);
- 另外也调整了关闭按钮的位置;
- 更换 Logo,建立基础 VI;
- 创建了全系列 WebFont 字体 `dist/fonts/editormd-logo.*`
- 新增样式类 `editormd-logo` 等;
- 改进:修复插入 Emoji `:moon:` 无法显示的问题,修改为其是 `:waxing_gibbous_moon:` 的别名 [#94](https://github.com/pandao/editor.md/pull/94);
- 改用 `<textarea>` 来存放 Markdown 源文档;
- 原先使用 `<script type="text/markdown"></script>` 来存放 Markdown 源文档;
- 创建 Editor.md 只需要写一个 `<div id="xxxx"></div>` ,如果没有添加 `class="editormd"` 属性会自动添加,另外如果不存在 `<textarea>` 标签,则也会自动添加 `<textarea>`
- 改进:修改了 CodeMirror 代码行的左右内间距,使其不会挨着左边的行号层;
- 相关 issues [#97](https://github.com/pandao/editor.md/issues/97);
- 新增支持智能识别和解析 HTML 标签,增强了 Markdown 语法的扩展性,几乎无限,例如:插入视频等等;
- 新增配置项 `htmlDecode` ,表示是否开启 HTML 标签识别和解析,但是为了安全性,默认不开启;
- 新增识别和解析 HTML 标签的示例;
- 新增插入链接、锚点链接、预格式文本和代码块的弹出对话框层;
- 弹出层改为使用固定定位;
- 新增动态创建对话框的方法 `createDialog()`
- 新增静态属性 `editormd.codeLanguages` ,用于存放代码语言列表;
- 改进:修改了同步滚动的定位算法,提高精确度;
- 修正问题 [#99](https://github.com/pandao/editor.md/issues/99);
- 修改了 `bindScrollEvent()` 方法;
- 开始支持图片上传;
- 新增添加图片(上传)弹出对话框层;
- 支持基于 iframe 的跨域上传,并添加相应的示例( PHP 版);
- 开始支持自定义工具栏图标及操作处理;
- 配置项 `toolbarIcons` 类型由数组更改为函数,返回一个图标按钮列表数组;
- 新增配置项 `toolbarHandlers``toolbarIconsTexts` ,分别用于自定义按钮操作处理和按钮内容文本;
- 新增方法 `getToolbarHandles()` ,用于可在外部使用默认的操作方法;
- 新增成员属性 `activeIcon` ,可获取当前或上次点击的工具栏图标的 jQuery 实例对象;
- 新增表单取值、自定义工具栏、图片上传、多个 Editor.md 并存和动态加载 Editor.md 等多个示例;
- 改进:完善 HTML 标签过滤功能,即代码块、`<pre>` 预格式文本和行内代码里的标签及属性不会被过滤;
- 修复 Bug [#105](https://github.com/pandao/editor.md/issues/105);
- 改进:当不显示行号时 `settings.lineNumbers == false`,CodeMirror 行号层去掉右边框;
- 改进:根据指针在当前行的位置更合理插入标题和水平线 [#104](https://github.com/pandao/editor.md/pull/104);
- 改进:调整了字体,优先显示 `"YaHei Consolas Hybrid", Consolas`
- 改进:修复在 Bootstrap 下的兼容性问题,即因为 box-sizing 写错位置导致的弹出层宽度等错位问题 [#107](https://github.com/pandao/editor.md/issues/107);
- 新增插入锚点按钮和操作处理;
### v1.4.x
- 新增预览 HTML 内容窗口的关闭按钮,之前只能按 ESC 才能退出 HTML 全窗口预览;
#### v1.4.5
- 新增多语言( l18n )及动态加载语言包支持;
- 新增英语 `en` 和繁体中文 `zh-tw` 语言包模块;
- 修改一些方法的内部实现以支持动态语言加载:
- `toolbarHandler()` 更为 `setToolbarHandler()`
- `setToolbar()` 方法包含 `setToolbarHandler()`
- 新建 `createInfoDialog()` 方法;
- 修改 `showInfoDialog()``hideInfoDialog()` 方法的内部实现等;
- 规范项目的中英文混排;
- 新增配置项 `name`,用于指定 Markdown textarea 的 `name="xxxx"` 属性;
- 修复 Bug,即无法正确解析公式的 `<``>` 的问题 [#87](https://github.com/pandao/editor.md/issues/87);
- 修复 Bug,即 `getHTML()` 无效的问题 [#95](https://github.com/pandao/editor.md/issues/95);
- 修复 Bug,即火狐上传图片后无法返回值的问题 [#96](https://github.com/pandao/editor.md/issues/96);
- 修改了图片上传插件;
- 修改 PHP 上传类及示例;
- 方法更名:`extends()` 更名为 `extend()`,以兼容 IE8;
- 修复 IE8 下 Emoji 正则表达式字符集越界的问题;
- 更新了 `README.md``CHANGE.md` 等相关文档文件;
- 修改多次 Bug ,并优化触摸事件,改进对 iPad 的支持;
#### v1.4.4
- 工具栏新增清空按钮和清空方法 `clear()` ,解决工具栏文本会被选中出现蓝底的问题;
- 修复 Bug [#81](https://github.com/pandao/editor.md/issues/81),即不支持 `:+1:` 的问题;
- 修复 Bug [#85](https://github.com/pandao/editor.md/issues/85),即图片上传返回结果不支持 `Content-Type=application/json` 的问题;
- 修复图片上传无法显示 loading 的问题;
- 配置项 `tocStartLevel` 的默认值由 2 改为 1,表示默认从 H1 开始生成 ToC;
#### v1.4.3
- 解决 IE8 下加载出错的问题;
- 新增两个静态成员属性 `isIE``isIE8` ,用于判断 IE8;
- 由于 IE8 不支持 FlowChart 和 SequenceDiagram,默认在 IE8 下不加载这两个组件,无论是否开启;
- 改进:可配置是否自动聚焦编辑器 [#74](https://github.com/pandao/editor.md/issues/74);
- 新增配置项 `autoFocus`,默认值为 `true`;
- 修复 Bug [#77](https://github.com/pandao/editor.md/issues/77);
- 改进:帮助对话框里的链接改为新窗口打开,避免直接跳转到链接,导致编辑内容丢失的问题 [#79](https://github.com/pandao/editor.md/issues/79);
- 改进和完善编辑器配置项;
- 新增配置项 `tabSize`、`indentUnit` 和 `lineWrapping`
- 新增配置项 `autoCloseBrackets``showTrailingSpace`
- 新增配置项 `matchBrackets`、`indentWithTabs` 和 `styleSelectedText`
- 改进:修改 CSS `font-family`,改进跨平台中英文字体显示;
- 修改了 `README.md`
- 新增 Zepto.js 的支持;
- 为了兼容 Zepto.js ,某些元素在操作处理上不再使用 `outerWidth()``outerHeight()` 、`hover()` 、`is()` 等方法;
- 为了避免修改 flowChart.js 和 sequence-diagram.js 的源码,所以想支持 flowChart 或 sequenceDiagram 得加上这一句: `var jQuery = Zepto;`
#### v1.4.2
- 新增 `editormd.$name` 属性,修改 `editormd.homePage` 属性的新地址;
- 改进和增强自定义工具栏功能,支持图标按钮右对齐 [#69](https://github.com/pandao/editor.md/issues/69);
- 改进和增强 HTML 标签的解析过滤功能,支持过滤指定的属性等 [#70](https://github.com/pandao/editor.md/issues/70);
- 删除分支 `mathjax-version``v1.1.9`
- `editormd.markdownToHTML()` 新增方法返回一个 jQuery 实例对象;
- 该实例对象定义了一个 `getMarkdown()`方法,用于获取 Markdown 源代码;
- 该实例对象定义了一个 `tocContainer` 成员属性,即 ToC 列表的父层的 jQuery 实例对象;
#### v1.4.1
- 新增只读模式;
- 新增配置项 `readOnly` ,默认值为 `false` ,即可编辑模式;
- 其他相关改动;
- 新增配置项 `syncScrolling`,即是否开启同步滚动预览,默认值为 `false`
- 修复 Bug [#64](https://github.com/pandao/editor.md/issues/64);
- 更新 `editormd.katexURL` 资源地址的默认值,即更新版本为 `0.3.0`
- 新增测试用例`tests/katex-tests.html`;
- 修改示例文件`examples/katex.html`;
- 修复 Bug [#66](https://github.com/pandao/editor.md/issues/66);
- 修复编辑器工具栏按钮 `:hover` CSS3 transition 无效的问题;
- 修改了 `README.md`
- 新增方法 `focus()``setCursor()``getCursor()` 、`setSelection()` 、`getSelection()` 、 `replaceSelection()``insertValue()` 方法,并增加对应的示例;
#### v1.4.0
- 新增配置项 `saveHTMLToTextarea` ,用于将解析后的 HTML 保存到 Textarea,以供提交到后台程序;
- `getHTML()` 方法必须在 `saveHTMLToTextarea == true` 的情况下才能使用;
- 新增 `getHTML()` 方法的别名 `getTextareaSavedHTML()` 方法;
- 新增方法 `getPreviewedHTML()` ,用于获取预览窗口的 HTML ;
**主要更新:**
- 修复了一些大大小小的 Bugs;
- 新增延迟解析机制,预览更即时;
- 新增跳转到指定行的功能和对话框;
- 新增 ToC 下拉菜单、自定义 ToC 容器的功能;
- 新增跳转到行、搜索的工具栏按钮;
- 新增支持插入和解析(打印)分页符;
- 改进快捷键功能和自动高度模式等;
- 改进:将锚点链接改名为引用链接;
- 改进编辑器重建和重配置功能;
- 修复多个 Bug;
##### v1.1.1
**具体更新:**
- 接受一个 pull 请求,修复了 `getHTML ()``getPreviewedHTML()` 方法中的 3 处错误;
- 新增延迟解析预览的机制,解决输入太多太快出现的 “延迟卡顿” 问题;
- 新增配置项 `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) 等;
- 新增和修改以上更新的相关示例;
##### v1.1.2
### v1.3.x
- 修复 Bug [#10](https://github.com/pandao/editor.md/issues/10);
- 修复 Bug [#12](https://github.com/pandao/editor.md/issues/12);
#### v1.3.0
##### v1.1.3
**主要更新:**
- 修复 Bug [#14](https://github.com/pandao/editor.md/issues/14);
- 修复 Bug [#15](https://github.com/pandao/editor.md/issues/15);
- 预设键盘快捷键处理(粗体等),插入 Markdown 更加方便;
- 更新 CodeMirror 版本为 `5.0`
- 更新 Marked 版本为 `0.3.3`
- 新增自动高度和工具栏固定定位功能;
- 改进表格插入对话框;
- 工具栏新增三个按钮,分别是将所选文本首字母转成大写、转成小写、转成大写;
- 修改使用帮助文档;
- 修复多个 Bug;
##### v1.1.4
**具体更新如下:**
- 修复 Bug [#17](https://github.com/pandao/editor.md/issues/17);
- 修改了 `getToolbarHandles()``setToolbarHandler()` 方法;
- 从 `editormd.scss` 中分离出 `editormd.logo.scss` ,并生成 `editormd.logo.css` ,以便单独使用;
- 同时修改了 `Gulpfile.js` 的相应任务;
##### v1.1.5
- 修复 Bug [#18](https://github.com/pandao/editor.md/issues/18);
- 修改了 `showInfoDialog()``createInfoDialog()` 方法;
- 新增 `infoDialogPosition()` 方法;
- 修复 Bug [#20](https://github.com/pandao/editor.md/issues/20);
- 修改了引用的处理函数;
- 插入的 headers 的 `#` 号后面都加上了一个空格;
##### v1.1.6
修复多处 Bug,具体如下:
- 修复 Bug [#23](https://github.com/pandao/editor.md/issues/23),即 Headers 的 id 属性的重复及中文问题;
- 修改了 `editormd.markedRenderer()` 方法;
- 修复 Bug [#24](https://github.com/pandao/editor.md/issues/24);
- 修改了 `setMarkdown()``clear()``loadedDisplay()` 方法的内部实现;
- 新增了 `katexRender()``flowChartAndSequenceDiagramRender()``previewCodeHighlight()` 方法;
- 修复有些情况下无法保存 Markdown 源文档到 textarea 的问题;
- 修改了 `setCodeMirror()``recreateEditor()` 等方法;
- 修改了以上 Bug 及部分相关示例文件;
##### v1.1.7
修复多处 Bug,具体如下:
- 修复 Bug [#25](https://github.com/pandao/editor.md/issues/25);
- 修改了 `loadedDisplay()` 方法,将 `settings.onload` 移动了 `CodeMirror.on("change")` 事件注册后再触发;
- 修复 Bug [#26](https://github.com/pandao/editor.md/issues/26);
- 修改了 `saveToTextareas()` 方法;
- 新增 `state.loaded``state.watching` 两个属性;
- 修改了以上 Bug 相关示例文件;
##### v1.1.8
改进功能,具体如下:
- 改进 [#27](https://github.com/pandao/editor.md/issues/27);
- 新增配置项 `matchWordHighlight` ,可选值有: `true, false, "onselected"` ,默认值为 `true` ,即开启自动匹配和标示相同单词;
- 改进 [#28](https://github.com/pandao/editor.md/issues/28);
- 将 `jquery.min.js``font-awesome.min.css``github-markdown.css` 移除(这是一个疏忽,它们不是动态加载的依赖模块或者不需要的,避免不必要的硬盘空间占用);
- 修改了所有相关的示例文件;
##### v1.1.9
- 修复无法解析 heading link 的 Bug [#29](https://github.com/pandao/editor.md/issues/29);
- 新增常用键盘快捷键预设处理;
- 新增属性 `editormd.keyMaps` ,预设一些常用操作,例如插入粗体等;
- 新增成员方法 `registerKeyMaps()`
- 退出HTML全屏预览快捷键更改为 `Shift + ESC`
- 新增配置项 `disabledKeyMaps` ,用于屏蔽一些快捷键操作;
- 更新 CodeMirror 版本为 `5.0`
- 修改无法输入 `/` 的问题;
- 更新 Marked 版本为 `0.3.3`
- 新增自动高度和工具栏固定定位(滚动条拖动时)模式;
- 新增配置项 `settings.autoHeight`
- 新增配置项 `settings.toolbarAutoFixed`
- 新增方法 `setToolbarAutoFixed(true|false)`
- 新增邮箱地址自动添加链接功能;
- 新增配置项 `emailLink` ,默认为 `true` ;
- 改进表格插入对话框;
- 工具栏新增三个按钮,分别是将所选文本首字母转成大写、转成小写、转成大写;
- 新增方法 `editormd.ucwords()` ,别名 `editormd.wordsFirstUpperCase()`
- 新增方法 `editormd.ucfirst()` ,别名 `editormd.firstUpperCase()`
- 新增两个成员方法 `getSelections()``getSelections()`
- 修改了 `editormd.markedRenderer()` 方法的内部实现;
- 新增了 `editormd.trim()` ,用于清除字符串两边的空格;
- 修改了所有相关的示例文件和测试用例 `marked-heading-link-test.html`
- 修改了 `README.md` ,添加了 `Shields.io` 图标;
- 修复 Font awesome 图标 emoji 部分无法解析的 Bug,[#39](https://github.com/pandao/editor.md/issues/39)
- 改进 @link 功能 [#40](https://github.com/pandao/editor.md/issues/40);
- 新增配置项 `atLink` ,默认为 `true` ;
- 修复无法输入 `/` 的问题 [#42](https://github.com/pandao/editor.md/issues/42);
- 修改使用帮助说明的错误 [#43](https://github.com/pandao/editor.md/issues/43);
- 新增配置项 `pluginPath`,默认为空时,等于 `settings.path + "../plugins/"`
### v1.2
### v1.2.x
##### v1.2.0
#### v1.2.0
v1.2.0 主要更新:
**主要更新:**
- 新增代码折叠、搜索替换、自定义样式主题和自定义快捷键等功能;
- 新增 Emoji 表情、@Link 、GFM Task Lists 支持;
@ -304,231 +326,212 @@ v1.2.0 主要更新:
- 修改和新增以上改进等相关示例;
### v1.3
### v1.1.x
#### v1.3.0
#### v1.1.9
主要更新:
- 修复无法解析 heading link 的 Bug [#29](https://github.com/pandao/editor.md/issues/29);
- 预设键盘快捷键处理(粗体等),插入 Markdown 更加方便;
- 更新 CodeMirror 版本为 `5.0`
- 更新 Marked 版本为 `0.3.3`
- 新增自动高度和工具栏固定定位功能;
- 改进表格插入对话框;
- 工具栏新增三个按钮,分别是将所选文本首字母转成大写、转成小写、转成大写;
- 修改使用帮助文档;
- 修复多个 Bug;
- 修改了 `editormd.markedRenderer()` 方法的内部实现;
- 新增了 `editormd.trim()` ,用于清除字符串两边的空格;
- 修改了所有相关的示例文件和测试用例 `marked-heading-link-test.html`
- 修改了 `README.md` ,添加了 `Shields.io` 图标;
具体更新如下:
#### v1.1.8
- 新增常用键盘快捷键预设处理;
- 新增属性 `editormd.keyMaps` ,预设一些常用操作,例如插入粗体等;
- 新增成员方法 `registerKeyMaps()`
- 退出HTML全屏预览快捷键更改为 `Shift + ESC`
- 新增配置项 `disabledKeyMaps` ,用于屏蔽一些快捷键操作;
- 更新 CodeMirror 版本为 `5.0`
- 修改无法输入 `/` 的问题;
- 更新 Marked 版本为 `0.3.3`
- 新增自动高度和工具栏固定定位(滚动条拖动时)模式;
- 新增配置项 `settings.autoHeight`
- 新增配置项 `settings.toolbarAutoFixed`
- 新增方法 `setToolbarAutoFixed(true|false)`
- 新增邮箱地址自动添加链接功能;
- 新增配置项 `emailLink` ,默认为 `true` ;
- 改进表格插入对话框;
- 工具栏新增三个按钮,分别是将所选文本首字母转成大写、转成小写、转成大写;
- 新增方法 `editormd.ucwords()` ,别名 `editormd.wordsFirstUpperCase()`
- 新增方法 `editormd.ucfirst()` ,别名 `editormd.firstUpperCase()`
- 新增两个成员方法 `getSelections()``getSelections()`
改进功能,具体如下:
- 修复 Font awesome 图标 emoji 部分无法解析的 Bug,[#39](https://github.com/pandao/editor.md/issues/39)
- 改进 @link 功能 [#40](https://github.com/pandao/editor.md/issues/40);
- 新增配置项 `atLink` ,默认为 `true` ;
- 修复无法输入 `/` 的问题 [#42](https://github.com/pandao/editor.md/issues/42);
- 修改使用帮助说明的错误 [#43](https://github.com/pandao/editor.md/issues/43);
- 新增配置项 `pluginPath`,默认为空时,等于 `settings.path + "../plugins/"`
- 改进 [#27](https://github.com/pandao/editor.md/issues/27);
- 新增配置项 `matchWordHighlight` ,可选值有: `true, false, "onselected"` ,默认值为 `true` ,即开启自动匹配和标示相同单词;
### v1.4
- 改进 [#28](https://github.com/pandao/editor.md/issues/28);
- 将 `jquery.min.js``font-awesome.min.css``github-markdown.css` 移除(这是一个疏忽,它们不是动态加载的依赖模块或者不需要的,避免不必要的硬盘空间占用);
#### v1.4.0
- 修改了所有相关的示例文件;
主要更新:
#### v1.1.7
- 新增延迟解析机制,预览更即时;
- 新增跳转到指定行的功能和对话框;
- 新增 ToC 下拉菜单、自定义 ToC 容器的功能;
- 新增跳转到行、搜索的工具栏按钮;
- 新增支持插入和解析(打印)分页符;
- 改进快捷键功能和自动高度模式等;
- 改进:将锚点链接改名为引用链接;
- 改进编辑器重建和重配置功能;
- 修复多个 Bug;
修复多处 Bug,具体如下:
具体更新:
- 修复 Bug [#25](https://github.com/pandao/editor.md/issues/25);
- 修改了 `loadedDisplay()` 方法,将 `settings.onload` 移动了 `CodeMirror.on("change")` 事件注册后再触发;
- 新增延迟解析预览的机制,解决输入太多太快出现的 “延迟卡顿” 问题;
- 新增配置项 `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) 等;
- 新增和修改以上更新的相关示例;
- 修复 Bug [#26](https://github.com/pandao/editor.md/issues/26);
- 修改了 `saveToTextareas()` 方法;
- 新增 `state.loaded``state.watching` 两个属性;
#### v1.4.1
- 修改了以上 Bug 相关示例文件;
- 新增配置项 `syncScrolling`,即是否开启同步滚动预览,默认值为 `false`
- 修复 Bug [#64](https://github.com/pandao/editor.md/issues/64);
- 更新 `editormd.katexURL` 资源地址的默认值,即更新版本为 `0.3.0`
- 新增测试用例`tests/katex-tests.html`;
- 修改示例文件`examples/katex.html`;
- 修复 Bug [#66](https://github.com/pandao/editor.md/issues/66);
- 修复编辑器工具栏按钮 `:hover` CSS3 transition 无效的问题;
- 修改了 `README.md`
#### v1.1.6
#### v1.4.2
修复多处 Bug,具体如下:
- 修复 Bug [#23](https://github.com/pandao/editor.md/issues/23),即 Headers 的 id 属性的重复及中文问题;
- 修改了 `editormd.markedRenderer()` 方法;
- 改进和增强自定义工具栏功能,支持图标按钮右对齐 [#69](https://github.com/pandao/editor.md/issues/69);
- 改进和增强 HTML 标签的解析过滤功能,支持过滤指定的属性等 [#70](https://github.com/pandao/editor.md/issues/70);
- 删除分支 `mathjax-version``v1.1.9`
- 修复 Bug [#24](https://github.com/pandao/editor.md/issues/24);
- 修改了 `setMarkdown()``clear()``loadedDisplay()` 方法的内部实现;
- 新增了 `katexRender()``flowChartAndSequenceDiagramRender()``previewCodeHighlight()` 方法;
- 修复有些情况下无法保存 Markdown 源文档到 textarea 的问题;
- 修改了 `setCodeMirror()``recreateEditor()` 等方法;
#### v1.4.3
- 修改了以上 Bug 及部分相关示例文件;
#### v1.1.5
- 改进:可配置是否自动聚焦编辑器 [#74](https://github.com/pandao/editor.md/issues/74);
- 新增配置项 `autoFocus`,默认值为 `true`;
- 修复 Bug [#77](https://github.com/pandao/editor.md/issues/77);
- 改进:帮助对话框里的链接改为新窗口打开,避免直接跳转到链接,导致编辑内容丢失的问题 [#79](https://github.com/pandao/editor.md/issues/79);
- 改进和完善编辑器配置项;
- 新增配置项 `tabSize`、`indentUnit` 和 `lineWrapping`
- 新增配置项 `autoCloseBrackets``showTrailingSpace`
- 新增配置项 `matchBrackets`、`indentWithTabs` 和 `styleSelectedText`
- 改进:修改 CSS `font-family`,改进跨平台中英文字体显示;
- 修改了 `README.md`
- 修复 Bug [#18](https://github.com/pandao/editor.md/issues/18);
- 修改了 `showInfoDialog()``createInfoDialog()` 方法;
- 新增 `infoDialogPosition()` 方法;
- 修复 Bug [#20](https://github.com/pandao/editor.md/issues/20);
- 修改了引用的处理函数;
- 插入的 headers 的 `#` 号后面都加上了一个空格;
#### v1.4.4
#### v1.1.4
- 修复 Bug [#81](https://github.com/pandao/editor.md/issues/81),即不支持 `:+1:` 的问题;
- 修复 Bug [#85](https://github.com/pandao/editor.md/issues/85),即图片上传返回结果不支持 `Content-Type=application/json` 的问题;
- 修复图片上传无法显示 loading 的问题;
- 修复 Bug [#17](https://github.com/pandao/editor.md/issues/17);
- 修改了 `getToolbarHandles()``setToolbarHandler()` 方法;
- 从 `editormd.scss` 中分离出 `editormd.logo.scss` ,并生成 `editormd.logo.css` ,以便单独使用;
- 同时修改了 `Gulpfile.js` 的相应任务;
#### v1.4.5
#### v1.1.3
- 规范项目的中英文混排;
- 新增配置项 `name`,用于指定 Markdown textarea 的 `name="xxxx"` 属性;
- 修复 Bug,即无法正确解析公式的 `<``>` 的问题 [#87](https://github.com/pandao/editor.md/issues/87);
- 修复 Bug,即 `getHTML()` 无效的问题 [#95](https://github.com/pandao/editor.md/issues/95);
- 修复 Bug,即火狐上传图片后无法返回值的问题 [#96](https://github.com/pandao/editor.md/issues/96);
- 修改了图片上传插件;
- 修改 PHP 上传类及示例;
- 方法更名:`extends()` 更名为 `extend()`,以兼容 IE8;
- 修复 IE8 下 Emoji 正则表达式字符集越界的问题;
- 更新了 `README.md``CHANGE.md` 等相关文档文件;
- 修复 Bug [#14](https://github.com/pandao/editor.md/issues/14);
- 修复 Bug [#15](https://github.com/pandao/editor.md/issues/15);
#### v1.1.2
### v1.5
- 修复 Bug [#10](https://github.com/pandao/editor.md/issues/10);
- 修复 Bug [#12](https://github.com/pandao/editor.md/issues/12);
#### v1.5.0
#### v1.1.1
主要更新:
- 接受一个 pull 请求,修复了 `getHTML ()``getPreviewedHTML()` 方法中的 3 处错误;
- 新增:编辑器黑色主题 Dark,改进自定义主题功能(即工具栏、编辑区、预览区可分别设置主题样式);
- 新增:多行公式支持;
- 新增:支持非编辑状态下的 ToC 自定义容器;
- 新增:支持设置为单向同步滚动;
- 改进:编辑器样式美化,更换了滚动条样式;
- 改进:提高同步滚动定位的精确度;
- 改进:修复和改进 HTML 标签及属性过滤功能;
- 改进:修复在 Bootstrap 下的兼容性问题;
- 修复多处 Bug;
#### v1.1.0
具体更新:
**主要更新:**
- 新增:解析后的代码块自动换行;
- 设计并更换了 Logo;
- 新增添加图片、链接、锚点链接、代码块、预格式文本等操作弹出对话框层及示例;
- 新增支持图片(跨域)上传;
- 改用 `<textarea>` 来存放 Markdown 源文档;
- 新增支持自定义工具栏;
- 新增支持多语言;
- 新增支持 Zepto.js;
- 新增支持多个 Editor.md 并存和动态加载 Editor.md 及示例;
- 新增支持智能识别和解析 HTML 标签及示例;
- 新增多个外部操作方法接口及示例;
- 修复了一些大大小小的 Bug;
- 新增:支持多行公式;
- 新增:新增语法:\`\`\`math | latex | katex;
- 改进:美化 KaTeX 公式,即加大字号等;
**具体更新如下:**
- 新增:支持设置为单向同步滚动,即只是编辑区单向同步滚动,配置项 `syncScrolling : "single"`
- 新增:配置同步滚动示例文件 `sync-scrolling.html`
- 更换 Logo,建立基础 VI;
- 创建了全系列 WebFont 字体 `dist/fonts/editormd-logo.*`
- 新增样式类 `editormd-logo` 等;
- 新增:增加了编辑器样式主题 Dark,即工具栏和预览区各自有一个暗黑色主题;
- 变更:自 `v1.5.0` 开始,配置项 `theme` 改为指定 Editor.md 本身的主题;
- 新增配置项 `editorTheme` ,用于指定编辑区的主题,即 CodeMirror 的主题;
- 新增配置项 `previewTheme` ,用于指定预览区的主题;
- 新增方法 `setEditorTheme()`,别名: `setCodeMirror()`
- 新增方法 `setPreviewTheme()`
- 修改了方法 `setTheme()`
- 更换了滚动条样式,Only Webkit;
- 改进全屏状态下的样式显示,去掉 JS 操作的部分,改为通过 CSS 样式类 `.editormd-fullscreen` 控制;
- 修改和增加相关的方法、SCSS 文件及示例文件 `themes.html`
- 改用 `<textarea>` 来存放 Markdown 源文档;
- 原先使用 `<script type="text/markdown"></script>` 来存放 Markdown 源文档;
- 创建 Editor.md 只需要写一个 `<div id="xxxx"></div>` ,如果没有添加 `class="editormd"` 属性会自动添加,另外如果不存在 `<textarea>` 标签,则也会自动添加 `<textarea>`
- 新增:非编辑状态下 ToC 自定义容器支持;
- 新增配置项 `markdownSourceCode`,即解析后是否保留源码,默认为不保留 `false`
- 新增配置项 `tocContainer`,值为自定义 ToC 容器的 ID 选择器 `#xxxxx`,默认为空;
- 新增和修改了相关示例文件;
- 新增支持智能识别和解析 HTML 标签,增强了 Markdown 语法的扩展性,几乎无限,例如:插入视频等等;
- 新增配置项 `htmlDecode` ,表示是否开启 HTML 标签识别和解析,但是为了安全性,默认不开启;
- 新增识别和解析 HTML 标签的示例;
- 新增插入链接、锚点链接、预格式文本和代码块的弹出对话框层;
- 弹出层改为使用固定定位;
- 新增动态创建对话框的方法 `createDialog()`
- 新增静态属性 `editormd.codeLanguages` ,用于存放代码语言列表;
- 新增:新增加了 CSS 样式类 `editormd-preview-active`,可以控制全屏HTML预览时的内容层样式;
- 修改了 `previewing()``previewed()` 方法;
- 相关 issues [#103](https://github.com/pandao/editor.md/issues/103);
- 另外也调整了关闭按钮的位置;
- 开始支持图片上传;
- 新增添加图片(上传)弹出对话框层;
- 支持基于 iframe 的跨域上传,并添加相应的示例( PHP 版);
- 开始支持自定义工具栏图标及操作处理;
- 配置项 `toolbarIcons` 类型由数组更改为函数,返回一个图标按钮列表数组;
- 新增配置项 `toolbarHandlers``toolbarIconsTexts` ,分别用于自定义按钮操作处理和按钮内容文本;
- 新增方法 `getToolbarHandles()` ,用于可在外部使用默认的操作方法;
- 新增成员属性 `activeIcon` ,可获取当前或上次点击的工具栏图标的 jQuery 实例对象;
- 新增表单取值、自定义工具栏、图片上传、多个 Editor.md 并存和动态加载 Editor.md 等多个示例;
- 改进:修复插入 Emoji `:moon:` 无法显示的问题,修改为其是 `:waxing_gibbous_moon:` 的别名 [#94](https://github.com/pandao/editor.md/pull/94);
- 新增插入锚点按钮和操作处理
- 改进:修改了 CodeMirror 代码行的左右内间距,使其不会挨着左边的行号层;
- 相关 issues [#97](https://github.com/pandao/editor.md/issues/97);
- 新增预览 HTML 内容窗口的关闭按钮,之前只能按 ESC 才能退出 HTML 全窗口预览;
- 改进:修改了同步滚动的定位算法,提高精确度;
- 修正问题 [#99](https://github.com/pandao/editor.md/issues/99);
- 修改了 `bindScrollEvent()` 方法;
- 新增多语言( l18n )及动态加载语言包支持;
- 新增英语 `en` 和繁体中文 `zh-tw` 语言包模块;
- 修改一些方法的内部实现以支持动态语言加载:
- `toolbarHandler()` 更为 `setToolbarHandler()`
- `setToolbar()` 方法包含 `setToolbarHandler()`
- 新建 `createInfoDialog()` 方法;
- 修改 `showInfoDialog()``hideInfoDialog()` 方法的内部实现等;
- 改进:完善 HTML 标签过滤功能,即代码块、`<pre>` 预格式文本和行内代码里的标签及属性不会被过滤;
- 修复 Bug [#105](https://github.com/pandao/editor.md/issues/105);
- 改进:当不显示行号时 `settings.lineNumbers == false`,CodeMirror 行号层去掉右边框;
- 改进:根据指针在当前行的位置更合理插入标题和水平线 [#104](https://github.com/pandao/editor.md/pull/104);
- 改进:调整了字体,优先显示 `"YaHei Consolas Hybrid", Consolas`
- 改进:修复在 Bootstrap 下的兼容性问题,即因为 box-sizing 写错位置导致的弹出层宽度等错位问题 [#107](https://github.com/pandao/editor.md/issues/107);
- 修改多次 Bug ,并优化触摸事件,改进对 iPad 的支持;
- 工具栏新增清空按钮和清空方法 `clear()` ,解决工具栏文本会被选中出现蓝底的问题;
- 配置项 `tocStartLevel` 的默认值由 2 改为 1,表示默认从 H1 开始生成 ToC;
- 解决 IE8 下加载出错的问题;
- 新增两个静态成员属性 `isIE``isIE8` ,用于判断 IE8;
- 由于 IE8 不支持 FlowChart 和 SequenceDiagram,默认在 IE8 下不加载这两个组件,无论是否开启;
- 新增 Zepto.js 的支持;
- 为了兼容 Zepto.js ,某些元素在操作处理上不再使用 `outerWidth()``outerHeight()` 、`hover()` 、`is()` 等方法;
- 为了避免修改 flowChart.js 和 sequence-diagram.js 的源码,所以想支持 flowChart 或 sequenceDiagram 得加上这一句: `var jQuery = Zepto;`
- 新增 `editormd.$name` 属性,修改 `editormd.homePage` 属性的新地址;
- `editormd.markdownToHTML()` 新增方法返回一个 jQuery 实例对象;
- 该实例对象定义了一个 `getMarkdown()`方法,用于获取 Markdown 源代码;
- 该实例对象定义了一个 `tocContainer` 成员属性,即 ToC 列表的父层的 jQuery 实例对象;
- 新增只读模式;
- 新增配置项 `readOnly` ,默认值为 `false` ,即可编辑模式;
- 其他相关改动;
- 新增方法 `focus()``setCursor()``getCursor()` 、`setSelection()` 、`getSelection()` 、 `replaceSelection()``insertValue()` 方法,并增加对应的示例;
- 新增配置项 `saveHTMLToTextarea` ,用于将解析后的 HTML 保存到 Textarea,以供提交到后台程序;
- `getHTML()` 方法必须在 `saveHTMLToTextarea == true` 的情况下才能使用;
- 新增 `getHTML()` 方法的别名 `getTextareaSavedHTML()` 方法;
- 新增方法 `getPreviewedHTML()` ,用于获取预览窗口的 HTML ;
- 修复了一些大大小小的 Bugs;
### v1.0.x
#### v1.0.0 releases
**主要更新:**
- 新建分支 `mathjax-version`,但不打算继续对此分支进行开发;
- 移除 MathJax,改用 KaTeX [#2](https://github.com/pandao/editor.md/issues/2),解析和预览响应速度大幅度提高 [#3](https://github.com/pandao/editor.md/issues/3);
- 移除 `mathjax` 配置项;
- 移除 `mathjaxURL` 属性;
- 移除 `setMathJaxConfig()` 方法;
- 移除 `loadMathJax()` 方法;
- 移除MathJax的所有示例;
- 新增 `tex` 配置项,表示是否开启支持科学公式 TeX ,基于 KaTeX;
- 新增 `katexURL` 属性;
- 新增 `loadKaTeX` 方法;
- 新增 KaTeX 的示例;
- `setCodeEditor()` 方法更名为 `setCodeMirror()`
- 合并 CodeMirror 使用到的多个 JS 模块文件,大幅减少 HTTP 请求,加快下载速度;
- 新增合并后的两个模块文件:`./lib/codemirror/modes.min.js`、`./lib/codemirror/addons.min.js` ;
- `Gulpfile.js` 新增合并 CodeMirror 模块文件的任务方法 `codemirror-mode``codemirror-addon`
- 另外在使用 Require.js 时,因为 CodeMirror 的严格模块依赖的限制,不能使用上述合并的模块文件,仍然采用动态加载多个模块文件;
- 更新 `README.md` 等相关文档和示例;
- 解决 Sea.js 环境下 Raphael.js 无法运行导致不支持流程图和时序图的问题,即必须先加载 Raphael.js ,后加载 Sea.js ;
#### v1.0.0 beta
正式预览版:基本功能完成;

684
Gulpfile.js

@ -1,342 +1,342 @@
"use strict";
var os = require("os");
var gulp = require("gulp");
var gutil = require("gulp-util");
var sass = require("gulp-ruby-sass");
var jshint = require("gulp-jshint");
var uglify = require("gulp-uglifyjs");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var notify = require("gulp-notify");
var header = require("gulp-header");
var minifycss = require("gulp-minify-css");
//var jsdoc = require("gulp-jsdoc");
//var jsdoc2md = require("gulp-jsdoc-to-markdown");
var pkg = require("./package.json");
var dateFormat = require("dateformatter").format;
var replace = require("gulp-replace");
pkg.name = "Editor.md";
pkg.today = dateFormat;
var headerComment = ["/*",
" * <%= pkg.name %>",
" *",
" * @file <%= fileName(file) %> ",
" * @version v<%= pkg.version %> ",
" * @description <%= pkg.description %>",
" * @license MIT License",
" * @author <%= pkg.author %>",
" * {@link <%= pkg.homepage %>}",
" * @updateTime <%= pkg.today('Y-m-d') %>",
" */",
"\r\n"].join("\r\n");
var headerMiniComment = "/*! <%= pkg.name %> v<%= pkg.version %> | <%= fileName(file) %> | <%= pkg.description %> | MIT License | By: <%= pkg.author %> | <%= pkg.homepage %> | <%=pkg.today('Y-m-d') %> */\r\n";
var scssTask = function(fileName, path) {
path = path || "scss/";
var distPath = "css";
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() {
return scssTask("editormd");
});
gulp.task("scss2", function() {
return scssTask("editormd.preview");
});
gulp.task("scss3", function() {
return scssTask("editormd.logo");
});
gulp.task("js", function() {
return gulp.src("./src/editormd.js")
.pipe(jshint("./.jshintrc"))
.pipe(jshint.reporter("default"))
.pipe(header(headerComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base);
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(rename({ suffix: ".min" }))
.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") ? "\\" : "/") );
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(notify({ message: "editormd.js task complete" }));
});
gulp.task("amd", function() {
var replaceText1 = [
'var cmModePath = "codemirror/mode/";',
' var cmAddonPath = "codemirror/addon/";',
'',
' var codeMirrorModules = [',
' "jquery", "marked", "prettify",',
' "katex", "raphael", "underscore", "flowchart", "jqueryflowchart", "sequenceDiagram",',
'',
' "codemirror/lib/codemirror",',
' cmModePath + "css/css",',
' cmModePath + "sass/sass",',
' cmModePath + "shell/shell",',
' cmModePath + "sql/sql",',
' cmModePath + "clike/clike",',
' cmModePath + "php/php",',
' cmModePath + "xml/xml",',
' cmModePath + "markdown/markdown",',
' cmModePath + "javascript/javascript",',
' cmModePath + "htmlmixed/htmlmixed",',
' cmModePath + "gfm/gfm",',
' cmModePath + "http/http",',
' cmModePath + "go/go",',
' cmModePath + "dart/dart",',
' cmModePath + "coffeescript/coffeescript",',
' cmModePath + "nginx/nginx",',
' cmModePath + "python/python",',
' cmModePath + "perl/perl",',
' cmModePath + "lua/lua",',
' cmModePath + "r/r", ',
' cmModePath + "ruby/ruby", ',
' cmModePath + "rst/rst",',
' cmModePath + "smartymixed/smartymixed",',
' cmModePath + "vb/vb",',
' cmModePath + "vbscript/vbscript",',
' cmModePath + "velocity/velocity",',
' cmModePath + "xquery/xquery",',
' cmModePath + "yaml/yaml",',
' cmModePath + "erlang/erlang",',
' cmModePath + "jade/jade",',
'',
' cmAddonPath + "edit/trailingspace", ',
' cmAddonPath + "dialog/dialog", ',
' cmAddonPath + "search/searchcursor", ',
' cmAddonPath + "search/search", ',
' cmAddonPath + "scroll/annotatescrollbar", ',
' cmAddonPath + "search/matchesonscrollbar", ',
' cmAddonPath + "display/placeholder", ',
' cmAddonPath + "edit/closetag", ',
' cmAddonPath + "fold/foldcode",',
' cmAddonPath + "fold/foldgutter",',
' cmAddonPath + "fold/indent-fold",',
' cmAddonPath + "fold/brace-fold",',
' cmAddonPath + "fold/xml-fold", ',
' cmAddonPath + "fold/markdown-fold",',
' cmAddonPath + "fold/comment-fold", ',
' cmAddonPath + "mode/overlay", ',
' cmAddonPath + "selection/active-line", ',
' cmAddonPath + "edit/closebrackets", ',
' cmAddonPath + "display/fullscreen",',
' cmAddonPath + "search/match-highlighter"',
' ];',
'',
' define(codeMirrorModules, factory);'
].join("\r\n");
var replaceText2 = [
"if (typeof define == \"function\" && define.amd) {",
" $ = arguments[0];",
" marked = arguments[1];",
" prettify = arguments[2];",
" katex = arguments[3];",
" Raphael = arguments[4];",
" _ = arguments[5];",
" flowchart = arguments[6];",
" CodeMirror = arguments[9];",
" }"
].join("\r\n");
gulp.src("src/editormd.js")
.pipe(rename({ suffix: ".amd" }))
.pipe(gulp.dest('./'))
.pipe(header(headerComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base);
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(replace("/* Require.js define replace */", replaceText1))
.pipe(gulp.dest('./'))
.pipe(replace("/* Require.js assignment replace */", replaceText2))
.pipe(gulp.dest('./'))
.pipe(rename({ suffix: ".min" }))
.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") ? "\\" : "/") );
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(notify({ message: "amd version task complete"}));
});
var codeMirror = {
path : {
src : {
mode : "lib/codemirror/mode",
addon : "lib/codemirror/addon"
},
dist : "lib/codemirror"
},
modes : [
"css",
"sass",
"shell",
"sql",
"clike",
"php",
"xml",
"markdown",
"javascript",
"htmlmixed",
"gfm",
"http",
"go",
"dart",
"coffeescript",
"nginx",
"python",
"perl",
"lua",
"r",
"ruby",
"rst",
"smartymixed",
"vb",
"vbscript",
"velocity",
"xquery",
"yaml",
"erlang",
"jade",
],
addons : [
"edit/trailingspace",
"dialog/dialog",
"search/searchcursor",
"search/search",
"scroll/annotatescrollbar",
"search/matchesonscrollbar",
"display/placeholder",
"edit/closetag",
"fold/foldcode",
"fold/foldgutter",
"fold/indent-fold",
"fold/brace-fold",
"fold/xml-fold",
"fold/markdown-fold",
"fold/comment-fold",
"mode/overlay",
"selection/active-line",
"edit/closebrackets",
"display/fullscreen",
"search/match-highlighter"
]
};
gulp.task("cm-mode", function() {
var modes = [
codeMirror.path.src.mode + "/meta.js"
];
for(var i in codeMirror.modes) {
var mode = codeMirror.modes[i];
modes.push(codeMirror.path.src.mode + "/" + mode + "/" + mode + ".js");
}
return gulp.src(modes)
.pipe(concat("modes.min.js"))
.pipe(gulp.dest(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]?name[1]:name[0]).replace(/\\/g, "");
}}))
.pipe(gulp.dest(codeMirror.path.dist))
.pipe(notify({ message: "codemirror-mode task complete!" }));
});
gulp.task("cm-addon", function() {
var addons = [];
for(var i in codeMirror.addons) {
var addon = codeMirror.addons[i];
addons.push(codeMirror.path.src.addon + "/" + addon + ".js");
}
return gulp.src(addons)
.pipe(concat("addons.min.js"))
.pipe(gulp.dest(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]?name[1]:name[0]).replace(/\\/g, "");
}}))
.pipe(gulp.dest(codeMirror.path.dist))
.pipe(notify({ message: "codemirror-addon.js task complete" }));
});
/*
gulp.task("jsdoc", function(){
return gulp.src(["./src/editormd.js", "README.md"])
.pipe(jsdoc.parser())
.pipe(jsdoc.generator("./docs/html"));
});
gulp.task("jsdoc2md", function() {
return gulp.src("src/js/editormd.js")
.pipe(jsdoc2md())
.on("error", function(err){
gutil.log(gutil.colors.red("jsdoc2md failed"), err.message);
})
.pipe(rename(function(path) {
path.extname = ".md";
}))
.pipe(gulp.dest("docs/markdown"));
});
*/
gulp.task("watch", function() {
gulp.watch("scss/editormd.scss", ["scss"]);
gulp.watch("scss/editormd.preview.scss", ["scss", "scss2"]);
gulp.watch("scss/editormd.logo.scss", ["scss", "scss3"]);
gulp.watch("src/editormd.js", ["js", "amd"]);
});
gulp.task("default", function() {
gulp.run("scss");
gulp.run("scss2");
gulp.run("scss3");
gulp.run("js");
gulp.run("amd");
gulp.run("cm-addon");
gulp.run("cm-mode");
});
"use strict";
var os = require("os");
var gulp = require("gulp");
var gutil = require("gulp-util");
var sass = require("gulp-ruby-sass");
var jshint = require("gulp-jshint");
var uglify = require("gulp-uglifyjs");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var notify = require("gulp-notify");
var header = require("gulp-header");
var minifycss = require("gulp-minify-css");
//var jsdoc = require("gulp-jsdoc");
//var jsdoc2md = require("gulp-jsdoc-to-markdown");
var pkg = require("./package.json");
var dateFormat = require("dateformatter").format;
var replace = require("gulp-replace");
pkg.name = "Editor.md";
pkg.today = dateFormat;
var headerComment = ["/*",
" * <%= pkg.name %>",
" *",
" * @file <%= fileName(file) %> ",
" * @version v<%= pkg.version %> ",
" * @description <%= pkg.description %>",
" * @license MIT License",
" * @author <%= pkg.author %>",
" * {@link <%= pkg.homepage %>}",
" * @updateTime <%= pkg.today('Y-m-d') %>",
" */",
"\r\n"].join("\r\n");
var headerMiniComment = "/*! <%= pkg.name %> v<%= pkg.version %> | <%= fileName(file) %> | <%= pkg.description %> | MIT License | By: <%= pkg.author %> | <%= pkg.homepage %> | <%=pkg.today('Y-m-d') %> */\r\n";
var scssTask = function(fileName, path) {
path = path || "scss/";
var distPath = "css";
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() {
return scssTask("editormd");
});
gulp.task("scss2", function() {
return scssTask("editormd.preview");
});
gulp.task("scss3", function() {
return scssTask("editormd.logo");
});
gulp.task("js", function() {
return gulp.src("./src/editormd.js")
.pipe(jshint("./.jshintrc"))
.pipe(jshint.reporter("default"))
.pipe(header(headerComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base);
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(rename({ suffix: ".min" }))
.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") ? "\\" : "/") );
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(notify({ message: "editormd.js task complete" }));
});
gulp.task("amd", function() {
var replaceText1 = [
'var cmModePath = "codemirror/mode/";',
' var cmAddonPath = "codemirror/addon/";',
'',
' var codeMirrorModules = [',
' "jquery", "marked", "prettify",',
' "katex", "raphael", "underscore", "flowchart", "jqueryflowchart", "sequenceDiagram",',
'',
' "codemirror/lib/codemirror",',
' cmModePath + "css/css",',
' cmModePath + "sass/sass",',
' cmModePath + "shell/shell",',
' cmModePath + "sql/sql",',
' cmModePath + "clike/clike",',
' cmModePath + "php/php",',
' cmModePath + "xml/xml",',
' cmModePath + "markdown/markdown",',
' cmModePath + "javascript/javascript",',
' cmModePath + "htmlmixed/htmlmixed",',
' cmModePath + "gfm/gfm",',
' cmModePath + "http/http",',
' cmModePath + "go/go",',
' cmModePath + "dart/dart",',
' cmModePath + "coffeescript/coffeescript",',
' cmModePath + "nginx/nginx",',
' cmModePath + "python/python",',
' cmModePath + "perl/perl",',
' cmModePath + "lua/lua",',
' cmModePath + "r/r", ',
' cmModePath + "ruby/ruby", ',
' cmModePath + "rst/rst",',
' cmModePath + "smartymixed/smartymixed",',
' cmModePath + "vb/vb",',
' cmModePath + "vbscript/vbscript",',
' cmModePath + "velocity/velocity",',
' cmModePath + "xquery/xquery",',
' cmModePath + "yaml/yaml",',
' cmModePath + "erlang/erlang",',
' cmModePath + "jade/jade",',
'',
' cmAddonPath + "edit/trailingspace", ',
' cmAddonPath + "dialog/dialog", ',
' cmAddonPath + "search/searchcursor", ',
' cmAddonPath + "search/search", ',
' cmAddonPath + "scroll/annotatescrollbar", ',
' cmAddonPath + "search/matchesonscrollbar", ',
' cmAddonPath + "display/placeholder", ',
' cmAddonPath + "edit/closetag", ',
' cmAddonPath + "fold/foldcode",',
' cmAddonPath + "fold/foldgutter",',
' cmAddonPath + "fold/indent-fold",',
' cmAddonPath + "fold/brace-fold",',
' cmAddonPath + "fold/xml-fold", ',
' cmAddonPath + "fold/markdown-fold",',
' cmAddonPath + "fold/comment-fold", ',
' cmAddonPath + "mode/overlay", ',
' cmAddonPath + "selection/active-line", ',
' cmAddonPath + "edit/closebrackets", ',
' cmAddonPath + "display/fullscreen",',
' cmAddonPath + "search/match-highlighter"',
' ];',
'',
' define(codeMirrorModules, factory);'
].join("\r\n");
var replaceText2 = [
"if (typeof define == \"function\" && define.amd) {",
" $ = arguments[0];",
" marked = arguments[1];",
" prettify = arguments[2];",
" katex = arguments[3];",
" Raphael = arguments[4];",
" _ = arguments[5];",
" flowchart = arguments[6];",
" CodeMirror = arguments[9];",
" }"
].join("\r\n");
gulp.src("src/editormd.js")
.pipe(rename({ suffix: ".amd" }))
.pipe(gulp.dest('./'))
.pipe(header(headerComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base);
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(replace("/* Require.js define replace */", replaceText1))
.pipe(gulp.dest('./'))
.pipe(replace("/* Require.js assignment replace */", replaceText2))
.pipe(gulp.dest('./'))
.pipe(rename({ suffix: ".min" }))
.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") ? "\\" : "/") );
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest("./"))
.pipe(notify({ message: "amd version task complete"}));
});
var codeMirror = {
path : {
src : {
mode : "lib/codemirror/mode",
addon : "lib/codemirror/addon"
},
dist : "lib/codemirror"
},
modes : [
"css",
"sass",
"shell",
"sql",
"clike",
"php",
"xml",
"markdown",
"javascript",
"htmlmixed",
"gfm",
"http",
"go",
"dart",
"coffeescript",
"nginx",
"python",
"perl",
"lua",
"r",
"ruby",
"rst",
"smartymixed",
"vb",
"vbscript",
"velocity",
"xquery",
"yaml",
"erlang",
"jade",
],
addons : [
"edit/trailingspace",
"dialog/dialog",
"search/searchcursor",
"search/search",
"scroll/annotatescrollbar",
"search/matchesonscrollbar",
"display/placeholder",
"edit/closetag",
"fold/foldcode",
"fold/foldgutter",
"fold/indent-fold",
"fold/brace-fold",
"fold/xml-fold",
"fold/markdown-fold",
"fold/comment-fold",
"mode/overlay",
"selection/active-line",
"edit/closebrackets",
"display/fullscreen",
"search/match-highlighter"
]
};
gulp.task("cm-mode", function() {
var modes = [
codeMirror.path.src.mode + "/meta.js"
];
for(var i in codeMirror.modes) {
var mode = codeMirror.modes[i];
modes.push(codeMirror.path.src.mode + "/" + mode + "/" + mode + ".js");
}
return gulp.src(modes)
.pipe(concat("modes.min.js"))
.pipe(gulp.dest(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]?name[1]:name[0]).replace(/\\/g, "");
}}))
.pipe(gulp.dest(codeMirror.path.dist))
.pipe(notify({ message: "codemirror-mode task complete!" }));
});
gulp.task("cm-addon", function() {
var addons = [];
for(var i in codeMirror.addons) {
var addon = codeMirror.addons[i];
addons.push(codeMirror.path.src.addon + "/" + addon + ".js");
}
return gulp.src(addons)
.pipe(concat("addons.min.js"))
.pipe(gulp.dest(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]?name[1]:name[0]).replace(/\\/g, "");
}}))
.pipe(gulp.dest(codeMirror.path.dist))
.pipe(notify({ message: "codemirror-addon.js task complete" }));
});
/*
gulp.task("jsdoc", function(){
return gulp.src(["./src/editormd.js", "README.md"])
.pipe(jsdoc.parser())
.pipe(jsdoc.generator("./docs/html"));
});
gulp.task("jsdoc2md", function() {
return gulp.src("src/js/editormd.js")
.pipe(jsdoc2md())
.on("error", function(err){
gutil.log(gutil.colors.red("jsdoc2md failed"), err.message);
})
.pipe(rename(function(path) {
path.extname = ".md";
}))
.pipe(gulp.dest("docs/markdown"));
});
*/
gulp.task("watch", function() {
gulp.watch("scss/*.scss", ["scss"]);
gulp.watch("scss/editormd.preview.scss", ["scss", "scss2"]);
gulp.watch("scss/editormd.logo.scss", ["scss", "scss3"]);
gulp.watch("src/editormd.js", ["js", "amd"]);
});
gulp.task("default", function() {
gulp.run("scss");
gulp.run("scss2");
gulp.run("scss3");
gulp.run("js");
gulp.run("amd");
gulp.run("cm-addon");
gulp.run("cm-mode");
});

467
README.md

@ -1,123 +1,123 @@
# Editor.md
![](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)
![](https://img.shields.io/github/stars/pandao/editor.md.svg)
![](https://img.shields.io/github/forks/pandao/editor.md.svg)
![](https://img.shields.io/github/tag/pandao/editor.md.svg)
![](https://img.shields.io/github/release/pandao/editor.md.svg)
![](https://img.shields.io/github/issues/pandao/editor.md.svg)
![](https://img.shields.io/bower/v/editor.md.svg)
**Editor.md** : The open source embeddable online markdown editor (component), based on CodeMirror & jQuery & Marked.
### Features
- Support Standard Markdown / CommonMark and GFM (GitHub Flavored Markdown);
- Full-featured: Real-time Preview, Image (cross-domain) upload, Preformatted text/Code blocks/Tables insert, Code fold, Search replace, Read only, Themes, Multi-languages, L18n, HTML entities, Code syntax highlighting...;
- Markdown Extras : Support [ToC (Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html), [Emoji](https://pandao.github.io/editor.md/examples/emoji.html), [Task lists](https://pandao.github.io/editor.md/examples/task-lists.html), [@Links](https://pandao.github.io/editor.md/examples/@links.html)...;
- Compatible with all major browsers (IE8+), compatible Zepto.js and iPad;
- Support [decode & fliter of the HTML tags & attributes](https://pandao.github.io/editor.md/examples/html-tags-decode.html);
- Support [TeX (LaTeX expressions, Based on KaTeX)](https://pandao.github.io/editor.md/examples/katex.html), [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) and [Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html) of Markdown extended syntax;
- Support AMD/CMD (Require.js & Sea.js) Module Loader, and Custom/define editor plugins;
[README & Examples (English)](https://pandao.github.io/editor.md/en.html)
--------
**Editor.md** 是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建。
![editormd-screenshot](https://pandao.github.io/editor.md/examples/images/editormd-screenshot.png "editormd-screenshot")
#### 主要特性
- 支持通用 Markdown / CommonMark 和 GFM (GitHub Flavored Markdown) 风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html);
- 支持实时预览、图片(跨域)上传、预格式文本/代码/表格插入、代码折叠、跳转到行、搜索替换、只读模式、自定义样式主题和多语言语法高亮等功能;
- 支持 [ToC(Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html)、[Emoji表情](https://pandao.github.io/editor.md/examples/emoji.html)、[Task lists](https://pandao.github.io/editor.md/examples/task-lists.html)、[@链接](https://pandao.github.io/editor.md/examples/@links.html)等 Markdown 扩展语法;
- 支持 TeX 科学公式(基于 [KaTeX](https://pandao.github.io/editor.md/examples/katex.html))、流程图 [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) 和 [时序图 Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html);
- 支持[识别和解析 HTML 标签,并且支持自定义过滤标签及属性解析](https://pandao.github.io/editor.md/examples/html-tags-decode.html),具有可靠的安全性和几乎无限的扩展性;
- 支持 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 等平板设备;
# Editor.md
![](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)
![](https://img.shields.io/github/stars/pandao/editor.md.svg)
![](https://img.shields.io/github/forks/pandao/editor.md.svg)
![](https://img.shields.io/github/tag/pandao/editor.md.svg)
![](https://img.shields.io/github/release/pandao/editor.md.svg)
![](https://img.shields.io/github/issues/pandao/editor.md.svg)
![](https://img.shields.io/bower/v/editor.md.svg)
**Editor.md** : The open source embeddable online markdown editor (component), based on CodeMirror & jQuery & Marked.
### Features
- Support Standard Markdown / CommonMark and GFM (GitHub Flavored Markdown);
- Full-featured: Real-time Preview, Image (cross-domain) upload, Preformatted text/Code blocks/Tables insert, Code fold, Search replace, Read only, Themes, Multi-languages, L18n, HTML entities, Code syntax highlighting...;
- Markdown Extras : Support [ToC (Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html), [Emoji](https://pandao.github.io/editor.md/examples/emoji.html), [Task lists](https://pandao.github.io/editor.md/examples/task-lists.html), [@Links](https://pandao.github.io/editor.md/examples/@links.html)...;
- Compatible with all major browsers (IE8+), compatible Zepto.js and iPad;
- Support [decode & fliter of the HTML tags & attributes](https://pandao.github.io/editor.md/examples/html-tags-decode.html);
- Support [TeX (LaTeX expressions, Based on KaTeX)](https://pandao.github.io/editor.md/examples/katex.html), [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) and [Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html) of Markdown extended syntax;
- Support AMD/CMD (Require.js & Sea.js) Module Loader, and Custom/define editor plugins;
[README & Examples (English)](https://pandao.github.io/editor.md/en.html)
--------
**Editor.md** 是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建。
![editormd-screenshot](https://pandao.github.io/editor.md/examples/images/editormd-screenshot.png "editormd-screenshot")
#### 主要特性
- 支持通用 Markdown / CommonMark 和 GFM (GitHub Flavored Markdown) 风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html);
- 支持实时预览、图片(跨域)上传、预格式文本/代码/表格插入、代码折叠、跳转到行、搜索替换、只读模式、自定义样式主题和多语言语法高亮等功能;
- 支持 [ToC(Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html)、[Emoji表情](https://pandao.github.io/editor.md/examples/emoji.html)、[Task lists](https://pandao.github.io/editor.md/examples/task-lists.html)、[@链接](https://pandao.github.io/editor.md/examples/@links.html)等 Markdown 扩展语法;
- 支持 TeX 科学公式(基于 [KaTeX](https://pandao.github.io/editor.md/examples/katex.html))、流程图 [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) 和 [时序图 Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html);
- 支持[识别和解析 HTML 标签,并且支持自定义过滤标签及属性解析](https://pandao.github.io/editor.md/examples/html-tags-decode.html),具有可靠的安全性和几乎无限的扩展性;
- 支持 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 等平板设备;
#### Download & install
Download:
[Github download](https://github.com/pandao/editor.md/archive/master.zip)
NPM install :
```bash
npm install editor.md
```
Bower install :
```bash
bower install editor.md
```
Download:
[Github download](https://github.com/pandao/editor.md/archive/master.zip)
NPM install :
```bash
npm install editor.md
```
Bower install :
```bash
bower install editor.md
```
#### Usages
##### Create a Markdown editor
```html
<link rel="stylesheet" href="editor.md/css/editormd.min.css" />
##### Create a Markdown editor
```html
<link rel="stylesheet" href="editor.md/css/editormd.min.css" />
<div id="editor">
<!-- Tips: Editor.md can auto append a `<textarea>` tag -->
<textarea style="display:none;">### Hello Editor.md !</textarea>
</div>
<script src="jquery.min.js"></script>
<script src="editor.md/editormd.min.js"></script>
<script type="text/javascript">
$(function() {
<!-- Tips: Editor.md can auto append a `<textarea>` tag -->
<textarea style="display:none;">### Hello Editor.md !</textarea>
</div>
<script src="jquery.min.js"></script>
<script src="editor.md/editormd.min.js"></script>
<script type="text/javascript">
$(function() {
var editor = editormd("editor", {
// width: "100%",
// height: "100%",
// markdown: "xxxx", // dynamic set Markdown text
path : "editor.md/lib/" // Autoload modules mode, codemirror, marked... dependents libs path
});
});
</script>
```
If you using modular script loader:
- [Using Require.js](https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html)
// markdown: "xxxx", // dynamic set Markdown text
path : "editor.md/lib/" // Autoload modules mode, codemirror, marked... dependents libs path
});
});
</script>
```
If you using modular script loader:
- [Using Require.js](https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html)
- [Using Sea.js](https://github.com/pandao/editor.md/tree/master/examples/use-seajs.html)
##### Markdown to HTML
```html
<link rel="stylesheet" href="editormd/css/editormd.preview.css" />
```html
<link rel="stylesheet" href="editormd/css/editormd.preview.css" />
<div id="test-markdown-view">
<!-- Server-side output Markdown text -->
<textarea style="display:none;">### Hello world!</textarea>
</div>
<script src="jquery.min.js"></script>
<script src="editormd/editormd.js"></script>
<script src="editormd/lib/marked.min.js"></script>
<script src="editormd/lib/prettify.min.js"></script>
<script type="text/javascript">
$(function() {
var testView = editormd.markdownToHTML("test-markdown-view", {
// markdown : "[TOC]\n### Hello world!\n## Heading 2", // Also, you can dynamic set Markdown text
// htmlDecode : true, // Enable / disable HTML tag encode.
// htmlDecode : "style,script,iframe", // Note: If enabled, you should filter some dangerous HTML tags for website security.
<!-- Server-side output Markdown text -->
<textarea style="display:none;">### Hello world!</textarea>
</div>
<script src="jquery.min.js"></script>
<script src="editormd/editormd.js"></script>
<script src="editormd/lib/marked.min.js"></script>
<script src="editormd/lib/prettify.min.js"></script>
<script type="text/javascript">
$(function() {
var testView = editormd.markdownToHTML("test-markdown-view", {
// markdown : "[TOC]\n### Hello world!\n## Heading 2", // Also, you can dynamic set Markdown text
// htmlDecode : true, // Enable / disable HTML tag encode.
// htmlDecode : "style,script,iframe", // Note: If enabled, you should filter some dangerous HTML tags for website security.
});
});
</script>
</script>
```
> See the full example: [http://editor.md.ipandao.com/examples/html-preview-markdown-to-html.html](http://editor.md.ipandao.com/examples/html-preview-markdown-to-html.html)
##### HTML to Markdown?
Sorry, Editor.md not support HTML to Markdown parsing, Maybe In the future.
#### Examples
Sorry, Editor.md not support HTML to Markdown parsing, Maybe In the future.
#### Examples
[https://pandao.github.io/editor.md/examples/index.html](https://pandao.github.io/editor.md/examples/index.html)
#### Options
@ -125,144 +125,153 @@ Sorry, Editor.md not support HTML to Markdown parsing, Maybe In the future.
Editor.md options and default values:
```javascript
{
mode : "gfm", // gfm or markdown
name : "", // Form element name for post
value : "", // value for CodeMirror, if mode not gfm/markdown
theme : "", // Editor.md self themes, before v1.5.0 is CodeMirror theme, default empty
editorTheme : "default", // Editor area, this is CodeMirror theme at v1.5.0
previewTheme : "", // Preview area theme, default empty
markdown : "", // Markdown source code
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/"
delay : 300, // Delay parse markdown to html, Uint : ms
autoLoadModules : true, // Automatic load dependent module files
watch : true,
placeholder : "Enjoy Markdown! coding now...",
gotoLine : true, // Enable / disable goto a line
codeFold : false,
autoHeight : false,
autoFocus : true, // Enable / disable auto focus editor left input area
autoCloseTags : true,
searchReplace : true, // Enable / disable (CodeMirror) search and replace function
syncScrolling : true, // options: true | false | "single", default true
readOnly : false, // Enable / disable readonly mode
tabSize : 4,
indentUnit : 4,
lineNumbers : true, // Display editor line numbers
lineWrapping : true,
autoCloseBrackets : true,
showTrailingSpace : true,
matchBrackets : true,
indentWithTabs : true,
styleSelectedText : true,
matchWordHighlight : true, // options: true, false, "onselected"
styleActiveLine : true, // Highlight the current line
dialogLockScreen : true,
dialogShowMask : true,
dialogDraggable : true,
dialogMaskBgColor : "#fff",
dialogMaskOpacity : 0.1,
fontSize : "13px",
saveHTMLToTextarea : false, // If enable, Editor will create a <textarea name="{editor-id}-html-code"> tag save HTML code for form post to server-side.
disabledKeyMaps : [],
onload : function() {},
onresize : function() {},
onchange : function() {},
onwatch : null,
onunwatch : null,
onpreviewing : function() {},
onpreviewed : function() {},
onfullscreen : function() {},
onfullscreenExit : function() {},
onscroll : function() {},
onpreviewscroll : function() {},
imageUpload : false, // Enable/disable upload
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "", // Upload url
crossDomainUpload : false, // Enable/disable Cross-domain upload
uploadCallbackURL : "", // Cross-domain upload callback url
toc : true, // Table of contents
tocm : false, // Using [TOCM], auto create ToC dropdown menu
tocTitle : "", // for ToC dropdown menu button
tocDropdown : false, // Enable/disable Table Of Contents dropdown menu
tocContainer : "", // Custom Table Of Contents Container Selector
tocStartLevel : 1, // Said from H1 to create ToC
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
emoji : false, // :emoji: , Support Github emoji, Twitter Emoji (Twemoji);
// Support FontAwesome icon emoji :fa-xxx: > Using fontAwesome icon web fonts;
// Support Editor.md logo icon emoji :editormd-logo: :editormd-logo-1x: > 1~8x;
tex : false, // TeX(LaTeX), based on KaTeX
flowChart : false, // flowChart.js only support IE9+
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
previewCodeHighlight : true, // Enable / disable code highlight of editor preview area
toolbar : true, // show or hide toolbar
toolbarAutoFixed : true, // on window scroll auto fixed position
toolbarIcons : "full", // Toolbar icons mode, options: full, simple, mini, See `editormd.toolbarModes` property.
toolbarTitles : {},
toolbarHandlers : {
ucwords : function() {
return editormd.toolbarHandlers.ucwords;
},
lowercase : function() {
return editormd.toolbarHandlers.lowercase;
}
},
toolbarCustomIcons : { // using html tag create toolbar icon, unused default <a> tag.
lowercase : "<a href=\"javascript:;\" title=\"Lowercase\" unselectable=\"on\"><i class=\"fa\" name=\"lowercase\" style=\"font-size:24px;margin-top: -10px;\">a</i></a>",
"ucwords" : "<a href=\"javascript:;\" title=\"ucwords\" unselectable=\"on\"><i class=\"fa\" name=\"ucwords\" style=\"font-size:20px;margin-top: -3px;\">Aa</i></a>"
},
toolbarIconTexts : {},
lang : { // Language data, you can custom your language.
name : "zh-cn",
description : "开源在线Markdown编辑器<br/>Open source online Markdown editor.",
tocTitle : "目录",
{
mode : "gfm", // gfm or markdown
name : "", // Form element name for post
value : "", // value for CodeMirror, if mode not gfm/markdown
theme : "", // Editor.md self themes, before v1.5.0 is CodeMirror theme, default empty
editorTheme : "default", // Editor area, this is CodeMirror theme at v1.5.0
previewTheme : "", // Preview area theme, default empty
markdown : "", // Markdown source code
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/"
delay : 300, // Delay parse markdown to html, Uint : ms
autoLoadModules : true, // Automatic load dependent module files
watch : true,
placeholder : "Enjoy Markdown! coding now...",
gotoLine : true, // Enable / disable goto a line
codeFold : false,
autoHeight : false,
autoFocus : true, // Enable / disable auto focus editor left input area
autoCloseTags : true,
searchReplace : true, // Enable / disable (CodeMirror) search and replace function
syncScrolling : true, // options: true | false | "single", default true
readOnly : false, // Enable / disable readonly mode
tabSize : 4,
indentUnit : 4,
lineNumbers : true, // Display editor line numbers
lineWrapping : true,
autoCloseBrackets : true,
showTrailingSpace : true,
matchBrackets : true,
indentWithTabs : true,
styleSelectedText : true,
matchWordHighlight : true, // options: true, false, "onselected"
styleActiveLine : true, // Highlight the current line
dialogLockScreen : true,
dialogShowMask : true,
dialogDraggable : true,
dialogMaskBgColor : "#fff",
dialogMaskOpacity : 0.1,
fontSize : "13px",
saveHTMLToTextarea : false, // If enable, Editor will create a <textarea name="{editor-id}-html-code"> tag save HTML code for form post to server-side.
disabledKeyMaps : [],
onload : function() {},
onresize : function() {},
onchange : function() {},
onwatch : null,
onunwatch : null,
onpreviewing : function() {},
onpreviewed : function() {},
onfullscreen : function() {},
onfullscreenExit : function() {},
onscroll : function() {},
onpreviewscroll : function() {},
imageUpload : false, // Enable/disable upload
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "", // Upload url
imageUploadFields : "", // append upload form fields for CRSF etc. Server-side receives the POST parameters. v1.5.1+
imageUploadCallback : function() {}, // set image upload finish (success or failure) callback handler v1.5.1+
imageUploadCallbackName : '__Editor_md_ImageUploadCallback', // upload callback name for cross-domain upload v1.5.1+
crossDomainUpload : false, // Enable/disable Cross-domain upload
uploadCallbackURL : "", // Cross-domain upload callback url
toc : true, // Table of contents
tocm : false, // Using [TOCM], auto create ToC dropdown menu
tocTitle : "", // for ToC dropdown menu button
tocDropdown : false, // Enable/disable Table Of Contents dropdown menu
tocContainer : "", // Custom Table Of Contents Container Selector
tocStartLevel : 1, // Said from H1 to create ToC
htmlDecode : false, // Open the HTML tag identification, If set String value expression : tagName,tagName,...|attrName,attrName,...
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
emoji : false, // :emoji: , Support Github emoji, Twitter Emoji (Twemoji);
// Support FontAwesome icon emoji :fa-xxx: > Using fontAwesome icon web fonts;
// Support Editor.md logo icon emoji :editormd-logo: :editormd-logo-1x: > 1~8x;
emojiCategories : [ // Custom Emoji categories
"github-emoji",
"twemoji",
"font-awesome",
"editormd-logo"
],
tex : false, // TeX(LaTeX), based on KaTeX
flowChart : false, // flowChart.js only support IE9+
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
previewCodeHighlight : true, // Enable / disable code highlight of editor preview area
toolbar : true, // show or hide toolbar
toolbarAutoFixed : true, // on window scroll auto fixed position
toolbarIcons : "full", // Toolbar icons mode, options: full, simple, mini, See `editormd.toolbarModes` property.
toolbarTitles : {},
toolbarHandlers : {
ucwords : function() {
return editormd.toolbarHandlers.ucwords;
},
lowercase : function() {
return editormd.toolbarHandlers.lowercase;
}
},
toolbarCustomIcons : { // using html tag create toolbar icon, unused default <a> tag.
lowercase : "<a href=\"javascript:;\" title=\"Lowercase\" unselectable=\"on\"><i class=\"fa\" name=\"lowercase\" style=\"font-size:24px;margin-top: -10px;\">a</i></a>",
"ucwords" : "<a href=\"javascript:;\" title=\"ucwords\" unselectable=\"on\"><i class=\"fa\" name=\"ucwords\" style=\"font-size:20px;margin-top: -3px;\">Aa</i></a>"
},
toolbarIconTexts : {},
lang : { // Language data, you can custom your language.
name : "zh-cn",
description : "开源在线Markdown编辑器<br/>Open source online Markdown editor.",
tocTitle : "目录",
toolbar : {
//...
},
button: {
//...
},
},
dialog : {
//...
}
//...
}
}
```
#### Dependents
- [CodeMirror](http://codemirror.net/ "CodeMirror")
- [marked](https://github.com/markedjs/marked "marked")
- [jQuery](http://jquery.com/ "jQuery")
- [FontAwesome](http://fontawesome.io/ "FontAwesome")
- [github-markdown.css](https://github.com/sindresorhus/github-markdown-css "github-markdown.css")
- [KaTeX](http://khan.github.io/KaTeX/ "KaTeX")
- [prettify.js](http://code.google.com/p/google-code-prettify/ "prettify.js")
- [Rephael.js](http://raphaeljs.com/ "Rephael.js")
- [flowchart.js](http://adrai.github.io/flowchart.js/ "flowchart.js")
- [sequence-diagram.js](http://bramp.github.io/js-sequence-diagrams/ "sequence-diagram.js")
- [Prefixes.scss](https://github.com/pandao/prefixes.scss "Prefixes.scss")
#### Changes
[Change logs](https://github.com/pandao/editor.md/blob/master/CHANGE.md)
#### License
The MIT License.
Copyright (c) 2015-2019 Pandao
```
#### Dependents
- [CodeMirror](http://codemirror.net/ "CodeMirror")
- [marked](https://github.com/markedjs/marked "marked")
- [jQuery](http://jquery.com/ "jQuery")
- [FontAwesome](http://fontawesome.io/ "FontAwesome")
- [github-markdown.css](https://github.com/sindresorhus/github-markdown-css "github-markdown.css")
- [KaTeX](http://khan.github.io/KaTeX/ "KaTeX")
- [prettify.js](http://code.google.com/p/google-code-prettify/ "prettify.js")
- [Rephael.js](http://raphaeljs.com/ "Rephael.js")
- [flowchart.js](http://adrai.github.io/flowchart.js/ "flowchart.js")
- [sequence-diagram.js](http://bramp.github.io/js-sequence-diagrams/ "sequence-diagram.js")
- [Prefixes.scss](https://github.com/pandao/prefixes.scss "Prefixes.scss")
#### Changes
[Change logs](https://github.com/pandao/editor.md/blob/master/CHANGE.md)
#### License
The MIT License.
Copyright (c) 2015-2019 Pandao

9222
css/editormd.css

File diff suppressed because it is too large

178
css/editormd.logo.css

@ -1,98 +1,98 @@
/*
* Editor.md
*
* @file editormd.logo.css
* @version v1.5.0
* @file /editormd.logo.css
* @version v1.5.1
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-06-09
* @updateTime 2019-05-11
*/
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */
@font-face {
font-family: 'editormd-logo';
src: url("../fonts/editormd-logo.eot?-5y8q6h");
src: url(".../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg");
font-weight: normal;
font-style: normal;
}
.editormd-logo,
.editormd-logo-1x,
.editormd-logo-2x,
.editormd-logo-3x,
.editormd-logo-4x,
.editormd-logo-5x,
.editormd-logo-6x,
.editormd-logo-7x,
.editormd-logo-8x {
font-family: 'editormd-logo';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
font-size: inherit;
line-height: 1;
display: inline-block;
text-rendering: auto;
vertical-align: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.editormd-logo:before,
.editormd-logo-1x:before,
.editormd-logo-2x:before,
.editormd-logo-3x:before,
.editormd-logo-4x:before,
.editormd-logo-5x:before,
.editormd-logo-6x:before,
.editormd-logo-7x:before,
.editormd-logo-8x:before {
content: "\e1987";
/*
HTML Entity &#xe1987;
example: <span class="editormd-logo">&#xe1987;</span>
*/
}
.editormd-logo-1x {
font-size: 1em;
}
.editormd-logo-lg {
font-size: 1.2em;
}
.editormd-logo-2x {
font-size: 2em;
}
.editormd-logo-3x {
font-size: 3em;
}
.editormd-logo-4x {
font-size: 4em;
}
.editormd-logo-5x {
font-size: 5em;
}
.editormd-logo-6x {
font-size: 6em;
}
.editormd-logo-7x {
font-size: 7em;
}
.editormd-logo-8x {
font-size: 8em;
}
.editormd-logo-color {
color: #2196F3;
}
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */
@font-face {
font-family: 'editormd-logo';
src: url("../fonts/editormd-logo.eot?-5y8q6h");
src: url("../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg");
font-weight: normal;
font-style: normal;
}
.editormd-logo,
.editormd-logo-1x,
.editormd-logo-2x,
.editormd-logo-3x,
.editormd-logo-4x,
.editormd-logo-5x,
.editormd-logo-6x,
.editormd-logo-7x,
.editormd-logo-8x {
font-family: 'editormd-logo';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
font-size: inherit;
line-height: 1;
display: inline-block;
text-rendering: auto;
vertical-align: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.editormd-logo:before,
.editormd-logo-1x:before,
.editormd-logo-2x:before,
.editormd-logo-3x:before,
.editormd-logo-4x:before,
.editormd-logo-5x:before,
.editormd-logo-6x:before,
.editormd-logo-7x:before,
.editormd-logo-8x:before {
content: "\e1987";
/*
HTML Entity &#xe1987;
example: <span class="editormd-logo">&#xe1987;</span>
*/
}
.editormd-logo-1x {
font-size: 1em;
}
.editormd-logo-lg {
font-size: 1.2em;
}
.editormd-logo-2x {
font-size: 2em;
}
.editormd-logo-3x {
font-size: 3em;
}
.editormd-logo-4x {
font-size: 4em;
}
.editormd-logo-5x {
font-size: 5em;
}
.editormd-logo-6x {
font-size: 6em;
}
.editormd-logo-7x {
font-size: 7em;
}
.editormd-logo-8x {
font-size: 8em;
}
.editormd-logo-color {
color: #2196F3;
}

4
css/editormd.logo.min.css

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

10
css/editormd.min.css

File diff suppressed because one or more lines are too long

7414
css/editormd.preview.css

File diff suppressed because it is too large

10
css/editormd.preview.min.css

File diff suppressed because one or more lines are too long

8998
editormd.amd.js

File diff suppressed because it is too large

6
editormd.amd.min.js

File diff suppressed because one or more lines are too long

8993
editormd.js

File diff suppressed because it is too large

5
editormd.min.js

File diff suppressed because one or more lines are too long

14
examples/dynamic-create-editormd.html

@ -16,6 +16,7 @@
<div class="btns" style="margin:0;">
<button id="create-btn">动态创建一个 Editor.md</button>
<button id="remove-btn">移除 Editor.md</button>
<button id="destroy-btn">消毁 Editor.md</button>
</div>
</header>
</div>
@ -23,12 +24,12 @@
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
var testEditormd;
$(function() {
$("#create-btn").click(function(){
$.getScript("../editormd.js", function() {
$.getScript("../editormd.js?v=20190511", function() {
$("#layout").append("<div id=\"test-editormd\"></div>");
testEditormd = editormd("test-editormd", {
width: "90%",
height: 640,
@ -37,10 +38,15 @@
});
});
});
$("#remove-btn").click(function() {
testEditormd.editor.remove();
});
$("#destroy-btn").click(function() {
testEditormd.destroy();
testEditormd = null;
});
});
</script>
</body>

386
examples/emoji.html

@ -1,191 +1,195 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Emoji - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Emoji 表情</h1>
<p>Supports:</p>
<ul style="margin: 10px 0 0 18px;">
<li>Github emoji : <a href="http://www.emoji-cheat-sheet.com/" target="_blank">http://www.emoji-cheat-sheet.com/</a></li>
<li>Twitter Emoji(Twemoji) : <a href="http://twitter.github.io/twemoji/preview.html" target="_blank">http://twitter.github.io/twemoji/preview.html</a></li>
<li>FontAwesome icon font emoji : <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a></li>
<li>Editor.md logo icon font emoji</li>
</ul>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Emoji 表情 :smiley:
[TOC]
### Emoji
Emoji cheat sheet for Campfire and GitHub.
[http://www.emoji-cheat-sheet.com/](http://www.emoji-cheat-sheet.com/)
**Usage:**
:emoji-name:
**Examples:**
:heart: :smiley: :+1: :-1: :black_large_square: :waxing_gibbous_moon: :moon: :crescent_moon:
### Twitter Emoji (Twemoji)
**Usage:**
:tw-xxxx:
**Examples:**
:tw-1f504: :tw-30-20e3: :tw-31-20e3: :tw-32-20e3: :tw-33-20e3: :tw-34-20e3: :tw-35-20e3: :tw-36-20e3: :tw-37-20e3: :tw-38-20e3: :tw-39-20e3: :tw-1f51f:
[http://twitter.github.io/twemoji/preview.html](http://twitter.github.io/twemoji/preview.html)
### Fortawesome icons
[http://fortawesome.github.io/Font-Awesome/icons/](http://fortawesome.github.io/Font-Awesome/icons/)
**Usage:**
:fa-xxxx:
**Examples:**
:fa-wifi: :fa-twitter: :fa-google-plus: :fa-git-square: :fa-github-alt: :fa-external-link-square:
### Editor.md logos
**Usage:**
:editormd-logo:
:editormd-logo-1x:
...
:editormd-logo-8x:
**Examples:**
:editormd-logo: :editormd-logo-1x: :editormd-logo-2x: :editormd-logo-3x: :editormd-logo-4x: :editormd-logo-5x: :editormd-logo-6x: :editormd-logo-7x: :editormd-logo-8x:
### Mixed tests
&gt; Blockquotes :star:
@pandao dasfsadfasdf:fa-edit: :warning: :smiley:dsafsdfsad\:fdsfdf\:f dfdf: :fa-save::fa-star: :fa-truck:
**fdfasd:smiley:dsfsdfsfd** ~~fsdfds:smiley:dfsdfsdf :fa-info:~~ @pandao
:fa-weixin: :fa-qq: :fa-weibo: :fa-tencent-weibo: :fa-github: :fa-git:
*dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf*
___Emphasis :fa-gear: Italic:smiley:___ __Emphasis:smiley:__
# H1 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
## H2 dsfd:fa-star:fsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
### H3 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf @pandao
#### H4 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
##### H5 dsfdfsfd:smiley:dsfsfd @pandao sfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
###### H6 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-star:dsfsdf
[:smiley:](http://www.emoji-cheat-sheet.com/ "link + emoji") link + emoji
- dafs@pandao sdfsdaf:smiley:dfsdfsdf
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafssdfsdaf:smiley:dfsdfsdf
- dafss:fa-truck:dfsdaf:smiley:dfsd @pandao fsdf
- dafssd: :fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
+ dafssdfsdaf:smiley:dfsdfsdf @pandao
+ dafs@pandao s:fa-truck:dfsdaf:smiley:dfsdfsdf
1. :smiley:第一行:fa-truck:fsdaf:smiley:dfs@pandao dfsdf :fa-save:: :fa-truck:
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafss:fa-truck:dfsdaf:smiley:dfsdfsdf
2. :smiley:第二行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
3. 第三行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-save:: :fa-truck:
&gt; Blockquotes @pandao
&gt; dd:smiley:引用文本(Blockquotes:smiley:)fdasfad :fa-star:: dfd :fa-truck: @pandao
#### Datetime test
02:21:47
2015-03-12 02:21:47
### In table
|:100: First Header | Second:smiley: Header:smiley: |
| ------------- | ------------- |
| Content:fa-truck: Cell | :smiley:Content Cell :smiley: |
| Con:fa-truck:tent Cell:bangbang: | Content Cell dfsdfsdf :fa-star: :dfdf :fa-truck: |
### Editor.md logo emoji
:fa-heart:fasdfsdfsfddffd:editormd-logo: :editormd-logo: :editormd-logo-4x:
dfasfasdfasdf:bangbang:
This is an H1 :editormd-logo-4x: @pandao
=============
@pandao This :fa-save:: :fa-truck:is an H2 :100:
-------------
### GFM task lists :editormd-logo-5x:
- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;
- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
- [x] [ ] :smiley: this is a complete item :smiley:;
- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;
- [ ] [ ]this is an incomplete item;
- [ ] :smiley: this is an incomplete item [test link](#);
- [ ] :smiley: this is an incomplete item [test link](#);
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
// You can custom Emoji's graphics files url path
editormd.emoji = {
path : "http://www.emoji-cheat-sheet.com/graphics/emojis/",
ext : ".png"
};
// Twitter Emoji (Twemoji) graphics files url path
editormd.twemoji = {
path : "http://twemoji.maxcdn.com/72x72/",
ext : ".png"
};
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
toc : true,
emoji : true, // Support Github emoji, Twitter Emoji(Twemoji), fontAwesome, Editor.md logo emojis.
taskList : true,
path : '../lib/'
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Emoji - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Emoji 表情</h1>
<p>Supports:</p>
<ul style="margin: 10px 0 0 18px;">
<li>Github emoji : <a href="http://www.emoji-cheat-sheet.com/" target="_blank">http://www.emoji-cheat-sheet.com/</a></li>
<li>Twitter Emoji(Twemoji) : <a href="http://twitter.github.io/twemoji/preview.html" target="_blank">http://twitter.github.io/twemoji/preview.html</a></li>
<li>FontAwesome icon font emoji : <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a></li>
<li>Editor.md logo icon font emoji</li>
</ul>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Emoji 表情 :smiley:
[TOC]
### Emoji
Emoji cheat sheet for Campfire and GitHub.
[http://www.emoji-cheat-sheet.com/](http://www.emoji-cheat-sheet.com/)
**Usage:**
:emoji-name:
**Examples:**
:heart: :smiley: :+1: :-1: :black_large_square: :waxing_gibbous_moon: :moon: :crescent_moon:
### Twitter Emoji (Twemoji)
**Usage:**
:tw-xxxx:
**Examples:**
:tw-1f504: :tw-30-20e3: :tw-31-20e3: :tw-32-20e3: :tw-33-20e3: :tw-34-20e3: :tw-35-20e3: :tw-36-20e3: :tw-37-20e3: :tw-38-20e3: :tw-39-20e3: :tw-1f51f:
[http://twitter.github.io/twemoji/preview.html](http://twitter.github.io/twemoji/preview.html)
### Fortawesome icons
[http://fortawesome.github.io/Font-Awesome/icons/](http://fortawesome.github.io/Font-Awesome/icons/)
**Usage:**
:fa-xxxx:
**Examples:**
:fa-wifi: :fa-twitter: :fa-google-plus: :fa-git-square: :fa-github-alt: :fa-external-link-square:
### Editor.md logos
**Usage:**
:editormd-logo:
:editormd-logo-1x:
...
:editormd-logo-8x:
**Examples:**
:editormd-logo: :editormd-logo-1x: :editormd-logo-2x: :editormd-logo-3x: :editormd-logo-4x: :editormd-logo-5x: :editormd-logo-6x: :editormd-logo-7x: :editormd-logo-8x:
### Mixed tests
&gt; Blockquotes :star:
@pandao dasfsadfasdf:fa-edit: :warning: :smiley:dsafsdfsad\:fdsfdf\:f dfdf: :fa-save::fa-star: :fa-truck:
**fdfasd:smiley:dsfsdfsfd** ~~fsdfds:smiley:dfsdfsdf :fa-info:~~ @pandao
:fa-weixin: :fa-qq: :fa-weibo: :fa-tencent-weibo: :fa-github: :fa-git:
*dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf*
___Emphasis :fa-gear: Italic:smiley:___ __Emphasis:smiley:__
# H1 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
## H2 dsfd:fa-star:fsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
### H3 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf @pandao
#### H4 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
##### H5 dsfdfsfd:smiley:dsfsfd @pandao sfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
###### H6 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-star:dsfsdf
[:smiley:](http://www.emoji-cheat-sheet.com/ "link + emoji") link + emoji
- dafs@pandao sdfsdaf:smiley:dfsdfsdf
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafssdfsdaf:smiley:dfsdfsdf
- dafss:fa-truck:dfsdaf:smiley:dfsd @pandao fsdf
- dafssd: :fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
+ dafssdfsdaf:smiley:dfsdfsdf @pandao
+ dafs@pandao s:fa-truck:dfsdaf:smiley:dfsdfsdf
1. :smiley:第一行:fa-truck:fsdaf:smiley:dfs@pandao dfsdf :fa-save:: :fa-truck:
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafss:fa-truck:dfsdaf:smiley:dfsdfsdf
2. :smiley:第二行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
3. 第三行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-save:: :fa-truck:
&gt; Blockquotes @pandao
&gt; dd:smiley:引用文本(Blockquotes:smiley:)fdasfad :fa-star:: dfd :fa-truck: @pandao
#### Datetime test
02:21:47
2015-03-12 02:21:47
### In table
|:100: First Header | Second:smiley: Header:smiley: |
| ------------- | ------------- |
| Content:fa-truck: Cell | :smiley:Content Cell :smiley: |
| Con:fa-truck:tent Cell:bangbang: | Content Cell dfsdfsdf :fa-star: :dfdf :fa-truck: |
### Editor.md logo emoji
:fa-heart:fasdfsdfsfddffd:editormd-logo: :editormd-logo: :editormd-logo-4x:
dfasfasdfasdf:bangbang:
This is an H1 :editormd-logo-4x: @pandao
=============
@pandao This :fa-save:: :fa-truck:is an H2 :100:
-------------
### GFM task lists :editormd-logo-5x:
- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;
- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
- [x] [ ] :smiley: this is a complete item :smiley:;
- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;
- [ ] [ ]this is an incomplete item;
- [ ] :smiley: this is an incomplete item [test link](#);
- [ ] :smiley: this is an incomplete item [test link](#);
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
// You can custom Emoji's graphics files url path
editormd.emoji = {
path : "https://www.webpagefx.com/tools/emoji-cheat-sheet/graphics/emojis/",
ext : ".png"
};
// Twitter Emoji (Twemoji) graphics files url path
editormd.twemoji = {
path : "http://twemoji.maxcdn.com/72x72/",
ext : ".png"
};
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
toc : true,
emoji : true, // Support Github emoji, Twitter Emoji(Twemoji), fontAwesome, Editor.md logo emojis.
// emojiCategories : ["github-emoji", "twemoji"], // Custom Emoji categories
// emojiCategories : ["twemoji"], // Custom Emoji categories
// emojiCategories : ["font-awesome"], // Custom Emoji categories
// emojiCategories : ["editormd-logo"], // Custom Emoji categories
taskList : true,
path : '../lib/'
});
});
</script>
</body>
</html>

4
examples/form-get-value.html

@ -11,9 +11,9 @@
<div id="layout">
<header>
<h1>表单取值</h1>
<p>Form get textarea value.</p>
<p>Form get textarea value.</p>
</header>
<form method="post" action="http://editormd.ipandao.com/php/post.php">
<form method="post" action="./php/post.php">
<div id="test-editormd">
<!-- Custom textarea name attribute <textarea style="display:none;" name="test-textarea-name"> -->
<textarea style="display:none;">#### Get value

284
examples/html-preview-markdown-to-html.html

@ -1,142 +1,142 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>HTML Preview(markdown to html) - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.preview.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
.editormd-html-preview {
width: 90%;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Markdown转HTML的显示处理</h1>
<p>即:非编辑情况下的HTML预览</p>
<p>HTML Preview(markdown to html)</p>
</header>
<div class="btns">
<button onclick="location.href='./html-preview-markdown-to-html-custom-toc-container.html';">将 ToC 移到自定义容器层</button>
</div>
<div id="test-editormd-view">
<textarea style="display:none;" name="test-editormd-markdown-doc">###Hello world!</textarea>
</div>
<div id="test-editormd-view2">
<textarea id="append-test" style="display:none;">
###科学公式 TeX(KaTeX)
$$E=mc^2$$
行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。
$$\(\sqrt{3x-1}+(1+x)^2\)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
$$X^2 > Y$$
#####上标和下标
上标:X&lt;sup&gt;2&lt;/sup&gt;
下标:O&lt;sub&gt;2&lt;/sub&gt;
##### 代码块里包含的过滤标签及属性不会被过滤
```html
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;
```
#####Style
&lt;style&gt;
body{background:red;}
&lt;/style&gt;
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
#####Script
&lt;script&gt;
alert("script");
&lt;/script&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;</textarea>
</div>
</div>
<!-- <script src="js/zepto.min.js"></script>
<script>
var jQuery = Zepto; // 为了避免修改flowChart.js和sequence-diagram.js的源码,所以使用Zepto.js时想支持flowChart/sequenceDiagram就得加上这一句
</script> -->
<script src="js/jquery.min.js"></script>
<script src="../lib/marked.min.js"></script>
<script src="../lib/prettify.min.js"></script>
<script src="../lib/raphael.min.js"></script>
<script src="../lib/underscore.min.js"></script>
<script src="../lib/sequence-diagram.min.js"></script>
<script src="../lib/flowchart.min.js"></script>
<script src="../lib/jquery.flowchart.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditormdView, testEditormdView2;
$.get("test.md", function(markdown) {
testEditormdView = editormd.markdownToHTML("test-editormd-view", {
markdown : markdown ,//+ "\r\n" + $("#append-test").text(),
//htmlDecode : true, // 开启 HTML 标签解析,为了安全性,默认不开启
htmlDecode : "style,script,iframe", // you can filter tags decode
//toc : false,
tocm : true, // Using [TOCM]
//tocContainer : "#custom-toc-container", // 自定义 ToC 容器层
//gfm : false,
//tocDropdown : true,
// markdownSourceCode : true, // 是否保留 Markdown 源码,即是否删除保存源码的 Textarea 标签
emoji : true,
taskList : true,
tex : true, // 默认不解析
flowChart : true, // 默认不解析
sequenceDiagram : true, // 默认不解析
});
//console.log("返回一个 jQuery 实例 =>", testEditormdView);
// 获取Markdown源码
//console.log(testEditormdView.getMarkdown());
//alert(testEditormdView.getMarkdown());
});
testEditormdView2 = editormd.markdownToHTML("test-editormd-view2", {
htmlDecode : "style,script,iframe", // you can filter tags decode
emoji : true,
taskList : true,
tex : true, // 默认不解析
flowChart : true, // 默认不解析
sequenceDiagram : true, // 默认不解析
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>HTML Preview(markdown to html) - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.preview.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
.editormd-html-preview {
width: 90%;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Markdown转HTML的显示处理</h1>
<p>即:非编辑情况下的HTML预览</p>
<p>HTML Preview(markdown to html)</p>
</header>
<div class="btns">
<button onclick="location.href='./html-preview-markdown-to-html-custom-toc-container.html';">将 ToC 移到自定义容器层</button>
</div>
<div id="test-editormd-view">
<textarea style="display:none;" name="test-editormd-markdown-doc">###Hello world!</textarea>
</div>
<div id="test-editormd-view2">
<textarea id="append-test" style="display:none;">
### 科学公式 TeX(KaTeX)
$$E=mc^2$$
行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。
$$\(\sqrt{3x-1}+(1+x)^2\)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
$$X^2 > Y$$
##### 上标和下标
上标:X&lt;sup&gt;2&lt;/sup&gt;
下标:O&lt;sub&gt;2&lt;/sub&gt;
##### 代码块里包含的过滤标签及属性不会被过滤
```html
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;
```
##### Style
&lt;style&gt;
body{background:red;}
&lt;/style&gt;
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
##### Script
&lt;script&gt;
alert("script");
&lt;/script&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;</textarea>
</div>
</div>
<!-- <script src="js/zepto.min.js"></script>
<script>
var jQuery = Zepto; // 为了避免修改flowChart.js和sequence-diagram.js的源码,所以使用Zepto.js时想支持flowChart/sequenceDiagram就得加上这一句
</script> -->
<script src="js/jquery.min.js"></script>
<script src="../lib/marked.min.js"></script>
<script src="../lib/prettify.min.js"></script>
<script src="../lib/raphael.min.js"></script>
<script src="../lib/underscore.min.js"></script>
<script src="../lib/sequence-diagram.min.js"></script>
<script src="../lib/flowchart.min.js"></script>
<script src="../lib/jquery.flowchart.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditormdView, testEditormdView2;
$.get("test.md", function(markdown) {
testEditormdView = editormd.markdownToHTML("test-editormd-view", {
markdown : markdown ,//+ "\r\n" + $("#append-test").text(),
//htmlDecode : true, // 开启 HTML 标签解析,为了安全性,默认不开启
htmlDecode : "style,script,iframe", // you can filter tags decode
//toc : false,
tocm : true, // Using [TOCM]
//tocContainer : "#custom-toc-container", // 自定义 ToC 容器层
//gfm : false,
//tocDropdown : true,
// markdownSourceCode : true, // 是否保留 Markdown 源码,即是否删除保存源码的 Textarea 标签
emoji : true,
taskList : true,
tex : true, // 默认不解析
flowChart : true, // 默认不解析
sequenceDiagram : true, // 默认不解析
});
//console.log("返回一个 jQuery 实例 =>", testEditormdView);
// 获取Markdown源码
//console.log(testEditormdView.getMarkdown());
//alert(testEditormdView.getMarkdown());
});
testEditormdView2 = editormd.markdownToHTML("test-editormd-view2", {
htmlDecode : "style,script,iframe", // you can filter tags decode
emoji : true,
taskList : true,
tex : true, // 默认不解析
flowChart : true, // 默认不解析
sequenceDiagram : true, // 默认不解析
});
});
</script>
</body>
</html>

255
examples/html-tags-decode.html

@ -1,119 +1,136 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>识别和解析 HTML 标签 - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>识别和解析HTML标签</h1>
<p>HTML tags (filter) decode, You can increase safety by filtering the danger label.</p>
<p>注:虽然此功能能极大地扩展 Markdown 语法,但也面临着安全上的风险,所以默认是不开启的。</p>
<p>Update: 可以通过设置 `settings.htmlDecode = "style,script,iframe|on*"`来实现过滤指定标签及属性的解析,提高安全性;</p>
</header>
<div class="btns">
<button class="filter-btn" exp="true">Unfilter</button>
<button class="filter-btn" exp="style,script,iframe|*">Filter style,script,iframe|*</button>
<button class="filter-btn" exp="style,script,iframe|on*">Filter style,script,iframe|on*</button>
<button class="filter-btn" exp="style,script,iframe|onclick,title,onmouseover,onmouseout,style">Filter style,script,iframe|onclick,title,onmouseover,onmouseout,style</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">#### 开启识别和解析 HTML 标签
配置项:
{
htmlDecode : true // Decode all html tags & attributes
// Filter tags/attributes expression : tagName,tagName,...|attrName,attrName,...
htmlDecode : "style,script,iframe,sub,sup|on*" // Filter tags, and all on* attributes
//htmlDecode : "style,script,iframe,sub,sup|*" // Filter tags, and all attributes
//htmlDecode : "style,script,iframe,sub,sup,embed|onclick,title,onmouseover,onmouseout,style" // Filter tags, and your custom attributes
}
#### 示例
##### 上标和下标
上标:X&lt;sup&gt;2&lt;/sup&gt;
下标:O&lt;sub&gt;2&lt;/sub&gt;
##### 代码块里包含的过滤标签及属性不会被过滤
```html
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;
```
##### Style
&lt;style&gt;
body{background:red;}
&lt;/style&gt;
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
##### Script
&lt;script&gt;
alert("script");
&lt;/script&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
##### Events
&lt;div style="color:green;" onclick="alert(1233);" title="div xxxxx"&gt;Events&lt;/div&gt;
&lt;div style="color:red;" contenteditable onclick="alert(1233);" onmouseover="alert(1233);" onmouseout="alert(1233);" title="div xxxxx"&gt;Events&lt;/div&gt;
##### 插入Flash
&lt;embed src="http://player.youku.com/player.php/sid/XMzA0MzIwMDgw/v.swf" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;
##### 插入视频
李健《最好不相见》
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width: "90%",
height: 720,
path : '../lib/',
htmlDecode : true, // Decode all html tags & attributes
// Expression : tagName,tagName,...|attrName,attrName,...
//htmlDecode : "style,script,iframe,sub,sup|on*" // Filter tags, and all on* attributes
//htmlDecode : "style,script,iframe,sub,sup|*" // Filter tags, and all attributes
//htmlDecode : "style,script,iframe,sub,sup,embed|onclick,title,onmouseover,onmouseout,style" // Filter tags, and your custom attributes
});
$(".filter-btn").click(function(){
testEditor.config("htmlDecode", $(this).attr("exp"));
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>识别和解析 HTML 标签 - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>识别和解析HTML标签</h1>
<p>HTML tags (filter) decode, You can increase safety by filtering the danger label.</p>
<p>注:虽然此功能能极大地扩展 Markdown 语法,但也面临着安全上的风险,所以默认是不开启的。</p>
<p>Update: 可以通过设置 `settings.htmlDecode = "style,script,iframe|on*"`来实现过滤指定标签及属性的解析,提高安全性;</p>
</header>
<div class="btns">
<button class="filter-btn" exp="true">Unfilter</button>
<button class="filter-btn" exp="style,script,iframe|*">Filter style,script,iframe|*</button>
<button class="filter-btn" exp="style,script,iframe|on*">Filter style,script,iframe|on*</button>
<button class="filter-btn" exp="style,script,iframe|onclick,title,onmouseover,onmouseout,style">Filter style,script,iframe|onclick,title,onmouseover,onmouseout,style</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">[TOC]
#### 开启识别和解析 HTML 标签
配置项:
{
htmlDecode : true // Decode all html tags & attributes
// Filter tags/attributes expression : tagName,tagName,...|attrName,attrName,...
htmlDecode : "style,script,iframe,sub,sup|on*" // Filter tags, and all on* attributes
//htmlDecode : "style,script,iframe,sub,sup|*" // Filter tags, and all attributes
//htmlDecode : "style,script,iframe,sub,sup,embed|onclick,title,onmouseover,onmouseout,style" // Filter tags, and your custom attributes
}
#### 示例
##### 上标和下标
上标:X&lt;sup&gt;2&lt;/sup&gt;
下标:O&lt;sub&gt;2&lt;/sub&gt;
##### 代码块里包含的过滤标签及属性不会被过滤
```html
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;
```
#### **Strong text** Test
##### Image
&lt;img src="http://editor.md.ipandao.com/images/logos/editormd-logo-64x64.png"/&gt;
&lt;a href="https://github.com/pandao/editor.md"&gt;&lt;img src="http://editor.md.ipandao.com/images/logos/editormd-logo-64x64.png"/&gt;&lt/a&gt;
[![](http://editor.md.ipandao.com/images/logos/editormd-logo-64x64.png)](https://github.com/pandao/editor.md)
:sweat_smile: :blush: :smiley: :relaxed: :smile: [:laughing:](https://github.com/pandao/editor.md)
##### Style :sweat_smile:
&lt;style&gt;
body{background:red;}
&lt;/style&gt;
&lt;style type="text/style"&gt;
body{background:red;}
&lt;/style&gt;
##### Script
&lt;script&gt;
alert("script");
&lt;/script&gt;
&lt;script type="text/javscript"&gt;
alert("script");
&lt;/script&gt;
&lt;a href="javascript:alert('xss')"&gt;a javascript:alert("xss")&lt;/a&gt;
##### Events
&lt;div style="color:green;" onclick="alert(1233);" title="div xxxxx"&gt;Events&lt;/div&gt;
&lt;div style="color:red;" contenteditable onclick="alert(1233);" onmouseover="alert(1233);" onmouseout="alert(1233);" title="div xxxxx"&gt;Events&lt;/div&gt;
##### 插入Flash
&lt;embed src="http://player.youku.com/player.php/sid/XMzA0MzIwMDgw/v.swf" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;
##### 插入视频
李健《最好不相见》
&lt;iframe height=498 width=510 src="http://player.youku.com/embed/XMzA0MzIwMDgw" frameborder=0 allowfullscreen&gt;&lt;/iframe&gt;</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width: "90%",
height: 720,
path : '../lib/',
emoji: true,
htmlDecode : true, // Decode all html tags & attributes
// Expression : tagName,tagName,...|attrName,attrName,...
htmlDecode : "style,script,iframe,sub,sup|on*" // Filter tags, and all on* attributes
// htmlDecode : "style,script,iframe,sub,sup|*" // Filter tags, and all attributes, TOC not parsing
//htmlDecode : "style,script,iframe,sub,sup,embed|onclick,title,onmouseover,onmouseout,style" // Filter tags, and your custom attributes
});
$(".filter-btn").click(function(){
testEditor.config("htmlDecode", $(this).attr("exp"));
});
});
</script>
</body>
</html>

22
examples/image-cross-domain-upload.html

@ -21,8 +21,12 @@
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "http://xxxxxxx/editor.md/examples/php/cross-domain-upload.php?test=dfdf",
imageUploadFields : "&lt;input type=\"hidden\" name=\"token\" value=\"d3sE3fc87\"/&gt;", // v1.5.1+
crossDomainUpload : true,
uploadCallbackURL : "http://xxxxxx/upload_callback.html?test=dfdf"
uploadCallbackURL : "http://xxxxxx/upload_callback.html?test=dfdf",
imageUploadCallback : function (result, dialog) { // v1.5.1+
console.log('imageUploadCallback: ', this, result, dialog);
}
}
```
@ -74,6 +78,14 @@ exit;
var imageDialog = window.parent.document.getElementById(query['dialog_id']);
//console.log(imageDialog, window.parent.document, window.parent, query);
if (query['callback_handler']) {
try {
window.parent[query['callback_handler']](query, imageDialog);
} catch (e) {
console.error('upload_callback: callback_handler =>', e);
}
}
&lt;/script&gt;
```</textarea>
</div>
@ -89,9 +101,13 @@ exit;
path : '../lib/',
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "http://www.ipandao.com/editor.md/examples/php/cross-domain-upload.php?test=dfdf",
imageUploadURL : "http://127.0.0.1/editor.md/examples/php/cross-domain-upload.php?test=dfdf",
imageUploadFields : "<input type=\"hidden\" name=\"token\" value=\"d3sE3fc87\"/>", // append upload form fields for CRSF etc. Server-side receives the POST parameters. v1.5.1+
crossDomainUpload : true,
uploadCallbackURL : "http://localhost/editor.md/examples/php/upload_callback.html?test=dfdf"
uploadCallbackURL : "http://localhost/editor.md/examples/php/upload_callback.html?test=dfdf",
imageUploadCallback : function (result, dialog) { // v1.5.1+
console.log('imageUploadCallback: ', this, result, dialog);
}
/*
跨域时,上传的图片服务器后台只需要返回一个跳转 URL 并跳转到原页面同域下的 callback 页面,结构如下:

14
examples/image-upload.html

@ -18,9 +18,13 @@
```javascript
{
imageUpload : false,
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php",
imageUploadFields: "&lt;input type=\"hidden\" name=\"token\" value=\"d3sE3fc87\"/&gt;", // append upload form fields for CRSF etc. v1.5.1+
imageUploadCallback : function (result, dialog) { // v1.5.1+
console.log('imageUploadCallback: ', this, result, dialog);
}
}
```
@ -44,7 +48,7 @@
height: 640,
markdown : "",
path : '../lib/',
//dialogLockScreen : false, // 设置弹出层对话框不锁屏,全局通用,默认为 true
//dialogLockScreen : false, // 设置弹出层对话框不锁屏,全局通用,默认为 false
//dialogShowMask : false, // 设置弹出层对话框显示透明遮罩层,全局通用,默认为 true
//dialogDraggable : false, // 设置弹出层对话框不可拖动,全局通用,默认为 true
//dialogMaskOpacity : 0.4, // 设置透明遮罩层的透明度,全局通用,默认值为 0.1
@ -52,7 +56,11 @@
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php?test=dfdf",
imageUploadFields: "<input type=\"hidden\" name=\"token\" value=\"d3sE3fc87\"/>", // append upload form fields for CRSF etc. Server-side receives the POST parameters. v1.5.1+
imageUploadCallback : function (result, dialog) { // v1.5.1+
console.log('imageUploadCallback: ', this, result, dialog);
}
/*
上传的后台只需要返回一个 JSON 数据,结构如下:
{

17
examples/katex.html

@ -31,8 +31,8 @@
// Default using CloudFlare KaTeX's CDN
// You can custom url
editormd.katexURL = {
js : "your url", // default: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min
css : "your url" // default: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min
js : "your url", // default: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.1/katex.min
css : "your url" // default: //cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.1/katex.min
};
```
@ -162,6 +162,13 @@ f(x) = \int_{-\infty}^\infty
}
```
```katex
\begin{cases}x^2+y^2-2x=0
\\
x^2+y^2-2x=0
\end{cases}
```
```latex
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
@ -180,6 +187,12 @@ f(x) = \int_{-\infty}^\infty
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
// custom Katex version
// editormd.katexURL = {
// css : "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.1/katex.min",
// js : "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.1/katex.min"
// };
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,

25
examples/multi-editormd.html

@ -35,28 +35,29 @@
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditormd, testEditormd2;
$(function() {
testEditormd = editormd("test-editormd", {
var testEditormd = editormd("test-editormd", {
width: "90%",
height: 480,
markdown : "#### Editor.md A",
path : '../lib/'
});
testEditormd2 = editormd("test-editormd2", {
width: "90%",
height: 480,
markdown : "#### Editor.md B",
path : '../lib/'
var testEditormd2 = editormd("test-editormd2", {
width: "50%",
height: 280,
markdown : "#### Editor.md B\n\n多个 Editor.md 并存",
path : '../lib/',
toolbarIcons: 'mini'
});
testEditormd3 = editormd("test-editormd3", {
width: "90%",
height: 480,
var testEditormd3 = editormd("test-editormd3", {
width: "60%",
height: 380,
markdown : "#### Editor.md C",
path : '../lib/'
path : '../lib/',
toolbarIcons: 'simple',
watch: false
});
});
</script>

7
examples/php/cross-domain-upload.php

@ -38,7 +38,12 @@
'maxSize' => 1024, // 允许上传的最大文件大小,以KB为单位,默认值为1024
'cover' => true // 是否覆盖同名文件,默认为true
));
$imageUploader->appendResult = array(
'callback_handler' => $_GET['callback_handler'],
'meta' => $_POST
);
$imageUploader->redirect = true;
$imageUploader->redirectURL = $callbackUrl . (empty(parse_url($callbackUrl)['query']) ? '?' : '&') . 'dialog_id=' . $_GET['dialog_id'] . '&temp=' . date('ymdhis');

25
examples/php/editormd.uploader.class.php

@ -19,6 +19,7 @@
public $saveName; // 最终保存的文件名
public $saveURL; // 最终保存URL地址
public $savePath; // 保存本地文件路径
public $appendResult = []; // 追加到输出结果的数据
public $randomLength = ''; // 生成随机文件名的长度,当为日期时为日期的格式
public $randomNameType = 1; // 生成随机的形式, NULL为保留原文件名, 1生成随机字符串, 2生成日期文件名
public $formats = array( // 允许上传的文件格式
@ -252,7 +253,7 @@
private function setSeveName()
{
$this->saveName = $this->randomFileName().".".$this->fileExt;
$this->saveName = $this->randomFileName();
if($this->saveName == '') //如果没生成随机文件名,就保留原文件名
{
@ -307,21 +308,29 @@
public function message($message, $success = 0)
{
$array = array(
'success' => $success
'success' => $success,
'message' => $message
);
$url = $this->saveURL . $this->saveName;
$array = array_merge($array, $this->appendResult);
$url = $this->saveURL . $this->saveName;
// 适用于跨域上传时,跳转到中介页面等
if ($this->redirect)
{
$this->redirectURL .= "&success=" . $success . "&message=" . $message;
foreach ($array as $key => $value) {
if (is_array($value)) {
$this->redirectURL .= '&' . $key . '=' . urlencode(json_encode($value));
} else {
$this->redirectURL .= '&' . $key . '=' . $value;
}
}
if ($success == 1)
{
$this->redirectURL .= '&url=' . $url;
}
$this->redirect();
}
else
@ -330,10 +339,6 @@
{
$array['url'] = $url;
}
else
{
$array['message'] = $message;
}
echo json_encode($array);
}

4
examples/php/upload.php

@ -38,6 +38,10 @@
'maxSize' => 1024, // 允许上传的最大文件大小,以KB为单位,默认值为1024
'cover' => true // 是否覆盖同名文件,默认为true
));
$imageUploader->appendResult = array(
'meta' => $_POST
);
if ($imageUploader->upload($name))
{

16
examples/php/upload_callback.html

@ -15,9 +15,11 @@
for (var i = 0; i< urlParams.length; i++)
{
var param = urlParams[i].split("=");
query[param[0]] = param[1];
query[param[0]] = param[0] === "meta" ? JSON.parse(decodeURIComponent(param[1])) : param[1];
}
console.log('upload_callback: result =>', JSON.stringify(query, null, ' '));
var imageDialog = window.parent.document.getElementById(query['dialog_id']);
if (parseInt(query['success']) === 1)
@ -26,10 +28,18 @@
}
else
{
alert(query['message']);
alert(decodeURIComponent(query['message']));
}
if (query['callback_handler']) {
try {
window.parent[query['callback_handler']](query, imageDialog);
} catch (e) {
console.error('upload_callback: callback_handler =>', e);
}
}
location.href = "about:blank";
location.replace("about:blank");
</script>
</body>
</html>

175
examples/sequence-diagram.html

@ -1,65 +1,110 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>SequenceDiagram - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.min.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>SequenceDiagram 时序图/序列图</h1>
<p>Based on SequenceDiagram.js:<a href="http://bramp.github.io/js-sequence-diagrams/" target="_blank">http://bramp.github.io/js-sequence-diagrams/</a></p>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Setting
{
sequenceDiagram : true
}
#### Syntax
```seq
.........
```
# or
```sequence
.........
```
#### Example
```seq
A->B: Message
B->C: Message
C->A: Message
```
```sequence
Andrew->China: Says Hello
Note right of China: China thinks\nabout it
China-->Andrew: How are you?
Andrew->>China: I am good thanks!
```</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
sequenceDiagram : true
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>SequenceDiagram - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.min.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>SequenceDiagram 时序图/序列图</h1>
<p>Based on SequenceDiagram.js:<a href="http://bramp.github.io/js-sequence-diagrams/" target="_blank">http://bramp.github.io/js-sequence-diagrams/</a></p>
<br/>
<p>Web Sequence Diagrams Syntax Examples: <a href="https://www.websequencediagrams.com/" target="_blank">https://www.websequencediagrams.com/</a></p>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Setting
{
sequenceDiagram : true
}
#### Syntax
```seq
.........
```
# or
```sequence
.........
```
#### Examples
```seq
A->B: Message
B->C: Message
C->A: Message
```
```seq
Title: Here is a title
A->B: Normal line
B-->C: Dashed line
C->>D: Open arrow
D-->>A: Dashed open arrow
```
```seq
D->A: text xxxx
A->B: text xxxx
B->A: Wow!
A->D: Hi~
```
```seq
A->A: text
A-->B: text
note right of A: Note Text
```
```seq
# Example of a comment.
Note left of A: Note to the\n left of A
Note right of A: Note to the\n right of A
Note over A: Note over A
Note over A,B: Note over both A and B
```
```seq
participant C
participant B
participant A
Note right of A: By listing the participants\n you can change their order
```
```seq
A->+B: text
B-->A: text
Note right of A: Note A
note over A,B: Note over A-B
```
```sequence
Andrew->China: Says Hello
Note right of China: China thinks\nabout it
China-->Andrew: How are you?
Andrew->>China: I am good thanks!
```</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
sequenceDiagram : true
});
});
</script>
</body>
</html>

5
examples/task-lists.html

@ -22,13 +22,13 @@
### Examples
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported;
- [x] list syntax required (any unordered or ordered list supported);
- [x] list syntax required (any unordered or ordered list supported); :heart: :blush:
- [x] this is a complete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item [test link](#);
- [x] list syntax required (any unordered or ordered list supported);
- [x] list syntax required (any unordered or ordered list supported); :smile:
- [x] this is a complete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item;
@ -53,6 +53,7 @@
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
emoji : true, // enable for test
taskList : true,
path : '../lib/',
htmlDebode : true,

732
examples/test.md

@ -1,365 +1,367 @@
# Editor.md
![](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)
![](https://img.shields.io/github/stars/pandao/editor.md.svg) ![](https://img.shields.io/github/forks/pandao/editor.md.svg) ![](https://img.shields.io/github/tag/pandao/editor.md.svg) ![](https://img.shields.io/github/release/pandao/editor.md.svg) ![](https://img.shields.io/github/issues/pandao/editor.md.svg) ![](https://img.shields.io/bower/v/editor.md.svg)
**目录 (Table of Contents)**
[TOCM]
[TOC]
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
# Heading 1 link [Heading link](https://github.com/pandao/editor.md "Heading link")
## Heading 2 link [Heading link](https://github.com/pandao/editor.md "Heading link")
### Heading 3 link [Heading link](https://github.com/pandao/editor.md "Heading link")
#### Heading 4 link [Heading link](https://github.com/pandao/editor.md "Heading link") Heading link [Heading link](https://github.com/pandao/editor.md "Heading link")
##### Heading 5 link [Heading link](https://github.com/pandao/editor.md "Heading link")
###### Heading 6 link [Heading link](https://github.com/pandao/editor.md "Heading link")
#### 标题(用底线的形式)Heading (underline)
This is an H1
=============
This is an H2
-------------
### 字符效果和横线等
----
~~删除线~~ <s>删除线(开启识别HTML标签时)</s>
*斜体字* _斜体字_
**粗体** __粗体__
***粗斜体*** ___粗斜体___
上标:X<sub>2</sub>,下标:O<sup>2</sup>
**缩写(同HTML的abbr标签)**
> 即更长的单词或短语的缩写形式,前提是开启识别HTML标签时,已默认开启
The <abbr title="Hyper Text Markup Language">HTML</abbr> specification is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.
### 引用 Blockquotes
> 引用文本 Blockquotes
引用的行内混合 Blockquotes
> 引用:如果想要插入空白换行`即<br />标签`,在插入处先键入两个以上的空格然后回车即可,[普通链接](http://localhost/)。
### 锚点与链接 Links
[普通链接](http://localhost/)
[普通链接带标题](http://localhost/ "普通链接带标题")
直接链接:<https://github.com>
[锚点链接][anchor-id]
[anchor-id]: http://www.this-anchor-link.com/
[mailto:test.test@gmail.com](mailto:test.test@gmail.com)
GFM a-tail link @pandao 邮箱地址自动链接 test.test@gmail.com www@vip.qq.com
> @pandao
### 多语言代码高亮 Codes
#### 行内代码 Inline code
执行命令:`npm install marked`
#### 缩进风格
即缩进四个空格,也做为实现类似 `<pre>` 预格式化文本 ( Preformatted Text ) 的功能。
<?php
echo "Hello world!";
?>
预格式化文本:
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
#### JS代码 
```javascript
function test() {
console.log("Hello world!");
}
(function(){
var box = function() {
return box.fn.init();
};
box.prototype = box.fn = {
init : function(){
console.log('box.init()');
return this;
},
add : function(str) {
alert("add", str);
return this;
},
remove : function(str) {
alert("remove", str);
return this;
}
};
box.fn.init.prototype = box.fn;
window.box =box;
})();
var testBox = box();
testBox.add("jQuery").remove("jQuery");
```
#### HTML 代码 HTML codes
```html
<!DOCTYPE html>
<html>
<head>
<mate charest="utf-8" />
<meta name="keywords" content="Editor.md, Markdown, Editor" />
<title>Hello world!</title>
<style type="text/css">
body{font-size:14px;color:#444;font-family: "Microsoft Yahei", Tahoma, "Hiragino Sans GB", Arial;background:#fff;}
ul{list-style: none;}
img{border:none;vertical-align: middle;}
</style>
</head>
<body>
<h1 class="text-xxl">Hello world!</h1>
<p class="text-green">Plain text</p>
</body>
</html>
```
### 图片 Images
Image:
![](https://pandao.github.io/editor.md/examples/images/4.jpg)
> Follow your heart.
![](https://pandao.github.io/editor.md/examples/images/8.jpg)
> 图为:厦门白城沙滩
图片加链接 (Image + Link):
[![](https://pandao.github.io/editor.md/examples/images/7.jpg)](https://pandao.github.io/editor.md/images/7.jpg "李健首张专辑《似水流年》封面")
> 图为:李健首张专辑《似水流年》封面
----
### 列表 Lists
#### 无序列表(减号)Unordered Lists (-)
- 列表一
- 列表二
- 列表三
#### 无序列表(星号)Unordered Lists (*)
* 列表一
* 列表二
* 列表三
#### 无序列表(加号和嵌套)Unordered Lists (+)
+ 列表一
+ 列表二
+ 列表二-1
+ 列表二-2
+ 列表二-3
+ 列表三
* 列表一
* 列表二
* 列表三
#### 有序列表 Ordered Lists (-)
1. 第一行
2. 第二行
3. 第三行
#### GFM task list
- [x] GFM task list 1
- [x] GFM task list 2
- [ ] GFM task list 3
- [ ] GFM task list 3-1
- [ ] GFM task list 3-2
- [ ] GFM task list 3-3
- [ ] GFM task list 4
- [ ] GFM task list 4-1
- [ ] GFM task list 4-2
----
### 绘制表格 Tables
| 项目 | 价格 | 数量 |
| -------- | -----: | :----: |
| 计算机 | $1600 | 5 |
| 手机 | $12 | 12 |
| 管线 | $1 | 234 |
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
| Function name | Description |
| ------------- | ------------------------------ |
| `help()` | Display the help window. |
| `destroy()` | **Destroy your computer!** |
| Left-Aligned | Center Aligned | Right Aligned |
| :------------ |:---------------:| -----:|
| col 3 is | some wordy text | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
| Item | Value |
| --------- | -----:|
| Computer | $1600 |
| Phone | $12 |
| Pipe | $1 |
----
#### 特殊符号 HTML Entities Codes
&copy; & &uml; &trade; &iexcl; &pound;
&amp; &lt; &gt; &yen; &euro; &reg; &plusmn; &para; &sect; &brvbar; &macr; &laquo; &middot;
X&sup2; Y&sup3; &frac34; &frac14; &times; &divide; &raquo;
18&ordm;C &quot; &apos;
[========]
### Emoji表情 :smiley:
> Blockquotes :star:
#### GFM task lists & Emoji & fontAwesome icon emoji & editormd logo emoji :editormd-logo-5x:
- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;
- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
- [x] [ ] :smiley: this is a complete item :smiley:;
- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;
- [ ] [ ]this is an incomplete item :fa-star: :fa-gear:;
- [ ] :smiley: this is an incomplete item [test link](#) :fa-star: :fa-gear:;
- [ ] :smiley: this is :fa-star: :fa-gear: an incomplete item [test link](#);
#### 反斜杠 Escape
\*literal asterisks\*
[========]
### 科学公式 TeX(KaTeX)
$$E=mc^2$$
行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。
$$x > y$$
$$\(\sqrt{3x-1}+(1+x)^2\)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
多行公式:
```math
\displaystyle
\left( \sum\_{k=1}^n a\_k b\_k \right)^2
\leq
\left( \sum\_{k=1}^n a\_k^2 \right)
\left( \sum\_{k=1}^n b\_k^2 \right)
```
```katex
\displaystyle
\frac{1}{
\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{
\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {
1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}}
{1+\cdots} }
}
}
```
```latex
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
\,d\xi
```
### 分页符 Page break
> Print Test: Ctrl + P
[========]
### 绘制流程图 Flowchart
```flow
st=>start: 用户登陆
op=>operation: 登陆操作
cond=>condition: 登陆成功 Yes or No?
e=>end: 进入后台
st->op->cond
cond(yes)->e
cond(no)->op
```
[========]
### 绘制序列图 Sequence Diagram
```seq
Andrew->China: Says Hello
Note right of China: China thinks\nabout it
China-->Andrew: How are you?
Andrew->>China: I am good thanks!
```
### End
# Editor.md
![](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)
![](https://img.shields.io/github/stars/pandao/editor.md.svg) ![](https://img.shields.io/github/forks/pandao/editor.md.svg) ![](https://img.shields.io/github/tag/pandao/editor.md.svg) ![](https://img.shields.io/github/release/pandao/editor.md.svg) ![](https://img.shields.io/github/issues/pandao/editor.md.svg) ![](https://img.shields.io/bower/v/editor.md.svg)
**目录 (Table of Contents)**
[TOCM]
[TOC]
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
# Heading 1 link [Heading link](https://github.com/pandao/editor.md "Heading link")
## Heading 2 link [Heading link](https://github.com/pandao/editor.md "Heading link")
### Heading 3 link [Heading link](https://github.com/pandao/editor.md "Heading link")
#### Heading 4 link [Heading link](https://github.com/pandao/editor.md "Heading link") Heading link [Heading link](https://github.com/pandao/editor.md "Heading link")
##### Heading 5 link [Heading link](https://github.com/pandao/editor.md "Heading link")
###### Heading 6 link [Heading link](https://github.com/pandao/editor.md "Heading link")
#### 标题(用底线的形式)Heading (underline)
This is an H1
=============
This is an H2
-------------
### 字符效果和横线等
----
~~删除线~~ <s>删除线(开启识别HTML标签时)</s>
*斜体字* _斜体字_
**粗体** __粗体__
***粗斜体*** ___粗斜体___
上标:X<sub>2</sub>,下标:O<sup>2</sup>
**缩写(同HTML的abbr标签)**
> 即更长的单词或短语的缩写形式,前提是开启识别HTML标签时,已默认开启
The <abbr title="Hyper Text Markup Language">HTML</abbr> specification is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.
### 引用 Blockquotes
> 引用文本 Blockquotes
引用的行内混合 Blockquotes
> 引用:如果想要插入空白换行`即<br />标签`,在插入处先键入两个以上的空格然后回车即可,[普通链接](http://localhost/)。
### 锚点与链接 Links
[普通链接](http://localhost/)
[普通链接带标题](http://localhost/ "普通链接带标题")
直接链接:<https://github.com>
[锚点链接][anchor-id]
[anchor-id]: http://www.this-anchor-link.com/
[mailto:test.test@gmail.com](mailto:test.test@gmail.com)
GFM a-tail link @pandao 邮箱地址自动链接 test.test@gmail.com www@vip.qq.com
> @pandao
### 多语言代码高亮 Codes
#### 行内代码 Inline code
执行命令:`npm install marked`
#### 缩进风格
即缩进四个空格,也做为实现类似 `<pre>` 预格式化文本 ( Preformatted Text ) 的功能。
<?php
echo "Hello world!";
?>
预格式化文本:
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
#### JS代码
```javascript
function test() {
console.log("Hello world!");
}
(function(){
var box = function() {
return box.fn.init();
};
box.prototype = box.fn = {
init : function(){
console.log('box.init()');
return this;
},
add : function(str) {
alert("add", str);
return this;
},
remove : function(str) {
alert("remove", str);
return this;
}
};
box.fn.init.prototype = box.fn;
window.box =box;
})();
var testBox = box();
testBox.add("jQuery").remove("jQuery");
```
#### HTML 代码 HTML codes
```html
<!DOCTYPE html>
<html>
<head>
<mate charest="utf-8" />
<meta name="keywords" content="Editor.md, Markdown, Editor" />
<title>Hello world!</title>
<style type="text/css">
body{font-size:14px;color:#444;font-family: "Microsoft Yahei", Tahoma, "Hiragino Sans GB", Arial;background:#fff;}
ul{list-style: none;}
img{border:none;vertical-align: middle;}
</style>
</head>
<body>
<h1 class="text-xxl">Hello world!</h1>
<p class="text-green">Plain text</p>
</body>
</html>
```
### 图片 Images
Image:
![](https://pandao.github.io/editor.md/examples/images/4.jpg)
> Follow your heart.
![](https://pandao.github.io/editor.md/examples/images/8.jpg)
> 图为:厦门白城沙滩
图片加链接 (Image + Link):
[![](https://pandao.github.io/editor.md/examples/images/7.jpg)](https://pandao.github.io/editor.md/images/7.jpg "李健首张专辑《似水流年》封面")
> 图为:李健首张专辑《似水流年》封面
----
### 列表 Lists
#### 无序列表(减号)Unordered Lists (-)
- 列表一
- 列表二
- 列表三
#### 无序列表(星号)Unordered Lists (*)
* 列表一
* 列表二
* 列表三
#### 无序列表(加号和嵌套)Unordered Lists (+)
+ 列表一
+ 列表二
+ 列表二-1
+ 列表二-2
+ 列表二-3
+ 列表三
* 列表一
* 列表二
* 列表三
#### 有序列表 Ordered Lists (-)
1. 第一行
2. 第二行
3. 第三行
#### GFM task list
- [x] GFM task list 1
- [x] GFM task list 2
- [ ] GFM task list 3
- [ ] GFM task list 3-1
- [ ] GFM task list 3-2
- [ ] GFM task list 3-3
- [ ] GFM task list 4
- [ ] GFM task list 4-1
- [ ] GFM task list 4-2
----
### 绘制表格 Tables
| 项目 | 价格 | 数量 |
| -------- | -----: | :----: |
| 计算机 | $1600 | 5 |
| 手机 | $12 | 12 |
| 管线 | $1 | 234 |
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
| Function name | Description |
| ------------- | ------------------------------ |
| `help()` | Display the help window. |
| `destroy()` | **Destroy your computer!** |
| Left-Aligned | Center Aligned | Right Aligned |
| :------------ |:---------------:| -----:|
| col 3 is | some wordy text | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
| Item | Value |
| --------- | -----:|
| Computer | $1600 |
| Phone | $12 |
| Pipe | $1 |
----
#### 特殊符号 HTML Entities Codes
&copy; & &uml; &trade; &iexcl; &pound;
&amp; &lt; &gt; &yen; &euro; &reg; &plusmn; &para; &sect; &brvbar; &macr; &laquo; &middot;
X&sup2; Y&sup3; &frac34; &frac14; &times; &divide; &raquo;
18&ordm;C &quot; &apos;
#### **简要描述**
[========]
### Emoji表情 :smiley:
> Blockquotes :star:
#### GFM task lists & Emoji & fontAwesome icon emoji & editormd logo emoji :editormd-logo-2x:
- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;
- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
- [x] [ ] :smiley: this is a complete item :smiley:;
- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;
- [ ] [ ]this is an incomplete item :fa-star: :fa-gear:;
- [ ] :smiley: this is an incomplete item [test link](#) :fa-star: :fa-gear:;
- [ ] :smiley: this is :fa-star: :fa-gear: an incomplete item [test link](#);
#### 反斜杠 Escape
\*literal asterisks\*
[========]
### 科学公式 TeX(KaTeX)
$$E=mc^2$$
行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。
$$x > y$$
$$\(\sqrt{3x-1}+(1+x)^2\)$$
$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$
多行公式:
```math
\displaystyle
\left( \sum\_{k=1}^n a\_k b\_k \right)^2
\leq
\left( \sum\_{k=1}^n a\_k^2 \right)
\left( \sum\_{k=1}^n b\_k^2 \right)
```
```katex
\displaystyle
\frac{1}{
\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{
\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {
1+\frac{e^{-6\pi}}
{1+\frac{e^{-8\pi}}
{1+\cdots} }
}
}
```
```latex
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
\,d\xi
```
### 分页符 Page break
> Print Test: Ctrl + P
[========]
### 绘制流程图 Flowchart
```flow
st=>start: 用户登陆
op=>operation: 登陆操作
cond=>condition: 登陆成功 Yes or No?
e=>end: 进入后台
st->op->cond
cond(yes)->e
cond(no)->op
```
[========]
### 绘制序列图 Sequence Diagram
```seq
Andrew->China: Says Hello
Note right of China: China thinks\nabout it
China-->Andrew: How are you?
Andrew->>China: I am good thanks!
```
### End

257
examples/toolbar-auto-fixed.html

@ -1,122 +1,135 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Toolbar auto fixed - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout" style="height:3000px;">
<header>
<h1>工具栏自动固定定位的开启与禁用</h1>
<p>Enable / disable toolbar auto fixed position.</p>
</header>
<div class="btns">
<button id="enable-btn">Enable</button>
<button id="disable-btn">Disable</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">### Hello world!
codemirror
In-browser code editor
codemirror 6291 3 days ago
angular-ui-codemirror
This directive allows you to add CodeMirror to your textarea elements.
angular-ui 174 6 weeks ago
share-codemirror
Codemirror bindings for ShareJS
share 24 3 months ago
requirejs-codemirror
Load codemirror with needed modes and appending codemirror's css only when needed
tuchk4 14 2 months ago
codemirror-interactive-numbers
Drag and update literal numbers inside codemirror
fullstackio 4 17 months ago
cm-searchbox
CodeMirror addon for search and replace
coderaiser 3 4 days ago
ng-codemirror-dictionary-hint
Angular directive that adds hint support to a Codemirror instance based on a custom dictionary.
amarnus 3 3 months ago
opentok-editor
A real time collaborative editor for OpenTok using CodeMirror and ot.js
aullman 3 2 weeks ago
cirru-mode
Cirru mode for CodeMorror
Cirru 2 12 months ago
ckeditor-codemirror
A bower wrapper for the ckeditor codemirror plugin
friedolinfoerder 1 2 weeks ago
cm-show-invisibles
Addon for CodeMirror that helps to show invisibles.
coderaiser 1 6 days ago
angular-codemirror
Add CodeMirror to your AngularJS app
chouseknecht 0 12 months ago
codemirror-chord
Codemirror mode for guitar chords
zabudipar 0 3 weeks ago
codemirror-states
Export and import CodeMirror line classes, line widgets and markers
lusever 0 12 days ago
ember-cli-codemirror-shim
ES6 module shim for CodeMirror.
IvyApp 0 3 months ago
ivy-codemirror
Shim repository for ivy-codemirror.
IvyApp 0 2 months ago
ng-codemirror
Allows you to integrate AngularJS and Codemirror with compatibility for RequireJS 2.x.
VictorQueiroz 0 4 months ago
sml-codemirror-mode
Bower Distribution of the Sparqlification Mapping Language (SML) Syntax Highlighting Mode for CodeMirror
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width : "90%",
height : 1600,
path : "../lib/"
});
$("#enable-btn").bind("click", function() {
testEditor.setToolbarAutoFixed(true);
// or
//testEditor.config("toolbarAutoFixed", true);
});
$("#disable-btn").bind("click", function() {
testEditor.setToolbarAutoFixed(false);
// or
//testEditor.config("toolbarAutoFixed", false);
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Toolbar auto fixed - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout" style="height: 4000px;">
<header>
<h1>工具栏自动固定定位的开启与禁用</h1>
<p>Enable / disable toolbar auto fixed position.</p>
</header>
<div class="btns">
<button id="enable-btn">Enable</button>
<button id="disable-btn">Disable</button>
<button id="set-offset-btn">Set editor offset(random)</button>
<button id="reset-offset-btn">Reset editor offset</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">### Hello world!
codemirror
In-browser code editor
codemirror 6291 3 days ago
angular-ui-codemirror
This directive allows you to add CodeMirror to your textarea elements.
angular-ui 174 6 weeks ago
share-codemirror
Codemirror bindings for ShareJS
share 24 3 months ago
requirejs-codemirror
Load codemirror with needed modes and appending codemirror's css only when needed
tuchk4 14 2 months ago
codemirror-interactive-numbers
Drag and update literal numbers inside codemirror
fullstackio 4 17 months ago
cm-searchbox
CodeMirror addon for search and replace
coderaiser 3 4 days ago
ng-codemirror-dictionary-hint
Angular directive that adds hint support to a Codemirror instance based on a custom dictionary.
amarnus 3 3 months ago
opentok-editor
A real time collaborative editor for OpenTok using CodeMirror and ot.js
aullman 3 2 weeks ago
cirru-mode
Cirru mode for CodeMorror
Cirru 2 12 months ago
ckeditor-codemirror
A bower wrapper for the ckeditor codemirror plugin
friedolinfoerder 1 2 weeks ago
cm-show-invisibles
Addon for CodeMirror that helps to show invisibles.
coderaiser 1 6 days ago
angular-codemirror
Add CodeMirror to your AngularJS app
chouseknecht 0 12 months ago
codemirror-chord
Codemirror mode for guitar chords
zabudipar 0 3 weeks ago
codemirror-states
Export and import CodeMirror line classes, line widgets and markers
lusever 0 12 days ago
ember-cli-codemirror-shim
ES6 module shim for CodeMirror.
IvyApp 0 3 months ago
ivy-codemirror
Shim repository for ivy-codemirror.
IvyApp 0 2 months ago
ng-codemirror
Allows you to integrate AngularJS and Codemirror with compatibility for RequireJS 2.x.
VictorQueiroz 0 4 months ago
sml-codemirror-mode
Bower Distribution of the Sparqlification Mapping Language (SML) Syntax Highlighting Mode for CodeMirror
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width : "90%",
height : 1600,
path : "../lib/"
});
$("#enable-btn").bind("click", function() {
testEditor.setToolbarAutoFixed(true);
// or
//testEditor.config("toolbarAutoFixed", true);
});
$("#disable-btn").bind("click", function() {
testEditor.setToolbarAutoFixed(false);
// or
//testEditor.config("toolbarAutoFixed", false);
});
$("#set-offset-btn").click(function () {
testEditor.editor.css({
marginLeft: editormd.rand(0, 200) + "px",
marginTop: editormd.rand(0, 1000) + "px"
})
});
$("#reset-offset-btn").click(function () {
testEditor.editor.css("margin", "0 auto");
});
});
</script>
</body>
</html>

0
examples/uploads/.gitkeep

2
examples/use-zepto.html

@ -59,7 +59,7 @@
htmlDecode : "style,script,iframe|on*", // 开启 HTML 标签解析,为了安全性,默认不开启
emoji : true,
taskList : true,
tocm : true, // Using [TOCM]
tocm : true, // Using [TOCM]
tex : true, // 开启科学公式 TeX 语言支持,默认关闭
//previewCodeHighlight : false, // 关闭预览窗口的代码高亮,默认开启
flowChart : true,

4
languages/zh-tw.js

@ -78,7 +78,7 @@
preformattedText : {
title : "添加預格式文本或代碼塊",
emptyAlert : "錯誤:請填寫預格式文本或代碼的內容。",
placeholder : "coding now...."
placeholder : "Coding now...."
},
codeBlock : {
title : "添加代碼塊",
@ -87,7 +87,7 @@
otherLanguage : "其他語言",
unselectedLanguageAlert : "錯誤:請選擇代碼所屬的語言類型。",
codeEmptyAlert : "錯誤:請填寫代碼內容。",
placeholder: : "coding now...."
placeholder : "Coding now...."
},
htmlEntities : {
title : "HTML實體字符"

6
lib/codemirror/addons.min.js

File diff suppressed because one or more lines are too long

12
lib/codemirror/modes.min.js

File diff suppressed because one or more lines are too long

11
lib/marked.min.js

File diff suppressed because one or more lines are too long

8
lib/sequence-diagram.min.js

File diff suppressed because one or more lines are too long

4
package.json

@ -1,6 +1,6 @@
{
"name": "editor.md",
"version": "1.5.0",
"version": "1.5.1",
"description": "Open source online markdown editor.",
"directories": {
"doc": "docs",
@ -8,6 +8,8 @@
"test": "tests"
},
"scripts": {
"dev": "gulp watch",
"build": "gulp",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

4
plugins/code-block-dialog/code-block-dialog.js

@ -127,11 +127,15 @@
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]
}

639
plugins/emoji-dialog/emoji-dialog.js

@ -1,327 +1,312 @@
/*!
* Emoji dialog plugin for Editor.md
*
* @file emoji-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "emoji-dialog";
var emojiTabIndex = 0;
var emojiData = [];
var selecteds = [];
var logoPrefix = "editormd-logo";
var logos = [
logoPrefix,
logoPrefix + "-1x",
logoPrefix + "-2x",
logoPrefix + "-3x",
logoPrefix + "-4x",
logoPrefix + "-5x",
logoPrefix + "-6x",
logoPrefix + "-7x",
logoPrefix + "-8x"
];
var langs = {
"zh-cn" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"zh-tw" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"en" : {
toolbar : {
emoji : "Emoji"
},
dialog : {
emoji : {
title : "Emoji"
}
}
}
};
exports.fn.emojiDialog = function() {
var _this = this;
var cm = this.cm;
var settings = _this.settings;
if (!settings.emoji)
{
alert("settings.emoji == false");
return ;
}
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.emoji;
var dialogContent = [
"<div class=\"" + classPrefix + "emoji-dialog-box\" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;\">",
"<div class=\"" + classPrefix + "tab\"></div>",
"</div>",
].join("\n");
cm.focus();
if (editor.find("." + dialogName).length > 0)
{
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
}
else
{
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 475,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"];
var tab = dialog.find("." + classPrefix + "tab");
if (tab.html() === "")
{
var head = "<ul class=\"" + classPrefix + "tab-head\">";
for (var i = 0; i<4; i++) {
var active = (i === 0) ? " class=\"active\"" : "";
head += "<li" + active + "><a href=\"javascript:;\">" + category[i] + "</a></li>";
}
head += "</ul>";
tab.append(head);
var container = "<div class=\"" + classPrefix + "tab-container\">";
for (var x = 0; x < 4; x++)
{
var display = (x === 0) ? "" : "display:none;";
container += "<div class=\"" + classPrefix + "tab-box\" style=\"height: 260px;overflow: hidden;overflow-y: auto;" + display + "\"></div>";
}
container += "</div>";
tab.append(container);
}
var tabBoxs = tab.find("." + classPrefix + "tab-box");
var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix];
var drawTable = function() {
var cname = emojiCategories[emojiTabIndex];
var $data = emojiData[cname];
var $tab = tabBoxs.eq(emojiTabIndex);
if ($tab.html() !== "") {
//console.log("break =>", cname);
return ;
}
var pagination = function(data, type) {
var rowNumber = (type === "editormd-logo") ? "5" : 20;
var pageTotal = Math.ceil(data.length / rowNumber);
var table = "<div class=\"" + classPrefix + "grid-table\">";
for (var i = 0; i < pageTotal; i++)
{
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++)
{
var emoji = $.trim(data[(i * rowNumber) + x]);
if (typeof emoji !== "undefined" && emoji !== "")
{
var img = "", icon = "";
if (type === "github-emoji")
{
var src = (emoji === "+1") ? "plus1" : emoji;
src = (src === "black_large_square") ? "black_square" : src;
src = (src === "moon") ? "waxing_gibbous_moon" : src;
src = exports.emoji.path + src + exports.emoji.ext;
img = "<img src=\"" + src + "\" width=\"24\" class=\"emoji\" title=\"&#58;" + emoji + "&#58;\" alt=\"&#58;" + emoji + "&#58;\" />";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "twemoji")
{
var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext;
img = "<img src=\"" + twemojiSrc + "\" width=\"24\" title=\"twemoji-" + emoji + "\" alt=\"twemoji-" + emoji + "\" class=\"emoji twemoji\" />";
row += "<a href=\"javascript:;\" value=\":tw-" + emoji + ":\" title=\":tw-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
}
else if (type === "font-awesome")
{
icon = "<i class=\"fa fa-" + emoji + " fa-emoji\" title=\"" + emoji + "\"></i>";
row += "<a href=\"javascript:;\" value=\":fa-" + emoji + ":\" title=\":fa-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
else if (type === "editormd-logo")
{
icon = "<i class=\"" + emoji + "\" title=\"Editor.md logo (" + emoji + ")\"></i>";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" style=\"width:20%;\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
}
else
{
row += "<a href=\"javascript:;\" value=\"\"></a>";
}
}
row += "</div>";
table += row;
}
table += "</div>";
return table;
};
if (emojiTabIndex === 0)
{
for (var i = 0, len = $data.length; i < len; i++)
{
var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\"";
$tab.append("<h4" + h4Style + ">" + $data[i].category + "</h4>");
$tab.append(pagination($data[i].list, cname));
}
}
else
{
$tab.append(pagination($data, cname));
}
$tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected"))
{
selecteds.push($(this).attr("value"));
}
});
};
if (emojiData.length < 1)
{
if (typeof dialog.loading === "function") {
dialog.loading(true);
}
$.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) {
if (typeof dialog.loading === "function") {
dialog.loading(false);
}
emojiData = json;
emojiData[logoPrefix] = logos;
drawTable();
});
}
else
{
drawTable();
}
tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() {
var $this = $(this);
emojiTabIndex = $this.index();
$this.addClass("active").siblings().removeClass("active");
tabBoxs.eq(emojiTabIndex).show().siblings().hide();
drawTable();
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
/*!
* Emoji dialog plugin for Editor.md
*
* @file emoji-dialog.js
* @author pandao
* @version 1.2.0
* @updateTime 2015-03-08
* {@link https://github.com/pandao/editor.md}
* @license MIT
*/
(function() {
var factory = function (exports) {
var $ = jQuery;
var pluginName = "emoji-dialog";
var emojiTabIndex = 0;
var emojiData = [];
var selecteds = [];
var logoPrefix = "editormd-logo";
var logos = [
logoPrefix,
logoPrefix + "-1x",
logoPrefix + "-2x",
logoPrefix + "-3x",
logoPrefix + "-4x",
logoPrefix + "-5x",
logoPrefix + "-6x",
logoPrefix + "-7x",
logoPrefix + "-8x"
];
var langs = {
"zh-cn" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"zh-tw" : {
toolbar : {
emoji : "Emoji 表情"
},
dialog : {
emoji : {
title : "Emoji 表情"
}
}
},
"en" : {
toolbar : {
emoji : "Emoji"
},
dialog : {
emoji : {
title : "Emoji"
}
}
}
};
exports.fn.emojiDialog = function() {
var _this = this;
var cm = this.cm;
var settings = _this.settings;
if (!settings.emoji) {
alert("settings.emoji == false");
return false;
}
var path = settings.pluginPath + pluginName + "/";
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
var classPrefix = this.classPrefix;
$.extend(true, this.lang, langs[this.lang.name]);
this.setToolbar();
var lang = this.lang;
var dialogName = classPrefix + pluginName, dialog;
var dialogLang = lang.dialog.emoji;
var categoryNames = {
"github-emoji" : "Github emoji",
"twemoji" : "Twemoji",
"font-awesome" : "Font Awesome",
"editormd-logo" : "Editor.md logo"
};
var dialogContent = [
"<div class=\"" + classPrefix + "emoji-dialog-box\" style=\"width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;\">",
"<div class=\"" + classPrefix + "tab\"></div>",
"</div>",
].join("\n");
cm.focus();
if (editor.find("." + dialogName).length > 0) {
dialog = editor.find("." + dialogName);
selecteds = [];
dialog.find("a").removeClass("selected");
this.dialogShowMask(dialog);
this.dialogLockScreen();
dialog.show();
} else {
dialog = this.createDialog({
name : dialogName,
title : dialogLang.title,
width : 800,
height : 480,
mask : settings.dialogShowMask,
drag : settings.dialogDraggable,
cached : true,
content : dialogContent,
lockScreen : settings.dialogLockScreen,
maskStyle : {
opacity : settings.dialogMaskOpacity,
backgroundColor : settings.dialogMaskBgColor
},
buttons : {
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
return false;
}]
}
});
}
var tab = dialog.find("." + classPrefix + "tab");
var tabTitles = [];
var emojiCategories = [];
if (settings.emojiCategories) {
$.each(settings.emojiCategories, function (key, value) {
emojiCategories.push(value);
tabTitles.push(categoryNames[value]);
});
}
if (tab.html() === "") {
var head = "<ul class=\"" + classPrefix + "tab-head\">";
var tabTotal = tabTitles.length;
for (var i = 0; i < tabTotal; i++) {
var active = (i === 0) ? " class=\"active\"" : "";
head += "<li" + active + "><a href=\"javascript:;\">" + tabTitles[i] + "</a></li>";
}
head += "</ul>";
tab.append(head);
var container = "<div class=\"" + classPrefix + "tab-container\">";
for (var x = 0; x < tabTotal; x++) {
var display = (x === 0) ? "" : "display:none;";
container += "<div class=\"" + classPrefix + "tab-box\" style=\"height: 320px;overflow: hidden;overflow-y: auto;" + display + "\"></div>";
}
container += "</div>";
tab.append(container);
}
var tabBoxs = tab.find("." + classPrefix + "tab-box");
var drawTable = function() {
var cname = emojiCategories[emojiTabIndex];
var $data = emojiData[cname];
var $tab = tabBoxs.eq(emojiTabIndex);
if ($tab.html() !== "") {
return ;
}
var pagination = function(data, type) {
var rowNumber = (type === "editormd-logo") ? "5" : 20;
var pageTotal = Math.ceil(data.length / rowNumber);
var table = "<div class=\"" + classPrefix + "grid-table\">";
for (var i = 0; i < pageTotal; i++) {
var row = "<div class=\"" + classPrefix + "grid-table-row\">";
for (var x = 0; x < rowNumber; x++) {
var emoji = $.trim(data[(i * rowNumber) + x]);
if (typeof emoji !== "undefined" && emoji !== "") {
var img = "", icon = "";
if (type === "github-emoji") {
var src = (emoji === "+1") ? "plus1" : emoji;
src = (src === "black_large_square") ? "black_square" : src;
src = (src === "moon") ? "waxing_gibbous_moon" : src;
src = exports.emoji.path + src + exports.emoji.ext;
img = "<img src=\"" + src + "\" width=\"24\" class=\"emoji\" title=\"&#58;" + emoji + "&#58;\" alt=\"&#58;" + emoji + "&#58;\" />";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
} else if (type === "twemoji") {
var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext;
img = "<img src=\"" + twemojiSrc + "\" width=\"24\" title=\"twemoji-" + emoji + "\" alt=\"twemoji-" + emoji + "\" class=\"emoji twemoji\" />";
row += "<a href=\"javascript:;\" value=\":tw-" + emoji + ":\" title=\":tw-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + img + "</a>";
} else if (type === "font-awesome") {
icon = "<i class=\"fa fa-" + emoji + " fa-emoji\" title=\"" + emoji + "\"></i>";
row += "<a href=\"javascript:;\" value=\":fa-" + emoji + ":\" title=\":fa-" + emoji + ":\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
} else if (type === "editormd-logo") {
icon = "<i class=\"" + emoji + "\" title=\"Editor.md logo (" + emoji + ")\"></i>";
row += "<a href=\"javascript:;\" value=\":" + emoji + ":\" title=\":" + emoji + ":\" style=\"width:20%;\" class=\"" + classPrefix + "emoji-btn\">" + icon + "</a>";
}
} else {
row += "<a href=\"javascript:;\" value=\"\"></a>";
}
}
row += "</div>";
table += row;
}
table += "</div>";
return table;
};
if (cname === "github-emoji") {
for (var i = 0, len = $data.length; i < len; i++) {
var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\"";
$tab.append("<h4" + h4Style + ">" + $data[i].category + "</h4>");
$tab.append(pagination($data[i].list, cname));
}
} else {
$tab.append(pagination($data, cname));
}
$tab.find("." + classPrefix + "emoji-btn").bind("click", function() {
$(this).toggleClass("selected");
if ($(this).hasClass("selected")) {
selecteds.push($(this).attr("value"));
}
});
};
if (emojiData.length < 1) {
if (typeof dialog.loading === "function") {
dialog.loading(true);
}
$.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) {
if (typeof dialog.loading === "function") {
dialog.loading(false);
}
emojiData = json;
emojiData[logoPrefix] = logos;
drawTable();
});
} else {
drawTable();
}
tab.find("li").bind("click", function() {
var $this = $(this);
emojiTabIndex = $this.index();
$this.addClass("active").siblings().removeClass("active");
tabBoxs.eq(emojiTabIndex).show().siblings().hide();
drawTable();
});
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
module.exports = factory;
} else if (typeof define === "function") { // AMD/CMD/Sea.js
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
} else {
factory(window.editormd);
}
})();

4
plugins/goto-line-dialog/goto-line-dialog.js

@ -108,12 +108,16 @@
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]
}

2
plugins/help-dialog/help-dialog.js

@ -46,6 +46,8 @@
buttons : {
close : [lang.buttons.close, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]

4
plugins/html-entities-dialog/html-entities-dialog.js

@ -71,11 +71,15 @@
enter : [lang.buttons.enter, function() {
cm.replaceSelection(selecteds.join(" "));
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]

53
plugins/image-dialog/image-dialog.js

@ -41,18 +41,43 @@
var guid = (new Date).getTime();
var action = settings.imageUploadURL + (settings.imageUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid;
var imageUploadCallback = function (json, dialog) {
if (typeof settings.imageUploadCallback === 'function') {
$.proxy(settings.imageUploadCallback, _this)(json, dialog);
}
};
if (settings.crossDomainUpload)
{
var callbackName = settings.imageUploadCallbackName;
window[callbackName] = imageUploadCallback;
action += "&callback_handler=" + callbackName;
action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-image-dialog-" + guid;
settings.imageUploadFields += "<input type=\"hidden\" name=\"callback\" value=\"" + settings.uploadCallbackURL + "\" />";
settings.imageUploadFields += "<input type=\"hidden\" name=\"callback_handler\" value=\"" + callbackName + "\" />";
settings.imageUploadFields += "<input type=\"hidden\" name=\"dialog_id\" value=\"editormd-image-dialog-" + guid + "\" />";
}
var dialogContent = ( (settings.imageUpload) ? "<form action=\"" + action +"\" target=\"" + iframeName + "\" method=\"post\" enctype=\"multipart/form-data\" class=\"" + classPrefix + "form\">" : "<div class=\"" + classPrefix + "form\">" ) +
var imageUploadAccept = [];
settings.imageFormats.forEach(function (format) {
imageUploadAccept.push("image/" + format);
});
imageUploadAccept.join(",");
var dialogContent = ( (settings.imageUpload) ? "<form action=\"" + action + "\" target=\"" + iframeName + "\" method=\"post\" enctype=\"multipart/form-data\" class=\"" + classPrefix + "form\">" : "<div class=\"" + classPrefix + "form\">" ) +
( (settings.imageUpload) ? "<iframe name=\"" + iframeName + "\" id=\"" + iframeName + "\" guid=\"" + guid + "\"></iframe>" : "" ) +
"<label>" + imageLang.url + "</label>" +
"<input type=\"text\" data-url />" + (function(){
return (settings.imageUpload) ? "<div class=\"" + classPrefix + "file-input\">" +
"<input type=\"file\" name=\"" + classPrefix + "image-file\" accept=\"image/*\" />" +
"<input type=\"file\" name=\"" + classPrefix + "image-file\" accept=\"" + imageUploadAccept + "\" />" +
"<input type=\"submit\" value=\"" + imageLang.uploadButton + "\" />" +
"<input type=\"hidden\" name=\"guid\" value=\"" + guid + "\" />" +
settings.imageUploadFields +
"</div>" : "";
})() +
"<br/>" +
@ -108,7 +133,6 @@
this.hide().lockScreen(false).hideMask();
//删除对话框
this.remove();
return false;
@ -117,7 +141,6 @@
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
//删除对话框
this.remove();
return false;
@ -168,21 +191,25 @@
if(!settings.crossDomainUpload)
{
if (json.success === 1)
{
dialog.find("[data-url]").val(json.url);
}
else
{
alert(json.message);
}
if (json.success === 1)
{
dialog.find("[data-url]").val(json.url);
}
else
{
alert(json.message);
}
if (typeof settings.imageUploadCallback === 'function') {
$.proxy(settings.imageUploadCallback, _this)(json, dialog);
}
}
return false;
};
};
dialog.find("[type=\"submit\"]").bind("click", submitHandler).trigger("click");
dialog.find('form').on("submit", submitHandler).trigger("submit");
});
}

4
plugins/link-dialog/link-dialog.js

@ -90,12 +90,16 @@
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]
}

2
plugins/preformatted-text-dialog/preformatted-text-dialog.js

@ -82,11 +82,13 @@
cm.replaceSelection(codeTexts);
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]

4
plugins/reference-link-dialog/reference-link-dialog.js

@ -99,11 +99,15 @@
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]
}

4
plugins/table-dialog/table-dialog.js

@ -155,12 +155,16 @@
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}],
cancel : [lang.buttons.cancel, function() {
this.hide().lockScreen(false).hideMask();
this.remove();
return false;
}]
}

368
scss/editormd.dialog.scss

@ -1,184 +1,184 @@
@charset "UTF-8";
#{$prefix}dialog {
color: $color;
position: fixed;
z-index: 99999;
display: none;
@include border-radius(3px);
@include box-shadow(0 0 10px rgba(0, 0, 0, 0.3));
//@include user-select(none);
background: #fff;
font-size: 14px;
}
#{$prefix}dialog-container {
position: relative;
padding: 20px;
line-height: 1.4;
h1 {
font-size: 24px;
margin-bottom: 10px;
.fa {
color: #2C7EEA;
padding-right: 5px;
}
small {
padding-left: 5px;
font-weight: normal;
font-size: 12px;
color: #999;
}
}
select {
color: #999;
padding: 3px 8px;
border: 1px solid $borderColor;
}
}
#{$prefix}dialog-close {
position: absolute;
top: 12px;
right: 15px;
font-size: 18px;
color: #ccc;
@include transition(color 300ms ease-out);
&:hover {
color: #999;
}
}
#{$prefix}dialog-header {
padding: 11px 20px;
border-bottom: 1px solid #eee;
@include transition(background 300ms ease-out);
&:hover {
background: #f6f6f6;
}
}
#{$prefix}dialog-title {
font-size: 14px;
}
#{$prefix}dialog-footer {
padding: 10px 0 0 0;
text-align: right;
}
#{$prefix}dialog-info {
width: 420px;
h1 {
font-weight: normal;
}
#{$prefix}dialog-container {
padding: 20px 25px 25px;
}
#{$prefix}dialog-close {
top: 10px;
right: 10px;
}
p > a, .hover-link:hover {
color: #2196F3;
}
.hover-link {
color: #666;
}
a {
.fa-external-link {
display: none;
}
&:hover {
color: #2196F3;
.fa-external-link {
display: inline-block;
}
}
}
}
#{$prefix}mask,
#{$prefix}container-mask,
#{$prefix}dialog-mask {
display: none;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
#{$prefix}mask,
#{$prefix}dialog-mask-bg {
background: #fff;
opacity: 0.5;
filter: alpha(opacity=50);
}
#{$prefix}mask {
position: fixed;
background: #000;
@include opacity(0.2);
z-index: 99998;
}
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background: url(../images/loading.gif) no-repeat center center;
@include background-size(32px 32px);
}
#{$prefix}container-mask {
z-index: 20;
display: block;
background-color: #fff;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) {
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background-image: url(../images/loading@2x.gif);
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) {
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background-image: url(../images/loading@3x.gif);
}
}
#{$prefix}code-block-dialog,
#{$prefix}preformatted-text-dialog {
textarea {
width: 100%;
height: 400px;
margin-bottom: 6px;
overflow: auto;
border: 1px solid #eee;
background: #fff;
padding: 15px;
resize: none;
}
}
#{$prefix}code-toolbar {
color: #999;
font-size: 14px;
margin: -5px 0 10px;
}
@charset "UTF-8";
#{$prefix}dialog {
color: $color;
position: fixed;
z-index: 99999;
display: none;
@include border-radius(3px);
@include box-shadow(0 0 10px rgba(0, 0, 0, 0.3));
//@include user-select(none);
background: #fff;
font-size: 14px;
}
#{$prefix}dialog-container {
position: relative;
padding: 20px;
line-height: 1.4;
h1 {
font-size: 24px;
margin-bottom: 10px;
.fa {
color: #2C7EEA;
padding-right: 5px;
}
small {
padding-left: 5px;
font-weight: normal;
font-size: 12px;
color: #999;
}
}
select {
color: #999;
padding: 3px 8px;
border: 1px solid $borderColor;
}
}
#{$prefix}dialog-close {
position: absolute;
top: 12px;
right: 15px;
font-size: 18px;
color: #ccc;
@include transition(color 300ms ease-out);
&:hover {
color: #999;
}
}
#{$prefix}dialog-header {
padding: 11px 20px;
border-bottom: 1px solid #eee;
@include transition(background 300ms ease-out);
&:hover {
background: #f6f6f6;
}
}
#{$prefix}dialog-title {
font-size: 14px;
}
#{$prefix}dialog-footer {
padding: 10px 0 0 0;
text-align: right;
}
#{$prefix}dialog-info {
width: 420px;
h1 {
font-weight: normal;
}
#{$prefix}dialog-container {
padding: 20px 25px 25px;
}
#{$prefix}dialog-close {
top: 10px;
right: 10px;
}
p > a, .hover-link:hover {
color: #2196F3;
}
.hover-link {
color: #666;
}
a {
.fa-external-link {
display: none;
}
&:hover {
color: #2196F3;
.fa-external-link {
display: inline-block;
}
}
}
}
#{$prefix}mask,
#{$prefix}container-mask,
#{$prefix}dialog-mask {
display: none;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
#{$prefix}mask,
#{$prefix}dialog-mask-bg {
background: #fff;
opacity: 0.5;
filter: alpha(opacity=50);
}
#{$prefix}mask {
position: fixed;
background: #000;
@include opacity(0.2);
z-index: 9998;
}
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background: url(../images/loading.gif) no-repeat center center;
@include background-size(32px 32px);
}
#{$prefix}container-mask {
z-index: 20;
display: block;
background-color: #fff;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) {
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background-image: url(../images/loading@2x.gif);
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) {
#{$prefix}container-mask,
#{$prefix}dialog-mask-con {
background-image: url(../images/loading@3x.gif);
}
}
#{$prefix}code-block-dialog,
#{$prefix}preformatted-text-dialog {
textarea {
width: 100%;
height: 400px;
margin-bottom: 6px;
overflow: auto;
border: 1px solid #eee;
background: #fff;
padding: 15px;
resize: none;
}
}
#{$prefix}code-toolbar {
color: #999;
font-size: 14px;
margin: -5px 0 10px;
}

670
scss/editormd.preview.scss

@ -1,322 +1,348 @@
@charset "UTF-8";
@import "lib/variables";
@import "lib/prefixes";
@import "font-awesome";
@import "editormd.logo";
// github-markdown.css
@import "github-markdown";
#{$prefix}preview-container, #{$prefix}html-preview {
text-align: left;
font-size: 14px;
line-height: 1.6;
padding: 20px;
overflow: auto;
width: 100%;
background-color: #fff;
blockquote {
color: $color;
border-left: 4px solid $borderColor;
padding-left: 20px;
margin-left: 0;
font-size: 14px;
font-style: italic;
}
p code {
margin-left: 5px;
margin-right: 4px;
}
abbr {
background: #ffffdd;
}
hr {
height: 1px;
border: none;
border-top: 1px solid $borderColor;
background: none;
}
code {
border: 1px solid $borderColor;
background: #f6f6f6;
padding: 3px;
border-radius: 3px;
font-size: 14px;
}
pre {
border: 1px solid $borderColor;
background: #f6f6f6;
padding: 10px;
@include border-radius(3px);
code {
padding: 0;
}
}
pre, code, kbd {
font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
}
table thead tr {
background-color: #F8F8F8;
}
.markdown-toc {
}
.markdown-toc-list {
}
p#{$prefix}tex {
text-align: center;
}
span#{$prefix}tex {
margin: 0 5px;
}
.emoji {
width: 24px;
height: 24px;
}
.katex {
font-size: 1.4em;
}
.sequence-diagram, .flowchart {
margin: 0 auto;
text-align: center;
svg {
margin: 0 auto;
}
text {
font-size : 15px !important;
font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important;
}
}
}
//Pretty printing styles. Used with prettify.js.
@import "prettify";
#{$prefix}preview-container, #{$prefix}html-preview {
pre.prettyprint {
padding: 10px;
border: 1px solid $borderColor;
white-space: pre-wrap;
word-wrap: break-word;
}
ol.linenums {
color: #999;
padding-left: 2.5em;
li {
list-style-type: decimal;
code {
border: none;
background:none;
padding: 0;
}
}
}
}
#{$prefix}preview-container, #{$prefix}html-preview {
#{$prefix}toc-menu {
margin: 8px 0 12px 0;
display: inline-block;
> .markdown-toc {
position: relative;
@include border-radius(4px);
border: 1px solid #ddd;
display: inline-block;
font-size: 1em;
> ul {
width : 160%;
min-width: 180px;
position: absolute;
left: -1px;
top: -2px;
z-index: 100;
padding: 0 10px 10px;
display: none;
background: #fff;
border: 1px solid #ddd;
@include border-radius(4px);
@include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
> li ul {
width: 100%;
min-width: 180px;
border: 1px solid #ddd;
display: none;
background: #fff;
@include border-radius(4px);
}
> li a {
color: #666;
padding: 6px 10px;
display: block;
@include transition(background-color 500ms ease-out);
&:hover {
background-color: #f6f6f6;
}
}
}
li {
position: relative;
> ul {
position: absolute;
top: 32px;
left: 10%;
display: none;
@include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
&:before, &:after {
pointer-events: pointer-events;
position: absolute;
left: 15px;
top: -6px;
display: block;
content: "";
width: 0;
height: 0;
border: 6px solid transparent;
border-width: 0 6px 6px;
z-index: 10;
}
&:before {
border-bottom-color: #ccc;
}
&:after {
border-bottom-color: #ffffff;
top: -5px;
}
}
}
}
ul {
list-style: none;
}
a {
text-decoration: none;
}
h1 {
font-size: 16px;
padding: 5px 0 10px 10px;
line-height: 1;
border-bottom: 1px solid #eee;
.fa {
padding-left: 10px;
}
}
.toc-menu-btn {
color: #666;
min-width: 180px;
padding: 5px 10px;
border-radius: 4px;
display: inline-block;
@include transition(background-color 500ms ease-out);
&:hover {
background-color: #f6f6f6;
}
.fa {
float: right;
padding: 3px 0 0 10px;
font-size: 1.3em;
}
}
}
}
.markdown-body {
#{$prefix}toc-menu {
ul {
padding-left: 0;
}
}
.highlight pre, pre {
line-height: 1.6;
}
}
hr.editormd-page-break {
border: 1px dotted #ccc;
font-size: 0;
height: 2px;
}
@media only print {
hr.editormd-page-break {
background: none;
border: none;
height: 0;
}
}
#{$prefix}html-preview {
textarea {
display : none;
}
hr.editormd-page-break {
background: none;
border: none;
height: 0;
}
}
#{$prefix}preview-close-btn {
color: #fff;
padding: 4px 6px;
font-size: 18px;
@include border-radius(500px);
display: none;
background-color: #ccc;
position: absolute;
top: 25px;
right: 35px;
z-index: 19;
@include transition(background-color 300ms ease-out);
&:hover {
background-color: #999;
}
}
.editormd-preview-active {
width: 100%;
padding: 40px;
}
@charset "UTF-8";
@import "lib/variables";
@import "lib/prefixes";
@import "font-awesome";
@import "editormd.logo";
// github-markdown.css
@import "github-markdown";
#{$prefix}preview-container, #{$prefix}html-preview {
text-align: left;
font-size: 14px;
line-height: 1.6;
padding: 20px;
overflow: auto;
width: 100%;
background-color: #fff;
blockquote {
color: $color;
border-left: 4px solid $borderColor;
padding-left: 20px;
margin-left: 0;
font-size: 14px;
font-style: italic;
}
p code {
margin-left: 5px;
margin-right: 4px;
}
abbr {
background: #ffffdd;
}
hr {
height: 1px;
border: none;
border-top: 1px solid $borderColor;
background: none;
}
code {
border: 1px solid $borderColor;
background: #f6f6f6;
padding: 3px;
border-radius: 3px;
font-size: 14px;
}
pre {
border: 1px solid $borderColor;
background: #f6f6f6;
padding: 10px;
@include border-radius(3px);
code {
padding: 0;
}
}
pre, code, kbd {
font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
}
table thead tr {
background-color: #F8F8F8;
}
.markdown-toc {
}
.markdown-toc-list {
}
p#{$prefix}tex {
text-align: center;
}
span#{$prefix}tex {
margin: 0 5px;
}
.emoji {
width: 24px;
height: 24px;
}
.katex {
font-size: 1.4em;
}
.sequence-diagram, .flowchart {
margin: 0 auto;
text-align: center;
svg {
margin: 0 auto;
}
text {
font-size : 15px !important;
font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important;
}
}
}
//Pretty printing styles. Used with prettify.js.
@import "prettify";
#{$prefix}preview-container, #{$prefix}html-preview {
pre {
&.prettyprint {
padding: 10px;
border: 1px solid $borderColor;
white-space: pre-wrap;
word-wrap: break-word;
background: #fff;
@include transition(border-color .3s ease, background-color .3s ease);
li {
border-left: 1px solid #ddd;
padding-left: 0.8em;
@include transition(background-color .3s ease);
&:hover {
background-color: #fafafa;
}
}
li + li {
margin-top: 0;
}
&:hover {
border: 1px solid darken($borderColor, 3%);
}
ol.linenums {
color: #999;
padding-left: 2.7em;
li {
list-style-type: decimal;
code {
border: none;
background:none;
padding: 0;
}
}
}
}
}
}
#{$prefix}preview-container, #{$prefix}html-preview {
#{$prefix}toc-menu {
margin: 8px 0 12px 0;
display: inline-block;
> .markdown-toc {
position: relative;
@include border-radius(4px);
border: 1px solid #ddd;
display: inline-block;
font-size: 1em;
> ul {
width : 160%;
min-width: 180px;
position: absolute;
left: -1px;
top: -2px;
z-index: 100;
padding: 0 10px 10px;
display: none;
background: #fff;
border: 1px solid #ddd;
@include border-radius(4px);
@include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
> li ul {
width: 100%;
min-width: 180px;
border: 1px solid #ddd;
display: none;
background: #fff;
@include border-radius(4px);
}
> li a {
color: #666;
padding: 6px 10px;
display: block;
@include transition(background-color 500ms ease-out);
&:hover {
background-color: #f6f6f6;
}
}
}
li {
position: relative;
> ul {
position: absolute;
top: 32px;
left: 10%;
display: none;
@include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2));
&:before, &:after {
pointer-events: pointer-events;
position: absolute;
left: 15px;
top: -6px;
display: block;
content: "";
width: 0;
height: 0;
border: 6px solid transparent;
border-width: 0 6px 6px;
z-index: 10;
}
&:before {
border-bottom-color: #ccc;
}
&:after {
border-bottom-color: #ffffff;
top: -5px;
}
}
}
}
ul {
list-style: none;
}
a {
text-decoration: none;
}
h1 {
font-size: 16px;
padding: 5px 0 10px 10px;
line-height: 1;
border-bottom: 1px solid #eee;
.fa {
padding-left: 10px;
}
}
.toc-menu-btn {
color: #666;
min-width: 180px;
padding: 5px 10px;
border-radius: 4px;
display: inline-block;
@include transition(background-color 500ms ease-out);
&:hover {
background-color: #f6f6f6;
}
.fa {
float: right;
padding: 3px 0 0 10px;
font-size: 1.3em;
}
}
}
}
.markdown-body {
#{$prefix}toc-menu {
ul {
padding-left: 0;
}
}
img {
background: none;
}
.highlight pre, pre {
line-height: 1.6;
}
}
hr.editormd-page-break {
border: 1px dotted #ccc;
font-size: 0;
height: 2px;
}
@media only print {
hr.editormd-page-break {
background: none;
border: none;
height: 0;
}
}
#{$prefix}html-preview {
textarea {
display : none;
}
hr.editormd-page-break {
background: none;
border: none;
height: 0;
}
}
#{$prefix}preview-close-btn {
color: #fff;
padding: 4px 6px;
font-size: 18px;
@include border-radius(500px);
display: none;
background-color: #ccc;
position: absolute;
top: 25px;
right: 35px;
z-index: 19;
@include transition(background-color 300ms ease-out);
&:hover {
background-color: #999;
}
}
.editormd-preview-active {
width: 100%;
padding: 40px;
}

282
scss/editormd.preview.themes.scss

@ -1,131 +1,151 @@
/* Preview dark theme */
#{$prefix}preview-theme-dark {
color: #777;
background:#2C2827;
#{$prefix}preview-container {
color: #888;
background-color: #2C2827;
//font-family: "Meiryo UI", "Helvetica Neue", "Microsoft YaHei";
pre.prettyprint {
border: none;
}
blockquote {
color: #555;
padding: 0.5em;
background: #222;
border-color: #333;
}
abbr {
color: #fff;
padding: 1px 3px;
@include border-radius(3px);
background:#ff9900;
}
code {
color: #fff;
border: none;
padding: 1px 3px;
@include border-radius(3px);
background: #5A9600;
}
table {
border: none;
}
.fa-emoji {
color: #B4BF42;
}
.katex {
color: #FEC93F;
}
}
.editormd-toc-menu {
> .markdown-toc {
background:#fff;
border:none;
h1 {
border-color:#ddd;
}
}
}
.markdown-body {
h1, h2, hr {
border-color: #222;
}
}
pre {
color: #999;
background-color: #111;
background-color: rgba(0,0,0,.4);
/* plain text */
.pln {
color: #999;
}
}
li.L1, li.L3, li.L5, li.L7, li.L9 {
background: none;
}
[class*=editormd-logo] {
color: #2196F3;
}
.sequence-diagram {
text {
fill: #fff;
}
rect, path {
color:#fff;
fill : #64D1CB;
stroke : #64D1CB;
}
}
.flowchart {
rect, path {
stroke : #A6C6FF;
}
rect {
fill: #A6C6FF;
}
text {
fill: #5879B4;
}
}
}
@media screen {
#{$prefix}preview-theme-dark {
.str { color: #080 } /* string content */
.kwd { color: #ff9900; } /* a keyword */
.com { color: #444444; } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #ff9900; } /* a markup tag name */
.atn { color: #6C95F5; } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #008BA7; } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
}
/* Preview dark theme */
#{$prefix}preview-theme-dark {
color: #777;
background:#2C2827;
#{$prefix}preview-container {
color: #888;
background-color: #2C2827;
//font-family: "Meiryo UI", "Helvetica Neue", "Microsoft YaHei";
pre.prettyprint {
border: none;
}
blockquote {
color: #555;
padding: 0.5em;
background: #222;
border-color: #333;
}
abbr {
color: #fff;
padding: 1px 3px;
@include border-radius(3px);
background:#ff9900;
}
code {
color: #fff;
border: none;
padding: 1px 3px;
@include border-radius(3px);
background: #5A9600;
}
table {
border: none;
}
.fa-emoji {
color: #B4BF42;
}
.katex {
color: #FEC93F;
}
}
.editormd-toc-menu {
> .markdown-toc {
background:#fff;
border:none;
h1 {
border-color:#ddd;
}
}
}
.markdown-body {
h1, h2, hr {
border-color: #222;
}
}
pre {
color: #999;
background-color: #111;
background-color: rgba(0,0,0,.4);
/* plain text */
.pln {
color: #999;
}
&.prettyprint {
border: none;
background-color: #111;
li {
border-left: 1px solid #222;
}
&:hover {
border: none;
background-color: #000;
li {
&:hover {
background-color: rgba(#fff, .1);
}
}
}
}
}
li.L1, li.L3, li.L5, li.L7, li.L9 {
background: none;
}
[class*=editormd-logo] {
color: #2196F3;
}
.sequence-diagram {
text {
fill: #fff;
}
rect, path {
color:#fff;
fill : #64D1CB;
stroke : #64D1CB;
}
}
.flowchart {
rect, path {
stroke : #A6C6FF;
}
rect {
fill: #A6C6FF;
}
text {
fill: #5879B4;
}
}
}
@media screen {
#{$prefix}preview-theme-dark {
.str { color: #080 } /* string content */
.kwd { color: #ff9900; } /* a keyword */
.com { color: #444444; } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #ff9900; } /* a markup tag name */
.atn { color: #6C95F5; } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #008BA7; } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
}

274
scss/editormd.scss

@ -1,137 +1,137 @@
@charset "UTF-8";
@import "lib/variables";
@import "lib/prefixes";
.editormd {
width: 90%;
height: 640px;
margin: 0 auto;
text-align: left;
overflow: hidden;
position: relative;
margin-bottom: 15px;
border: 1px solid $borderColor;
font-family: "Meiryo UI", "Microsoft YaHei", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
*, *:before, *:after {
@include box-sizing(border-box);
}
a {
text-decoration: none;
}
img {
border: none;
vertical-align: middle;
}
> textarea,
#{$prefix}html-textarea,
#{$prefix}markdown-textarea {
width: 0;
height: 0;
outline: 0;
resize:none;
}
#{$prefix}html-textarea,
#{$prefix}markdown-textarea {
display : none;
}
input[type="text"],
input[type="button"],
input[type="submit"],
select, textarea, button {
@include appearance(none);
}
::-webkit-scrollbar {
height: 10px;
width: 7px;
background: rgba(0, 0, 0, .1);
&:hover {
background: rgba(0, 0, 0, .2);
}
}
::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.3);
@include border-radius(6px);
&:hover {
@include box-shadow(inset 1px 1px 1px rgba(0, 0, 0, .25));
background-color: rgba(0, 0, 0, .4);
}
}
}
#{$prefix}user-unselect {
@include user-select(none);
}
#{$prefix}toolbar {
width: 100%;
min-height: 37px;
background: #fff;
display: none;
position: absolute;
top: 0;
left: 0;
z-index: 10;
border-bottom: 1px solid $borderColor;
}
#{$prefix}toolbar-container {
padding: 0 8px;
min-height: 35px;
@include user-select(none);
}
@import "editormd.menu";
#{$prefix}container {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
padding: 35px 0 0;
position: relative;
background: #fff;
@include box-sizing(border-box);
}
@import "editormd.dialog";
@import "editormd.grid";
@import "editormd.tab";
@import "editormd.form";
@import "editormd.codemirror";
@import "editormd.preview";
@import "editormd.preview.themes";
#{$prefix}onlyread {
#{$prefix}toolbar {
display: none;
}
.CodeMirror {
margin-top: 0;
}
#{$prefix}preview {
top: 0;
}
}
#{$prefix}fullscreen {
position: fixed;
top : 0;
left : 0;
border: none;
margin: 0 auto;
}
@import "editormd.themes";
@charset "UTF-8";
@import "lib/variables";
@import "lib/prefixes";
.editormd {
width: 90%;
height: 640px;
margin: 0 auto;
text-align: left;
overflow: hidden;
position: relative;
margin-bottom: 15px;
border: 1px solid $borderColor;
font-family: "Meiryo UI", "Microsoft YaHei", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
*, *:before, *:after {
@include box-sizing(border-box);
}
a {
text-decoration: none;
}
img {
border: none;
vertical-align: middle;
}
> textarea,
#{$prefix}html-textarea,
#{$prefix}markdown-textarea {
width: 0;
height: 0;
outline: 0;
resize:none;
}
#{$prefix}html-textarea,
#{$prefix}markdown-textarea {
display : none;
}
input[type="text"],
input[type="button"],
input[type="submit"],
select, textarea, button {
@include appearance(none);
}
::-webkit-scrollbar {
height: 10px;
width: 7px;
background: rgba(0, 0, 0, .1);
&:hover {
background: rgba(0, 0, 0, .2);
}
}
::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.3);
@include border-radius(6px);
&:hover {
@include box-shadow(inset 1px 1px 1px rgba(0, 0, 0, .25));
background-color: rgba(0, 0, 0, .4);
}
}
}
#{$prefix}user-unselect {
@include user-select(none);
}
#{$prefix}toolbar {
width: 100%;
min-height: 37px;
background: #fff;
display: none;
position: absolute;
top: 0;
left: 0;
z-index: 10;
border-bottom: 1px solid $borderColor;
}
#{$prefix}toolbar-container {
padding: 0 8px;
min-height: 35px;
@include user-select(none);
}
@import "editormd.menu";
#{$prefix}container {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
padding: 35px 0 0;
position: relative;
background: #fff;
@include box-sizing(border-box);
}
@import "editormd.dialog";
@import "editormd.grid";
@import "editormd.tab";
@import "editormd.form";
@import "editormd.codemirror";
@import "editormd.preview";
@import "editormd.preview.themes";
#{$prefix}onlyread {
#{$prefix}toolbar {
display: none;
}
.CodeMirror {
margin-top: 0;
}
#{$prefix}preview {
top: 0;
}
}
#{$prefix}fullscreen {
position: fixed;
top : 0;
left : 0;
border: none;
margin: 0 auto!important;
}
@import "editormd.themes";

56
scss/editormd.themes.scss

@ -1,28 +1,28 @@
/* Editor.md Dark theme */
#{$prefix}theme-dark {
border-color: #1a1a17;
#{$prefix}toolbar {
background: #1A1A17;
border-color: #1a1a17;
}
#{$prefix}menu > li > a {
color: #777;
border-color: #1a1a17;
&:hover, &.active {
border-color: #333;
background: #333;
}
}
#{$prefix}menu > li.divider {
border-right: 1px solid #111;
}
.CodeMirror {
border-right: 1px solid rgba(0,0,0,0.1);
}
}
/* Editor.md Dark theme */
#{$prefix}theme-dark {
border-color: #1a1a17;
#{$prefix}toolbar {
background: #1A1A17;
border-color: #1a1a17;
}
#{$prefix}menu > li > a {
color: #777;
border-color: #1a1a17;
&:hover, &.active {
border-color: #333;
background: #333;
}
}
#{$prefix}menu > li.divider {
border-right: 1px solid #111;
}
.CodeMirror {
border-right: 1px solid rgba(0,0,0,0.1);
}
}

1008
scss/github-markdown.scss

File diff suppressed because it is too large

2
scss/prettify.scss

@ -50,4 +50,4 @@ li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }
li.L9 { background: #fff }

8991
src/editormd.js

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