From 01c724d61ea68574a4cc651df684f70566e9580b Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Mon, 25 Mar 2019 12:04:21 -0300 Subject: [PATCH 1/2] Fix input text caret size on Safari --- app/theme/client/imports/forms/input.css | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/theme/client/imports/forms/input.css b/app/theme/client/imports/forms/input.css index d530a866b789..0ac7abd71bdf 100644 --- a/app/theme/client/imports/forms/input.css +++ b/app/theme/client/imports/forms/input.css @@ -1,4 +1,6 @@ textarea.rc-input__element { + height: auto; + font-family: inherit; line-height: 0.5rem 1rem; } @@ -52,6 +54,7 @@ textarea.rc-input__element { &__element { width: 100%; + height: 2.5rem; padding: 0 1rem; text-overflow: ellipsis; @@ -64,11 +67,10 @@ textarea.rc-input__element { background-color: transparent; font-size: var(--input-font-size); - - line-height: 2.25rem; + line-height: normal; &--small { - line-height: 1.75rem; + height: 2rem; } &::placeholder { From f38ead213f9bc7460c61e809530d6a9cd4b42cd3 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Mon, 25 Mar 2019 13:30:11 -0300 Subject: [PATCH 2/2] Prevent errors in absence of Permissions API; move microphone handling to messageBoxAudioMessage module --- app/ui-message/client/messageBox.html | 4 +-- app/ui-message/client/messageBox.js | 17 --------- .../client/messageBoxAudioMessage.html | 36 ++++++++++--------- .../client/messageBoxAudioMessage.js | 24 +++++++++++++ 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/app/ui-message/client/messageBox.html b/app/ui-message/client/messageBox.html index 761c72ca5137..a08b102819e7 100644 --- a/app/ui-message/client/messageBox.html +++ b/app/ui-message/client/messageBox.html @@ -26,9 +26,7 @@ {{else}} {{#if subscribed}} - {{#if isAudioMessageAllowed}} - {{> messageBoxAudioMessage rid=_id}} - {{/if}} + {{> messageBoxAudioMessage rid=_id}} {{#if actions}} diff --git a/app/ui-message/client/messageBox.js b/app/ui-message/client/messageBox.js index ebb590cdedd9..a04ff80c3f29 100644 --- a/app/ui-message/client/messageBox.js +++ b/app/ui-message/client/messageBox.js @@ -9,7 +9,6 @@ import { Markdown } from '../../markdown'; import { ChatSubscription } from '../../models'; import { settings } from '../../settings'; import { - AudioRecorder, ChatMessages, chatMessages, fileUpload, @@ -146,14 +145,6 @@ Template.messageBox.onCreated(function() { this.isMicrophoneDenied = new ReactiveVar(true); this.sendIconDisabled = new ReactiveVar(false); messageBox.emit('created', this); - - navigator.permissions.query({ name: 'microphone' }) - .then((permissionStatus) => { - this.isMicrophoneDenied.set(permissionStatus.state === 'denied'); - permissionStatus.onchange = () => { - this.isMicrophoneDenied.set(permissionStatus.state === 'denied'); - }; - }); }); Template.messageBox.onRendered(function() { @@ -241,14 +232,6 @@ Template.messageBox.helpers({ isSendIconDisabled() { return !Template.instance().sendIconDisabled.get(); }, - isAudioMessageAllowed() { - return AudioRecorder.isSupported() && - !Template.instance().isMicrophoneDenied.get() && - settings.get('FileUpload_Enabled') && - settings.get('Message_AudioRecorderEnabled') && - (!settings.get('FileUpload_MediaTypeWhiteList') || - settings.get('FileUpload_MediaTypeWhiteList').match(/audio\/mp3|audio\/\*/i)); - }, actions() { const actionGroups = messageBox.actions.get(); return Object.values(actionGroups) diff --git a/app/ui-message/client/messageBoxAudioMessage.html b/app/ui-message/client/messageBoxAudioMessage.html index 601907ce0e35..2fb54e27ac55 100644 --- a/app/ui-message/client/messageBoxAudioMessage.html +++ b/app/ui-message/client/messageBoxAudioMessage.html @@ -1,20 +1,22 @@ diff --git a/app/ui-message/client/messageBoxAudioMessage.js b/app/ui-message/client/messageBoxAudioMessage.js index e5a071f77096..03aed400ef41 100644 --- a/app/ui-message/client/messageBoxAudioMessage.js +++ b/app/ui-message/client/messageBoxAudioMessage.js @@ -3,6 +3,7 @@ import { Session } from 'meteor/session'; import { Tracker } from 'meteor/tracker'; import { Template } from 'meteor/templating'; import { fileUploadHandler } from '../../file-upload'; +import { settings } from '../../settings'; import { AudioRecorder, chatMessages } from '../../ui'; import { call } from '../../ui-utils'; import { t } from '../../utils'; @@ -87,9 +88,31 @@ const recordingRoomId = new ReactiveVar(null); Template.messageBoxAudioMessage.onCreated(function() { this.state = new ReactiveVar(null); this.time = new ReactiveVar('00:00'); + this.isMicrophoneDenied = new ReactiveVar(true); + + if (navigator.permissions) { + navigator.permissions.query({ name: 'microphone' }) + .then((permissionStatus) => { + this.isMicrophoneDenied.set(permissionStatus.state === 'denied'); + permissionStatus.onchange = () => { + this.isMicrophoneDenied.set(permissionStatus.state === 'denied'); + }; + }); + } else { + this.isMicrophoneDenied.set(false); + } }); Template.messageBoxAudioMessage.helpers({ + isAllowed() { + return AudioRecorder.isSupported() && + !Template.instance().isMicrophoneDenied.get() && + settings.get('FileUpload_Enabled') && + settings.get('Message_AudioRecorderEnabled') && + (!settings.get('FileUpload_MediaTypeWhiteList') || + settings.get('FileUpload_MediaTypeWhiteList').match(/audio\/mp3|audio\/\*/i)); + }, + stateClass() { if (recordingRoomId.get() && (recordingRoomId.get() !== Template.currentData().rid)) { return 'rc-message-box__audio-message--busy'; @@ -129,6 +152,7 @@ Template.messageBoxAudioMessage.events({ recordingRoomId.set(this.rid); } catch (error) { instance.state.set(null); + instance.isMicrophoneDenied.set(true); chatMessages[this.rid].recording = false; } },