Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
22519b57
Commit
22519b57
authored
Mar 23, 2026
by
memoclaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(web): prevent MemoContent prop leaks
parent
45b21530
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
18 deletions
+43
-18
Tag.tsx
web/src/components/MemoContent/Tag.tsx
+2
-2
index.tsx
web/src/components/MemoContent/index.tsx
+41
-16
No files found.
web/src/components/MemoContent/Tag.tsx
View file @
22519b57
...
...
@@ -15,7 +15,7 @@ interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
children
?:
React
.
ReactNode
;
}
export
const
Tag
:
React
.
FC
<
TagProps
>
=
({
"data-tag"
:
dataTag
,
children
,
className
,
style
,
...
props
})
=>
{
export
const
Tag
:
React
.
FC
<
TagProps
>
=
({
"data-tag"
:
dataTag
,
children
,
className
,
style
,
node
:
_node
,
...
props
})
=>
{
const
{
parentPage
}
=
useMemoViewContext
();
const
location
=
useLocation
();
const
navigateTo
=
useNavigateTo
();
...
...
@@ -66,7 +66,7 @@ export const Tag: React.FC<TagProps> = ({ "data-tag": dataTag, children, classNa
return
(
<
span
className=
{
cn
(
"inline-flex items-center
px-1 text-sm
rounded-full border cursor-pointer transition-opacity hover:opacity-75"
,
"inline-flex items-center
align-baseline px-1.5 py-0.5 text-[0.9em] leading-none font-normal
rounded-full border cursor-pointer transition-opacity hover:opacity-75"
,
!
bgHex
&&
"border-primary text-primary bg-primary/15"
,
className
,
)
}
...
...
web/src/components/MemoContent/index.tsx
View file @
22519b57
...
...
@@ -55,10 +55,11 @@ const MemoContent = (props: MemoContentProps) => {
components=
{
{
// Child components consume from MemoViewContext directly
input
:
((
inputProps
:
React
.
ComponentProps
<
"input"
>
&
{
node
?:
Element
})
=>
{
if
(
inputProps
.
node
&&
isTaskListItemNode
(
inputProps
.
node
))
{
const
{
node
,
...
rest
}
=
inputProps
;
if
(
node
&&
isTaskListItemNode
(
node
))
{
return
<
TaskListItem
{
...
inputProps
}
/>;
}
return
<
input
{
...
inputProps
}
/>;
return
<
input
{
...
rest
}
/>;
})
as
React
.
ComponentType
<
React
.
ComponentProps
<
"input"
>>
,
span
:
((
spanProps
:
React
.
ComponentProps
<
"span"
>
&
{
node
?:
Element
})
=>
{
const
{
node
,
...
rest
}
=
spanProps
;
...
...
@@ -68,16 +69,40 @@ const MemoContent = (props: MemoContentProps) => {
return
<
span
{
...
rest
}
/>;
})
as
React
.
ComponentType
<
React
.
ComponentProps
<
"span"
>>
,
// Headings
h1
:
({
children
})
=>
<
Heading
level=
{
1
}
>
{
children
}
</
Heading
>,
h2
:
({
children
})
=>
<
Heading
level=
{
2
}
>
{
children
}
</
Heading
>,
h3
:
({
children
})
=>
<
Heading
level=
{
3
}
>
{
children
}
</
Heading
>,
h4
:
({
children
})
=>
<
Heading
level=
{
4
}
>
{
children
}
</
Heading
>,
h5
:
({
children
})
=>
<
Heading
level=
{
5
}
>
{
children
}
</
Heading
>,
h6
:
({
children
})
=>
<
Heading
level=
{
6
}
>
{
children
}
</
Heading
>,
h1
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
1
}
{
...
props
}
>
{
children
}
</
Heading
>
),
h2
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
2
}
{
...
props
}
>
{
children
}
</
Heading
>
),
h3
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
3
}
{
...
props
}
>
{
children
}
</
Heading
>
),
h4
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
4
}
{
...
props
}
>
{
children
}
</
Heading
>
),
h5
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
5
}
{
...
props
}
>
{
children
}
</
Heading
>
),
h6
:
({
children
,
...
props
})
=>
(
<
Heading
level=
{
6
}
{
...
props
}
>
{
children
}
</
Heading
>
),
// Block elements
p
:
({
children
})
=>
<
Paragraph
>
{
children
}
</
Paragraph
>,
blockquote
:
({
children
})
=>
<
Blockquote
>
{
children
}
</
Blockquote
>,
hr
:
(
)
=>
<
HorizontalRule
/>,
p
:
({
children
,
...
props
})
=>
<
Paragraph
{
...
props
}
>
{
children
}
</
Paragraph
>,
blockquote
:
({
children
,
...
props
})
=>
<
Blockquote
{
...
props
}
>
{
children
}
</
Blockquote
>,
hr
:
(
props
)
=>
<
HorizontalRule
{
...
props
}
/>,
// Lists
ul
:
({
children
,
...
props
})
=>
<
List
{
...
props
}
>
{
children
}
</
List
>,
ol
:
({
children
,
...
props
})
=>
(
...
...
@@ -88,15 +113,15 @@ const MemoContent = (props: MemoContentProps) => {
li
:
({
children
,
...
props
})
=>
<
ListItem
{
...
props
}
>
{
children
}
</
ListItem
>,
// Inline elements
a
:
({
children
,
...
props
})
=>
<
Link
{
...
props
}
>
{
children
}
</
Link
>,
code
:
({
children
})
=>
<
InlineCode
>
{
children
}
</
InlineCode
>,
code
:
({
children
,
...
props
})
=>
<
InlineCode
{
...
props
}
>
{
children
}
</
InlineCode
>,
img
:
({
...
props
})
=>
<
Image
{
...
props
}
/>,
// Code blocks
pre
:
CodeBlock
,
// Tables
table
:
({
children
})
=>
<
Table
>
{
children
}
</
Table
>,
thead
:
({
children
})
=>
<
TableHead
>
{
children
}
</
TableHead
>,
tbody
:
({
children
})
=>
<
TableBody
>
{
children
}
</
TableBody
>,
tr
:
({
children
})
=>
<
TableRow
>
{
children
}
</
TableRow
>,
table
:
({
children
,
...
props
})
=>
<
Table
{
...
props
}
>
{
children
}
</
Table
>,
thead
:
({
children
,
...
props
})
=>
<
TableHead
{
...
props
}
>
{
children
}
</
TableHead
>,
tbody
:
({
children
,
...
props
})
=>
<
TableBody
{
...
props
}
>
{
children
}
</
TableBody
>,
tr
:
({
children
,
...
props
})
=>
<
TableRow
{
...
props
}
>
{
children
}
</
TableRow
>,
th
:
({
children
,
...
props
})
=>
<
TableHeaderCell
{
...
props
}
>
{
children
}
</
TableHeaderCell
>,
td
:
({
children
,
...
props
})
=>
<
TableCell
{
...
props
}
>
{
children
}
</
TableCell
>,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment