Skip to content

Commit

Permalink
up to date with fx115 flex
Browse files Browse the repository at this point in the history
  • Loading branch information
volatile-static committed Mar 7, 2024
1 parent 06d0c10 commit bf08455
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"esbenp.prettier-vscode",
"macabeus.vscode-fluent",
"firefox-devtools.vscode-firefox-debug",
"vue.vscode-typescript-vue-plugin",
"vue.volar",
"syler.sass-indented"
]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"tsx": "^4.7.1",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.4",
"vue-tsc": "^1.8.27",
"vite": "^5.1.5",
"vue-tsc": "^2.0.5",
"zotero-types": "file:../zotero-types"
},
"eslintConfig": {
Expand Down
33 changes: 1 addition & 32 deletions src/bootstrap/modules/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { initReaderAlert } from './history/misc';

const dashboards: { [id: number]: HTMLIFrameElement } = {};

export function updateDashboard(id?: number) {
Expand All @@ -8,35 +6,6 @@ export function updateDashboard(id?: number) {
dashboards[id]?.contentWindow?.postMessage({ id }, '*');
}

async function renderDashboard(
panel: XUL.TabPanel,
reader?: _ZoteroTypes.ReaderInstance
) {
await reader?._waitForReader();
if (panel.childElementCount) return; // 已经有元素了
const dashboard = addon.ui.appendElement(
{
tag: 'iframe',
namespace: 'xul',
ignoreIfExists: true,
attributes: {
flex: 1,
src: 'chrome://chartero/content/dashboard/index.html',
},
classList: ['chartero-dashboard'],
},
panel
) as HTMLIFrameElement;
(dashboard.contentWindow as any).wrappedJSObject.addon ??= addon;

if (reader) {
dashboard.contentWindow?.addEventListener('load', () =>
updateDashboard(reader.itemID)
);
reader.itemID && (dashboards[reader.itemID] = dashboard);
}
}

/**
* 初始化侧边栏TabPanel
*/
Expand Down Expand Up @@ -77,9 +46,9 @@ export function renderSummaryPanel(ids: number[]) {
id: 'chartero-summary-iframe',
ignoreIfExists: true,
attributes: {
flex: 1,
src: 'chrome://chartero/content/summary/index.html',
},
styles: { height: '100%' }
});

if (summary.parentElement != content) {
Expand Down

0 comments on commit bf08455

Please sign in to comment.