diff --git a/src/univer/sheets.ts b/src/univer/sheets.ts index 7573e74..11b55f9 100644 --- a/src/univer/sheets.ts +++ b/src/univer/sheets.ts @@ -97,18 +97,18 @@ export function sheetInit(option: IUniverUIConfig, settings: UniverPluginSetting async getMentions() { return [ - { - id: mockUser.userID, - label: mockUser.name, - type: 'user', - icon: mockUser.avatar, - }, - { - id: '2', - label: 'User2', - type: 'user', - icon: mockUser.avatar, - }, + // { + // id: mockUser.userID, + // label: mockUser.name, + // type: 'user', + // icon: mockUser.avatar, + // }, + // { + // id: '2', + // label: 'User2', + // type: 'user', + // icon: mockUser.avatar, + // }, ] } } diff --git a/src/views/udoc.ts b/src/views/udoc.ts index 7364eec..7a6ea85 100644 --- a/src/views/udoc.ts +++ b/src/views/udoc.ts @@ -1,5 +1,5 @@ import type { DocumentDataModel, IDocumentData, Univer } from '@univerjs/core' -import { Tools, UniverInstanceType } from '@univerjs/core' +import { IResourceLoaderService, Tools, UniverInstanceType } from '@univerjs/core' import { FUniver } from '@univerjs/facade' import type { WorkspaceLeaf } from 'obsidian' import { TextFileView } from 'obsidian' @@ -21,7 +21,9 @@ export class UDocView extends TextFileView { } getViewData(): string { - return JSON.stringify(Tools.deepClone(this.documentModal.getSnapshot())) + const resourceLoaderService = this.univer.__getInjector().get(IResourceLoaderService) + const snapshot = resourceLoaderService.saveDoc(this.documentModal) + return JSON.stringify(Tools.deepClone(snapshot)) } setViewData(data: string): void { @@ -56,7 +58,7 @@ export class UDocView extends TextFileView { return Type } - clear(): void {} + clear(): void { } async onOpen() { this.rootContainer = this.contentEl as HTMLDivElement diff --git a/src/views/xlsx.ts b/src/views/xlsx.ts index d1c1e0e..4558f22 100644 --- a/src/views/xlsx.ts +++ b/src/views/xlsx.ts @@ -82,7 +82,10 @@ export class XlsxTypeView extends TextFileView { async saveToExcel(file: TFile, workbook: Workbook) { if (!file || !workbook) return - const saveWorkbookData = workbook.save() + const saveWorkbookData = this.FUniver.getUniverSheet(workbook.getUnitId())?.getSnapshot() + if (!saveWorkbookData) { + return + } const snapshotJSON = await transformWorkbookDataToSnapshotJson(saveWorkbookData) const snapshot = JSON.stringify(snapshotJSON) // @ts-expect-error