Skip to content

Commit 4053ce6

Browse files
committed
fix
1 parent 45bef06 commit 4053ce6

File tree

4 files changed

+16
-1066
lines changed

4 files changed

+16
-1066
lines changed

src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function App() {
66
const visible = useAppVisible();
77
if (visible) {
88
return (
9-
<main
9+
<main
1010
className="backdrop-filter backdrop-blur-md fixed inset-0 flex items-center justify-center"
1111
onClick={(e) => {
1212
if (!innerRef.current?.contains(e.target as any)) {

src/main.tsx

+13-12
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@ import App from "./App";
88
// @ts-expect-error
99
const css = (t, ...args) => String.raw(t, ...args);
1010

11-
function createModel() {
12-
return {
13-
show() {
14-
logseq.showMainUI();
15-
},
16-
};
17-
}
18-
1911
function main() {
12+
const pluginId = logseq.baseInfo.id;
13+
console.info(`#${pluginId}: MAIN`);
2014
ReactDOM.render(
2115
<React.StrictMode>
2216
<App />
2317
</React.StrictMode>,
2418
document.getElementById("app")
2519
);
2620

27-
const key = logseq.baseInfo.id;
21+
function createModel() {
22+
return {
23+
show() {
24+
logseq.showMainUI();
25+
},
26+
};
27+
}
2828

29+
logseq.provideModel(createModel());
2930
logseq.setMainUIInlineStyle({
3031
zIndex: 11,
3132
});
3233

3334
const openIconName = "template-plugin-open";
3435

3536
logseq.provideStyle(css`
36-
div[data-injected-ui=${openIconName}-${key}] {
37+
div[data-injected-ui=${openIconName}-${pluginId}] {
3738
display: inline-flex;
3839
align-items: center;
3940
opacity: 0.55;
@@ -42,7 +43,7 @@ function main() {
4243
position: relative;
4344
}
4445
45-
div[data-injected-ui=${openIconName}-${key}]:hover {
46+
div[data-injected-ui=${openIconName}-${pluginId}]:hover {
4647
opacity: 0.9;
4748
}
4849
`);
@@ -57,4 +58,4 @@ function main() {
5758
});
5859
}
5960

60-
logseq.ready(createModel()).then(main).catch(console.error);
61+
logseq.ready(main).catch(console.error);

vite.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig, Plugin, ResolvedConfig } from "vite";
22
import reactRefresh from "@vitejs/plugin-react-refresh";
33
import WindiCSS from "vite-plugin-windicss";
44
// @ts-expect-error
5-
import { writeFile } from "fs/promises";
5+
import { writeFile, mkdir } from "fs/promises";
66
import path from "path";
77

88
// Hard-coded for now
@@ -44,6 +44,7 @@ const devIndexHtmlPlugin: () => Plugin = () => {
4444
</body>
4545
</html>
4646
`;
47+
await mkdir(config.build.outDir, { recursive: true });
4748
await writeFile(
4849
path.resolve(config.build.outDir, "index.html"),
4950
template,

0 commit comments

Comments
 (0)