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

display content first and then load menus #2226

Merged
merged 2 commits into from
Mar 8, 2022
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
4 changes: 2 additions & 2 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.

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/files-modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.

22 changes: 19 additions & 3 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
</p>
</div>
<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="tiptap && !syncError && !readOnly"
<div v-if="tiptap" id="editor">
<MenuBar v-if="initialLoading && !syncError && !readOnly"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be better to use a computed here?

ref="menubar"
:editor="tiptap"
:sync-service="syncService"
Expand All @@ -44,6 +44,7 @@
:is-rich-editor="isRichEditor"
:is-public="isPublic"
:autohide="autohide"
:loaded.sync="menubarLoaded"
@show-help="showHelp">
<div id="editor-session-list">
<div v-tooltip="lastSavedStatusTooltip" class="save-status" :class="lastSavedStatusClass">
Expand All @@ -55,8 +56,9 @@
</div>
<slot name="header" />
</MenuBar>
<div v-if="!menubarLoaded" class="menubar placeholder" />
<div ref="contentWrapper" class="content-wrapper">
<MenuBubble v-if="tiptap && !readOnly && isRichEditor"
<MenuBubble v-if="initialLoading && !readOnly && isRichEditor"
:editor="tiptap"
:content-wrapper="contentWrapper"
:file-path="relativePath" />
Expand Down Expand Up @@ -176,6 +178,7 @@ export default {
hasConnectionIssue: false,
readOnly: true,
forceRecreate: false,
menubarLoaded: false,

saveStatusPolling: null,
displayHelp: false,
Expand Down Expand Up @@ -694,6 +697,19 @@ export default {
padding-top: 50px;
}
}

.menubar.placeholder {
position: fixed;
position: -webkit-sticky;
position: sticky;
top: 0;
opacity: 0;
visibility: hidden;
height: 44px; // important for mobile so that the buttons are always inside the container
padding-top:3px;
padding-bottom: 3px;
}

</style>
<style lang="scss">
@import './../../css/style';
Expand Down
1 change: 1 addition & 0 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export default {
clearInterval(this.checkInterval)
}
}, 100)
this.$emit('update:loaded', true)
},
beforeDestroy() {
window.removeEventListener('resize', this.getWindowWidth)
Expand Down