Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Bring back keyboard shortcuts to help modal on non-mobile
Cache result of method `isMobilePlatform()` as computed property, given
that it doesn't change within one browser anyway.

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot-nextcloud[bot] committed Jun 20, 2023
commit 1b8d4e9093d50bd65fb0f2221f64f25f43661abb
40 changes: 22 additions & 18 deletions src/components/HelpModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@close="$emit('close')">
<h2>{{ t('text', 'Formatting help') }}</h2>
<p>{{ t('text', 'Speed up your writing with simple shortcuts.') }}</p>
<p v-if="!isMobilePlatform">
<p v-if="!isMobileCached">
{{ t('text', 'Just type the Markdown syntax or use keyboard shortcuts from below.') }}
</p>
<p v-else>
Expand All @@ -17,7 +17,7 @@
<tr>
<th>{{ t('text', 'Style') }}</th>
<th>{{ t('text', 'Syntax') }}</th>
<th v-if="!isMobilePlatform">
<th v-if="!isMobileCached">
{{ t('text', 'Keyboard shortcuts') }}
</th>
</tr>
Expand All @@ -28,7 +28,7 @@
<td>
<kbd>{{ t('text', 'Enter') }}</kbd>
</td>
<td v-if="!isMobilePlatform" />
<td v-if="!isMobileCached" />
</tr>
<tr>
<td>{{ t('text', 'Hard line break') }}</td>
Expand All @@ -37,7 +37,7 @@
{{ t('text', 'followed by') }}
<kbd>{{ t('text', 'Backspace') }}</kbd>
</td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Shift') }}</kbd>
+
<kbd>{{ t('text', 'Enter') }}</kbd>
Expand All @@ -46,7 +46,7 @@
<tr>
<td>{{ t('text', 'Bold') }}</td>
<td><code>**{{ t('text', 'Bold text') }}**</code></td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>B</kbd>
Expand All @@ -55,7 +55,7 @@
<tr>
<td>{{ t('text', 'Italic') }}</td>
<td><code>*{{ t('text', 'Italicized text') }}*</code></td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>I</kbd>
Expand All @@ -64,7 +64,7 @@
<tr>
<td>{{ t('text', 'Strikethrough') }}</td>
<td><code>~~{{ t('text', 'Mistaken text') }}~~</code></td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>{{ t('text', 'Shift') }}</kbd>
Expand All @@ -75,7 +75,7 @@
<tr>
<td>{{ t('text', 'Underline') }}</td>
<td><code>__{{ t('text', 'Underlined text') }}__</code></td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>U</kbd>
Expand All @@ -88,7 +88,7 @@
<td class="ellipsis_top">
<code># {{ t('text', 'Heading level 1') }}</code>
</td>
<td v-if="!isMobilePlatform" class="ellipsis_top">
<td v-if="!isMobileCached" class="ellipsis_top">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>{{ t('text', 'Shift') }}</kbd>
Expand All @@ -103,7 +103,7 @@
<td class="noborder ellipsis">
</td>
<td v-if="!isMobilePlatform" class="ellipsis noborder">
<td v-if="!isMobileCached" class="ellipsis noborder">
</td>
</tr>
Expand All @@ -114,7 +114,7 @@
<td class="noborder ellipsis_bottom">
<code>###### {{ t('text', 'Heading level 6') }}</code>
</td>
<td v-if="!isMobilePlatform" class="noborder ellipsis_bottom">
<td v-if="!isMobileCached" class="noborder ellipsis_bottom">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>{{ t('text', 'Shift') }}</kbd>
Expand All @@ -127,7 +127,7 @@
<td>
<code>* {{ t('text', 'An item') }}</code>
</td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>{{ t('text', 'Shift') }}</kbd>
Expand All @@ -140,7 +140,7 @@
<td>
<code>1. {{ t('text', 'First item') }}</code>
</td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>{{ t('text', 'Shift') }}</kbd>
Expand All @@ -153,14 +153,14 @@
<td>
<code>* [] {{ t('text', 'To-Do item') }}</code>
</td>
<td v-if="!isMobilePlatform" />
<td v-if="!isMobileCached" />
</tr>
<tr>
<td>{{ t('text', 'Blockquote') }}</td>
<td>
<code>> {{ t('text', 'Quoted text') }}</code>
</td>
<td v-if="!isMobilePlatform">
<td v-if="!isMobileCached">
<kbd>{{ t('text', 'Ctrl') }}</kbd>
+
<kbd>></kbd>
Expand All @@ -171,7 +171,7 @@
<td>
<code>``` {{ t('text', 'Some code') }}</code>
</td>
<td v-if="!isMobilePlatform" />
<td v-if="!isMobileCached" />
</tr>
</tbody>
</table>
Expand All @@ -180,7 +180,7 @@

<script>
import { NcModal, Tooltip } from '@nextcloud/vue'
import { isMobilePlatform } from './../helpers/platform.js'
import { isMobilePlatform } from '../helpers/platform.js'

export default {
name: 'HelpModal',
Expand Down Expand Up @@ -210,6 +210,10 @@ export default {
isFormatted() {
return (style) => this.formatted[style]
},
// Cache the output of `isMobilePlatform()`
isMobileCached() {
return this.isMobilePlatform()
},
},
methods: {
toggleFormatted(style) {
Expand All @@ -230,7 +234,7 @@ export default {
// Remove padding-right on mobile, screen might not be wide enough
@media only screen and (max-width: 512px) {
.modal-container {
padding: 30px 0px 20px 40px;
padding: 30px 0 20px 40px;
}
}
}
Expand Down