Browse Source

fix bugs

v1.1.9
pandao 10 years ago
parent
commit
bae1b9996d
  1. 5
      CHANGE.md
  2. 2
      bower.json
  3. 26
      dist/js/editormd.js
  4. 6
      dist/js/editormd.min.js
  5. 2
      dist/js/languages/en.js
  6. 2
      dist/js/languages/en.min.js
  7. 2
      dist/js/languages/zh-tw.js
  8. 2
      dist/js/languages/zh-tw.min.js
  9. 6
      examples/simple.html
  10. 2
      package.json
  11. 24
      src/js/editormd.js

5
CHANGE.md

@ -128,5 +128,8 @@
#####v1.1.1
接受一个pull请求,修复了`getHTML ()`和`getPreviewedHTML()`方法中的3处错误;
- 接受一个pull请求,修复了`getHTML ()`和`getPreviewedHTML()`方法中的3处错误;
#####v1.1.2
- 修复Bug[#10](https://github.com/pandao/editor.md/issues/10);

2
bower.json

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

26
dist/js/editormd.js

@ -1,7 +1,7 @@
/*
* Editor.md
* @file editormd.js
* @version v1.1.1
* @version v1.1.2
* @description A simple online markdown editor.
* @license MIT License
* @author Pandao
@ -12,7 +12,7 @@
/**
* @fileOverview Editor.md
* @author pandao
* @version 1.1.0
* @version 1.1.2
*/
;(function(factory) {
@ -55,7 +55,7 @@
};
editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.1.0";
editormd.version = "1.1.2";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";
@ -2159,9 +2159,9 @@
if (settings.toolbar) {
toolbar.toggle();
toolbar.find(".fa[name=preview]").toggleClass("active");
}
toolbar.find(".fa[name=preview]").toggleClass("active");
codeMirror.toggle();
if(codeMirror.css("display") === "none") // 为了兼容Zepto,而不使用codeMirror.is(":hidden")
@ -2175,6 +2175,22 @@
editor.find("." + this.classPrefix + "preview-close-btn").show().bind(editormd.mouseOrTouch("click", "touchend"), function(){
_this.previewed();
});
if(!settings.watch)
{
var codeEditor = this.codeEditor;
var previewContainer = this.previewContainer;
codeEditor.save();
var markdownToC = this.markdownToC = [];
var newMarkdownDoc = editormd.$marked(codeEditor.getValue(), {renderer : editormd.markedRenderer(markdownToC)});
previewContainer.html(newMarkdownDoc);
if (settings.toc) {
editormd.markdownToCRenderer(markdownToC, previewContainer, settings.tocStartLevel);
}
}
preview.show().css({
top : 0,

6
dist/js/editormd.min.js

File diff suppressed because one or more lines are too long

2
dist/js/languages/en.js

@ -1,7 +1,7 @@
/*
* Editor.md
* @file languages/en.js
* @version v1.1.1
* @version v1.1.2
* @description A simple online markdown editor.
* @license MIT License
* @author Pandao

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

@ -1,2 +1,2 @@
/*! Editor.md v1.1.1 | media | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-02-19 */
/*! Editor.md v1.1.2 | media | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-02-19 */
!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)}();

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

@ -1,7 +1,7 @@
/*
* Editor.md
* @file languages/zh-tw.js
* @version v1.1.1
* @version v1.1.2
* @description A simple online markdown editor.
* @license MIT License
* @author Pandao

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

@ -1,2 +1,2 @@
/*! Editor.md v1.1.1 | media | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-02-19 */
/*! Editor.md v1.1.2 | media | A simple online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-02-19 */
!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)}();

6
examples/simple.html

@ -9,9 +9,9 @@
<body>
<div id="layout">
<header>
<h1>简单示例</h1>
<h1>简单示例</h1>
</header>
<div id="test-editormd">
<div id="test-editormd">
<textarea style="display:none;">###Hello world!
本示例未开启:
@ -23,7 +23,7 @@
</div>
</div>
<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">
var testEditor;

2
package.json

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

24
src/js/editormd.js

@ -1,7 +1,7 @@
/**
* @fileOverview Editor.md
* @author pandao
* @version 1.1.0
* @version 1.1.2
*/
;(function(factory) {
@ -44,7 +44,7 @@
};
editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.1.0";
editormd.version = "1.1.2";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";
@ -2148,9 +2148,9 @@
if (settings.toolbar) {
toolbar.toggle();
toolbar.find(".fa[name=preview]").toggleClass("active");
}
toolbar.find(".fa[name=preview]").toggleClass("active");
codeMirror.toggle();
if(codeMirror.css("display") === "none") // 为了兼容Zepto,而不使用codeMirror.is(":hidden")
@ -2164,6 +2164,22 @@
editor.find("." + this.classPrefix + "preview-close-btn").show().bind(editormd.mouseOrTouch("click", "touchend"), function(){
_this.previewed();
});
if(!settings.watch)
{
var codeEditor = this.codeEditor;
var previewContainer = this.previewContainer;
codeEditor.save();
var markdownToC = this.markdownToC = [];
var newMarkdownDoc = editormd.$marked(codeEditor.getValue(), {renderer : editormd.markedRenderer(markdownToC)});
previewContainer.html(newMarkdownDoc);
if (settings.toc) {
editormd.markdownToCRenderer(markdownToC, previewContainer, settings.tocStartLevel);
}
}
preview.show().css({
top : 0,

Loading…
Cancel
Save