Add support for plugin links (#6386)
Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#pragma once
|
||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||
# include "messages/Link.hpp"
|
||||
# include "messages/Message.hpp"
|
||||
|
||||
# include <sol/forward.hpp>
|
||||
|
||||
# include <cstdint>
|
||||
|
||||
namespace chatterino::lua::api::message {
|
||||
|
||||
/* @lua-fragment
|
||||
@@ -32,6 +35,7 @@ c2.Message = {}
|
||||
---@class MessageElementInitBase
|
||||
---@field tooltip? string Tooltip text
|
||||
---@field trailing_space? boolean Whether to add a trailing space after the element (default: true)
|
||||
---@field link? c2.Link An action when clicking on this element. Mention and Link elements don't support this. They manage the link themselves.
|
||||
|
||||
---@alias MessageColor "text"|"link"|"system"|string A color for a text element - "text", "link", and "system" are special values that take the current theme into account
|
||||
|
||||
@@ -86,6 +90,20 @@ c2.Message = {}
|
||||
function c2.Message.new(init) end
|
||||
*/
|
||||
|
||||
/** @lua@alias c2.Link { type: c2.LinkType, value: string } A link on a message element. */
|
||||
|
||||
// We only want certain links to be usable
|
||||
// Note: code dependant on this needs these values to be meaningful `Link::Type`s
|
||||
/** @exposeenum c2.LinkType */
|
||||
enum class ExposedLinkType : std::uint8_t {
|
||||
Url = Link::Type::Url,
|
||||
UserInfo = Link::Type::UserInfo,
|
||||
UserAction = Link::Type::UserAction, // run a command/send message
|
||||
JumpToChannel = Link::Type::JumpToChannel,
|
||||
CopyToClipboard = Link::Type::CopyToClipboard,
|
||||
JumpToMessage = Link::Type::JumpToMessage,
|
||||
};
|
||||
|
||||
/**
|
||||
* @includefile singletons/Fonts.hpp
|
||||
* @includefile messages/MessageElement.hpp
|
||||
|
||||
Reference in New Issue
Block a user