Skip to content

Commit d50cf0d

Browse files
committed
fix ci
1 parent 71bdedb commit d50cf0d

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

src/spreadsheet.ts

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,22 @@ const zod = import("zod");
3636
const docs_plugin = import("@univerjs/docs");
3737
const docs_ui_plugin = import("@univerjs/docs-ui");
3838

39-
const DesignEnUS = import('node_modules/@univerjs/design/lib/locale/en-US.json');
40-
const SheetsEnUS = import('node_modules/@univerjs/sheets/lib/locale/en-US.json');
41-
const SheetsUIEnUS = import('node_modules/@univerjs/sheets-ui/lib/locale/en-US.json');
42-
const SheetsFormulaEnUS = import('node_modules/@univerjs/sheets-formula/lib/locale/en-US.json');
43-
const UIEnUS = import('node_modules/@univerjs/ui/lib/locale/en-US.json');
44-
const DocsUIEnUS = import('node_modules/@univerjs/docs-ui/lib/locale/en-US.json');
39+
const DesignEnUS = import(
40+
"node_modules/@univerjs/design/lib/locale/en-US.json"
41+
);
42+
const SheetsEnUS = import(
43+
"node_modules/@univerjs/sheets/lib/locale/en-US.json"
44+
);
45+
const SheetsUIEnUS = import(
46+
"node_modules/@univerjs/sheets-ui/lib/locale/en-US.json"
47+
);
48+
const SheetsFormulaEnUS = import(
49+
"node_modules/@univerjs/sheets-formula/lib/locale/en-US.json"
50+
);
51+
const UIEnUS = import("node_modules/@univerjs/ui/lib/locale/en-US.json");
52+
const DocsUIEnUS = import(
53+
"node_modules/@univerjs/docs-ui/lib/locale/en-US.json"
54+
);
4555

4656
const NUMBER_CELL_TYPE: typeof CellValueType.NUMBER = 2;
4757
const UNIVER_SHEET_TYPE: typeof UniverInstanceType.UNIVER_SHEET = 2;
@@ -85,12 +95,12 @@ async function setupUniver(container: HTMLElement) {
8595
locale: LocaleType.EN_US,
8696
locales: {
8797
[LocaleType.EN_US]: Tools.deepMerge(
88-
await DesignEnUS,
89-
await SheetsEnUS,
90-
await SheetsUIEnUS,
91-
await SheetsFormulaEnUS,
92-
await UIEnUS,
93-
await DocsUIEnUS
98+
await DesignEnUS,
99+
await SheetsEnUS,
100+
await SheetsUIEnUS,
101+
await SheetsFormulaEnUS,
102+
await UIEnUS,
103+
await DocsUIEnUS,
94104
),
95105
},
96106
});
@@ -113,10 +123,9 @@ async function loadOptionalPlugins(univer: Univer) {
113123
}
114124

115125
function setupErrorModal(resp_modal: HTMLElement) {
116-
if (!resp_modal) throw new Error(`errorModal not found`);
126+
if (!resp_modal) throw new Error("errorModal not found");
117127
const resp_modal_body = resp_modal.querySelector(".modal-body");
118-
if (!resp_modal_body)
119-
throw new Error(`errorModal not found`);
128+
if (!resp_modal_body) throw new Error("errorModal not found");
120129
// @ts-ignore: bootstrap.is included by sqlpage
121130
const Modal = window?.bootstrap?.Modal;
122131
if (!Modal) throw new Error("bootstrap.Modal not found");
@@ -196,7 +205,9 @@ async function renderSpreadsheet(
196205
data: any[],
197206
) {
198207
const { update_link, freeze_x, freeze_y } = props;
199-
const errorModal = setupErrorModal(container.querySelector(".modal")!);
208+
const modal = container.querySelector(".modal");
209+
if (!(modal instanceof HTMLElement)) throw new Error("modal not found");
210+
const errorModal = setupErrorModal(modal);
200211

201212
const worksheet = generateWorkSheet(data, await zod);
202213

@@ -300,5 +311,6 @@ export async function renderSpreadsheetToElement(element: HTMLElement) {
300311

301312
const elems = document.getElementsByClassName("sqlpage_spreadsheet");
302313
const elem = elems[elems.length - 1];
303-
if (!(elem instanceof HTMLElement)) throw new Error("No spreadsheet elements found");
314+
if (!(elem instanceof HTMLElement))
315+
throw new Error("No spreadsheet elements found");
304316
renderSpreadsheetToElement(elem);

0 commit comments

Comments
 (0)