Skip to content

Commit 5184723

Browse files
committed
✨(frontend) prevent readers from changing callout emoji
restrict callout emoji editing to maintain proper permissions Signed-off-by: Cyril <[email protected]>
1 parent ca10fb9 commit 5184723

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ and this project adheres to
3838
- 🐛(frontend) fix legacy role computation #1376
3939
- 🛂(frontend) block editing title when not allowed #1412
4040
- 🐛(frontend) scroll back to top when navigate to a document #1406
41+
- 🔒(frontend) prevent readers from changing callout emoji #1449
4142

4243
## [3.7.0] - 2025-09-12
4344

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ export const CalloutBlock = createReactBlockSpec(
2525
{
2626
render: ({ block, editor, contentRef }) => {
2727
const [openEmojiPicker, setOpenEmojiPicker] = useState(false);
28+
const isEditable = editor.isEditable;
2829

2930
const toggleEmojiPicker = (e: React.MouseEvent) => {
31+
if (!isEditable) {
32+
return;
33+
}
3034
e.preventDefault();
3135
e.stopPropagation();
3236
setOpenEmojiPicker(!openEmojiPicker);
@@ -65,9 +69,13 @@ export const CalloutBlock = createReactBlockSpec(
6569
onClick={toggleEmojiPicker}
6670
$css={css`
6771
font-size: 1.125rem;
68-
&:hover {
69-
background-color: rgba(0, 0, 0, 0.1);
70-
}
72+
cursor: ${isEditable ? 'pointer' : 'default'};
73+
${isEditable &&
74+
`
75+
&:hover {
76+
background-color: rgba(0, 0, 0, 0.1);
77+
}
78+
`}
7179
`}
7280
$align="center"
7381
$height="28px"

0 commit comments

Comments
 (0)