Plugin links pt 2: Link::InsertText (#6527)
This commit is contained in:
@@ -190,6 +190,7 @@ std::unique_ptr<MessageElement> elementFromTable(const sol::table &tbl)
|
||||
break;
|
||||
|
||||
// these links should be safe to click as they don't have any immediate action associated with them
|
||||
case Link::InsertText:
|
||||
case Link::JumpToChannel:
|
||||
case Link::JumpToMessage:
|
||||
case Link::UserInfo:
|
||||
@@ -201,7 +202,6 @@ std::unique_ptr<MessageElement> elementFromTable(const sol::table &tbl)
|
||||
case Link::None:
|
||||
case Link::AutoModAllow:
|
||||
case Link::AutoModDeny:
|
||||
case Link::InsertText:
|
||||
case Link::OpenAccountsPage:
|
||||
case Link::Reconnect:
|
||||
throw std::runtime_error(
|
||||
|
||||
@@ -102,6 +102,7 @@ enum class ExposedLinkType : std::uint8_t {
|
||||
JumpToChannel = Link::Type::JumpToChannel,
|
||||
CopyToClipboard = Link::Type::CopyToClipboard,
|
||||
JumpToMessage = Link::Type::JumpToMessage,
|
||||
InsertText = Link::Type::InsertText,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2423,6 +2423,15 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||
if (link.type == Link::InsertText)
|
||||
{
|
||||
this->linkClicked.invoke(link);
|
||||
|
||||
if (this->context_ == Context::None)
|
||||
{
|
||||
auto *split = dynamic_cast<Split *>(this->parentWidget());
|
||||
if (split)
|
||||
{
|
||||
split->insertTextToInput(link.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user