mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-10 05:06:56 +08:00
Ran eslint fix on existing codebase
Had to do some manual fixing of the app.js file due to misplaced comments
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {onSelect} from "../services/dom";
|
||||
import {KeyboardNavigationHandler} from "../services/keyboard-navigation";
|
||||
import {Component} from "./component";
|
||||
import {onSelect} from '../services/dom';
|
||||
import {KeyboardNavigationHandler} from '../services/keyboard-navigation';
|
||||
import {Component} from './component';
|
||||
|
||||
/**
|
||||
* Dropdown
|
||||
@ -41,7 +41,7 @@ export class Dropdown extends Component {
|
||||
this.menu.style.position = 'fixed';
|
||||
this.menu.style.width = `${menuOriginalRect.width}px`;
|
||||
this.menu.style.left = `${menuOriginalRect.left}px`;
|
||||
heightOffset = dropUpwards ? (window.innerHeight - menuOriginalRect.top - toggleHeight / 2) : menuOriginalRect.top;
|
||||
heightOffset = dropUpwards ? (window.innerHeight - menuOriginalRect.top - toggleHeight / 2) : menuOriginalRect.top;
|
||||
}
|
||||
|
||||
// Adjust menu to display upwards if near the bottom of the screen
|
||||
@ -76,7 +76,7 @@ export class Dropdown extends Component {
|
||||
}
|
||||
|
||||
hideAll() {
|
||||
for (let dropdown of window.$components.get('dropdown')) {
|
||||
for (const dropdown of window.$components.get('dropdown')) {
|
||||
dropdown.hide();
|
||||
}
|
||||
}
|
||||
@ -100,13 +100,13 @@ export class Dropdown extends Component {
|
||||
}
|
||||
|
||||
setupListeners() {
|
||||
const keyboardNavHandler = new KeyboardNavigationHandler(this.container, (event) => {
|
||||
const keyboardNavHandler = new KeyboardNavigationHandler(this.container, event => {
|
||||
this.hide();
|
||||
this.toggle.focus();
|
||||
if (!this.bubbleEscapes) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}, (event) => {
|
||||
}, event => {
|
||||
if (event.target.nodeName === 'INPUT') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@ -120,10 +120,10 @@ export class Dropdown extends Component {
|
||||
|
||||
// Hide menu on option click
|
||||
this.container.addEventListener('click', event => {
|
||||
const possibleChildren = Array.from(this.menu.querySelectorAll('a'));
|
||||
if (possibleChildren.includes(event.target)) {
|
||||
this.hide();
|
||||
}
|
||||
const possibleChildren = Array.from(this.menu.querySelectorAll('a'));
|
||||
if (possibleChildren.includes(event.target)) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
onSelect(this.toggle, event => {
|
||||
|
Reference in New Issue
Block a user