Liyuan Li 5 年之前
父节点
当前提交
3c86118eb6
共有 8 个文件被更改,包括 18 次插入10 次删除
  1. 6 5
      CHANGELOG.md
  2. 2 2
      demo/static-preview.html
  3. 2 2
      demo/static.html
  4. 0 0
      src/js/lute/lute.min.js
  5. 1 1
      src/ts/ir/index.ts
  6. 2 0
      src/ts/markdown/previewRender.ts
  7. 1 0
      src/ts/markdown/setLute.ts
  8. 4 0
      types/index.d.ts

+ 6 - 5
CHANGELOG.md

@@ -58,14 +58,14 @@
 * [open issues](https://github.com/Vanessa219/vditor/issues)
 * [346](https://github.com/Vanessa219/vditor/issues/346) 内容主题推荐(长期有效) `改进功能`
 
-### v3.1.21 / 2020-05-0x
+### v3.2.0 / 2020-05-0x
 
+### v3.1.21 / 2020-05-02
+
+* [349](https://github.com/Vanessa219/vditor/issues/349) 传统中文排版“段落开头空两格” `引入特性`
 * [351](https://github.com/Vanessa219/vditor/issues/351) MathJax plugin `修复缺陷`
 * [353](https://github.com/Vanessa219/vditor/issues/353) list demo at static-preview.html `文档相关`
 * [350](https://github.com/Vanessa219/vditor/issues/350) 自定义渲染的方法 `引入特性`
-
-### v3.1.20 / 2020-04-29
-
 * [345](https://github.com/Vanessa219/vditor/issues/345) 支持预览区域粘贴到公众号 `引入特性`
 * [324](https://github.com/Vanessa219/vditor/issues/324) 支持多款主题预览 `引入特性`
 * [325](https://github.com/Vanessa219/vditor/issues/325) 导出功能 `引入特性`
@@ -127,9 +127,10 @@
   * `setTheme` 方法添加 `conentTheme`, `codeTheme` 参数
   * `setPreviewMode` 方法移除 `preview`
   * `options.preview` 中 `maxWidth` 默认值改为 800, `mode` 移除 `preview` 选项,`markdonw` 添加 `theme`、`setext` 配置
-  * IPreviewOptions 添加 `after`,`lazyLoadImage`, `markdown.theme`, `renderers`,移除 `theme`
+  * IPreviewOptions 添加 `after`,`lazyLoadImage`, `markdown.theme`, `renderers`, `markdown.paragraphBeginningSpace`,移除 `theme`
   
   * `renderers` 使用文档详细说明
+  * `paragraphBeginningSpace`
   
 ### v3.0.12 / 2020-04-06
 

+ 2 - 2
demo/static-preview.html

@@ -34,8 +34,8 @@
     <meta name="twitter:url" content="https://hacpai.com/tag/vditor"/>
     <meta property="og:image" content="https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png"/>
     <meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png"/>
-    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]0/dist/index.css"/>
-    <script src="https://cdn.jsdelivr.net/npm/[email protected]0/dist/method.min.js"></script>
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]1/dist/index.css"/>
+    <script src="https://cdn.jsdelivr.net/npm/[email protected]1/dist/method.min.js"></script>
     <style>
         a {
             color: #4285f4;

+ 2 - 2
demo/static.html

@@ -34,8 +34,8 @@
     <meta name="twitter:url" content="https://hacpai.com/tag/vditor"/>
     <meta property="og:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
     <meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
-    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]0/dist/index.css"/>
-    <script src="https://cdn.jsdelivr.net/npm/[email protected]0/dist/index.min.js"></script>
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]1/dist/index.css"/>
+    <script src="https://cdn.jsdelivr.net/npm/[email protected]1/dist/index.min.js"></script>
     <style>
         a {
             color: #4285f4;

文件差异内容过多而无法显示
+ 0 - 0
src/js/lute/lute.min.js


+ 1 - 1
src/ts/ir/index.ts

@@ -140,7 +140,7 @@ class IR {
             if ((event.key === "Backspace" || event.key === "Delete") &&
                 vditor.ir.element.innerHTML !== "" && vditor.ir.element.childNodes.length === 1 &&
                 vditor.ir.element.firstElementChild && vditor.ir.element.firstElementChild.tagName === "P"
-                && vditor.wysiwyg.element.firstElementChild.childElementCount === 0
+                && vditor.ir.element.firstElementChild.childElementCount === 0
                 && (vditor.ir.element.textContent === "" || vditor.ir.element.textContent === "\n")) {
                 // 为空时显示 placeholder
                 vditor.ir.element.innerHTML = "";

+ 2 - 0
src/ts/markdown/previewRender.ts

@@ -33,6 +33,7 @@ const mergeOptions = (options?: IPreviewOptions) => {
             codeBlockPreview: true,
             fixTermTypo: false,
             footnotes: true,
+            paragraphBeginningSpace: false,
             setext: true,
             theme: "light",
             toc: false,
@@ -75,6 +76,7 @@ export const md2html = (mdText: string, options?: IPreviewOptions) => {
             headingAnchor: mergedOptions.anchor,
             inlineMathDigit: mergedOptions.math.inlineDigit,
             lazyLoadImage: mergedOptions.lazyLoadImage,
+            paragraphBeginningSpace: mergedOptions.markdown.paragraphBeginningSpace,
             setext: mergedOptions.markdown.setext,
             toc: mergedOptions.markdown.toc,
         });

+ 1 - 0
src/ts/markdown/setLute.ts

@@ -11,6 +11,7 @@ export const setLute = (options: ILuteOptions) => {
     lute.SetFixTermTypo(options.fixTermTypo);
     lute.SetVditorCodeBlockPreview(options.codeBlockPreview);
     lute.SetSetext(options.setext);
+    lute.SetChineseParagraphBeginningSpace(options.paragraphBeginningSpace);
     if (options.lazyLoadImage) {
         lute.SetImageLazyLoading(options.lazyLoadImage);
     }

+ 4 - 0
types/index.d.ts

@@ -46,6 +46,8 @@ interface ILute {
         },
     }): void;
 
+    SetChineseParagraphBeginningSpace(enable: boolean): void;
+
     SetHeadingAnchor(enable: boolean): void;
 
     SetImageLazyLoading(imagePath: string): void;
@@ -227,6 +229,8 @@ interface IMath {
 interface IMarkdownConfig {
     /** 自动空格。默认值: false */
     autoSpace?: boolean;
+    /** 段落开头是否空两格。默认值: false */
+    paragraphBeginningSpace?: boolean;
     /** 自动矫正术语。默认值: false */
     fixTermTypo?: boolean;
     /** 自动矫正标点。默认值: false */

部分文件因为文件数量过多而无法显示