add: clipboard functionality in room view
CTRL+V now checks if the clipboard contains an image and pastes it into the room. The library used for clipboard functionality requires an additional dependency: > Linux: require X11 dev package. For instance, install libx11-dev or xorg-dev or libX11-devel to access X window system.
This commit is contained in:
		@@ -26,6 +26,7 @@ import (
 | 
			
		||||
	"github.com/kyokomi/emoji/v2"
 | 
			
		||||
	"github.com/mattn/go-runewidth"
 | 
			
		||||
	"github.com/zyedidia/clipboard"
 | 
			
		||||
	pasteclip "golang.design/x/clipboard"
 | 
			
		||||
 | 
			
		||||
	"go.mau.fi/mauview"
 | 
			
		||||
	"go.mau.fi/tcell"
 | 
			
		||||
@@ -376,7 +377,14 @@ func (view *RoomView) OnKeyEvent(event mauview.KeyEvent) bool {
 | 
			
		||||
	case "send":
 | 
			
		||||
		view.InputSubmit(view.input.GetText())
 | 
			
		||||
		return true
 | 
			
		||||
	case "paste":
 | 
			
		||||
		cb := pasteclip.Read(pasteclip.FmtImage)
 | 
			
		||||
		if cb != nil {
 | 
			
		||||
			view.SendMessageMedia(string(cb))
 | 
			
		||||
		}
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return view.input.OnKeyEvent(event)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user