diff --git a/src/data/extra/web/js/graphpreviewer.js b/src/data/extra/web/js/graphpreviewer.js index 97ff5556..d010a6cb 100644 --- a/src/data/extra/web/js/graphpreviewer.js +++ b/src/data/extra/web/js/graphpreviewer.js @@ -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) { diff --git a/src/widgets/viewwindow.cpp b/src/widgets/viewwindow.cpp index 3cdfe755..14b7b9a7 100644 --- a/src/widgets/viewwindow.cpp +++ b/src/widgets/viewwindow.cpp @@ -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: