Skip to content

Commit

Permalink
🐛 用户的 input 不应该 debounced
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Feb 18, 2020
1 parent 2f48db8 commit acf900c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ts/wysiwyg/afterRenderEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ export const afterRenderEvent = (vditor: IVditor, options = {
enableInput: true,
}) => {
clearTimeout(vditor.wysiwyg.afterRenderTimeoutId);
const text = getMarkdown(vditor);
if (typeof vditor.options.input === "function" && options.enableInput) {
vditor.options.input(text);
}
vditor.wysiwyg.afterRenderTimeoutId = window.setTimeout(() => {
const text = getMarkdown(vditor);
if (vditor.options.counter > 0) {
vditor.counter.render(text.length, vditor.options.counter);
}

if (typeof vditor.options.input === "function" && options.enableInput) {
vditor.options.input(text);
}

if (vditor.options.cache) {
localStorage.setItem(`vditor${vditor.id}`, text);
}
Expand Down

0 comments on commit acf900c

Please sign in to comment.