mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59: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
|
||||
highlight_matches_in_page=true
|
||||
|
||||
; Incremental search in page
|
||||
find_incremental_search=true
|
||||
|
||||
[editor]
|
||||
; Auto indent as previous line
|
||||
auto_indent=true
|
||||
|
@ -689,8 +689,7 @@ void VMdTab::insertLink()
|
||||
void VMdTab::findText(const QString &p_text, uint p_options, bool p_peek,
|
||||
bool p_forward)
|
||||
{
|
||||
if (m_isEditMode) {
|
||||
Q_ASSERT(m_editor);
|
||||
if (m_isEditMode && !previewExpanded()) {
|
||||
if (p_peek) {
|
||||
m_editor->peekText(p_text, p_options);
|
||||
} else {
|
||||
@ -901,10 +900,27 @@ MarkdownConverterType VMdTab::getMarkdownConverterType() const
|
||||
|
||||
void VMdTab::focusChild()
|
||||
{
|
||||
if (m_mode == Mode::Read) {
|
||||
switch (m_mode) {
|
||||
case Mode::Read:
|
||||
m_webViewer->setFocus();
|
||||
} else {
|
||||
break;
|
||||
|
||||
case Mode::Edit:
|
||||
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)
|
||||
{
|
||||
if (m_isEditMode) {
|
||||
if (m_isEditMode && !previewExpanded()) {
|
||||
VVim *vim = getEditor()->getVim();
|
||||
if (vim) {
|
||||
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_cmd);
|
||||
if (m_isEditMode) {
|
||||
if (m_isEditMode && !previewExpanded()) {
|
||||
VVim *vim = getEditor()->getVim();
|
||||
if (vim) {
|
||||
vim->processCommandLineChanged(p_type, p_cmd);
|
||||
@ -1621,3 +1637,8 @@ bool VMdTab::expandRestorePreviewArea()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VMdTab::previewExpanded() const
|
||||
{
|
||||
return (m_mode == Mode::EditPreview) && !m_editor->isVisible();
|
||||
}
|
||||
|
@ -242,6 +242,8 @@ private:
|
||||
|
||||
void setCurrentMode(Mode p_mode);
|
||||
|
||||
bool previewExpanded() const;
|
||||
|
||||
VMdEditor *m_editor;
|
||||
VWebView *m_webViewer;
|
||||
VDocument *m_document;
|
||||
|
Loading…
x
Reference in New Issue
Block a user