2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-03 08:05:12 +00:00

Added SpellingHighlighter to InputField in HistoryWidget and some boxes.

This commit is contained in:
23rd
2019-10-18 16:54:26 +03:00
committed by John Preston
parent 6e95cfc24d
commit 4be178c75f
10 changed files with 43 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ private:
QString _startLink;
Fn<void(QString, QString)> _callback;
Fn<void()> _setInnerFocus;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
};
@@ -127,6 +128,7 @@ void EditLinkBox::prepare() {
getDelegate()->outerContainer(),
text,
_session);
_spelling = InitSpellchecker(_session, text);
const auto url = content->add(
object_ptr<Ui::InputField>(
@@ -273,6 +275,17 @@ void InitMessageField(
DefaultEditLinkCallback(&controller->session(), field));
}
base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
not_null<Main::Session*> session,
not_null<Ui::InputField*> field) {
auto s = base::make_unique_q<Spellchecker::SpellingHighlighter>(
field->rawTextEdit(),
session->settings().spellcheckerEnabledValue(),
field->documentContentsChanges());
field->setExtendedContextMenu(s->contextMenuCreated());
return s;
}
bool HasSendText(not_null<const Ui::InputField*> field) {
const auto &text = field->getTextWithTags().text;
for (const auto ch : text) {