recover extensions

Mathjax does not work because of JS.
This commit is contained in:
Le Tan 2019-07-28 12:28:39 +08:00
parent a16d2ea4c0
commit e40b8c677e
2 changed files with 7 additions and 9 deletions

View File

@ -89,7 +89,7 @@ QUrl VFile::getBaseUrl() const
// Need to judge the path: Url, local file, resource file. // Need to judge the path: Url, local file, resource file.
QUrl baseUrl; QUrl baseUrl;
// Use file path to make in page anchor work. // Use file path to make in page anchor work.
QString filePath = fetchBasePath(); QString filePath = fetchPath();
QFileInfo pathInfo(filePath); QFileInfo pathInfo(filePath);
if (pathInfo.exists()) { if (pathInfo.exists()) {
if (pathInfo.isNativePath()) { if (pathInfo.isNativePath()) {

View File

@ -4,6 +4,7 @@
#include <QPrintDialog> #include <QPrintDialog>
#include <QPainter> #include <QPainter>
#include <QWebPage> #include <QWebPage>
#include <QWebFrame>
#include "vmainwindow.h" #include "vmainwindow.h"
#include "vdirectorytree.h" #include "vdirectorytree.h"
@ -917,7 +918,6 @@ void VMainWindow::initMarkdownMenu()
QMenu *markdownMenu = menuBar()->addMenu(tr("&Markdown")); QMenu *markdownMenu = menuBar()->addMenu(tr("&Markdown"));
markdownMenu->setToolTipsVisible(true); markdownMenu->setToolTipsVisible(true);
/*
initConverterMenu(markdownMenu); initConverterMenu(markdownMenu);
initMarkdownitOptionMenu(markdownMenu); initMarkdownitOptionMenu(markdownMenu);
@ -969,7 +969,6 @@ void VMainWindow::initMarkdownMenu()
}); });
markdownMenu->addAction(lineNumberAct); markdownMenu->addAction(lineNumberAct);
lineNumberAct->setChecked(g_config->getEnableCodeBlockLineNumber()); lineNumberAct->setChecked(g_config->getEnableCodeBlockLineNumber());
*/
QAction *previewImageAct = new QAction(tr("In-Place Preview"), this); QAction *previewImageAct = new QAction(tr("In-Place Preview"), this);
previewImageAct->setToolTip(tr("Enable in-place preview (images, diagrams, and formulas) in edit mode (re-open current tabs to make it work)")); previewImageAct->setToolTip(tr("Enable in-place preview (images, diagrams, and formulas) in edit mode (re-open current tabs to make it work)"));
@ -1716,6 +1715,8 @@ void VMainWindow::initMarkdownExtensionMenu(QMenu *p_menu)
mathjaxAct->setChecked(g_config->getEnableMathjax()); mathjaxAct->setChecked(g_config->getEnableMathjax());
connect(mathjaxAct, &QAction::triggered, connect(mathjaxAct, &QAction::triggered,
this, &VMainWindow::enableMathjax); this, &VMainWindow::enableMathjax);
mathjaxAct->setChecked(false);
mathjaxAct->setEnabled(false);
optMenu->addAction(mathjaxAct); optMenu->addAction(mathjaxAct);
QAction *wavedromAct = new QAction(tr("&WaveDrom"), optMenu); QAction *wavedromAct = new QAction(tr("&WaveDrom"), optMenu);
@ -2090,7 +2091,6 @@ void VMainWindow::updateActionsStateFromTab(const VEditTab *p_tab)
deleteNoteAct->setEnabled(file && file->getType() == FileType::Note); deleteNoteAct->setEnabled(file && file->getType() == FileType::Note);
noteInfoAct->setEnabled(file && !systemFile); noteInfoAct->setEnabled(file && !systemFile);
m_attachmentBtn->setEnabled(file && file->getType() == FileType::Note); m_attachmentBtn->setEnabled(file && file->getType() == FileType::Note);
m_headingBtn->setEnabled(file && editMode); m_headingBtn->setEnabled(file && editMode);
@ -3599,7 +3599,6 @@ void VMainWindow::setupFileListSplitOut(bool p_enabled)
void VMainWindow::collectUserStat() const void VMainWindow::collectUserStat() const
{ {
/*
// One request per day. // One request per day.
auto lastCheckDate = g_config->getLastUserTrackDate(); auto lastCheckDate = g_config->getLastUserTrackDate();
if (lastCheckDate != QDate::currentDate()) { if (lastCheckDate != QDate::currentDate()) {
@ -3607,11 +3606,11 @@ void VMainWindow::collectUserStat() const
qDebug() << "send user track" << QDate::currentDate(); qDebug() << "send user track" << QDate::currentDate();
QWebEnginePage *page = new QWebEnginePage; QWebPage *page = new QWebPage;
QString url = QString("https://tamlok.github.io/user_track/vnote/vnote_%1.html").arg(VConfigManager::c_version); QString url = QString("https://tamlok.github.io/user_track/vnote/vnote_%1.html").arg(VConfigManager::c_version);
page->load(QUrl(url)); page->mainFrame()->load(QUrl(url));
connect(page, &QWebEnginePage::loadFinished, connect(page, &QWebPage::loadFinished,
this, [page](bool) { this, [page](bool) {
VUtils::sleepWait(2000); VUtils::sleepWait(2000);
page->deleteLater(); page->deleteLater();
@ -3619,7 +3618,6 @@ void VMainWindow::collectUserStat() const
} }
QTimer::singleShot(30 * 60 * 1000, this, SLOT(collectUserStat())); QTimer::singleShot(30 * 60 * 1000, this, SLOT(collectUserStat()));
*/
} }
void VMainWindow::promptForVNoteRestart() void VMainWindow::promptForVNoteRestart()