Skip to content

Commit

Permalink
Merge pull request dream-num#43 from karlsbeard/fix-issue-43
Browse files Browse the repository at this point in the history
feat: add the formula worker
  • Loading branch information
karlsbeard committed Apr 3, 2024
2 parents bbc1cf3 + f4cc821 commit d12e195
Show file tree
Hide file tree
Showing 4 changed files with 59,692 additions and 24 deletions.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { Type as UDocType, UDocView } from "./views/udoc";
import { ChooseTypeModal } from "./modals/chooseType";
import { SettingTab } from "./modals/settingTab";
import type { UniverPluginSettings } from "~/types/setting";
// import UniverWorker from './univer/worker?worker';

export type ViewType = typeof USheetType | typeof UDocType;
// export const univerWorker = new UniverWorker();


export default class UniverPlugin extends Plugin {
Expand Down
40 changes: 19 additions & 21 deletions src/univer/sheets.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { legacyLocales } from "~/utils/common";
import { LocaleType, Univer } from '@univerjs/core';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
import { UniverFindReplacePlugin } from '@univerjs/find-replace';
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
import { UniverUIPlugin } from '@univerjs/ui';
import { LocaleType, Univer } from "@univerjs/core";
import { defaultTheme } from "@univerjs/design";
import { UniverDocsPlugin } from "@univerjs/docs";
import { UniverDocsUIPlugin } from "@univerjs/docs-ui";
import { UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
import { UniverRenderEnginePlugin } from "@univerjs/engine-render";
import { UniverFindReplacePlugin } from "@univerjs/find-replace";
import type { IUniverRPCMainThreadConfig } from "@univerjs/rpc";
import { UniverRPCMainThreadPlugin } from "@univerjs/rpc";
import { UniverSheetsPlugin } from "@univerjs/sheets";
import { UniverSheetsFindReplacePlugin } from "@univerjs/sheets-find-replace";
import { UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
import { UniverSheetsNumfmtPlugin } from "@univerjs/sheets-numfmt";
import { UniverSheetsUIPlugin } from "@univerjs/sheets-ui";
import { UniverSheetsZenEditorPlugin } from "@univerjs/sheets-zen-editor";
import { UniverUIPlugin } from "@univerjs/ui";
import type { IUniverUIConfig } from "@univerjs/ui/lib/types/ui-plugin";
import { UniverPluginSettings } from "~/types/setting";
import UniverWoker from './worker?worker'

const worker = new UniverWoker();
const workerScriptURL = new URL("../utils/worker.js", import.meta.url);

export function sheetInit(
option: IUniverUIConfig,
Expand Down Expand Up @@ -52,8 +50,8 @@ export function sheetInit(
});
univer.registerPlugin(UniverSheetsFormulaPlugin);
univer.registerPlugin(UniverRPCMainThreadPlugin, {
workerURL: worker,
} as IUniverRPCMainThreadConfig);
workerURL: workerScriptURL,
} as IUniverRPCMainThreadConfig);

// find replace
univer.registerPlugin(UniverFindReplacePlugin);
Expand Down
Loading

0 comments on commit d12e195

Please sign in to comment.