mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 15:13:42 +08:00
Prevent flicker when editing a post
This commit is contained in:
parent
f9fc9dfb72
commit
459e428f4a
|
@ -81,7 +81,7 @@ export default class CommentPost extends Post {
|
||||||
// Every 50ms, if the composer content has changed, then update the post's
|
// Every 50ms, if the composer content has changed, then update the post's
|
||||||
// body with a preview.
|
// body with a preview.
|
||||||
let preview;
|
let preview;
|
||||||
const updateInterval = setInterval(() => {
|
const updatePreview = () => {
|
||||||
const content = app.composer.component.content();
|
const content = app.composer.component.content();
|
||||||
|
|
||||||
if (preview === content) return;
|
if (preview === content) return;
|
||||||
|
@ -89,8 +89,10 @@ export default class CommentPost extends Post {
|
||||||
preview = content;
|
preview = content;
|
||||||
|
|
||||||
s9e.TextFormatter.preview(preview || '', element);
|
s9e.TextFormatter.preview(preview || '', element);
|
||||||
}, 50);
|
};
|
||||||
|
updatePreview();
|
||||||
|
|
||||||
|
const updateInterval = setInterval(updatePreview, 50);
|
||||||
context.onunload = () => clearInterval(updateInterval);
|
context.onunload = () => clearInterval(updateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user