Skip to content
Closed
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
hand the content wrapper to the menububble explicitly
Signed-off-by: Azul <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
azul authored and max-nextcloud committed Jan 19, 2022
commit 0b09a9cdbd5d785bc98ba0f84ce4a16ce8168564
6 changes: 3 additions & 3 deletions js/editor-rich.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

10 changes: 5 additions & 5 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.

2 changes: 1 addition & 1 deletion js/files.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/public.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<template>
<div id="editor-container">
<div v-if="currentSession && active" class="document-status">
<div v-if="displayed" class="document-status">
<p v-if="idle" class="msg">
{{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }} <a class="button primary" @click="reconnect">{{ t('text', 'Reconnect') }}</a>
</p>
Expand All @@ -33,7 +33,7 @@
{{ t('text', 'File could not be loaded. Please check your internet connection.') }} <a class="button primary" @click="reconnect">{{ t('text', 'Reconnect') }}</a>
</p>
</div>
<div v-if="currentSession && active" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !initialLoading && !hasConnectionIssue, 'richEditor': isRichEditor, 'show-color-annotations': showAuthorAnnotations}">
<div v-if="displayed" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !initialLoading && !hasConnectionIssue, 'richEditor': isRichEditor, 'show-color-annotations': showAuthorAnnotations}">
<div id="editor">
<MenuBar v-if="!syncError && !readOnly"
ref="menubar"
Expand All @@ -42,7 +42,7 @@
:is-rich-editor="isRichEditor"
:is-public="isPublic"
:autohide="autohide">
<div v-if="currentSession && active" id="editor-session-list">
<div id="editor-session-list">
<div v-tooltip="lastSavedStatusTooltip" class="save-status" :class="lastSavedStatusClass">
{{ lastSavedStatus }}
</div>
Expand All @@ -52,9 +52,10 @@
</div>
<slot name="header" />
</MenuBar>
<div ref="wrapper" class="content-wrapper">
<div ref="contentWrapper" class="content-wrapper">
<MenuBubble v-if="!readOnly && isRichEditor"
:editor="tiptap"
:content-wrapper="contentWrapper"
:file-path="relativePath" />
<EditorContent v-show="initialLoading"
class="editor__content"
Expand Down Expand Up @@ -152,7 +153,7 @@ export default {
IDLE_TIMEOUT,

tiptap: null,
/** @type SyncService */
/** @type {SyncService} */
syncService: null,

document: null,
Expand All @@ -171,6 +172,7 @@ export default {
forceRecreate: false,

saveStatusPolling: null,
contentWrapper: null,
}
},
computed: {
Expand Down Expand Up @@ -222,11 +224,19 @@ export default {
fileExtension() {
return this.relativePath ? this.relativePath.split('/').pop().split('.').pop() : 'txt'
},
displayed() {
return this.currentSession && this.active
},
},
watch: {
lastSavedStatus() {
this.$refs.menubar && this.$refs.menubar.redrawMenuBar()
},
displayed() {
this.$nextTick(() => {
this.contentWrapper = this.$refs.contentWrapper
})
},
},
mounted() {
if (this.active && (this.hasDocumentParameters)) {
Expand Down
10 changes: 8 additions & 2 deletions src/components/MenuBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export default {
required: false,
default: null,
},
// used to calculate the position based on the scrollOffset
contentWrapper: {
type: Object,
required: false,
default: null,
},
filePath: {
type: String,
required: false,
Expand Down Expand Up @@ -160,10 +166,10 @@ export default {
this.hideLinkMenu()
},
bubblePosition(menu) {
const wrapper = this.$parent.$refs.wrapper
const left = Math.max(this.minLeft, menu.left)
const offset = this.contentWrapper?.scrollTop || 0
return {
top: `${menu.top + wrapper.scrollTop + 5}px`,
top: `${menu.top + offset + 5}px`,
left: `${left}px`,
}
},
Expand Down