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(sheets-ui): optimize shortcut for comment & hyperlink editor (#3434)
zhangw9604020c3339
diff --git a/packages/sheets-data-validation/src/views/list-dropdown/index.tsx b/packages/sheets-data-validation/src/views/list-dropdown/index.tsxindex 7b5f07a03f..95b8ced0ab 100644--- a/packages/sheets-data-validation/src/views/list-dropdown/index.tsx+++ b/packages/sheets-data-validation/src/views/list-dropdown/index.tsx@@ -198,9 +198,6 @@ export function ListDropDown(props: IDropdownComponentProps) {p: null,f: null,si: null,- custom: {- __link_url: '',- },},};diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsxindex 1672f8feae..5ad1fad201 100644--- a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx@@ -21,7 +21,7 @@ import { deserializeRangeWithSheet, IDefinedNamesService, serializeRange, serialimport { SetSelectionsOperation, SetWorksheetActiveOperation } from '@univerjs/sheets';import { SheetHyperLinkType } from '@univerjs/sheets-hyper-link';import { IEditorBridgeService, IMarkSelectionService, ScrollToRangeOperation } from '@univerjs/sheets-ui';-import { IZenZoneService, RangeSelector, useEvent, useObservable } from '@univerjs/ui';+import { IZenZoneService, KeyCode, RangeSelector, useEvent, useObservable } from '@univerjs/ui';import React, { useEffect, useMemo, useRef, useState } from 'react';import type { DocumentDataModel, IUnitRangeWithName, Nullable, Workbook } from '@univerjs/core';import type { ISetSelectionsOperationParams } from '@univerjs/sheets';@@ -272,6 +272,11 @@ export const CellLinkEdit = () => {});const handleSubmit = async () => {+ if ((showLabel && !display) || !payload || (type === SheetHyperLinkType.URL && !isLegalLink(payload))) {+ setShowError(true);+ return;+ }+if (editing) {if (id) {const commandId = (editing.type === HyperLinkEditSourceType.ZEN_EDITOR || editing.type === HyperLinkEditSourceType.EDITING) ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;@@ -346,6 +351,12 @@ export const CellLinkEdit = () => {setByPayload.current = false;}}placeholder={localeService.t('hyperLink.form.labelPlaceholder')}+ autoFocus+ onKeyDown={(e) => {+ if (e.keyCode === KeyCode.ENTER) {+ handleSubmit();+ }+ }}/></FormLayout>)@@ -374,6 +385,12 @@ export const CellLinkEdit = () => {}}}placeholder={localeService.t('hyperLink.form.linkPlaceholder')}+ autoFocus={!showLabel}+ onKeyDown={(e) => {+ if (e.keyCode === KeyCode.ENTER) {+ handleSubmit();+ }+ }}/></FormLayout>)}@@ -478,11 +495,6 @@ export const CellLinkEdit = () => {type="primary"style={{ marginLeft: 8 }}onClick={async () => {- if ((showLabel && !display) || !payload || (type === SheetHyperLinkType.URL && !isLegalLink(payload))) {- setShowError(true);- return;- }-handleSubmit();}}>diff --git a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsxindex 282bd3cd0c..cc642d0836 100644--- a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx+++ b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx@@ -19,7 +19,6 @@ import { Button, Mention, Mentions } from '@univerjs/design';import { DocSelectionManagerService } from '@univerjs/docs';import { DocSelectionRenderService } from '@univerjs/docs-ui';import { IRenderManagerService } from '@univerjs/engine-render';-import { KeyCode } from '@univerjs/ui';import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';import type { IDocumentBody } from '@univerjs/core';import type { MentionProps } from '@univerjs/design';@@ -113,11 +112,6 @@ export const ThreadCommentEditor = forwardRef<IThreadCommentEditorInstance, IThrdocSelectionRenderService?.blur();setEditing(true);}}- onKeyDown={(e) => {- if (e.keyCode === KeyCode.ENTER) {- handleSave();- }- }}><Mentionkey={mentionDataService.trigger}