From 54670876008c403842e9597766e1412c2026ac27 Mon Sep 17 00:00:00 2001 From: montelale Date: Tue, 22 Dec 2020 21:08:39 +0100 Subject: [PATCH 1/3] Adds new HTML contenteditable div and relative CSS --- client/index.html | 5 +++-- client/styles.css | 29 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/client/index.html b/client/index.html index 6924895..8e50e75 100644 --- a/client/index.html +++ b/client/index.html @@ -79,7 +79,7 @@
- +
Save @@ -94,7 +94,8 @@

Send a Message

- + +
Cancel diff --git a/client/styles.css b/client/styles.css index 6cb70af..d54c1bc 100644 --- a/client/styles.css +++ b/client/styles.css @@ -496,6 +496,24 @@ textarea { background: #f1f3f4; } +.textareaElement { + box-sizing: border-box; + border: none; + outline: none; + padding: 16px 24px; + border-radius: 16px; + margin: 8px 0; + font-size: 14px; + font-family: inherit; + background: #f1f3f4; + display: block; + overflow: auto; + resize: none; + min-height: 40px; + line-height: 16px; + max-height: 300px; +} + /* Info Animation */ @@ -679,8 +697,8 @@ screen and (min-width: 1100px) { } } -/* - Color Themes +/* + Color Themes */ /* Default colors */ @@ -704,6 +722,11 @@ textarea { background-color: var(--input-bg-color); } +.textareaElement { + color: var(--text-color); + background-color: var(--input-bg-color); +} + /* Dark theme colors */ body.dark-theme { --text-color: #eee; @@ -727,4 +750,4 @@ body.dark-theme { --bg-color: #fafafa; --input-bg-color: #f1f3f4; } -} \ No newline at end of file +} From c14c121ba5e2097f3479ebb0bc1998f92103b92f Mon Sep 17 00:00:00 2001 From: montelale Date: Tue, 22 Dec 2020 21:23:10 +0100 Subject: [PATCH 2/3] Fixes chatting functions for new approach (contenteditable div) --- client/scripts/ui.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 88735ab..599b3c3 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -19,12 +19,12 @@ class PeersUI { Events.on('peer-joined', e => this._onPeerJoined(e.detail)); Events.on('peer-left', e => this._onPeerLeft(e.detail)); Events.on('peers', e => this._onPeers(e.detail)); - Events.on('file-progress', e => this._onFileProgress(e.detail)); + Events.on('file-progress', e => this._onFileProgress(e.detail)); Events.on('paste', e => this._onPaste(e)); } _onPeerJoined(peer) { - if ($(peer.id)) return; // peer already exists + if ($(peer.id)) return; // peer already exists const peerUI = new PeerUI(peer); $$('x-peers').appendChild(peerUI.$el); } @@ -49,9 +49,9 @@ class PeersUI { _clearPeers() { const $peers = $$('x-peers').innerHTML = ''; - } - - _onPaste(e) { + } + + _onPaste(e) { const files = e.clipboardData.files || e.clipboardData.items .filter(i => i.type.indexOf('image') > -1) .map(i => i.getAsFile()); @@ -72,7 +72,7 @@ class PeersUI { class PeerUI { html() { - return ` + return `