chore(prettier): fix all files

This commit is contained in:
Elian Doran
2025-01-09 18:07:02 +02:00
parent 19ee861699
commit 4cbb529fd4
571 changed files with 23226 additions and 23940 deletions

View File

@@ -1,6 +1,6 @@
import { CommandNames } from '../components/app_context.js';
import keyboardActionService from '../services/keyboard_actions.js';
import utils from '../services/utils.js';
import { CommandNames } from "../components/app_context.js";
import keyboardActionService from "../services/keyboard_actions.js";
import utils from "../services/utils.js";
interface ContextMenuOptions<T extends CommandNames> {
x: number;
@@ -11,7 +11,7 @@ interface ContextMenuOptions<T extends CommandNames> {
}
interface MenuSeparatorItem {
title: "----"
title: "----";
}
export interface MenuCommandItem<T extends CommandNames> {
@@ -31,7 +31,6 @@ export type MenuItem<T extends CommandNames> = MenuCommandItem<T> | MenuSeparato
export type MenuHandler<T extends CommandNames> = (item: MenuCommandItem<T>, e: JQuery.MouseDownEvent<HTMLElement, undefined, HTMLElement, HTMLElement>) => void;
class ContextMenu {
private $widget: JQuery<HTMLElement>;
private $cover: JQuery<HTMLElement>;
private dateContextMenuOpenedMs: number;
@@ -48,7 +47,7 @@ class ContextMenu {
if (this.isMobile) {
this.$cover.on("click", () => this.hide());
} else {
$(document).on('click', (e) => this.hide());
$(document).on("click", (e) => this.hide());
}
}
@@ -102,7 +101,7 @@ class ContextMenu {
top = this.options.y - CONTEXT_MENU_OFFSET;
}
if (this.options.orientation === 'left' && contextMenuWidth) {
if (this.options.orientation === "left" && contextMenuWidth) {
if (this.options.x + CONTEXT_MENU_OFFSET > clientWidth - CONTEXT_MENU_PADDING) {
// Overflow: right
left = clientWidth - contextMenuWidth - CONTEXT_MENU_OFFSET;
@@ -124,11 +123,13 @@ class ContextMenu {
}
}
this.$widget.css({
display: "block",
top: top,
left: left
}).addClass("show");
this.$widget
.css({
display: "block",
top: top,
left: left
})
.addClass("show");
}
addItems($parent: JQuery<HTMLElement>, items: MenuItem<any>[]) {
@@ -137,7 +138,7 @@ class ContextMenu {
continue;
}
if (item.title === '----') {
if (item.title === "----") {
$parent.append($("<div>").addClass("dropdown-divider"));
} else {
const $icon = $("<span>");
@@ -160,23 +161,22 @@ class ContextMenu {
const $item = $("<li>")
.addClass("dropdown-item")
.append($link)
.on('contextmenu', e => false)
.on("contextmenu", (e) => false)
// important to use mousedown instead of click since the former does not change focus
// (especially important for focused text for spell check)
.on('mousedown', e => {
.on("mousedown", (e) => {
e.stopPropagation();
if (e.which !== 1) { // only left click triggers menu items
if (e.which !== 1) {
// only left click triggers menu items
return false;
}
if (this.isMobile && "items" in item && item.items) {
const $item = $(e.target)
.closest(".dropdown-item");
const $item = $(e.target).closest(".dropdown-item");
$item.toggleClass("submenu-open");
$item.find("ul.dropdown-menu")
.toggleClass("show");
$item.find("ul.dropdown-menu").toggleClass("show");
return false;
}