mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
* [#1575] Support paste * WebView: Implement copy * Localize copy dialog, lint * Implement a custom context menu for copy/paste * Remove click event which causes double events * WebView: Fix input events broken by moved preventDefault We want to fall back to the `input` event for Android bug and paste, but we want to prevent the event for the others, so change the order
This commit is contained in:
@@ -79,6 +79,16 @@ object WebView : Websocket<String>() {
|
||||
val deltaY: Float? = null,
|
||||
) : TypeObject()
|
||||
|
||||
@Serializable
|
||||
@SerialName("paste")
|
||||
data class JsPasteMessage(
|
||||
val data: String,
|
||||
) : TypeObject()
|
||||
|
||||
@Serializable
|
||||
@SerialName("copy")
|
||||
class JsCopyMessage : TypeObject()
|
||||
|
||||
override fun handleRequest(ctx: WsMessageContext) {
|
||||
val dr = driver ?: return
|
||||
try {
|
||||
@@ -97,6 +107,12 @@ object WebView : Websocket<String>() {
|
||||
is JsEventMessage -> {
|
||||
dr.event(event)
|
||||
}
|
||||
is JsPasteMessage -> {
|
||||
dr.paste(event.data)
|
||||
}
|
||||
is JsCopyMessage -> {
|
||||
dr.copy()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.warn(e) { "Failed to deserialize client request: ${ctx.message()}" }
|
||||
|
||||
Reference in New Issue
Block a user