Removed async preview hook
This commit is contained in:
parent
2972ffb97f
commit
5b251b61e3
@ -191,9 +191,12 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
|||||||
this.tocElt.classList[
|
this.tocElt.classList[
|
||||||
this.tocElt.querySelector('.cl-toc-section *') ? 'remove' : 'add'
|
this.tocElt.querySelector('.cl-toc-section *') ? 'remove' : 'add'
|
||||||
]('toc-tab--empty');
|
]('toc-tab--empty');
|
||||||
|
|
||||||
|
this.previewText = this.previewElt.textContent;
|
||||||
|
this.$emit('previewText', this.previewText);
|
||||||
this.makeTextToPreviewDiffs();
|
this.makeTextToPreviewDiffs();
|
||||||
|
|
||||||
// Run preview async operations (image loading, mathjax...)
|
// Wait for images to load
|
||||||
const loadedPromises = loadingImages.map(imgElt => new Promise((resolve) => {
|
const loadedPromises = loadingImages.map(imgElt => new Promise((resolve) => {
|
||||||
if (!imgElt.src) {
|
if (!imgElt.src) {
|
||||||
resolve();
|
resolve();
|
||||||
@ -205,13 +208,9 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
|||||||
img.src = imgElt.src;
|
img.src = imgElt.src;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Promise.all(loadedPromises.concat(extensionSvc.asyncPreview(this.options)))
|
Promise.all(loadedPromises)
|
||||||
.then(() => {
|
// Debounce if sections have already been measured
|
||||||
this.previewText = this.previewElt.textContent;
|
.then(() => this.measureSectionDimensions(!!this.sectionDescMeasuredList));
|
||||||
this.$emit('previewText', this.previewText);
|
|
||||||
// Debounce if sections have already been mesured
|
|
||||||
this.measureSectionDimensions(!!this.sectionDescMeasuredList);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const getOptionsListeners = [];
|
const getOptionsListeners = [];
|
||||||
const initConverterListeners = [];
|
const initConverterListeners = [];
|
||||||
const sectionPreviewListeners = [];
|
const sectionPreviewListeners = [];
|
||||||
const asyncPreviewListeners = [];
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
onGetOptions(listener) {
|
onGetOptions(listener) {
|
||||||
@ -16,10 +15,6 @@ export default {
|
|||||||
sectionPreviewListeners.push(listener);
|
sectionPreviewListeners.push(listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
onAsyncPreview(listener) {
|
|
||||||
asyncPreviewListeners.push(listener);
|
|
||||||
},
|
|
||||||
|
|
||||||
getOptions(properties, isCurrentFile) {
|
getOptions(properties, isCurrentFile) {
|
||||||
return getOptionsListeners.reduce((options, listener) => {
|
return getOptionsListeners.reduce((options, listener) => {
|
||||||
listener(options, properties, isCurrentFile);
|
listener(options, properties, isCurrentFile);
|
||||||
@ -39,8 +34,4 @@ export default {
|
|||||||
listener(elt, options);
|
listener(elt, options);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
asyncPreview(options) {
|
|
||||||
return Promise.all(asyncPreviewListeners.map(listener => listener(options)));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user