mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
🚨
This commit is contained in:
parent
1e04a4aa07
commit
ae7660f9ef
2 changed files with 11 additions and 9 deletions
|
|
@ -246,7 +246,7 @@ export const bazaar = {
|
||||||
hasSetting = item.__proto__.hasOwnProperty("openSetting");
|
hasSetting = item.__proto__.hasOwnProperty("openSetting");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
html += `<div data-obj='${JSON.stringify(dataObj)}' class="b3-card${item.current ? " b3-card--current" : ""}">
|
html += `<div data-obj='${JSON.stringify(dataObj)}' class="b3-card${item.current ? " b3-card--current" : ""}">
|
||||||
<div class="b3-card__img"><img src="${item.iconURL}" onerror="this.src='${item.previewURLThumb}'"/></div>
|
<div class="b3-card__img"><img src="${item.iconURL}" onerror="this.src='${item.previewURLThumb}'"/></div>
|
||||||
|
|
@ -606,10 +606,10 @@ export const bazaar = {
|
||||||
} else if (type === "setting") {
|
} else if (type === "setting") {
|
||||||
app.plugins.find((item: Plugin) => {
|
app.plugins.find((item: Plugin) => {
|
||||||
if (item.name === dataObj.name) {
|
if (item.name === dataObj.name) {
|
||||||
item.openSetting()
|
item.openSetting();
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public onload() {
|
public onload() {
|
||||||
|
// 加载
|
||||||
}
|
}
|
||||||
|
|
||||||
public addTopBar(options: {
|
public addTopBar(options: {
|
||||||
|
|
@ -49,11 +50,12 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public openSetting() {
|
public openSetting() {
|
||||||
|
// 打开设置
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadData(storageName: string) {
|
public loadData(storageName: string) {
|
||||||
if (!this.data) {
|
if (!this.data) {
|
||||||
this.data = {}
|
this.data = {};
|
||||||
}
|
}
|
||||||
if (typeof this.data[storageName] === "undefined") {
|
if (typeof this.data[storageName] === "undefined") {
|
||||||
this.data[storageName] = "";
|
this.data[storageName] = "";
|
||||||
|
|
@ -73,11 +75,11 @@ export class Plugin {
|
||||||
public saveData(storageName: string, data: any) {
|
public saveData(storageName: string, data: any) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const pathString = `/data/storage/petal/${this.name}/${storageName}`;
|
const pathString = `/data/storage/petal/${this.name}/${storageName}`;
|
||||||
const file = new File([new Blob([data])], pathString.split('/').pop());
|
const file = new File([new Blob([data])], pathString.split("/").pop());
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('path', pathString);
|
formData.append("path", pathString);
|
||||||
formData.append('file', file);
|
formData.append("file", file);
|
||||||
formData.append('isDir', "false");
|
formData.append("isDir", "false");
|
||||||
fetchPost("/api/file/putFile", formData, (response) => {
|
fetchPost("/api/file/putFile", formData, (response) => {
|
||||||
this.data[storageName] = data;
|
this.data[storageName] = data;
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue