small fix

This commit is contained in:
Le Tan 2021-01-13 21:46:47 +08:00
parent 9d76d1f06b
commit 508610d304
4 changed files with 17 additions and 4 deletions

View File

@ -81,6 +81,11 @@ QStringList FileNode::addAttachment(const QString &p_destFolderPath, const QStri
{
QStringList addedFiles;
for (const auto &file : p_files) {
if (PathUtils::isDir(file)) {
qWarning() << "skip adding folder as attachment" << file;
continue;
}
auto destFilePath = m_backend->renameIfExistsCaseInsensitive(
PathUtils::concatenateFilePath(p_destFolderPath, PathUtils::fileName(file)));
m_backend->copyFile(file, destFilePath);

View File

@ -252,10 +252,10 @@
"linkify" : true,
"//comment" : "Whether add indentation to the first line of paragraph",
"indent_first_line" : false,
"//comment" : "Whether enable smart table (formation)",
"//comment" : "Whether enable smart table (formatting)",
"smart_table" : true,
"//comment" : "Time interval (milliseconds) to do smart table formation",
"smart_table_interval" : 2000
"//comment" : "Time interval (milliseconds) to do smart table formatting",
"smart_table_interval" : 1000
}
},
"widget" : {

View File

@ -591,7 +591,7 @@ bool MarkdownEditor::processUrlFromMimeData(const QMimeData *p_source)
if (!localFile.isEmpty()) {
dialog.addSelection(tr("Insert As Relative Link"), 3);
if (m_buffer->isAttachmentSupported() && !m_buffer->isAttachment(localFile)) {
if (m_buffer->isAttachmentSupported() && !m_buffer->isAttachment(localFile) && !PathUtils::isDir(localFile)) {
dialog.addSelection(tr("Attach And Insert Link"), 6);
}
}

View File

@ -32,6 +32,14 @@ QTimer *MarkdownTableHelper::getTimer()
m_timer->setInterval(ConfigMgr::getInst().getEditorConfig().getMarkdownEditorConfig().getSmartTableInterval());
connect(m_timer, &QTimer::timeout,
this, &MarkdownTableHelper::formatTable);
connect(m_editor->getTextEdit(), &QTextEdit::cursorPositionChanged,
this, [this]() {
if (m_timer->isActive()) {
// Defer the formatting.
m_timer->start();
}
});
}
return m_timer;