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 1 commit
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
6 changes: 5 additions & 1 deletion schemas/Composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
"startsThread": {
"description": "Whether this message begins a new thread or not.",
"type": "boolean"
},
"isRichTextEditor": {
"description": "Whether this message was composed in the WYSIWYG-style rich text editor.",
jonnyandrew marked this conversation as resolved.
Show resolved Hide resolved
"type": "boolean"
}
},
"required": ["eventName", "isEditing", "isReply", "inThread"],
"required": ["eventName", "isEditing", "isReply", "inThread", "isRichTextEditor"],
"additionalProperties": false
}
32 changes: 32 additions & 0 deletions schemas/FormattedMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"type": "object",
"description": "Triggered when the user formats the message content within the composer.",
"properties": {
"eventName": {
"enum": ["FormattedMessage"]
},
"isRichTextEditor": {
"description": "Whether this message was composed in the rich text editor(as opposed to the predateding markdown-based edtior).",
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
"type": "boolean"
},
"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", "isRichTextEditor"],
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
"additionalProperties": false
}

24 changes: 24 additions & 0 deletions schemas/Mention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"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"
]
},
"isRichTextEditor": {
"description": "Whether this message was composed in the WYSIWYG-style rich text editor.",
"type": "boolean"
}
},
"required": ["targetType", "eventName", "isRichTextEditor"],
"additionalProperties": false
}

6 changes: 5 additions & 1 deletion schemas/SlashCommand.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
"Part",
"Invite"
]
},
"isRichTextEditor": {
"description": "Whether this message was composed in the WYSIWYG-style rich text editor.",
"type": "boolean"
}
},
"required": ["command", "eventName"],
"required": ["command", "eventName", "isRichTextEditor"],
"additionalProperties": false
}
5 changes: 5 additions & 0 deletions types/kotlin/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ data class Composer (
*/
val isReply: Boolean,

/**
* Whether this message was composed in the WYSIWYG-style rich text editor.
*/
val isRichTextEditor: Boolean,

/**
* Whether this message begins a new thread or not.
*/
Expand Down
23 changes: 23 additions & 0 deletions types/kotlin/FormattedMessage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package quicktype

/**
* Triggered when the user formats the message content within the composer.
*/
data class FormattedMessage (
val eventName: EventName,

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

/**
* Whether this message was composed in the rich text editor(as opposed to the predateding
* markdown-based edtior).
*/
val isRichTextEditor: Boolean
)

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

/**
* Triggered when the user mentions another user or room using the @ or # symbols
* respectively.
*/
data class Mention (
val eventName: EventName,

/**
* Whether this message was composed in the WYSIWYG-style rich text editor.
*/
val isRichTextEditor: Boolean,

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

enum class EventName {
Mention
}

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

val eventName: EventName
val eventName: EventName,

/**
* Whether this message was composed in the WYSIWYG-style rich text editor.
*/
val isRichTextEditor: Boolean
)

/**
Expand Down
6 changes: 6 additions & 0 deletions types/kotlin2/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ data class Composer(
* sent event.
*/
val isReply: Boolean,
/**
* Whether this message was composed in the WYSIWYG-style rich text
* editor.
*/
val isRichTextEditor: Boolean,
/**
* Whether this message begins a new thread or not.
*/
Expand All @@ -52,6 +57,7 @@ data class Composer(
put("inThread", inThread)
put("isEditing", isEditing)
put("isReply", isReply)
put("isRichTextEditor", isRichTextEditor)
startsThread?.let { put("startsThread", it) }
}.takeIf { it.isNotEmpty() }
}
Expand Down
99 changes: 99 additions & 0 deletions types/kotlin2/FormattedMessage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2021 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package im.vector.app.features.analytics.plan

import im.vector.app.features.analytics.itf.VectorAnalyticsEvent

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/**
* Triggered when the user formats the message content within the composer.
*/
data class FormattedMessage(
/**
* The format action taken.
*/
val formatAction: FormatAction,
/**
* Whether this message was composed in the rich text editor(as opposed
* to the predateding markdown-based edtior).
*/
val isRichTextEditor: Boolean,
) : VectorAnalyticsEvent {

enum class FormatAction {
/**
* Bold
*/
Bold,

/**
* Code block
*/
CodeBlock,

/**
* Inline code
*/
InlineCode,

/**
* Italic
*/
Italic,

/**
* Link
*/
Link,

/**
* Ordered list
*/
OrderedList,

/**
* Quote
*/
Quote,

/**
* Strikethrough
*/
Strikethrough,

/**
* Underline
*/
Underline,

/**
* Unordered list
*/
UnorderedList,
}

override fun getName() = "FormattedMessage"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("formatAction", formatAction.name)
put("isRichTextEditor", isRichTextEditor)
}.takeIf { it.isNotEmpty() }
}
}
53 changes: 53 additions & 0 deletions types/kotlin2/Mention.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2021 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package im.vector.app.features.analytics.plan

import im.vector.app.features.analytics.itf.VectorAnalyticsEvent

// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT
// https://github.com/matrix-org/matrix-analytics-events/

/**
* Triggered when the user mentions another user or room using the @ or #
* symbols respectively.
*/
data class Mention(
/**
* Whether this message was composed in the WYSIWYG-style rich text
* editor.
*/
val isRichTextEditor: Boolean,
/**
* The type of object targeted by the mention.
*/
val targetType: TargetType,
) : VectorAnalyticsEvent {

enum class TargetType {
Room,
User,
}

override fun getName() = "Mention"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("isRichTextEditor", isRichTextEditor)
put("targetType", targetType.name)
}.takeIf { it.isNotEmpty() }
}
}
6 changes: 6 additions & 0 deletions types/kotlin2/SlashCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ data class SlashCommand(
* The name of this command.
*/
val command: Command,
/**
* Whether this message was composed in the WYSIWYG-style rich text
* editor.
*/
val isRichTextEditor: Boolean,
) : VectorAnalyticsEvent {

enum class Command {
Expand All @@ -41,6 +46,7 @@ data class SlashCommand(
override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("command", command.name)
put("isRichTextEditor", isRichTextEditor)
}.takeIf { it.isNotEmpty() }
}
}
6 changes: 5 additions & 1 deletion types/swift/Composer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ extension AnalyticsEvent {
public let isEditing: Bool
/// Whether the user's composer interaction was a reply to a previously sent event.
public let isReply: Bool
/// Whether this message was composed in the WYSIWYG-style rich text editor.
public let isRichTextEditor: Bool
/// Whether this message begins a new thread or not.
public let startsThread: Bool?

public init(inThread: Bool, isEditing: Bool, isReply: Bool, startsThread: Bool?) {
public init(inThread: Bool, isEditing: Bool, isReply: Bool, isRichTextEditor: Bool, startsThread: Bool?) {
self.inThread = inThread
self.isEditing = isEditing
self.isReply = isReply
self.isRichTextEditor = isRichTextEditor
self.startsThread = startsThread
}

Expand All @@ -45,6 +48,7 @@ extension AnalyticsEvent {
"inThread": inThread,
"isEditing": isEditing,
"isReply": isReply,
"isRichTextEditor": isRichTextEditor,
"startsThread": startsThread as Any
]
}
Expand Down
Loading