dsh-foxy-memory 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/client.js +18 -6
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -304,6 +304,23 @@ window.__ModuleLoader__.load({
|
|
|
304
304
|
const name = 'dsh-foxy-memory'
|
|
305
305
|
const inject = ['slots']
|
|
306
306
|
|
|
307
|
+
function registerConsolePage() {
|
|
308
|
+
const root = window.__FOXY_CONSOLE__ || (window.__FOXY_CONSOLE__ = { pages: [], listeners: new Set() })
|
|
309
|
+
if (!Array.isArray(root.pages)) root.pages = []
|
|
310
|
+
if (!(root.listeners instanceof Set)) root.listeners = new Set()
|
|
311
|
+
const entry = { id: PANEL_ID, label: '记忆', order: 15, Component: Panel }
|
|
312
|
+
const index = root.pages.findIndex((page) => page.id === entry.id)
|
|
313
|
+
if (index >= 0) root.pages[index] = entry
|
|
314
|
+
else root.pages.push(entry)
|
|
315
|
+
for (const listener of root.listeners) {
|
|
316
|
+
try {
|
|
317
|
+
listener()
|
|
318
|
+
} catch {
|
|
319
|
+
// 单个面板的渲染错误不应影响其他标签页
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
307
324
|
function apply(ctx) {
|
|
308
325
|
const style = document.createElement('style')
|
|
309
326
|
style.setAttribute('data-plugin-css', 'dsh-foxy-memory')
|
|
@@ -311,18 +328,13 @@ window.__ModuleLoader__.load({
|
|
|
311
328
|
document.head.appendChild(style)
|
|
312
329
|
ctx.effect(() => () => style.remove(), 'dsh-foxy-memory: style')
|
|
313
330
|
|
|
331
|
+
registerConsolePage()
|
|
314
332
|
ctx.slots.inject('main', () =>
|
|
315
333
|
ctx.slots.register(
|
|
316
334
|
{ name: 'main', key: PANEL_ID, inject: () => ({ workbench: true }) },
|
|
317
335
|
() => h(Panel),
|
|
318
336
|
),
|
|
319
337
|
)
|
|
320
|
-
ctx.slots.inject('sidebar.panellist', () =>
|
|
321
|
-
ctx.slots.register(
|
|
322
|
-
{ name: 'sidebar.panellist', id: PANEL_ID, order: 15, label: () => LABEL },
|
|
323
|
-
MemoryIcon,
|
|
324
|
-
),
|
|
325
|
-
)
|
|
326
338
|
ctx.slots.inject('settings.section', () =>
|
|
327
339
|
ctx.slots.register(
|
|
328
340
|
{ name: 'settings.section', id: 'foxy-memory', order: 33, label: LABEL },
|
package/package.json
CHANGED