Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(doc-hyper-link): polyfill history data for doc hyper link (#3406)
zhangw5f2c2fe217aa
diff --git a/packages/docs-hyper-link/src/commands/mutations/hyper-link.mutation.ts b/packages/docs-hyper-link/src/commands/mutations/hyper-link.mutation.tsnew file mode 100644index 0000000000..ad3c559c42--- /dev/null+++ b/packages/docs-hyper-link/src/commands/mutations/hyper-link.mutation.ts@@ -0,0 +1,41 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { CommandType, type ICommand } from '@univerjs/core';++export const AddHyperLinkMuatation: ICommand = {+ id: 'docs.mutation.add-hyper-link',+ type: CommandType.MUTATION,+ handler: () => {+ return true;+ },+};++export const UpdateHyperLinkMuatation: ICommand = {+ id: 'docs.mutation.update-hyper-link',+ type: CommandType.MUTATION,+ handler: () => {+ return true;+ },+};++export const DeleteHyperLinkMuatation: ICommand = {+ id: 'docs.mutation.delete-hyper-link',+ type: CommandType.MUTATION,+ handler: () => {+ return true;+ },+};diff --git a/packages/docs-hyper-link/src/plugin.ts b/packages/docs-hyper-link/src/plugin.tsindex f9b42092a5..1c5d957947 100644--- a/packages/docs-hyper-link/src/plugin.ts+++ b/packages/docs-hyper-link/src/plugin.ts@@ -14,11 +14,12 @@* limitations under the License.*/-import { IConfigService, Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';+import { ICommandService, IConfigService, Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';import type { Dependency } from '@univerjs/core';+import { AddHyperLinkMuatation, DeleteHyperLinkMuatation, UpdateHyperLinkMuatation } from './commands/mutations/hyper-link.mutation';+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';import { DOC_HYPER_LINK_PLUGIN, DocHyperLinkResourceController } from './controllers/resource.controller';import type { IUniverDocsHyperLinkConfig } from './controllers/config.schema';-import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';export class UniverDocsHyperLinkPlugin extends Plugin {static override pluginName = DOC_HYPER_LINK_PLUGIN;@@ -27,7 +28,8 @@ export class UniverDocsHyperLinkPlugin extends Plugin {constructor(private readonly _config: Partial<IUniverDocsHyperLinkConfig> = defaultPluginConfig,@Inject(Injector) protected override _injector: Injector,- @IConfigService private readonly _configService: IConfigService+ @IConfigService private readonly _configService: IConfigService,+ @ICommandService private readonly _commandService: ICommandService) {super();@@ -44,5 +46,9 @@ export class UniverDocsHyperLinkPlugin extends Plugin {deps.forEach((dep) => {this._injector.add(dep);});++ [AddHyperLinkMuatation, DeleteHyperLinkMuatation, UpdateHyperLinkMuatation].forEach((mutation) => {+ this.disposeWithMe(this._commandService.registerCommand(mutation));+ });}}