mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
show hovered link in status line in read mode
This commit is contained in:
parent
adacaef1c7
commit
960426579b
@ -859,6 +859,7 @@ var finishOneAsyncJob = function() {
|
||||
// markdown-specifi handle logics, such as Mermaid, MathJax.
|
||||
var finishLogics = function() {
|
||||
if (asyncJobsCount <= 0) {
|
||||
hookLinks();
|
||||
content.finishLogics();
|
||||
calculateWordCount();
|
||||
}
|
||||
@ -1427,3 +1428,18 @@ var setPreviewContent = function(lang, html) {
|
||||
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,3 +188,8 @@ void VDocument::previewCodeBlockCB(int p_id, const QString &p_lang, const QStrin
|
||||
{
|
||||
emit codeBlockPreviewReady(p_id, p_lang, p_html);
|
||||
}
|
||||
|
||||
void VDocument::showHoveredLink(const QString &p_link)
|
||||
{
|
||||
emit linkHovered(p_link);
|
||||
}
|
||||
|
@ -112,6 +112,9 @@ public slots:
|
||||
|
||||
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:
|
||||
void textChanged(const QString &text);
|
||||
|
||||
@ -173,6 +176,8 @@ signals:
|
||||
|
||||
void codeBlockPreviewReady(int p_id, const QString &p_lang, const QString &p_html);
|
||||
|
||||
void linkHovered(const QString &p_link);
|
||||
|
||||
private:
|
||||
QString m_toc;
|
||||
QString m_header;
|
||||
|
@ -2542,7 +2542,7 @@ QAction *VMainWindow::newAction(const QIcon &p_icon,
|
||||
|
||||
void VMainWindow::showStatusMessage(const QString &p_msg)
|
||||
{
|
||||
const int timeout = 3000;
|
||||
const int timeout = 5000;
|
||||
statusBar()->showMessage(p_msg, timeout);
|
||||
}
|
||||
|
||||
|
@ -457,6 +457,8 @@ void VMdTab::setupMarkdownViewer()
|
||||
|
||||
emit statusUpdated(info);
|
||||
});
|
||||
connect(m_document, &VDocument::linkHovered,
|
||||
this, &VMdTab::statusMessage);
|
||||
|
||||
page->setWebChannel(channel);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user