mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-11 15:59:03 +00:00
fix: wait for api b4 hooking into state
This commit is contained in:
parent
45e0be7d62
commit
95483f4f25
@ -87,11 +87,11 @@ function Panel({
|
|||||||
$panel.resize(preDragWidth + (dragStartX - event.clientX));
|
$panel.resize(preDragWidth + (dragStartX - event.clientX));
|
||||||
},
|
},
|
||||||
endDrag = (event) => {
|
endDrag = (event) => {
|
||||||
userDragActive = false;
|
|
||||||
document.removeEventListener("mousemove", onDrag);
|
document.removeEventListener("mousemove", onDrag);
|
||||||
document.removeEventListener("mouseup", endDrag);
|
document.removeEventListener("mouseup", endDrag);
|
||||||
$panel.resize(preDragWidth + (dragStartX - event.clientX));
|
$panel.resize(preDragWidth + (dragStartX - event.clientX));
|
||||||
$panel.style.transitionDuration = "";
|
$panel.style.transitionDuration = "";
|
||||||
|
requestIdleCallback(() => (userDragActive = false));
|
||||||
};
|
};
|
||||||
$resizeHandle.addEventListener("mousedown", startDrag);
|
$resizeHandle.addEventListener("mousedown", startDrag);
|
||||||
|
|
||||||
|
@ -16,11 +16,10 @@ import { Mod } from "./islands/Mod.mjs";
|
|||||||
import { Options } from "./islands/Options.mjs";
|
import { Options } from "./islands/Options.mjs";
|
||||||
import { Profiles } from "./islands/Profiles.mjs";
|
import { Profiles } from "./islands/Profiles.mjs";
|
||||||
|
|
||||||
let _apiImported = false,
|
let _apiImport, //
|
||||||
_renderStarted = false,
|
_renderStarted,
|
||||||
_stateHookedInto = false,
|
_stateHookedInto,
|
||||||
_hotkeyRegistered = false;
|
_hotkeyRegistered;
|
||||||
|
|
||||||
const categories = [
|
const categories = [
|
||||||
{
|
{
|
||||||
icon: "palette",
|
icon: "palette",
|
||||||
@ -180,12 +179,12 @@ const renderMenu = async () => {
|
|||||||
if (theme === "light") document.body.classList.remove("dark");
|
if (theme === "light") document.body.classList.remove("dark");
|
||||||
};
|
};
|
||||||
|
|
||||||
const importApi = async () => {
|
const importApi = () => {
|
||||||
if (_apiImported) return;
|
return (_apiImport ??= (async () => {
|
||||||
_apiImported = true;
|
const api = globalThis.__enhancerApi;
|
||||||
const api = globalThis.__enhancerApi;
|
if (typeof api === "undefined") await import("../../shared/system.js");
|
||||||
if (typeof api === "undefined") await import("../../shared/system.js");
|
await import("../../load.mjs").then((i) => i.default);
|
||||||
await import("../../load.mjs").then((i) => i.default);
|
})());
|
||||||
},
|
},
|
||||||
hookIntoState = () => {
|
hookIntoState = () => {
|
||||||
if (_stateHookedInto) return;
|
if (_stateHookedInto) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user