Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] Bring back keyboard shortcuts to help modal on non-mobile #4320

Merged
merged 3 commits into from
Jun 20, 2023
Merged
Changes from 2 commits
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
42 changes: 24 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 @@ -223,14 +227,16 @@ export default {
<style lang="scss" scoped>
:deep(.modal-wrapper) {
.modal-container {
width: max-content;
padding: 30px 40px 20px;
user-select: text;
}

// 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;
width: inherit;
padding: 10px 0;
}
}
}
Expand Down
Loading