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

![image](https://github.com/toeverything/AFFiNE/assets/102217452/301ef02e-f0df-4a1b-843f-240cad44af0f)
This commit is contained in:
JimmFly 2023-12-20 08:20:21 +00:00
parent a4f31df192
commit 9981c24120
No known key found for this signature in database
GPG Key ID: 14A6F56854E1BED7

View File

@ -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,