Editor performance fixes
This commit is contained in:
parent
57f45f0c5f
commit
34e15ee1c4
@ -395,10 +395,11 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
||||
|
||||
const debouncedRefreshPreview = debounce(refreshPreview, 50);
|
||||
|
||||
const onEditorChanged =
|
||||
(sectionList = this.sectionList, selectionRange = this.selectionRange) => {
|
||||
if (this.sectionList !== sectionList) {
|
||||
this.sectionList = sectionList;
|
||||
let newSectionList;
|
||||
let newSelectionRange;
|
||||
const onEditorChanged = debounce(() => {
|
||||
if (this.sectionList !== newSectionList) {
|
||||
this.sectionList = newSectionList;
|
||||
this.$emit('sectionList', this.sectionList);
|
||||
if (instantPreview) {
|
||||
refreshPreview();
|
||||
@ -406,15 +407,17 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
||||
debouncedRefreshPreview();
|
||||
}
|
||||
}
|
||||
if (this.selectionRange !== selectionRange) {
|
||||
this.selectionRange = selectionRange;
|
||||
if (this.selectionRange !== newSelectionRange) {
|
||||
this.selectionRange = newSelectionRange;
|
||||
this.$emit('selectionRange', this.selectionRange);
|
||||
}
|
||||
this.saveContentState();
|
||||
};
|
||||
}, 10);
|
||||
|
||||
this.clEditor.selectionMgr.on('selectionChanged',
|
||||
(start, end, selectionRange) => onEditorChanged(undefined, selectionRange));
|
||||
this.clEditor.selectionMgr.on('selectionChanged', (start, end, selectionRange) => {
|
||||
newSelectionRange = selectionRange;
|
||||
onEditorChanged();
|
||||
});
|
||||
|
||||
/* -----------------------------
|
||||
* Inline images
|
||||
@ -502,8 +505,10 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
||||
triggerImgCacheGc();
|
||||
});
|
||||
|
||||
this.clEditor.on('contentChanged',
|
||||
(content, diffs, sectionList) => onEditorChanged(sectionList));
|
||||
this.clEditor.on('contentChanged', (content, diffs, sectionList) => {
|
||||
newSectionList = sectionList;
|
||||
onEditorChanged();
|
||||
});
|
||||
|
||||
// clEditorSvc.setPreviewElt(element[0].querySelector('.preview__inner-2'))
|
||||
// var previewElt = element[0].querySelector('.preview')
|
||||
|
@ -118,6 +118,7 @@
|
||||
text-align: center;
|
||||
background-color: #007acc;
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.landing__footer a {
|
||||
|
Loading…
Reference in New Issue
Block a user