Skip to content

Commit

Permalink
fix: hide menu modal when starting to load file
Browse files Browse the repository at this point in the history
Instead of waiting for the file to load completely, hide the menu modal when not docked.
  • Loading branch information
Zoramite committed Jul 9, 2021
1 parent 04d23a6 commit d4143ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/ts/editor/parts/content/sectionFields.ts
Expand Up @@ -63,6 +63,7 @@ export class FieldsPart extends ContentSectionPart {
return 'fields';
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
templateContent(editor: LiveEditor): TemplateResult {
const isValid = this.selective.isValid;
try {
Expand Down
8 changes: 5 additions & 3 deletions src/ts/editor/parts/menu.ts
@@ -1,8 +1,9 @@
import {BasePart, Part} from '.';
import {DialogPriorityLevel, Modal} from '../ui/modal';
import {TemplateResult, classMap, html} from '@blinkk/selective-edit';

import {DataStorage} from '../../utility/dataStorage';
import {EVENT_FILE_LOAD_COMPLETE} from '../events';
import {EVENT_FILE_LOAD} from '../events';
import {EditorState} from '../state';
import {LiveEditor} from '../editor';
import {SitePart} from './menu/site';
Expand Down Expand Up @@ -63,8 +64,9 @@ export class MenuPart extends BasePart implements Part {
this.modal = modal;
editor.parts.modals.modals[MODAL_KEY] = modal;

document.addEventListener(EVENT_FILE_LOAD_COMPLETE, () => {
// When loading a file, close the menu modal.
// When loading a file, close the menu modal.
// Hides the menu when the file is starting to load.
document.addEventListener(EVENT_FILE_LOAD, () => {
modal.hide();
});
}
Expand Down

0 comments on commit d4143ca

Please sign in to comment.