Liyuan Li 5 years ago
parent
commit
2d8d729722
3 changed files with 21 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 15 0
      src/index.ts
  3. 5 0
      types/index.d.ts

+ 1 - 0
CHANGELOG.md

@@ -80,6 +80,7 @@
 
 * [open issues](https://github.com/Vanessa219/vditor/issues)
 * [346](https://github.com/Vanessa219/vditor/issues/346) 内容主题推荐(长期有效) `改进功能`
+* [721](https://github.com/Vanessa219/vditor/issues/721) 所见即所得模式加入划词评论 `引入特性`
 
 ### v3.6.1 / 2020-10-xx
 

+ 15 - 0
src/index.ts

@@ -357,6 +357,21 @@ class Vditor extends VditorMethod {
         document.getElementById("vditorIconScript").remove();
         this.clearCache();
     }
+
+    /** 获取评论 ID */
+    public getCommentIds() {
+        return [""];
+    }
+
+    /** 高亮评论 */
+    public hlCommentIds(ids: string[]) {
+
+    }
+
+    /** 评论之后文字添加下划线样式 */
+    public afterCommentId(id: string) {
+
+    }
 }
 
 export default Vditor;

+ 5 - 0
types/index.d.ts

@@ -504,6 +504,11 @@ interface IOptions {
         hide?: boolean,
         pin?: boolean,
     };
+    /** 评论 */
+    comment?: {
+        add(id: string): void
+        remove(ids: string[]): void;
+    };
     /** 主题。默认值: 'classic' */
     theme?: "classic" | "dark";
     /** 图标。默认值: 'ant' */