mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
Refactor font loading from per-document to the portfolio (#659)
* Cleanup default font loading * Refactor fonts * Fix menulist mouse navigation * Format * Formatting * Move default font into consts.rs Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
parent
d4539bc304
commit
8923b68e30
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<LayoutRow class="dropdown-input">
|
||||
<LayoutRow class="dropdown-input" data-dropdown-input>
|
||||
<LayoutRow
|
||||
class="dropdown-box"
|
||||
:class="{ disabled }"
|
||||
:class="{ disabled, open }"
|
||||
:style="{ minWidth: `${minWidth}px` }"
|
||||
tabindex="0"
|
||||
@click="() => !disabled && (open = true)"
|
||||
@blur="() => (open = false)"
|
||||
@blur="(e: FocusEvent) => blur(e)"
|
||||
@keydown="(e) => keydown(e)"
|
||||
ref="dropdownBox"
|
||||
data-hover-menu-spawner
|
||||
@@ -145,6 +145,9 @@ export default defineComponent({
|
||||
keydown(e: KeyboardEvent) {
|
||||
(this.$refs.menuList as typeof MenuList).keydown(e, false);
|
||||
},
|
||||
blur(e: FocusEvent) {
|
||||
if ((e.target as HTMLElement).closest("[data-dropdown-input]") !== this.$el) this.open = false;
|
||||
},
|
||||
},
|
||||
components: {
|
||||
IconLabel,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="menu-bar-input">
|
||||
<div class="menu-bar-input" data-menu-bar-input>
|
||||
<div class="entry-container">
|
||||
<button @click="() => visitWebsite('https://graphite.rs')" class="entry">
|
||||
<IconLabel :icon="'GraphiteLogo'" />
|
||||
@@ -8,11 +8,11 @@
|
||||
<div class="entry-container" v-for="(entry, index) in entries" :key="index">
|
||||
<div
|
||||
@click="(e) => onClick(entry, e.target)"
|
||||
@blur="() => close(entry)"
|
||||
tabindex="0"
|
||||
@blur="(e: FocusEvent) => blur(e,entry)"
|
||||
@keydown="entry.ref?.keydown"
|
||||
class="entry"
|
||||
:class="{ open: entry.ref?.open }"
|
||||
:class="{ open: entry.ref?.isOpen }"
|
||||
data-hover-menu-spawner
|
||||
>
|
||||
<IconLabel v-if="entry.icon" :icon="entry.icon" />
|
||||
@@ -225,8 +225,8 @@ export default defineComponent({
|
||||
if (menuEntry.ref) menuEntry.ref.isOpen = true;
|
||||
else throw new Error("The menu bar floating menu has no associated ref");
|
||||
},
|
||||
close(menuEntry: MenuListEntry) {
|
||||
if (menuEntry.ref) menuEntry.ref.isOpen = false;
|
||||
blur(e: FocusEvent, menuEntry: MenuListEntry) {
|
||||
if ((e.target as HTMLElement).closest("[data-menu-bar-input]") !== this.$el && menuEntry.ref) menuEntry.ref.isOpen = false;
|
||||
},
|
||||
// TODO: Move to backend
|
||||
visitWebsite(url: string) {
|
||||
|
||||
Reference in New Issue
Block a user