update
This commit is contained in:
parent
8e8973852b
commit
6a6d7e2f03
2 changed files with 12 additions and 11 deletions
|
@ -16,6 +16,7 @@
|
||||||
"@sveltejs/vite-plugin-svelte": "^2.0.3",
|
"@sveltejs/vite-plugin-svelte": "^2.0.3",
|
||||||
"@tsconfig/svelte": "^4.0.1",
|
"@tsconfig/svelte": "^4.0.1",
|
||||||
"@types/node": "^20.2.0",
|
"@types/node": "^20.2.0",
|
||||||
|
"eslint": "^8.42.0",
|
||||||
"fast-glob": "^3.2.12",
|
"fast-glob": "^3.2.12",
|
||||||
"glob": "^7.2.3",
|
"glob": "^7.2.3",
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
|
|
22
src/index.ts
22
src/index.ts
|
@ -48,7 +48,7 @@ export default class PluginSample extends Plugin {
|
||||||
let rect = topBarElement.getBoundingClientRect();
|
let rect = topBarElement.getBoundingClientRect();
|
||||||
// 如果被隐藏,则使用更多按钮
|
// 如果被隐藏,则使用更多按钮
|
||||||
if (rect.width === 0) {
|
if (rect.width === 0) {
|
||||||
rect = document.querySelector("#barMore").getBoundingClientRect();
|
rect = document.querySelector("#barPlugins").getBoundingClientRect();
|
||||||
}
|
}
|
||||||
this.addMenu(rect);
|
this.addMenu(rect);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ export default class PluginSample extends Plugin {
|
||||||
confirmCallback: () => {
|
confirmCallback: () => {
|
||||||
this.saveData(STORAGE_NAME, {readonlyText: textareaElement.value});
|
this.saveData(STORAGE_NAME, {readonlyText: textareaElement.value});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.setting.addItem({
|
this.setting.addItem({
|
||||||
title: "Readonly text",
|
title: "Readonly text",
|
||||||
createActionElement: () => {
|
createActionElement: () => {
|
||||||
|
@ -144,18 +144,18 @@ export default class PluginSample extends Plugin {
|
||||||
textareaElement.value = this.data[STORAGE_NAME].readonlyText;
|
textareaElement.value = this.data[STORAGE_NAME].readonlyText;
|
||||||
return textareaElement;
|
return textareaElement;
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
const btnaElement = document.createElement("button");
|
const btnaElement = document.createElement("button");
|
||||||
btnaElement.className = "b3-button b3-button--outline fn__flex-center";
|
btnaElement.className = "b3-button b3-button--outline fn__flex-center fn__size200";
|
||||||
btnaElement.textContent = "Open";
|
btnaElement.textContent = "Open";
|
||||||
btnaElement.addEventListener("click", () => {
|
btnaElement.addEventListener("click", () => {
|
||||||
window.open("https://github.com/siyuan-note/plugin-sample-vite-svelte")
|
window.open("https://github.com/siyuan-note/plugin-sample-vite-svelte");
|
||||||
});
|
});
|
||||||
this.setting.addItem({
|
this.setting.addItem({
|
||||||
title: "Open plugin url",
|
title: "Open plugin url",
|
||||||
description: "Open plugin url in browser",
|
description: "Open plugin url in browser",
|
||||||
actionElement: btnaElement,
|
actionElement: btnaElement,
|
||||||
})
|
});
|
||||||
|
|
||||||
console.log(this.i18n.helloPlugin);
|
console.log(this.i18n.helloPlugin);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ export default class PluginSample extends Plugin {
|
||||||
fn: this.customTab
|
fn: this.customTab
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(tab)
|
console.log(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
|
@ -263,7 +263,7 @@ export default class PluginSample extends Plugin {
|
||||||
path: "assets/paragraph-20210512165953-ag1nib4.svg"
|
path: "assets/paragraph-20210512165953-ag1nib4.svg"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(tab)
|
console.log(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
|
@ -276,7 +276,7 @@ export default class PluginSample extends Plugin {
|
||||||
id: "20200812220555-lj3enxa",
|
id: "20200812220555-lj3enxa",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(tab)
|
console.log(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
|
@ -289,7 +289,7 @@ export default class PluginSample extends Plugin {
|
||||||
k: "SiYuan"
|
k: "SiYuan"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(tab)
|
console.log(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
|
@ -302,7 +302,7 @@ export default class PluginSample extends Plugin {
|
||||||
type: "all"
|
type: "all"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(tab)
|
console.log(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue