@@ -36,12 +36,22 @@ const zod = import("zod");
3636const docs_plugin = import ( "@univerjs/docs" ) ;
3737const 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
4656const NUMBER_CELL_TYPE : typeof CellValueType . NUMBER = 2 ;
4757const 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
115125function 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
301312const elems = document . getElementsByClassName ( "sqlpage_spreadsheet" ) ;
302313const 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" ) ;
304316renderSpreadsheetToElement ( elem ) ;
0 commit comments