Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich Text Editor events #80

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion schemas/Composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@
"startsThread": {
"description": "Whether this message begins a new thread or not.",
"type": "boolean"
},
"editor": {
"description": "Whether this message was composed in legacy editor, the new the rich text editor or the new plain text editor",
"type": "string",
"enum": [
"Legacy",
"RteFormatting",
"RtePlain"
]
},
"isMarkdownEnabled": {
"description": "Whether markdown is supported in the editor. This value is not applicable (always false) if editor is RteFormatting.",
"type": "boolean"
}
},
"required": ["eventName", "isEditing", "isReply", "inThread"],
"required": ["eventName", "isEditing", "isReply", "inThread", "editor", "isMarkdownEnabled"],
"additionalProperties": false
}
37 changes: 37 additions & 0 deletions schemas/FormattedMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"type": "object",
"description": "Triggered when the user formats the message content within the composer.",
"properties": {
"eventName": {
"enum": ["FormattedMessage"]
},
"editor": {
"description": "Whether this message was composed in legacy editor, the new the rich text editor or the new plain text editor",
"type": "string",
"enum": [
"Legacy",
"RteFormatting",
"RtePlain"
]
},
"formatAction": {
"description": "The format action taken.",
"type": "string",
"oneOf": [
{"const": "Bold", "description": "Bold" },
{"const": "Italic", "description": "Italic" },
{"const": "Underline", "description": "Underline" },
{"const": "Strikethrough", "description": "Strikethrough" },
{"const": "UnorderedList", "description": "Unordered list" },
{"const": "OrderedList", "description": "Ordered list" },
{"const": "Quote", "description": "Quote" },
{"const": "InlineCode", "description": "Inline code" },
{"const": "CodeBlock", "description": "Code block" },
{"const": "Link", "description": "Link" }
]
}
},
"required": ["eventName", "formatAction", "editor"],
"additionalProperties": false
}

29 changes: 29 additions & 0 deletions schemas/Mention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type": "object",
"description": "Triggered when the user mentions another user or room using the @ or # symbols respectively.",
"properties": {
"eventName": {
"enum": ["Mention"]
},
"targetType": {
"description": "The type of object targeted by the mention.",
"type": "string",
"enum": [
"User",
"Room"
]
},
"editor": {
"description": "Whether this message was composed in legacy editor, the new the rich text editor or the new plain text editor",
"type": "string",
"enum": [
"Legacy",
"RteFormatting",
"RtePlain"
]
}
},
"required": ["targetType", "eventName", "editor"],
"additionalProperties": false
}

11 changes: 10 additions & 1 deletion schemas/SlashCommand.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@
"Part",
"Invite"
]
},
"editor": {
"description": "Whether this message was composed in legacy editor, the new the rich text editor or the new plain text editor",
"type": "string",
"enum": [
"Legacy",
"RteFormatting",
"RtePlain"
]
}
},
"required": ["command", "eventName"],
"required": ["command", "eventName", "editor"],
"additionalProperties": false
}
22 changes: 22 additions & 0 deletions types/kotlin/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ package quicktype
* Triggered when the user sends a message via the composer.
*/
data class Composer (
/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
val editor: Editor,

val eventName: EventName,

/**
Expand All @@ -16,6 +22,12 @@ data class Composer (
*/
val isEditing: Boolean,

/**
* Whether markdown is supported in the editor. This value is not applicable (always false)
* if editor is RteFormatting.
*/
val isMarkdownEnabled: Boolean,

/**
* Whether the user's composer interaction was a reply to a previously sent event.
*/
Expand All @@ -27,6 +39,16 @@ data class Composer (
val startsThread: Boolean? = null
)

/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
enum class Editor {
Legacy,
RTEFormatting,
RTEPlain
}

enum class EventName {
Composer
}
33 changes: 33 additions & 0 deletions types/kotlin/FormattedMessage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package quicktype

/**
* Triggered when the user formats the message content within the composer.
*/
data class FormattedMessage (
/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
val editor: Editor,

val eventName: EventName,

/**
* The format action taken.
*/
val formatAction: String
)

/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
enum class Editor {
Legacy,
RTEFormatting,
RTEPlain
}

enum class EventName {
FormattedMessage
}
42 changes: 42 additions & 0 deletions types/kotlin/Mention.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package quicktype

/**
* Triggered when the user mentions another user or room using the @ or # symbols
* respectively.
*/
data class Mention (
/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
val editor: Editor,

val eventName: EventName,

/**
* The type of object targeted by the mention.
*/
val targetType: TargetType
)

/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
enum class Editor {
Legacy,
RTEFormatting,
RTEPlain
}

enum class EventName {
Mention
}

/**
* The type of object targeted by the mention.
*/
enum class TargetType {
Room,
User
}
16 changes: 16 additions & 0 deletions types/kotlin/SlashCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ data class SlashCommand (
*/
val command: Command,

/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
val editor: Editor,

val eventName: EventName
)

Expand All @@ -20,6 +26,16 @@ enum class Command {
Part
}

/**
* Whether this message was composed in legacy editor, the new the rich text editor or the
* new plain text editor
*/
enum class Editor {
Legacy,
RTEFormatting,
RTEPlain
}

enum class EventName {
SlashCommand
}
18 changes: 18 additions & 0 deletions types/kotlin2/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import im.vector.app.features.analytics.itf.VectorAnalyticsEvent
* Triggered when the user sends a message via the composer.
*/
data class Composer(
/**
* Whether this message was composed in legacy editor, the new the rich
* text editor or the new plain text editor
*/
val editor: Editor,
/**
* Whether the user was using the composer inside of a thread.
*/
Expand All @@ -34,6 +39,11 @@ data class Composer(
* event.
*/
val isEditing: Boolean,
/**
* Whether markdown is supported in the editor. This value is not
* applicable (always false) if editor is RteFormatting.
*/
val isMarkdownEnabled: Boolean,
/**
* Whether the user's composer interaction was a reply to a previously
* sent event.
Expand All @@ -45,12 +55,20 @@ data class Composer(
val startsThread: Boolean? = null,
) : VectorAnalyticsEvent {

enum class Editor {
Legacy,
RteFormatting,
RtePlain,
}

override fun getName() = "Composer"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("editor", editor.name)
put("inThread", inThread)
put("isEditing", isEditing)
put("isMarkdownEnabled", isMarkdownEnabled)
put("isReply", isReply)
startsThread?.let { put("startsThread", it) }
}.takeIf { it.isNotEmpty() }
Expand Down
Loading