mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
MarkdownEditor: fix
1. Fix issue that duplicated images would not be processed when copied; 2. Add suffix `*.nasm` to Intel ASM syntax.
This commit is contained in:
parent
ff7cf0f24e
commit
2d4d4609da
@ -1 +1 @@
|
|||||||
Subproject commit 08b440d3045c944a8a6d7f8945a197ff56dcec82
|
Subproject commit 6d924bef99de572016c34311063b50482b5851c6
|
@ -40,7 +40,7 @@ You should have received a copy of the GNU General Public License along
|
|||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
-->
|
-->
|
||||||
<language name="Intel x86 (NASM)" section="Assembler" version="3" kateversion="2.3" extensions="*.asm" mimetype="" author="Nicola Gigante (nicola.gigante@gmail.com)" license="GPLv2+">
|
<language name="Intel x86 (NASM)" section="Assembler" version="3" kateversion="2.3" extensions="*.asm;*.nasm" mimetype="" author="Nicola Gigante (nicola.gigante@gmail.com)" license="GPLv2+">
|
||||||
<highlighting>
|
<highlighting>
|
||||||
<list name="registers">
|
<list name="registers">
|
||||||
<!-- General purpose registers -->
|
<!-- General purpose registers -->
|
||||||
|
@ -254,7 +254,8 @@ bool FileUtils::isText(const QString &p_filePath)
|
|||||||
{
|
{
|
||||||
QMimeDatabase mimeDatabase;
|
QMimeDatabase mimeDatabase;
|
||||||
auto mimeType = mimeDatabase.mimeTypeForFile(p_filePath);
|
auto mimeType = mimeDatabase.mimeTypeForFile(p_filePath);
|
||||||
if (mimeType.name().startsWith(QStringLiteral("text/"))) {
|
const auto name = mimeType.name();
|
||||||
|
if (name.startsWith(QStringLiteral("text/")) || name == QStringLiteral("application/x-zerosize")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +346,6 @@ QString FileUtils::generateFileNameWithSequence(const QString &p_folderPath,
|
|||||||
void FileUtils::removeEmptyDir(const QString &p_dirPath)
|
void FileUtils::removeEmptyDir(const QString &p_dirPath)
|
||||||
{
|
{
|
||||||
QDir dir(p_dirPath);
|
QDir dir(p_dirPath);
|
||||||
qDebug() << "removeEmptyDir" << p_dirPath << dir.isEmpty();
|
|
||||||
if (dir.isEmpty()) {
|
if (dir.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include <vtextedit/markdowneditorconfig.h>
|
#include <vtextedit/markdowneditorconfig.h>
|
||||||
#include <vtextedit/previewmgr.h>
|
#include <vtextedit/previewmgr.h>
|
||||||
@ -1396,12 +1397,22 @@ void MarkdownEditor::uploadImagesToImageHost()
|
|||||||
proDlg.setWindowModality(Qt::WindowModal);
|
proDlg.setWindowModality(Qt::WindowModal);
|
||||||
proDlg.setWindowTitle(tr("Upload Images To Image Host"));
|
proDlg.setWindowTitle(tr("Upload Images To Image Host"));
|
||||||
|
|
||||||
|
QHash<QString, QString> uploadedImages;
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
auto cursor = m_textEdit->textCursor();
|
auto cursor = m_textEdit->textCursor();
|
||||||
cursor.beginEditBlock();
|
cursor.beginEditBlock();
|
||||||
for (int i = 0; i < images.size(); ++i) {
|
for (int i = 0; i < images.size(); ++i) {
|
||||||
const auto &link = images[i];
|
const auto &link = images[i];
|
||||||
|
|
||||||
|
auto it = uploadedImages.find(link.m_path);
|
||||||
|
if (it != uploadedImages.end()) {
|
||||||
|
cursor.setPosition(link.m_urlInLinkPos);
|
||||||
|
cursor.setPosition(link.m_urlInLinkPos + link.m_urlInLink.size(), QTextCursor::KeepAnchor);
|
||||||
|
cursor.insertText(it.value());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
proDlg.setValue(i + 1);
|
proDlg.setValue(i + 1);
|
||||||
if (proDlg.wasCanceled()) {
|
if (proDlg.wasCanceled()) {
|
||||||
break;
|
break;
|
||||||
@ -1444,6 +1455,7 @@ void MarkdownEditor::uploadImagesToImageHost()
|
|||||||
cursor.setPosition(link.m_urlInLinkPos);
|
cursor.setPosition(link.m_urlInLinkPos);
|
||||||
cursor.setPosition(link.m_urlInLinkPos + link.m_urlInLink.size(), QTextCursor::KeepAnchor);
|
cursor.setPosition(link.m_urlInLinkPos + link.m_urlInLink.size(), QTextCursor::KeepAnchor);
|
||||||
cursor.insertText(targetUrl);
|
cursor.insertText(targetUrl);
|
||||||
|
uploadedImages.insert(link.m_path, targetUrl);
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
cursor.endEditBlock();
|
cursor.endEditBlock();
|
||||||
|
@ -77,6 +77,7 @@ void FindAndReplaceWidget::setupUI()
|
|||||||
|
|
||||||
m_findLineEdit = WidgetsFactory::createLineEdit(this);
|
m_findLineEdit = WidgetsFactory::createLineEdit(this);
|
||||||
m_findLineEdit->setPlaceholderText(tr("Search"));
|
m_findLineEdit->setPlaceholderText(tr("Search"));
|
||||||
|
m_findLineEdit->setClearButtonEnabled(true);
|
||||||
connect(m_findLineEdit, &QLineEdit::textChanged,
|
connect(m_findLineEdit, &QLineEdit::textChanged,
|
||||||
m_findTextTimer, QOverload<>::of(&QTimer::start));
|
m_findTextTimer, QOverload<>::of(&QTimer::start));
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ void SearchPanel::setupUI()
|
|||||||
m_keywordComboBox->setEditable(true);
|
m_keywordComboBox->setEditable(true);
|
||||||
m_keywordComboBox->setLineEdit(WidgetsFactory::createLineEdit(mainWidget));
|
m_keywordComboBox->setLineEdit(WidgetsFactory::createLineEdit(mainWidget));
|
||||||
m_keywordComboBox->lineEdit()->setProperty(PropertyDefs::c_embeddedLineEdit, true);
|
m_keywordComboBox->lineEdit()->setProperty(PropertyDefs::c_embeddedLineEdit, true);
|
||||||
|
m_keywordComboBox->lineEdit()->setClearButtonEnabled(true);
|
||||||
m_keywordComboBox->completer()->setCaseSensitivity(Qt::CaseSensitive);
|
m_keywordComboBox->completer()->setCaseSensitivity(Qt::CaseSensitive);
|
||||||
connect(m_keywordComboBox->lineEdit(), &QLineEdit::returnPressed,
|
connect(m_keywordComboBox->lineEdit(), &QLineEdit::returnPressed,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
|
@ -1162,9 +1162,13 @@ void ViewWindow::replaceAll(const QString &p_text, FindOptions p_options, const
|
|||||||
|
|
||||||
void ViewWindow::showFindResult(const QStringList &p_texts, int p_totalMatches, int p_currentMatchIndex)
|
void ViewWindow::showFindResult(const QStringList &p_texts, int p_totalMatches, int p_currentMatchIndex)
|
||||||
{
|
{
|
||||||
|
if (p_texts.isEmpty() || p_texts[0].isEmpty()) {
|
||||||
|
showMessage(QString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_totalMatches == 0) {
|
if (p_totalMatches == 0) {
|
||||||
showMessage(tr("Pattern not found: %1%2").arg(p_texts.isEmpty() ? QString() : p_texts[0],
|
showMessage(tr("Pattern not found: %1").arg(p_texts.join(QStringLiteral("; "))));
|
||||||
p_texts.size() > 1 ? tr(" [+]"): QString()));
|
|
||||||
} else {
|
} else {
|
||||||
showMessage(tr("Match found: %1/%2").arg(p_currentMatchIndex + 1).arg(p_totalMatches));
|
showMessage(tr("Match found: %1/%2").arg(p_currentMatchIndex + 1).arg(p_totalMatches));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user