mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't insert "data:image.." after image paste cancel.
This commit is contained in:
parent
b377c02ad3
commit
b648548001
4 changed files with 7 additions and 2 deletions
|
@ -5668,7 +5668,7 @@ bool HistoryWidget::confirmSendingFiles(
|
||||||
cursor.setPosition(position, QTextCursor::KeepAnchor);
|
cursor.setPosition(position, QTextCursor::KeepAnchor);
|
||||||
}
|
}
|
||||||
_field->setTextCursor(cursor);
|
_field->setTextCursor(cursor);
|
||||||
if (!insertTextOnCancel.isEmpty()) {
|
if (Ui::InsertTextOnImageCancel(insertTextOnCancel)) {
|
||||||
_field->textCursor().insertText(insertTextOnCancel);
|
_field->textCursor().insertText(insertTextOnCancel);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -3415,7 +3415,7 @@ Fn<void()> ComposeControls::restoreTextCallback(
|
||||||
cursor.setPosition(position, QTextCursor::KeepAnchor);
|
cursor.setPosition(position, QTextCursor::KeepAnchor);
|
||||||
}
|
}
|
||||||
_field->setTextCursor(cursor);
|
_field->setTextCursor(cursor);
|
||||||
if (!insertTextOnCancel.isEmpty()) {
|
if (Ui::InsertTextOnImageCancel(insertTextOnCancel)) {
|
||||||
_field->textCursor().insertText(insertTextOnCancel);
|
_field->textCursor().insertText(insertTextOnCancel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,6 +82,10 @@ bool CanBeInAlbumType(PreparedFile::Type type, AlbumType album) {
|
||||||
Unexpected("AlbumType in CanBeInAlbumType.");
|
Unexpected("AlbumType in CanBeInAlbumType.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InsertTextOnImageCancel(const QString &text) {
|
||||||
|
return !text.isEmpty() && !text.startsWith(u"data:image"_q);
|
||||||
|
}
|
||||||
|
|
||||||
PreparedList PreparedList::Reordered(
|
PreparedList PreparedList::Reordered(
|
||||||
PreparedList &&list,
|
PreparedList &&list,
|
||||||
std::vector<int> order) {
|
std::vector<int> order) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct PreparedFile {
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] bool CanBeInAlbumType(PreparedFile::Type type, AlbumType album);
|
[[nodiscard]] bool CanBeInAlbumType(PreparedFile::Type type, AlbumType album);
|
||||||
|
[[nodiscard]] bool InsertTextOnImageCancel(const QString &text);
|
||||||
|
|
||||||
struct PreparedList {
|
struct PreparedList {
|
||||||
enum class Error {
|
enum class Error {
|
||||||
|
|
Loading…
Add table
Reference in a new issue