Skip to content

Commit b485b5e

Browse files
committed
refactor: 精简代码
1 parent 9872bbb commit b485b5e

2 files changed

Lines changed: 4 additions & 15 deletions

File tree

src/components/BootstrapBlazor.Vditor/Vditor.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,19 @@ public async Task Reset(string value, VditorOptions options)
132132
/// <para lang="zh">获取编辑器的 Markdown 内容</para>
133133
/// <para lang="en">Gets the markdown content of the editor.</para>
134134
/// </summary>
135-
public Task<string?> GetValueAsync() => InvokeAsync<string?>("getResult", Id, "getValue");
135+
public Task<string?> GetValueAsync() => InvokeAsync<string?>("execute", Id, "getValue");
136136

137137
/// <summary>
138138
/// <para lang="zh">获取 Markdown 渲染后的 HTML</para>
139139
/// <para lang="en">Gets the HTML rendered from markdown.</para>
140140
/// </summary>
141-
public Task<string?> GetHtmlAsync() => InvokeAsync<string?>("getResult", Id, "getHTML");
141+
public Task<string?> GetHtmlAsync() => InvokeAsync<string?>("execute", Id, "getHTML");
142142

143143
/// <summary>
144144
/// <para lang="zh">获取 返回选中的字符串</para>
145145
/// <para lang="en">Returns the selected string.</para>
146146
/// </summary>
147-
public Task<string?> GetSelectionAsync() => InvokeAsync<string?>("getResult", Id, "getSelection");
147+
public Task<string?> GetSelectionAsync() => InvokeAsync<string?>("execute", Id, "getSelection");
148148

149149
/// <summary>
150150
/// <para lang="zh">解除编辑器禁用</para>

src/components/BootstrapBlazor.Vditor/Vditor.razor.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function insertValue(id, value, render) {
6060
}
6161
}
6262

63-
export function getResult(id, method) {
63+
export function execute(id, method) {
6464
const md = Data.get(id);
6565
const { vditor } = md;
6666
let ret = '';
@@ -73,17 +73,6 @@ export function getResult(id, method) {
7373
return ret;
7474
}
7575

76-
export function execute(id, method) {
77-
const md = Data.get(id);
78-
const { vditor } = md;
79-
if (vditor) {
80-
var cb = vditor[method];
81-
if (cb) {
82-
cb.call(vditor);
83-
}
84-
}
85-
}
86-
8776
export function dispose(id) {
8877
const md = Data.get(id);
8978
const { vditor } = md;

0 commit comments

Comments
 (0)