mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
MdTab: focus bug fix and find-in-page in expanded preview mode
This commit is contained in:
parent
4d223d0397
commit
62c0f218df
@ -265,6 +265,9 @@ insert_new_note_in_front=false
|
|||||||
; Whether highlight matches in page when activating a search result item
|
; Whether highlight matches in page when activating a search result item
|
||||||
highlight_matches_in_page=true
|
highlight_matches_in_page=true
|
||||||
|
|
||||||
|
; Incremental search in page
|
||||||
|
find_incremental_search=true
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
; Auto indent as previous line
|
; Auto indent as previous line
|
||||||
auto_indent=true
|
auto_indent=true
|
||||||
|
@ -689,8 +689,7 @@ void VMdTab::insertLink()
|
|||||||
void VMdTab::findText(const QString &p_text, uint p_options, bool p_peek,
|
void VMdTab::findText(const QString &p_text, uint p_options, bool p_peek,
|
||||||
bool p_forward)
|
bool p_forward)
|
||||||
{
|
{
|
||||||
if (m_isEditMode) {
|
if (m_isEditMode && !previewExpanded()) {
|
||||||
Q_ASSERT(m_editor);
|
|
||||||
if (p_peek) {
|
if (p_peek) {
|
||||||
m_editor->peekText(p_text, p_options);
|
m_editor->peekText(p_text, p_options);
|
||||||
} else {
|
} else {
|
||||||
@ -901,10 +900,27 @@ MarkdownConverterType VMdTab::getMarkdownConverterType() const
|
|||||||
|
|
||||||
void VMdTab::focusChild()
|
void VMdTab::focusChild()
|
||||||
{
|
{
|
||||||
if (m_mode == Mode::Read) {
|
switch (m_mode) {
|
||||||
|
case Mode::Read:
|
||||||
m_webViewer->setFocus();
|
m_webViewer->setFocus();
|
||||||
} else {
|
break;
|
||||||
|
|
||||||
|
case Mode::Edit:
|
||||||
m_editor->setFocus();
|
m_editor->setFocus();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Mode::EditPreview:
|
||||||
|
if (m_editor->isVisible()) {
|
||||||
|
m_editor->setFocus();
|
||||||
|
} else {
|
||||||
|
m_webViewer->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1305,7 +1321,7 @@ void VMdTab::handleVimCmdCommandCancelled()
|
|||||||
|
|
||||||
void VMdTab::handleVimCmdCommandFinished(VVim::CommandLineType p_type, const QString &p_cmd)
|
void VMdTab::handleVimCmdCommandFinished(VVim::CommandLineType p_type, const QString &p_cmd)
|
||||||
{
|
{
|
||||||
if (m_isEditMode) {
|
if (m_isEditMode && !previewExpanded()) {
|
||||||
VVim *vim = getEditor()->getVim();
|
VVim *vim = getEditor()->getVim();
|
||||||
if (vim) {
|
if (vim) {
|
||||||
vim->processCommandLine(p_type, p_cmd);
|
vim->processCommandLine(p_type, p_cmd);
|
||||||
@ -1328,7 +1344,7 @@ void VMdTab::handleVimCmdCommandChanged(VVim::CommandLineType p_type, const QStr
|
|||||||
{
|
{
|
||||||
Q_UNUSED(p_type);
|
Q_UNUSED(p_type);
|
||||||
Q_UNUSED(p_cmd);
|
Q_UNUSED(p_cmd);
|
||||||
if (m_isEditMode) {
|
if (m_isEditMode && !previewExpanded()) {
|
||||||
VVim *vim = getEditor()->getVim();
|
VVim *vim = getEditor()->getVim();
|
||||||
if (vim) {
|
if (vim) {
|
||||||
vim->processCommandLineChanged(p_type, p_cmd);
|
vim->processCommandLineChanged(p_type, p_cmd);
|
||||||
@ -1621,3 +1637,8 @@ bool VMdTab::expandRestorePreviewArea()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VMdTab::previewExpanded() const
|
||||||
|
{
|
||||||
|
return (m_mode == Mode::EditPreview) && !m_editor->isVisible();
|
||||||
|
}
|
||||||
|
@ -242,6 +242,8 @@ private:
|
|||||||
|
|
||||||
void setCurrentMode(Mode p_mode);
|
void setCurrentMode(Mode p_mode);
|
||||||
|
|
||||||
|
bool previewExpanded() const;
|
||||||
|
|
||||||
VMdEditor *m_editor;
|
VMdEditor *m_editor;
|
||||||
VWebView *m_webViewer;
|
VWebView *m_webViewer;
|
||||||
VDocument *m_document;
|
VDocument *m_document;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user