Skip to content

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.

fix(docs): double click trigger defaule value (fs,ff,cl,bg) (#6664)

Roman Sergeevbbb41bb2aa46
diff --git a/packages/docs-ui/src/commands/commands/inline-format.command.ts b/packages/docs-ui/src/commands/commands/inline-format.command.ts
index 20dc04791a..0beddc4a27 100644
--- a/packages/docs-ui/src/commands/commands/inline-format.command.ts
+++ b/packages/docs-ui/src/commands/commands/inline-format.command.ts
@@ -359,7 +359,7 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {
docMenuStyleService.setStyleCache(
{
- [key]: cacheStyle?.[key] !== undefined
+ [key]: cacheStyle?.[key] !== undefined && isNeedReverseValue(key)
? getReverseFormatValue(
cacheStyle,
key,
@@ -419,6 +419,10 @@ function isTextDecoration(value: unknown | ITextDecoration): value is ITextDecor
return value !== null && typeof value === 'object';
}
+function isNeedReverseValue(key: keyof IStyleBase): boolean {
+ return !(/fs|ff|cl|bg/.test(key));
+}
+
function getReverseFormatValue(ts: Nullable<ITextStyle>, key: keyof IStyleBase, preCommandId: string) {
if (/bl|it/.test(key)) {
return ts?.[key] === BooleanNumber.TRUE ? BooleanNumber.FALSE : BooleanNumber.TRUE;