Browse Source

Releases v1.1.7

v1.1.9 v1.1.7
Pandao 10 years ago
parent
commit
0d65e7263b
  1. 15
      CHANGE.md
  2. 2
      bower.json
  3. 4
      dist/css/editormd.css
  4. 4
      dist/css/editormd.css.map
  5. 2
      dist/css/editormd.css.min.map
  6. 4
      dist/css/editormd.logo.css
  7. 4
      dist/css/editormd.logo.css.map
  8. 2
      dist/css/editormd.logo.css.min.map
  9. 2
      dist/css/editormd.logo.min.css
  10. 2
      dist/css/editormd.min.css
  11. 4
      dist/css/editormd.preview.css
  12. 4
      dist/css/editormd.preview.css.map
  13. 2
      dist/css/editormd.preview.css.min.map
  14. 2
      dist/css/editormd.preview.min.css
  15. 32
      dist/js/editormd.js
  16. 4
      dist/js/editormd.min.js
  17. 4
      dist/js/languages/en.js
  18. 2
      dist/js/languages/en.min.js
  19. 4
      dist/js/languages/zh-tw.js
  20. 2
      dist/js/languages/zh-tw.min.js
  21. 2
      docs/html/index.html
  22. 6
      examples/onchange.html
  23. 10
      examples/onload.html
  24. 2
      lib/codemirror/addons.min.js
  25. 2
      lib/codemirror/modes.min.js
  26. 2
      package.json
  27. 28
      src/js/editormd.js

15
CHANGE.md

@ -171,4 +171,17 @@
- 修复有些情况下无法保存Markdown源文档到textarea的问题; - 修复有些情况下无法保存Markdown源文档到textarea的问题;
- 修改了`setCodeMirror()`、`recreateEditor()`等方法; - 修改了`setCodeMirror()`、`recreateEditor()`等方法;
- 修改了以上Bug及部分相关示例文件;
- 修改了以上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相关示例文件;

2
bower.json

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

4
dist/css/editormd.css

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.css * @file editormd.css
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
@charset "UTF-8"; @charset "UTF-8";

