mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
use QWebEnginePage::linkHovered instead
This commit is contained in:
parent
3cd96794d1
commit
bab0140c9f
@ -859,7 +859,6 @@ var finishOneAsyncJob = function() {
|
|||||||
// markdown-specifi handle logics, such as Mermaid, MathJax.
|
// markdown-specifi handle logics, such as Mermaid, MathJax.
|
||||||
var finishLogics = function() {
|
var finishLogics = function() {
|
||||||
if (asyncJobsCount <= 0) {
|
if (asyncJobsCount <= 0) {
|
||||||
hookLinks();
|
|
||||||
content.finishLogics();
|
content.finishLogics();
|
||||||
calculateWordCount();
|
calculateWordCount();
|
||||||
}
|
}
|
||||||
@ -1428,18 +1427,3 @@ var setPreviewContent = function(lang, html) {
|
|||||||
previewDiv.className = '';
|
previewDiv.className = '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Show the href text of a link when mouse is over it.
|
|
||||||
var showRefInLink = function(e) {
|
|
||||||
if (typeof content.showHoveredLink != 'undefined') {
|
|
||||||
content.showHoveredLink(this.href);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var hookLinks = function() {
|
|
||||||
var As = document.links;
|
|
||||||
|
|
||||||
for (var i = 0; i < As.length; ++i){
|
|
||||||
As[i].onmouseover = showRefInLink;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
@ -188,8 +188,3 @@ void VDocument::previewCodeBlockCB(int p_id, const QString &p_lang, const QStrin
|
|||||||
{
|
{
|
||||||
emit codeBlockPreviewReady(p_id, p_lang, p_html);
|
emit codeBlockPreviewReady(p_id, p_lang, p_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDocument::showHoveredLink(const QString &p_link)
|
|
||||||
{
|
|
||||||
emit linkHovered(p_link);
|
|
||||||
}
|
|
||||||
|
@ -112,9 +112,6 @@ public slots:
|
|||||||
|
|
||||||
void previewCodeBlockCB(int p_id, const QString &p_lang, const QString &p_html);
|
void previewCodeBlockCB(int p_id, const QString &p_lang, const QString &p_html);
|
||||||
|
|
||||||
// Show @p_link in status line.
|
|
||||||
void showHoveredLink(const QString &p_link);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void textChanged(const QString &text);
|
void textChanged(const QString &text);
|
||||||
|
|
||||||
@ -176,8 +173,6 @@ signals:
|
|||||||
|
|
||||||
void codeBlockPreviewReady(int p_id, const QString &p_lang, const QString &p_html);
|
void codeBlockPreviewReady(int p_id, const QString &p_lang, const QString &p_html);
|
||||||
|
|
||||||
void linkHovered(const QString &p_link);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_toc;
|
QString m_toc;
|
||||||
QString m_header;
|
QString m_header;
|
||||||
|
@ -411,6 +411,8 @@ void VMdTab::setupMarkdownViewer()
|
|||||||
m_webViewer->setZoomFactor(g_config->getWebZoomFactor());
|
m_webViewer->setZoomFactor(g_config->getWebZoomFactor());
|
||||||
connect(page->profile(), &QWebEngineProfile::downloadRequested,
|
connect(page->profile(), &QWebEngineProfile::downloadRequested,
|
||||||
this, &VMdTab::handleDownloadRequested);
|
this, &VMdTab::handleDownloadRequested);
|
||||||
|
connect(page, &QWebEnginePage::linkHovered,
|
||||||
|
this, &VMdTab::statusMessage);
|
||||||
|
|
||||||
// Avoid white flash before loading content.
|
// Avoid white flash before loading content.
|
||||||
page->setBackgroundColor(Qt::transparent);
|
page->setBackgroundColor(Qt::transparent);
|
||||||
@ -457,8 +459,6 @@ void VMdTab::setupMarkdownViewer()
|
|||||||
|
|
||||||
emit statusUpdated(info);
|
emit statusUpdated(info);
|
||||||
});
|
});
|
||||||
connect(m_document, &VDocument::linkHovered,
|
|
||||||
this, &VMdTab::statusMessage);
|
|
||||||
|
|
||||||
page->setWebChannel(channel);
|
page->setWebChannel(channel);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user