Skip to content
Merged
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
Only show partial content of unfocused workspace on mobile
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 18, 2019
commit a669c37a2e7ec51fa626f35af1f56c04b329f7f2
8 changes: 7 additions & 1 deletion src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</SessionList>
</div>
</MenuBar>
<div class="editor__content">
<div>
<MenuBubble v-if="!readOnly && isRichEditor" :editor="tiptap" />
<EditorContent v-show="initialLoading"
class="editor__content"
Expand Down Expand Up @@ -316,6 +316,12 @@ export default {
enableRichEditing: this.isRichEditor,
languages,
})
this.tiptap.on('focus', () => {
this.$emit('focus')
})
this.tiptap.on('blur', () => {
this.$emit('blur')
})
this.syncService.state = this.tiptap.state
})
})
Expand Down
27 changes: 25 additions & 2 deletions src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div id="rich-workspace" :class="{'icon-loading': !loaded || !ready }">
<div id="rich-workspace" :class="{'icon-loading': !loaded || !ready, 'focus': focus }">
<div v-if="!file || (autofocus && !ready)" class="empty-workspace" @click="createNew">
<p class="placeholder">
{{ t('text', 'Add notes, lists or links …') }}
Expand All @@ -38,7 +38,9 @@
:autohide="true"
:mime="file.mimetype"
:autofocus="autofocus"
@ready="ready=true" />
@ready="ready=true"
@focus="focus=true"
@blur="focus=false" />
</div>
</template>

Expand All @@ -62,6 +64,7 @@ export default {
},
data() {
return {
focus: false,
file: null,
loaded: false,
ready: false,
Expand Down Expand Up @@ -158,4 +161,24 @@ export default {
#rich-workspace::v-deep .editor__content {
margin: 0;
}

@media only screen and (max-width: 1024px) {
#rich-workspace:not(.focus) {
max-height: 30vh;
position: relative;
overflow: hidden;
}
#rich-workspace:not(.focus):not(.icon-loading):after {
content: '';
position: absolute;
z-index: 1;
bottom: 0;
left: 0;
pointer-events: none;
background-image: linear-gradient(to bottom, rgba(0,0,0, 0), var(--color-main-background));
width: 100%;
height: 4em;
}
}

</style>