Vanessa 5 years ago
parent
commit
33ad2b30dc
6 changed files with 13 additions and 3 deletions
  1. 7 0
      CHANGELOG.md
  2. 1 1
      src/ts/ir/process.ts
  3. 1 1
      src/ts/sv/process.ts
  4. 1 0
      src/ts/util/Options.ts
  5. 1 1
      src/ts/wysiwyg/afterRenderEvent.ts
  6. 2 0
      types/index.d.ts

+ 7 - 0
CHANGELOG.md

@@ -86,6 +86,13 @@
 * [open issues](https://github.com/Vanessa219/vditor/issues)
 * [346](https://github.com/Vanessa219/vditor/issues/346) 内容主题推荐(长期有效) `改进功能`
 
+### v3.7.1 / 2020-12-0x
+
+* [837](https://github.com/Vanessa219/vditor/issues/837) 历史记录添加时间间隔配置 `引入特性`
+* 文档修改
+  * 3.7.1
+    * 添加 `options.undoDelay` 配置
+    
 ### v3.7.0 / 2020-12-01
 
 * [479](https://github.com/Vanessa219/vditor/issues/479) 大纲折叠 `改进功能`

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

@@ -73,7 +73,7 @@ export const processAfterRender = (vditor: IVditor, options = {
         if (options.enableAddUndoStack) {
             vditor.undo.addToUndoStack(vditor);
         }
-    }, 800);
+    }, vditor.options.undoDelay);
 };
 
 export const processHeading = (vditor: IVditor, value: string) => {

+ 1 - 1
src/ts/sv/process.ts

@@ -132,7 +132,7 @@ export const processAfterRender = (vditor: IVditor, options = {
         if (options.enableAddUndoStack && !vditor.sv.composingLock) {
             vditor.undo.addToUndoStack(vditor);
         }
-    }, 800);
+    }, vditor.options.undoDelay);
 };
 
 export const processHeading = (vditor: IVditor, value: string) => {

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

@@ -105,6 +105,7 @@ export class Options {
             pin: false,
         },
         typewriterMode: false,
+        undoDelay: 800,
         upload: {
             extraData: {},
             fieldName: "file[]",

+ 1 - 1
src/ts/wysiwyg/afterRenderEvent.ts

@@ -37,5 +37,5 @@ export const afterRenderEvent = (vditor: IVditor, options = {
         if (options.enableAddUndoStack) {
             vditor.undo.addToUndoStack(vditor);
         }
-    }, 800);
+    }, vditor.options.undoDelay);
 };

+ 2 - 0
types/index.d.ts

@@ -464,6 +464,8 @@ interface IResize {
 
 /** @link https://ld246.com/article/1549638745630#options */
 interface IOptions {
+    /** 历史记录间隔 */
+    undoDelay?: number;
     /** 内部调试时使用 */
     _lutePath?: string;
     /** 编辑器初始化值。默认值: '' */