diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html
index 35349e14..def06350 100644
--- a/routes/_components/compose/ComposeBox.html
+++ b/routes/_components/compose/ComposeBox.html
@@ -9,7 +9,7 @@
{{/if}}
-
+
@@ -188,26 +188,29 @@
dialogs.showComposeDialog()
} else {
// else we're actually posting a new toot
- let text = this.get('text')
- let media = this.get('media')
- let postPrivacyKey = this.get('postPrivacyKey')
- let contentWarning = this.get('contentWarning')
- let sensitive = media.length && !!contentWarning
- let realm = this.get('realm')
- let mediaIds = media.map(_ => _.data.id)
- let inReplyTo = (realm === 'home' || realm === 'dialog') ? null : realm
- let overLimit = this.get('overLimit')
- let mediaDescriptions = this.get('mediaDescriptions')
-
- if (!text || overLimit) {
- return // do nothing if invalid
- }
-
- /* no await */
- postStatus(realm, text, inReplyTo, mediaIds,
- sensitive, contentWarning, postPrivacyKey, mediaDescriptions)
+ this.onPostAction();
}
},
+ onPostAction() {
+ let text = this.get('text')
+ let media = this.get('media')
+ let postPrivacyKey = this.get('postPrivacyKey')
+ let contentWarning = this.get('contentWarning')
+ let sensitive = media.length && !!contentWarning
+ let realm = this.get('realm')
+ let mediaIds = media.map(_ => _.data.id)
+ let inReplyTo = (realm === 'home' || realm === 'dialog') ? null : realm
+ let overLimit = this.get('overLimit')
+ let mediaDescriptions = this.get('mediaDescriptions')
+
+ if (!text || overLimit) {
+ return // do nothing if invalid
+ }
+
+ /* no await */
+ postStatus(realm, text, inReplyTo, mediaIds,
+ sensitive, contentWarning, postPrivacyKey, mediaDescriptions)
+ },
setupStickyObserver() {
this.__stickyObserver = new IntersectionObserver(entries => {
this.set({sticky: !entries[0].isIntersecting})
diff --git a/routes/_components/compose/ComposeInput.html b/routes/_components/compose/ComposeInput.html
index f00043a1..d34d5df1 100644
--- a/routes/_components/compose/ComposeInput.html
+++ b/routes/_components/compose/ComposeInput.html
@@ -101,11 +101,18 @@
},
onKeydown(e) {
let { keyCode } = e
+ const ctrlPressed =
+ e.getModifierState('Control') || e.getModifierState('Meta')
switch (keyCode) {
case 9: // tab
- case 13: //enter
this.clickSelectedAutosuggestion(e)
break
+ case 13: //enter
+ const autosuggestionClicked = this.clickSelectedAutosuggestion(e)
+ if (!autosuggestionClicked && ctrlPressed) {
+ this.fire('postAction')
+ }
+ break
case 38: // up
this.incrementAutosuggestSelected(-1, e)
break
@@ -121,7 +128,7 @@
clickSelectedAutosuggestion(event) {
let autosuggestionShown = this.store.get('composeAutosuggestionShown')
if (!autosuggestionShown) {
- return
+ return false
}
let type = this.store.get('composeAutosuggestionType')
if (type === 'account') {
@@ -131,6 +138,7 @@
}
event.preventDefault()
event.stopPropagation()
+ return true
},
incrementAutosuggestSelected(increment, event) {
let autosuggestionShown = this.store.get('composeAutosuggestionShown')
@@ -170,4 +178,4 @@
selectionChange
}
}
-
\ No newline at end of file
+