@@ -102,6 +102,7 @@
* md2html 改为异步
* 添加 `options.preview.markdown.codeBlockPreview`
* 为 `options.toolbar` 添加 `className`
+ * 添加 getCurrentMode 方法
### v2.3.0 / 2020-03-12
@@ -141,6 +141,11 @@ class Vditor extends VditorMethod {
return getMarkdown(this.vditor);
}
+ /** 获取编辑器当前编辑模式 */
+ public getCurrentMode() {
+ return this.vditor.currentMode;
+ }
+
/** 聚焦到编辑器 */
public focus() {
if (this.vditor.currentMode === "sv") {
@@ -3,6 +3,5 @@ export const setHeaders = (vditor: IVditor, xhr: XMLHttpRequest) => {
Object.keys(vditor.options.upload.headers).forEach((key) => {
xhr.setRequestHeader(key, vditor.options.upload.headers[key]);
});
- xhr.setRequestHeader("X-Mode", vditor.currentMode);
};