Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): escape special characters for cmdk item values (#5353)

JimmFly9981c2412008
diff --git a/packages/frontend/core/src/components/pure/cmdk/data.tsx b/packages/frontend/core/src/components/pure/cmdk/data.tsx
index 98ccffe08e..f3f0003d53 100644
--- a/packages/frontend/core/src/components/pure/cmdk/data.tsx
+++ b/packages/frontend/core/src/components/pure/cmdk/data.tsx
@@ -168,14 +168,15 @@ export const pageToCommand = (
// hack: when comparing, the part between >>> and <<< will be ignored
// adding this patch so that CMDK will not complain about duplicated commands
- const id =
+ const id = CSS.escape(
title +
- (label?.subTitle || '') +
- valueWrapperStart +
- page.id +
- '.' +
- category +
- valueWrapperEnd;
+ (label?.subTitle || '') +
+ valueWrapperStart +
+ page.id +
+ '.' +
+ category +
+ valueWrapperEnd
+ );
return {
id,