Skip to content

Commit

Permalink
Merge pull request #4320 from nextcloud/backport/4251/stable27
Browse files Browse the repository at this point in the history
[stable27] Bring back keyboard shortcuts to help modal on non-mobile
  • Loading branch information
mejo- committed Jun 20, 2023
2 parents 71509b5 + 13996b7 commit 12f0f70
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 36 deletions.
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

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

0 comments on commit 12f0f70

Please sign in to comment.