join plain text and rich text to one struct.

This commit is contained in:
Miroslav Šedivý
2021-01-29 20:05:13 +01:00
parent 5c9a57ee91
commit 546cd608c3
6 changed files with 63 additions and 62 deletions

View File

@ -16,5 +16,8 @@ func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message
return nil
}
return h.desktop.ClipboardSetPlainText(payload.Text)
return h.desktop.ClipboardSetText(types.ClipboardText{
Text: payload.Text,
// TODO: Send HTML?
})
}

View File

@ -117,14 +117,15 @@ func (ws *WebSocketManagerCtx) Start() {
return
}
text, err := ws.desktop.ClipboardGetPlainText()
data, err := ws.desktop.ClipboardGetText()
if err != nil {
ws.logger.Warn().Err(err).Msg("could not get clipboard content")
}
if err := session.Send(message.ClipboardData{
Event: event.CLIPBOARD_UPDATED,
Text: text,
Text: data.Text,
// TODO: Send HTML?
}); err != nil {
ws.logger.Warn().Err(err).Msg("could not sync clipboard")
}