small fix

This commit is contained in:
Le Tan 2021-01-01 09:13:55 +08:00
parent bc11a8d0af
commit d376d1125e
2 changed files with 28 additions and 14 deletions

View File

@ -26,19 +26,14 @@ class GraphPreviewer {
{ passive: true });
}
// Interface 1.
previewGraph(p_id, p_timeStamp, p_lang, p_text) {
if (p_text.length == 0) {
this.setGraphPreviewData(p_id, p_timeStamp);
return;
}
if (this.firstPreview) {
this.firstPreview = false;
let contentStyle = window.getComputedStyle(this.vnotex.contentContainer);
this.currentColor = contentStyle.getPropertyValue('color');
console.log('currentColor', this.currentColor);
}
this.initOnFirstPreview();
if (p_lang === 'flow' || p_lang === 'flowchart') {
this.vnotex.getWorker('flowchartjs').renderText(this.container,
@ -92,6 +87,29 @@ class GraphPreviewer {
}
}
// Interface 2.
previewMath(p_id, p_timeStamp, p_text) {
if (p_text.length == 0) {
this.setMathPreviewData(p_id, p_timeStamp);
return;
}
this.initOnFirstPreview();
// Do we need to go through TexMath plugin? I don't think so.
this.renderMath(p_id, p_timeStamp, p_text, this.setMathPreviewData.bind(this));
}
initOnFirstPreview() {
if (this.firstPreview) {
this.firstPreview = false;
let contentStyle = window.getComputedStyle(this.vnotex.contentContainer);
this.currentColor = contentStyle.getPropertyValue('color');
console.log('currentColor', this.currentColor);
}
}
renderMath(p_id, p_timeStamp, p_text, p_dataSetter) {
let func = function(p_previewer, p_id, p_timeStamp) {
let previewer = p_previewer;
@ -162,11 +180,6 @@ class GraphPreviewer {
});
}
previewMath(p_id, p_timeStamp, p_text) {
// Do we need to go through TexMath plugin? I don't think so.
this.renderMath(p_id, p_timeStamp, p_text, this.setMathPreviewData.bind(this));
}
// Fix SVG with width and height being '100%'.
fixSvgRelativeWidth(p_svgNode) {
if (p_svgNode.getAttribute('width').indexOf('%') != -1) {

View File

@ -753,8 +753,9 @@ int ViewWindow::checkFileMissingOrChangedOutside()
} else if (m_buffer->checkFileChangedOutside()) {
int ret = MessageBoxHelper::questionSaveDiscardCancel(MessageBoxHelper::Warning,
tr("File is changed from outside (%1).").arg(m_buffer->getPath()),
tr("Do you want to override the file from buffer?"),
tr("The file is changed from outside. Please choose to save the buffer to the file or just discard the buffer and reload the file."),
tr("Do you want to save the buffer to the file to override, or discard the buffer?"),
tr("The file is changed from outside. Please choose to save the buffer to the file or "
"just discard the buffer and reload the file."),
this);
switch (ret) {
case QMessageBox::Save: