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
67c1a463
Commit
67c1a463
authored
Nov 05, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove html renderer sanitizes
parent
57c00734
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
31 deletions
+1
-31
package.json
web/package.json
+0
-2
pnpm-lock.yaml
web/pnpm-lock.yaml
+0
-23
CodeBlock.tsx
web/src/components/MemoContent/CodeBlock.tsx
+1
-6
No files found.
web/package.json
View file @
67c1a463
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
"clsx"
:
"^2.1.1"
,
"clsx"
:
"^2.1.1"
,
"copy-to-clipboard"
:
"^3.3.3"
,
"copy-to-clipboard"
:
"^3.3.3"
,
"dayjs"
:
"^1.11.13"
,
"dayjs"
:
"^1.11.13"
,
"dompurify"
:
"^3.1.7"
,
"fuse.js"
:
"^7.0.0"
,
"fuse.js"
:
"^7.0.0"
,
"highlight.js"
:
"^11.10.0"
,
"highlight.js"
:
"^11.10.0"
,
"i18next"
:
"^23.16.3"
,
"i18next"
:
"^23.16.3"
,
...
@@ -55,7 +54,6 @@
...
@@ -55,7 +54,6 @@
"@bufbuild/protobuf"
:
"^2.2.2"
,
"@bufbuild/protobuf"
:
"^2.2.2"
,
"@trivago/prettier-plugin-sort-imports"
:
"^4.3.0"
,
"@trivago/prettier-plugin-sort-imports"
:
"^4.3.0"
,
"@types/d3"
:
"^7.4.3"
,
"@types/d3"
:
"^7.4.3"
,
"@types/dompurify"
:
"^3.0.5"
,
"@types/katex"
:
"^0.16.7"
,
"@types/katex"
:
"^0.16.7"
,
"@types/leaflet"
:
"^1.9.14"
,
"@types/leaflet"
:
"^1.9.14"
,
"@types/lodash-es"
:
"^4.17.12"
,
"@types/lodash-es"
:
"^4.17.12"
,
...
...
web/pnpm-lock.yaml
View file @
67c1a463
...
@@ -53,9 +53,6 @@ importers:
...
@@ -53,9 +53,6 @@ importers:
dayjs
:
dayjs
:
specifier
:
^1.11.13
specifier
:
^1.11.13
version
:
1.11.13
version
:
1.11.13
dompurify
:
specifier
:
^3.1.7
version
:
3.1.7
fuse.js
:
fuse.js
:
specifier
:
^7.0.0
specifier
:
^7.0.0
version
:
7.0.0
version
:
7.0.0
...
@@ -141,9 +138,6 @@ importers:
...
@@ -141,9 +138,6 @@ importers:
'
@types/d3'
:
'
@types/d3'
:
specifier
:
^7.4.3
specifier
:
^7.4.3
version
:
7.4.3
version
:
7.4.3
'
@types/dompurify'
:
specifier
:
^3.0.5
version
:
3.0.5
'
@types/katex'
:
'
@types/katex'
:
specifier
:
^0.16.7
specifier
:
^0.16.7
version
:
0.16.7
version
:
0.16.7
...
@@ -1294,9 +1288,6 @@ packages:
...
@@ -1294,9 +1288,6 @@ packages:
'
@types/d3@7.4.3'
:
'
@types/d3@7.4.3'
:
resolution
:
{
integrity
:
sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==
}
resolution
:
{
integrity
:
sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==
}
'
@types/dompurify@3.0.5'
:
resolution
:
{
integrity
:
sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==
}
'
@types/estree@1.0.6'
:
'
@types/estree@1.0.6'
:
resolution
:
{
integrity
:
sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
}
resolution
:
{
integrity
:
sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
}
...
@@ -1339,9 +1330,6 @@ packages:
...
@@ -1339,9 +1330,6 @@ packages:
'
@types/textarea-caret@3.0.3'
:
'
@types/textarea-caret@3.0.3'
:
resolution
:
{
integrity
:
sha512-bsA9GdXV1wQsXyDjS5+A+czz8IAR3haH5DU+KctIoXbzobRL2NOiwF/+EbB7pofAyudMytLj4ihPtbmbJT8FWw==
}
resolution
:
{
integrity
:
sha512-bsA9GdXV1wQsXyDjS5+A+czz8IAR3haH5DU+KctIoXbzobRL2NOiwF/+EbB7pofAyudMytLj4ihPtbmbJT8FWw==
}
'
@types/trusted-types@2.0.7'
:
resolution
:
{
integrity
:
sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==
}
'
@types/use-sync-external-store@0.0.3'
:
'
@types/use-sync-external-store@0.0.3'
:
resolution
:
{
integrity
:
sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==
}
resolution
:
{
integrity
:
sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==
}
...
@@ -1896,9 +1884,6 @@ packages:
...
@@ -1896,9 +1884,6 @@ packages:
dompurify@3.1.6
:
dompurify@3.1.6
:
resolution
:
{
integrity
:
sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==
}
resolution
:
{
integrity
:
sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==
}
dompurify@3.1.7
:
resolution
:
{
integrity
:
sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==
}
eastasianwidth@0.2.0
:
eastasianwidth@0.2.0
:
resolution
:
{
integrity
:
sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
}
resolution
:
{
integrity
:
sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
}
...
@@ -4513,10 +4498,6 @@ snapshots:
...
@@ -4513,10 +4498,6 @@ snapshots:
'
@types/d3-transition'
:
3.0.9
'
@types/d3-transition'
:
3.0.9
'
@types/d3-zoom'
:
3.0.8
'
@types/d3-zoom'
:
3.0.8
'
@types/dompurify@3.0.5'
:
dependencies
:
'
@types/trusted-types'
:
2.0.7
'
@types/estree@1.0.6'
:
{}
'
@types/estree@1.0.6'
:
{}
'
@types/geojson@7946.0.14'
:
{}
'
@types/geojson@7946.0.14'
:
{}
...
@@ -4556,8 +4537,6 @@ snapshots:
...
@@ -4556,8 +4537,6 @@ snapshots:
'
@types/textarea-caret@3.0.3'
:
{}
'
@types/textarea-caret@3.0.3'
:
{}
'
@types/trusted-types@2.0.7'
:
{}
'
@types/use-sync-external-store@0.0.3'
:
{}
'
@types/use-sync-external-store@0.0.3'
:
{}
'
@types/uuid@10.0.0'
:
{}
'
@types/uuid@10.0.0'
:
{}
...
@@ -5193,8 +5172,6 @@ snapshots:
...
@@ -5193,8 +5172,6 @@ snapshots:
dompurify@3.1.6
:
{}
dompurify@3.1.6
:
{}
dompurify@3.1.7
:
{}
eastasianwidth@0.2.0
:
{}
eastasianwidth@0.2.0
:
{}
electron-to-chromium@1.5.45
:
{}
electron-to-chromium@1.5.45
:
{}
...
...
web/src/components/MemoContent/CodeBlock.tsx
View file @
67c1a463
import
clsx
from
"clsx"
;
import
clsx
from
"clsx"
;
import
copy
from
"copy-to-clipboard"
;
import
copy
from
"copy-to-clipboard"
;
import
DOMPurify
from
"dompurify"
;
import
hljs
from
"highlight.js"
;
import
hljs
from
"highlight.js"
;
import
{
CopyIcon
}
from
"lucide-react"
;
import
{
CopyIcon
}
from
"lucide-react"
;
import
{
useCallback
,
useMemo
}
from
"react"
;
import
{
useCallback
,
useMemo
}
from
"react"
;
...
@@ -24,15 +23,11 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
...
@@ -24,15 +23,11 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
// Users can set Markdown code blocks as `__html` to render HTML directly.
// Users can set Markdown code blocks as `__html` to render HTML directly.
if
(
formatedLanguage
===
SpecialLanguage
.
HTML
)
{
if
(
formatedLanguage
===
SpecialLanguage
.
HTML
)
{
const
purify
=
DOMPurify
(
window
);
return
(
return
(
<
div
<
div
className=
"w-full overflow-auto !my-2"
className=
"w-full overflow-auto !my-2"
dangerouslySetInnerHTML=
{
{
dangerouslySetInnerHTML=
{
{
__html
:
purify
.
sanitize
(
content
,
{
__html
:
content
,
ALLOWED_TAGS
:
[
"iframe"
],
ADD_ATTR
:
[
"allow"
,
"allowfullscreen"
,
"frameborder"
,
"scrolling"
],
}),
}
}
}
}
/>
/>
);
);
...
...
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