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(conditional-formatting): can not add custom formula (#2915)

Gpound.liue9435ee7c52e
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx
index 47185a520f..3d24d20242 100644
--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx
+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/formula.tsx
@@ -66,15 +66,16 @@ export const FormulaStyleEditor = (props: IStyleEditorProps) => {
}, [style, formula, interceptorManager]);
useEffect(() => {
- interceptorManager.intercept(interceptorManager.getInterceptPoints().beforeSubmit, {
+ const dispose = interceptorManager.intercept(interceptorManager.getInterceptPoints().beforeSubmit, {
handler: (v, _c, next) => {
- if (!formula || formula.length === 1 || !formulaError.startsWith('=')) {
+ if (!formula || formula.length === 1 || !formula.startsWith('=')) {
formulaErrorSet(localeService.t('sheet.cf.errorMessage.formulaError'));
return false;
}
return next(v);
},
});
+ return dispose as () => void;
}, [formula]);
const _onChange = (config: {