Browse Source

:sparkles: fix #2

Van 6 years ago
parent
commit
7ab27f2dfd
7 changed files with 16 additions and 9 deletions
  1. 9 2
      CHANGELOG.md
  2. 2 2
      demo/index.js
  3. 1 1
      package.json
  4. 0 0
      src/js/lute/lute.min.js
  5. 2 2
      src/ts/markdown/md2html.ts
  6. 1 2
      src/ts/util/Options.ts
  7. 1 0
      src/ts/wysiwyg/index.ts

+ 9 - 2
CHANGELOG.md

@@ -2,6 +2,8 @@
 
 ### 升级
 
+* v2.0
+  * 默认为 WYSIWYG 模式,可根据需要修改 option.mode 参数
 * v1.9
   * preview 静态方法参数修改为 `(previewElement: HTMLDivElement, markdown: string, options?: IPreviewOptions)`,其中参数 `IPreviewOptions` 修改为
     ```ts
@@ -32,11 +34,16 @@
 
 ### TODO
 
-* [2](https://github.com/Vanessa219/vditor/issues/2) 所见即所得 `enhancement`
 * [3](https://github.com/Vanessa219/vditor/issues/3) 编辑预览同步滚动改进 `enhancement`
 * [4](https://github.com/Vanessa219/vditor/issues/4) 添加支持思维导图的功能 `enhancement`
 
-### v1.10.10 / 2019-12-12
+### v2.0.0 / 2019-12-26
+
+* [2](https://github.com/Vanessa219/vditor/issues/2) 所见即所得 `enhancement`
+* 文档更新
+  * 添加 option.mode?: "wysiwyg-show" | "markdown-show" | "wysiwyg-only" | "markdown-only" 参数
+
+### v1.10.11 / 2019-12-12
 
 * [20](https://github.com/Vanessa219/vditor/issues/20) 报错:Lute is not defined `bug`
 * [19](https://github.com/Vanessa219/vditor/issues/19) CDN 切换优化 `enhancement`

+ 2 - 2
demo/index.js

@@ -2,8 +2,8 @@ import Vditor from '../src/index'
 import '../src/assets/scss/classic.scss'
 
 window.vditor = new Vditor('vditor', {
-  mode: "wysiwyg-show",
-  typewriterMode: true,
+  typewriterMode: false,
+  placeholder: 'placeholder',
   counter: 100,
   height: 300,
   hint: {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "vditor",
-  "version": "1.10.11",
+  "version": "2.0.0",
   "description": "A markdown editor written in TypeScript",
   "author": " Vanessa <[email protected]> (http://vanessa.b3log.org)",
   "homepage": "https://hacpai.com/tag/vditor",

File diff suppressed because it is too large
+ 0 - 0
src/js/lute/lute.min.js


+ 2 - 2
src/ts/markdown/md2html.ts

@@ -10,8 +10,8 @@ export const loadLuteJs = async (vditor: IVditor | string) => {
     } else if (typeof vditor === "object" && vditor.options.cdn) {
         cdn = vditor.options.cdn;
     }
-    // addScript(`${cdn}/dist/js/lute/lute.min.js`, "vditorLuteScript");
-    addScript(`http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");
+    addScript(`${cdn}/dist/js/lute/lute.min.js`, "vditorLuteScript");
+    // addScript(`http://192.168.0.107:9090/lute.min.js?${new Date().getTime()}`, "vditorLuteScript");
 
     if (vditor && typeof vditor === "object" && !vditor.lute) {
         vditor.lute = Lute.New();

+ 1 - 2
src/ts/util/Options.ts

@@ -26,8 +26,7 @@ export class Options {
             duplicate: "⌘-d",
         },
         lang: "zh_CN",
-        // TODO: mode: "wysiwyg-show",
-        mode: "markdown-only",
+        mode: "wysiwyg-show",
         placeholder: "",
         preview: {
             delay: 1000,

+ 1 - 0
src/ts/wysiwyg/index.ts

@@ -19,6 +19,7 @@ class WYSIWYG {
     constructor(vditor: IVditor) {
         this.element = document.createElement("pre");
         this.element.className = "vditor-reset vditor-wysiwyg";
+        // TODO: placeholder
         this.element.setAttribute("contenteditable", "true");
         if (vditor.currentMode === "markdown") {
             this.element.style.display = "none";

Some files were not shown because too many files changed in this diff