mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix(plugin): allow multiple loads assets (#3741)
This commit is contained in:
@@ -85,12 +85,13 @@ export const pluginRegisterPromise = Promise.all(
|
|||||||
if (assets.length > 0) {
|
if (assets.length > 0) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
assets.map(async (asset: string) => {
|
assets.map(async (asset: string) => {
|
||||||
|
const loadedAssetName = `${pluginName}_${asset}`;
|
||||||
// todo(himself65): add assets into shadow dom
|
// todo(himself65): add assets into shadow dom
|
||||||
if (loadedAssets.has(asset)) {
|
if (loadedAssets.has(loadedAssetName)) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
if (asset.endsWith('.css')) {
|
if (asset.endsWith('.css')) {
|
||||||
loadedAssets.add(asset);
|
loadedAssets.add(loadedAssetName);
|
||||||
const res = await fetch(`${baseURL}/${asset}`);
|
const res = await fetch(`${baseURL}/${asset}`);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
// todo: how to put css file into sandbox?
|
// todo: how to put css file into sandbox?
|
||||||
|
|||||||
@@ -10,4 +10,8 @@ const count = ref(0);
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped>
|
||||||
|
.el-button {
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user