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

Move emoji picker and "Insert image" under the overflow menu #2611

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
:autohide="autohide"
:loaded.sync="menubarLoaded">
<div class="text-editor__session-list">
<div v-if="isMobile" v-tooltip="lastSavedStatusTooltip" :class="saveStatusClass" />
<ContentSave v-if="isMobile" v-tooltip="lastSavedStatusTooltip" :fill-color="savedColor" />
<div v-else
v-tooltip="lastSavedStatusTooltip"
class="save-status"
Expand Down Expand Up @@ -125,6 +125,7 @@ import { Collaboration, Keymap, UserColor } from './../extensions/index.js'
import isMobile from './../mixins/isMobile.js'
import store from './../mixins/store.js'
import Lock from 'vue-material-design-icons/Lock'
import ContentSave from 'vue-material-design-icons/ContentSave'
import MenuBar from './Menu/MenuBar.vue'
import EditorMidiaHandler from './EditorMediaHandler.vue'

Expand All @@ -142,6 +143,7 @@ export default {
GuestNameDialog: () => import(/* webpackChunkName: "editor-guest" */'./GuestNameDialog.vue'),
SessionList: () => import(/* webpackChunkName: "editor-collab" */'./SessionList.vue'),
Lock,
ContentSave,
},
directives: {
Tooltip,
Expand Down Expand Up @@ -267,6 +269,12 @@ export default {
}
return this.dirtyStateIndicator ? t('text', 'Saving …') : t('text', 'Saved')
},
savedColor() {
if (this.hasConnectionIssue) {
return 'var(--color-error)'
}
return this.dirtyStateIndicator ? 'var(--color-background-dark)' : 'var(--color-primary)'
},
lastSavedStatusClass() {
return this.syncError && this.lastSavedString !== '' ? 'error' : ''
},
Expand Down
6 changes: 6 additions & 0 deletions src/components/Menu/ActionEntry.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@
}
}
}

@media (max-width: 660px) {
.emoji-popover {
top: calc(-55vh) !important;
}
}
45 changes: 41 additions & 4 deletions src/components/Menu/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,26 @@
<HelpModal v-if="displayHelp" @close="hideHelp" />

<div v-if="$isRichEditor" ref="menubar" class="text-menubar__entries">
<ActionEntry v-for="actionEntry of visibleEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
<template v-if="!isMobile">
<ActionEntry v-for="actionEntry of visibleEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</template>
<template v-else>
<div class="top-menubar">
<ActionEntry v-for="actionEntry of topEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</div>
<div class="bottom-menubar">
<ActionEntry v-for="actionEntry of bottomEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</div>
</template>
</div>
<div class="text-menubar__slot">
<slot />
Expand All @@ -50,13 +66,15 @@ import debounce from 'debounce'

import HelpModal from '../HelpModal.vue'
import actionsFullEntries from './entries.js'
import mobileEntries from './mobileEntries.js'
import ActionEntry from './ActionEntry.js'
import { DotsHorizontal } from '../icons.js'
import {
useEditorMixin,
useIsRichEditorMixin,
useIsRichWorkspaceMixin,
} from '../EditorWrapper.provider.js'
import isMobile from '../../mixins/isMobile.js'

export default {
name: 'MenuBar',
Expand All @@ -65,6 +83,7 @@ export default {
useEditorMixin,
useIsRichEditorMixin,
useIsRichWorkspaceMixin,
isMobile,
],
props: {
autohide: {
Expand Down Expand Up @@ -128,6 +147,12 @@ export default {
return priority !== undefined && priority > this.iconsLimit
})
},
topEntries() {
return [...mobileEntries].filter(({ position }) => position === 'top')
},
bottomEntries() {
return [...mobileEntries].filter(({ position }) => position === 'bottom')
},
remainAction() {
return {
key: 'remain',
Expand Down Expand Up @@ -262,6 +287,18 @@ export default {
.text-menubar__entries {
margin-left: 0;
}
.top-menubar {
display: flex;
}

.bottom-menubar {
display: flex;
position: fixed;
top: calc(100vh - 15vh);
left: 0;
width: 100%;
overflow-y: scroll;
}
}
}
</style>
4 changes: 2 additions & 2 deletions src/components/Menu/entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ export default [
action: (command, emojiObject = {}) => {
return command.emoji(emojiObject)
},
priority: 4,
priority: 19,
},
{
key: 'insert-image',
label: t('text', 'Insert image'),
icon: Images,
component: ActionImageUpload,
priority: 2,
priority: 18,
},
{
key: 'formatting-help',
Expand Down
Loading