4
dist/css/editormd.css.map

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.css.map * @file editormd.css.map
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
{ {

2
dist/css/editormd.css.min.map

File diff suppressed because one or more lines are too long

4
dist/css/editormd.logo.css

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.logo.css * @file editormd.logo.css
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
@font-face { @font-face {

4
dist/css/editormd.logo.css.map

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.logo.css.map * @file editormd.logo.css.map
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
{ {

2
dist/css/editormd.logo.css.min.map

@ -1,2 +1,2 @@
/*! Editor.md v1.1.6 | editormd.logo.css.min.map | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-02 */
/*! Editor.md v1.1.7 | editormd.logo.css.min.map | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-03 */
{"version":3,"mappings":"AAKA,UASC;EARA,WAAW,EAAE,eAAe;EAC5B,GAAG,EAAC,yCAAyC;EAC7C,GAAG,EAAC,sQAA4E;EAIhF,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,MAAM;;AAGnB,cAAe;EACd,WAAW,EAAE,eAAe;EAC5B,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,MAAM;EAClB,WAAW,EAAE,MAAM;EACnB,YAAY,EAAE,MAAM;EACpB,cAAc,EAAE,IAAI;EACjB,SAAS,EAAE,OAAO;EACrB,WAAW,EAAE,CAAC;EACX,OAAO,EAAE,YAAY;EACrB,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,OAAO;EAG1B,sBAAsB,EAAE,WAAW;EACnC,uBAAuB,EAAE,SAAS;;AAE/B,qBAAS;EACL,OAAO,EAAE,QAAQ;;;;;;;AAQzB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,KAAK;;;AAGpB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,oBAAqB;EACjB,KAAK,ECxEO,OAAU","sources"["../editormd.logo.scss","file:///D:/APMServ/www/htdocs/editor.md/src/scss/lib/variables.scss"],"names"[],"file":"editormd.logo.css"} {"version":3,"mappings":"AAKA,UASC;EARA,WAAW,EAAE,eAAe;EAC5B,GAAG,EAAC,yCAAyC;EAC7C,GAAG,EAAC,sQAA4E;EAIhF,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,MAAM;;AAGnB,cAAe;EACd,WAAW,EAAE,eAAe;EAC5B,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,MAAM;EAClB,WAAW,EAAE,MAAM;EACnB,YAAY,EAAE,MAAM;EACpB,cAAc,EAAE,IAAI;EACjB,SAAS,EAAE,OAAO;EACrB,WAAW,EAAE,CAAC;EACX,OAAO,EAAE,YAAY;EACrB,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,OAAO;EAG1B,sBAAsB,EAAE,WAAW;EACnC,uBAAuB,EAAE,SAAS;;AAE/B,qBAAS;EACL,OAAO,EAAE,QAAQ;;;;;;;AAQzB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,KAAK;;;AAGpB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,iBAAkB;EACd,SAAS,EAAE,GAAG;;;AAGlB,oBAAqB;EACjB,KAAK,ECxEO,OAAU","sources"["../editormd.logo.scss","file:///D:/APMServ/www/htdocs/editor.md/src/scss/lib/variables.scss"],"names"[],"file":"editormd.logo.css"}

2
dist/css/editormd.logo.min.css

@ -1,2 +1,2 @@
/*! Editor.md v1.1.6 | editormd.logo.min.css | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-02 */
/*! Editor.md v1.1.7 | editormd.logo.min.css | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-03 */
@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{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: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} @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{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: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}

2
dist/css/editormd.min.css

@ -1,4 +1,4 @@
/*! Editor.md v1.1.6 | editormd.min.css | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-02 */
/*! Editor.md v1.1.7 | editormd.min.css | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-03 */
@charset "UTF-8";/*! @charset "UTF-8";/*!
* Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)

4
dist/css/editormd.preview.css

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.preview.css * @file editormd.preview.css
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
/*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */ /*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */

4
dist/css/editormd.preview.css.map

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file editormd.preview.css.map * @file editormd.preview.css.map
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
{ {

2
dist/css/editormd.preview.css.min.map

File diff suppressed because one or more lines are too long

2
dist/css/editormd.preview.min.css

File diff suppressed because one or more lines are too long

32
dist/js/editormd.js

@ -1,18 +1,18 @@
/* /*
* Editor.md * Editor.md
* @file editormd.js * @file editormd.js
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
/** /**
* @fileOverview Editor.md * @fileOverview Editor.md
* @author pandao * @author pandao
* @version 1.1.6
* @version 1.1.7
*/ */
;(function(factory) { ;(function(factory) {
@ -55,7 +55,7 @@
}; };
editormd.title = editormd.$name = "Editor.md"; editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.1.6";
editormd.version = "1.1.7";
editormd.homePage = "https://pandao.github.io/editor.md/"; editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-"; editormd.classPrefix = "editormd-";
@ -234,6 +234,8 @@
editormd.prototype = editormd.fn = { editormd.prototype = editormd.fn = {
state : { state : {
watching : false,
loaded : false,
preview : false, preview : false,
fullscreen : false fullscreen : false
}, },
@ -264,6 +266,8 @@
} }
}; };
this.state.watching = (settings.watch) ? true : false;
if (!editor.hasClass("editormd")) { if (!editor.hasClass("editormd")) {
editor.addClass("editormd"); editor.addClass("editormd");
} }
@ -1742,8 +1746,6 @@
loadedDisplay : function() { loadedDisplay : function() {
this.state.loaded = true;
var _this = this; var _this = this;
var editor = this.editor; var editor = this.editor;
var preview = this.preview; var preview = this.preview;
@ -1768,8 +1770,6 @@
$(window).resize(function(){ $(window).resize(function(){
_this.resize(); _this.resize();
}); });
$.proxy(settings.onload, this)();
var codeEditorBindScroll = function() { var codeEditorBindScroll = function() {
codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function() { codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function() {
@ -1839,6 +1839,10 @@
codeEditor.on("change", function(cm, changeObj) { codeEditor.on("change", function(cm, changeObj) {
_this.saveToTextareas(); _this.saveToTextareas();
}); });
$.proxy(settings.onload, this)();
this.state.loaded = true;
return this; return this;
}, },
@ -1933,6 +1937,7 @@
saveToTextareas : function() { saveToTextareas : function() {
var _this = this; var _this = this;
var state = this.state;
var settings = this.settings; var settings = this.settings;
var codeEditor = this.codeEditor; var codeEditor = this.codeEditor;
var previewContainer = this.previewContainer; var previewContainer = this.previewContainer;
@ -1949,7 +1954,7 @@
this.htmlTextarea.html(newMarkdownDoc); this.htmlTextarea.html(newMarkdownDoc);
} }
if(settings.watch || (!settings.watch && this.state.preview))
if(settings.watch || (!settings.watch && state.preview))
{ {
previewContainer.html(newMarkdownDoc); previewContainer.html(newMarkdownDoc);
@ -1974,7 +1979,10 @@
_this.flowChartAndSequenceDiagramRender(); _this.flowChartAndSequenceDiagramRender();
}, 10); }, 10);
$.proxy(settings.onchange, this)();
if (state.loaded)
{
$.proxy(settings.onchange, this)();
}
} }
return this; return this;
@ -2144,7 +2152,7 @@
watch : function(callback) { watch : function(callback) {
callback = callback || function() {}; callback = callback || function() {};
this.settings.watch = true;
this.state.watching = this.settings.watch = true;
this.preview.show(); this.preview.show();
var watchIcon = this.settings.toolbarIconsClass.watch; var watchIcon = this.settings.toolbarIconsClass.watch;
@ -2170,7 +2178,7 @@
unwatch : function(callback) { unwatch : function(callback) {
callback = callback || function() {}; callback = callback || function() {};
this.settings.watch = false;
this.state.watching = this.settings.watch = false;
this.preview.hide(); this.preview.hide();
var watchIcon = this.settings.toolbarIconsClass.watch; var watchIcon = this.settings.toolbarIconsClass.watch;

4
dist/js/editormd.min.js

File diff suppressed because one or more lines are too long

4
dist/js/languages/en.js

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file languages\en.js * @file languages\en.js
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
(function(){ (function(){

2
dist/js/languages/en.min.js

@ -1,2 +1,2 @@
/*! Editor.md v1.1.6 | languages\en.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-02 */
/*! Editor.md v1.1.7 | languages\en.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-03 */
!function(){var e=function(e){var t={name:"en",description:"A simple markdown doucment online editor.",toolbar:{undo:"Undo(Ctrl+Z)",redo:"Redo(Ctrl+Y)",bold:"Bold",del:"Strikethrough",italic:"Italic",quote:"Block quote",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6","list-ul":"Unordered list","list-ol":"Ordered list",hr:"Horizontal line",link:"Link",anchor:"Anchor",image:"Image",code:"Code inline","code-block-tab":"Preformatted text / Code block (Tab indent)","code-block":"Code block (Multi-languages)",datetime:"Datetime",watch:"Unwatch",unwatch:"Watch",preview:"HTML Preview (Enter ESC exit)",fullscreen:"Fullscreen (Enter ESC exit)",clear:"Clear",info:"About "+e.title},buttons:{enter:"Enter",cancel:"Cancel"},dialog:{link:{title:"Link",url:"Address",urlTitle:"Title",urlEmpty:"Error: Please fill in the link address.",titleEmpty:"Error: Please fill in the link title."},anchor:{title:"Anchor link",name:"Name",url:"Address",urlTitle:"Title",nameEmpty:"Error: anchor name can't be empty.",titleEmpty:"Error: Please fill in anchor link title.",urlEmpty:"Error: Please fill in anchor link."},image:{title:"Image",url:"Address",link:"Link",alt:"Title",uploadButton:"Upload",imageURLEmpty:"Error: picture url address can't be empty.",uploadFileEmpty:"Error: upload pictures cannot be empty!",formatNotAllowed:"Error: only allows to upload pictures file, upload allowed image file format:"},tabCodeBlock:{title:"Preformatted text / Codes",codeEmptyAlert:"Error: Please fill in the Preformatted text or content of the codes."},codeBlock:{title:"Code block",selectLabel:"Languages: ",selectDefaultText:"select a code language...",otherLanguage:"Other languages",unselectedLanguageAlert:"Error: Please select the code language.",codeEmptyAlert:"Error: Please fill in the code content."}}};e.defaults.lang=t};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd?define(["editormd"],function(t){e(t)}):define(function(t){var l=t("../editormd");e(l)}):e(window.editormd)}(); !function(){var e=function(e){var t={name:"en",description:"A simple markdown doucment online editor.",toolbar:{undo:"Undo(Ctrl+Z)",redo:"Redo(Ctrl+Y)",bold:"Bold",del:"Strikethrough",italic:"Italic",quote:"Block quote",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6","list-ul":"Unordered list","list-ol":"Ordered list",hr:"Horizontal line",link:"Link",anchor:"Anchor",image:"Image",code:"Code inline","code-block-tab":"Preformatted text / Code block (Tab indent)","code-block":"Code block (Multi-languages)",datetime:"Datetime",watch:"Unwatch",unwatch:"Watch",preview:"HTML Preview (Enter ESC exit)",fullscreen:"Fullscreen (Enter ESC exit)",clear:"Clear",info:"About "+e.title},buttons:{enter:"Enter",cancel:"Cancel"},dialog:{link:{title:"Link",url:"Address",urlTitle:"Title",urlEmpty:"Error: Please fill in the link address.",titleEmpty:"Error: Please fill in the link title."},anchor:{title:"Anchor link",name:"Name",url:"Address",urlTitle:"Title",nameEmpty:"Error: anchor name can't be empty.",titleEmpty:"Error: Please fill in anchor link title.",urlEmpty:"Error: Please fill in anchor link."},image:{title:"Image",url:"Address",link:"Link",alt:"Title",uploadButton:"Upload",imageURLEmpty:"Error: picture url address can't be empty.",uploadFileEmpty:"Error: upload pictures cannot be empty!",formatNotAllowed:"Error: only allows to upload pictures file, upload allowed image file format:"},tabCodeBlock:{title:"Preformatted text / Codes",codeEmptyAlert:"Error: Please fill in the Preformatted text or content of the codes."},codeBlock:{title:"Code block",selectLabel:"Languages: ",selectDefaultText:"select a code language...",otherLanguage:"Other languages",unselectedLanguageAlert:"Error: Please select the code language.",codeEmptyAlert:"Error: Please fill in the code content."}}};e.defaults.lang=t};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd?define(["editormd"],function(t){e(t)}):define(function(t){var l=t("../editormd");e(l)}):e(window.editormd)}();

4
dist/js/languages/zh-tw.js

@ -1,12 +1,12 @@
/* /*
* Editor.md * Editor.md
* @file languages\zh-tw.js * @file languages\zh-tw.js
* @version v1.1.6
* @version v1.1.7
* @description A simple online markdown editor. * @description A simple online markdown editor.
* @license MIT License * @license MIT License
* @author Pandao * @author Pandao
* {@link https://github.com/pandao/editor.md} * {@link https://github.com/pandao/editor.md}
* @updateTime 2015-03-02
* @updateTime 2015-03-03
*/ */
(function(){ (function(){

2
dist/js/languages/zh-tw.min.js

@ -1,2 +1,2 @@
/*! Editor.md v1.1.6 | languages\zh-tw.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-02 */
/*! Editor.md v1.1.7 | languages\zh-tw.min.js | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-03 */
!function(){var e=function(e){var t={name:"zh-tw",description:"開源在線Markdown編輯器<br/>A simple markdown doucment online editor.",toolbar:{undo:"撤銷(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗體",del:"刪除線",italic:"斜體",quote:"引用",h1:"標題1",h2:"標題2",h3:"標題3",h4:"標題4",h5:"標題5",h6:"標題6","list-ul":"無序列表","list-ol":"有序列表",hr:"横线",link:"链接",anchor:"錨點",image:"圖片",code:"行內代碼","code-block-tab":"預格式文本 / 代碼塊(縮進風格)","code-block":"代碼塊(多語言風格)",datetime:"日期時間",watch:"關閉實時預覽",unwatch:"開啟實時預覽",preview:"全窗口預覽HTML(可按ESC還原)",fullscreen:"全屏(可按ESC還原)",clear:"清空",info:"關於"+e.title},buttons:{enter:"確定",cancel:"取消"},dialog:{link:{title:"添加鏈接",url:"鏈接地址",urlTitle:"鏈接標題",urlEmpty:"錯誤:請填寫鏈接地址。",titleEmpty:"錯誤:請填寫鏈接標題。"},anchor:{title:"添加錨點鏈接",name:"錨點名稱",url:"鏈接地址",urlTitle:"鏈接標題",nameEmpty:"錯誤:錨點名稱不能為空。",titleEmpty:"錯誤:請填寫錨點鏈接標題。",urlEmpty:"錯誤:請填寫錨點鏈接地址。"},image:{title:"添加圖片",url:"圖片地址",link:"圖片鏈接",alt:"圖片描述",uploadButton:"本地上傳",imageURLEmpty:"錯誤:圖片地址不能為空。",uploadFileEmpty:"錯誤:上傳的圖片不能為空!",formatNotAllowed:"錯誤:只允許上傳圖片文件,允許上傳的圖片文件格式有:"},tabCodeBlock:{title:"添加預格式文本或代碼塊",codeEmptyAlert:"錯誤:請填寫預格式文本或代碼的內容。"},codeBlock:{title:"添加代碼塊",selectLabel:"代碼語言:",selectDefaultText:"請語言代碼語言",otherLanguage:"其他語言",unselectedLanguageAlert:"錯誤:請選擇代碼所屬的語言類型。",codeEmptyAlert:"錯誤:請填寫代碼內容。"}}};e.defaults.lang=t};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd?define(["editormd"],function(t){e(t)}):define(function(t){var l=t("../editormd");e(l)}):e(window.editormd)}(); !function(){var e=function(e){var t={name:"zh-tw",description:"開源在線Markdown編輯器<br/>A simple markdown doucment online editor.",toolbar:{undo:"撤銷(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗體",del:"刪除線",italic:"斜體",quote:"引用",h1:"標題1",h2:"標題2",h3:"標題3",h4:"標題4",h5:"標題5",h6:"標題6","list-ul":"無序列表","list-ol":"有序列表",hr:"横线",link:"链接",anchor:"錨點",image:"圖片",code:"行內代碼","code-block-tab":"預格式文本 / 代碼塊(縮進風格)","code-block":"代碼塊(多語言風格)",datetime:"日期時間",watch:"關閉實時預覽",unwatch:"開啟實時預覽",preview:"全窗口預覽HTML(可按ESC還原)",fullscreen:"全屏(可按ESC還原)",clear:"清空",info:"關於"+e.title},buttons:{enter:"確定",cancel:"取消"},dialog:{link:{title:"添加鏈接",url:"鏈接地址",urlTitle:"鏈接標題",urlEmpty:"錯誤:請填寫鏈接地址。",titleEmpty:"錯誤:請填寫鏈接標題。"},anchor:{title:"添加錨點鏈接",name:"錨點名稱",url:"鏈接地址",urlTitle:"鏈接標題",nameEmpty:"錯誤:錨點名稱不能為空。",titleEmpty:"錯誤:請填寫錨點鏈接標題。",urlEmpty:"錯誤:請填寫錨點鏈接地址。"},image:{title:"添加圖片",url:"圖片地址",link:"圖片鏈接",alt:"圖片描述",uploadButton:"本地上傳",imageURLEmpty:"錯誤:圖片地址不能為空。",uploadFileEmpty:"錯誤:上傳的圖片不能為空!",formatNotAllowed:"錯誤:只允許上傳圖片文件,允許上傳的圖片文件格式有:"},tabCodeBlock:{title:"添加預格式文本或代碼塊",codeEmptyAlert:"錯誤:請填寫預格式文本或代碼的內容。"},codeBlock:{title:"添加代碼塊",selectLabel:"代碼語言:",selectDefaultText:"請語言代碼語言",otherLanguage:"其他語言",unselectedLanguageAlert:"錯誤:請選擇代碼所屬的語言類型。",codeEmptyAlert:"錯誤:請填寫代碼內容。"}}};e.defaults.lang=t};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd?define(["editormd"],function(t){e(t)}):define(function(t){var l=t("../editormd");e(l)}):e(window.editormd)}();

2
docs/html/index.html

@ -121,7 +121,7 @@
<br clear="both"> <br clear="both">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Mon Mar 02 2015 21:12:13 GMT+0800 (中国标准时间)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Tue Mar 03 2015 20:12:50 GMT+0800 (中国标准时间)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

6
examples/onchange.html

@ -19,13 +19,15 @@
<script src="../lib/jquery.min.js"></script> <script src="../lib/jquery.min.js"></script>
<script src="../src/js/editormd.js"></script> <script src="../src/js/editormd.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var testEditor;
$(function() { $(function() {
var testEditor = editormd("test-editormd", {
testEditor = editormd("test-editormd", {
width : "90%", width : "90%",
height : 720, height : 720,
path : '../lib/', path : '../lib/',
onchange : function() { onchange : function() {
console.log("onchange =>", this, this.id, this.settings);
console.log("onchange =>", this, this.id, this.settings, this.state);
} }
}); });
}); });

10
examples/onload.html

@ -17,16 +17,20 @@
</div> </div>
</div> </div>
<script src="../lib/jquery.min.js"></script> <script src="../lib/jquery.min.js"></script>
<script src="../src/js/editormd.js"></script>
<script src="../src/js/editormd.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
var testEditor = editormd("test-editormd", { var testEditor = editormd("test-editormd", {
width : "90%", width : "90%",
height : 720, height : 720,
//watch : false,
path : '../lib/', path : '../lib/',
onload : function() { onload : function() {
alert("onload");
console.log("onload =>", this, this.id, this.settings);
//this.watch();
//this.setMarkdown("###test onloaded");
testEditor.setMarkdown("###Test onloaded");
alert("onloaded");
console.log("onloaded =>", this, this.id, this.settings);
} }
}); });
}); });

2
lib/codemirror/addons.min.js

File diff suppressed because one or more lines are too long

2
lib/codemirror/modes.min.js

File diff suppressed because one or more lines are too long

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "editor.md", "name": "editor.md",
"version": "1.1.6",
"version": "1.1.7",
"description": "A simple online markdown editor.", "description": "A simple online markdown editor.",
"directories": { "directories": {
"doc": "docs", "doc": "docs",

28
src/js/editormd.js

@ -1,7 +1,7 @@
/** /**
* @fileOverview Editor.md * @fileOverview Editor.md
* @author pandao * @author pandao
* @version 1.1.6
* @version 1.1.7
*/ */
;(function(factory) { ;(function(factory) {
@ -44,7 +44,7 @@
}; };
editormd.title = editormd.$name = "Editor.md"; editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.1.6";
editormd.version = "1.1.7";
editormd.homePage = "https://pandao.github.io/editor.md/"; editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-"; editormd.classPrefix = "editormd-";
@ -223,6 +223,8 @@
editormd.prototype = editormd.fn = { editormd.prototype = editormd.fn = {
state : { state : {
watching : false,
loaded : false,
preview : false, preview : false,
fullscreen : false fullscreen : false
}, },
@ -253,6 +255,8 @@
} }
}; };
this.state.watching = (settings.watch) ? true : false;
if (!editor.hasClass("editormd")) { if (!editor.hasClass("editormd")) {
editor.addClass("editormd"); editor.addClass("editormd");
} }
@ -1731,8 +1735,6 @@
loadedDisplay : function() { loadedDisplay : function() {
this.state.loaded = true;
var _this = this; var _this = this;
var editor = this.editor; var editor = this.editor;
var preview = this.preview; var preview = this.preview;
@ -1757,8 +1759,6 @@
$(window).resize(function(){ $(window).resize(function(){
_this.resize(); _this.resize();
}); });
$.proxy(settings.onload, this)();
var codeEditorBindScroll = function() { var codeEditorBindScroll = function() {
codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function() { codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function() {
@ -1828,6 +1828,10 @@
codeEditor.on("change", function(cm, changeObj) { codeEditor.on("change", function(cm, changeObj) {
_this.saveToTextareas(); _this.saveToTextareas();
}); });
$.proxy(settings.onload, this)();
this.state.loaded = true;
return this; return this;
}, },
@ -1922,6 +1926,7 @@
saveToTextareas : function() { saveToTextareas : function() {
var _this = this; var _this = this;
var state = this.state;
var settings = this.settings; var settings = this.settings;
var codeEditor = this.codeEditor; var codeEditor = this.codeEditor;
var previewContainer = this.previewContainer; var previewContainer = this.previewContainer;
@ -1938,7 +1943,7 @@
this.htmlTextarea.html(newMarkdownDoc); this.htmlTextarea.html(newMarkdownDoc);
} }
if(settings.watch || (!settings.watch && this.state.preview))
if(settings.watch || (!settings.watch && state.preview))
{ {
previewContainer.html(newMarkdownDoc); previewContainer.html(newMarkdownDoc);
@ -1963,7 +1968,10 @@
_this.flowChartAndSequenceDiagramRender(); _this.flowChartAndSequenceDiagramRender();
}, 10); }, 10);
$.proxy(settings.onchange, this)();
if (state.loaded)
{
$.proxy(settings.onchange, this)();
}
} }
return this; return this;
@ -2133,7 +2141,7 @@
watch : function(callback) { watch : function(callback) {
callback = callback || function() {}; callback = callback || function() {};
this.settings.watch = true;
this.state.watching = this.settings.watch = true;
this.preview.show(); this.preview.show();
var watchIcon = this.settings.toolbarIconsClass.watch; var watchIcon = this.settings.toolbarIconsClass.watch;
@ -2159,7 +2167,7 @@
unwatch : function(callback) { unwatch : function(callback) {
callback = callback || function() {}; callback = callback || function() {};
this.settings.watch = false;
this.state.watching = this.settings.watch = false;
this.preview.hide(); this.preview.hide();
var watchIcon = this.settings.toolbarIconsClass.watch; var watchIcon = this.settings.toolbarIconsClass.watch;

Loading…
Cancel
Save