mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
bug-fix: use the default suffix from markdown suffix list
This commit is contained in:
parent
f9f508c193
commit
dfaa7772df
@ -219,9 +219,13 @@ void VFileList::newFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> suffixes = vconfig.getDocSuffixes()[(int)DocType::Markdown];
|
QList<QString> suffixes = vconfig.getDocSuffixes()[(int)DocType::Markdown];
|
||||||
|
QString defaultSuf;
|
||||||
QString suffixStr;
|
QString suffixStr;
|
||||||
for (auto const & suf : suffixes) {
|
for (auto const & suf : suffixes) {
|
||||||
suffixStr += (suffixStr.isEmpty() ? suf : "/" + suf);
|
suffixStr += (suffixStr.isEmpty() ? suf : "/" + suf);
|
||||||
|
if (defaultSuf.isEmpty() || suf == "md") {
|
||||||
|
defaultSuf = suf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString info = tr("Create a note in <span style=\"%1\">%2</span>.")
|
QString info = tr("Create a note in <span style=\"%1\">%2</span>.")
|
||||||
@ -229,7 +233,7 @@ void VFileList::newFile()
|
|||||||
info = info + "<br>" + tr("Note with name ending with \"%1\" will be treated as Markdown type.")
|
info = info + "<br>" + tr("Note with name ending with \"%1\" will be treated as Markdown type.")
|
||||||
.arg(suffixStr);
|
.arg(suffixStr);
|
||||||
QString text(tr("Note &name:"));
|
QString text(tr("Note &name:"));
|
||||||
QString defaultText("new_note.md");
|
QString defaultText = QString("new_note.%1").arg(defaultSuf);
|
||||||
do {
|
do {
|
||||||
VNewFileDialog dialog(tr("Create Note"), info, text, defaultText, this);
|
VNewFileDialog dialog(tr("Create Note"), info, text, defaultText, this);
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user