mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
Small fix
* Add *.rmd to Markdown suffix * Turn on system title bar by default * Enable AutoBreak by default * Fix title on new note
This commit is contained in:
parent
75dc7c6f28
commit
f2bfcd25d1
@ -24,7 +24,10 @@ void FileTypeHelper::setupBuiltInTypes()
|
||||
type.m_type = Type::Markdown;
|
||||
type.m_displayName = Buffer::tr("Markdown");
|
||||
type.m_typeName = QStringLiteral("Markdown");
|
||||
type.m_suffixes << QStringLiteral("md") << QStringLiteral("mkd") << QStringLiteral("markdown");
|
||||
type.m_suffixes << QStringLiteral("md")
|
||||
<< QStringLiteral("mkd")
|
||||
<< QStringLiteral("rmd")
|
||||
<< QStringLiteral("markdown");
|
||||
m_fileTypes.push_back(type);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include "configmgr.h"
|
||||
#include "mainconfig.h"
|
||||
|
||||
using namespace vnotex;
|
||||
|
||||
@ -53,6 +54,10 @@ void SessionConfig::init()
|
||||
const auto &sessionJobj = sessionSettings->getJson();
|
||||
|
||||
loadCore(sessionJobj);
|
||||
|
||||
if (MainConfig::isVersionChanged()) {
|
||||
doVersionSpecificOverride();
|
||||
}
|
||||
}
|
||||
|
||||
void SessionConfig::loadCore(const QJsonObject &p_session)
|
||||
@ -75,12 +80,7 @@ void SessionConfig::loadCore(const QJsonObject &p_session)
|
||||
if (!isUndefinedKey(coreObj, QStringLiteral("system_title_bar"))) {
|
||||
m_systemTitleBarEnabled = readBool(coreObj, QStringLiteral("system_title_bar"));
|
||||
} else {
|
||||
// Enable system title bar on macOS by default.
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
|
||||
m_systemTitleBarEnabled = true;
|
||||
#else
|
||||
m_systemTitleBarEnabled = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!isUndefinedKey(coreObj, QStringLiteral("minimize_to_system_tray"))) {
|
||||
@ -277,3 +277,10 @@ void SessionConfig::setMinimizeToSystemTray(bool p_enabled)
|
||||
{
|
||||
updateConfig(m_minimizeToSystemTray, p_enabled ? 1 : 0, this);
|
||||
}
|
||||
|
||||
void SessionConfig::doVersionSpecificOverride()
|
||||
{
|
||||
// In a new version, we may want to change one value by force.
|
||||
// SHOULD set the in memory variable only, or will override the notebook list.
|
||||
m_systemTitleBarEnabled = true;
|
||||
}
|
||||
|
@ -93,6 +93,8 @@ namespace vnotex
|
||||
|
||||
QJsonObject saveStateAndGeometry() const;
|
||||
|
||||
void doVersionSpecificOverride();
|
||||
|
||||
QString m_newNotebookDefaultRootFolderPath;
|
||||
|
||||
// Use root folder to identify a notebook uniquely.
|
||||
|
@ -247,7 +247,7 @@
|
||||
"//comment" : "Whether allow HTML tags in source",
|
||||
"html_tag" : true,
|
||||
"//comment" : "Whether auto break a line with '\\n'",
|
||||
"auto_break" : false,
|
||||
"auto_break" : true,
|
||||
"//comment" : "Whether convert URL-like text to links",
|
||||
"linkify" : true,
|
||||
"//comment" : "Whether add indentation to the first line of paragraph",
|
||||
|
@ -241,7 +241,7 @@ void MarkdownViewWindow::handleBufferChangedInternal()
|
||||
Q_ASSERT(m_mode != Mode::Read);
|
||||
const auto &markdownEditorConfig = ConfigMgr::getInst().getEditorConfig().getMarkdownEditorConfig();
|
||||
if (markdownEditorConfig.getInsertFileNameAsTitle() && buffer->getContent().isEmpty()) {
|
||||
const auto title = QString("# %1\n").arg(QFileInfo(buffer->getName()).baseName());
|
||||
const auto title = QString("# %1\n").arg(QFileInfo(buffer->getName()).completeBaseName());
|
||||
m_editor->insertText(title);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user