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
fdbf2d8a
Commit
fdbf2d8a
authored
Jan 15, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix blockquote renderer
parent
5a723f00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
3 deletions
+17
-3
blockquote.go
plugin/gomark/parser/blockquote.go
+1
-1
blockquote_test.go
plugin/gomark/parser/blockquote_test.go
+14
-0
Blockquote.tsx
web/src/components/MemoContent/Blockquote.tsx
+1
-1
index.tsx
web/src/components/MemoEditor/index.tsx
+1
-1
No files found.
plugin/gomark/parser/blockquote.go
View file @
fdbf2d8a
...
@@ -14,7 +14,7 @@ func NewBlockquoteParser() *BlockquoteParser {
...
@@ -14,7 +14,7 @@ func NewBlockquoteParser() *BlockquoteParser {
}
}
func
(
*
BlockquoteParser
)
Match
(
tokens
[]
*
tokenizer
.
Token
)
(
int
,
bool
)
{
func
(
*
BlockquoteParser
)
Match
(
tokens
[]
*
tokenizer
.
Token
)
(
int
,
bool
)
{
if
len
(
tokens
)
<
4
{
if
len
(
tokens
)
<
3
{
return
0
,
false
return
0
,
false
}
}
if
tokens
[
0
]
.
Type
!=
tokenizer
.
GreaterThan
||
tokens
[
1
]
.
Type
!=
tokenizer
.
Space
{
if
tokens
[
0
]
.
Type
!=
tokenizer
.
GreaterThan
||
tokens
[
1
]
.
Type
!=
tokenizer
.
Space
{
...
...
plugin/gomark/parser/blockquote_test.go
View file @
fdbf2d8a
...
@@ -29,6 +29,20 @@ func TestBlockquoteParser(t *testing.T) {
...
@@ -29,6 +29,20 @@ func TestBlockquoteParser(t *testing.T) {
},
},
},
},
},
},
{
text
:
"> 你好"
,
blockquote
:
&
ast
.
Blockquote
{
Children
:
[]
ast
.
Node
{
&
ast
.
Paragraph
{
Children
:
[]
ast
.
Node
{
&
ast
.
Text
{
Content
:
"你好"
,
},
},
},
},
},
},
{
{
text
:
"> Hello
\n
world"
,
text
:
"> Hello
\n
world"
,
blockquote
:
&
ast
.
Blockquote
{
blockquote
:
&
ast
.
Blockquote
{
...
...
web/src/components/MemoContent/Blockquote.tsx
View file @
fdbf2d8a
...
@@ -8,7 +8,7 @@ interface Props extends BaseProps {
...
@@ -8,7 +8,7 @@ interface Props extends BaseProps {
const
Blockquote
:
React
.
FC
<
Props
>
=
({
children
}:
Props
)
=>
{
const
Blockquote
:
React
.
FC
<
Props
>
=
({
children
}:
Props
)
=>
{
return
(
return
(
<
blockquote
>
<
blockquote
className=
"p-2 border-s-4 border-gray-300 bg-gray-50 dark:border-gray-500 dark:bg-zinc-700"
>
{
children
.
map
((
child
,
index
)
=>
(
{
children
.
map
((
child
,
index
)
=>
(
<
Renderer
key=
{
`${child.type}-${index}`
}
index=
{
String
(
index
)
}
node=
{
child
}
/>
<
Renderer
key=
{
`${child.type}-${index}`
}
index=
{
String
(
index
)
}
node=
{
child
}
/>
))
}
))
}
...
...
web/src/components/MemoEditor/index.tsx
View file @
fdbf2d8a
...
@@ -368,6 +368,7 @@ const MemoEditor = (props: Props) => {
...
@@ -368,6 +368,7 @@ const MemoEditor = (props: Props) => {
<
Editor
ref=
{
editorRef
}
{
...
editorConfig
}
/>
<
Editor
ref=
{
editorRef
}
{
...
editorConfig
}
/>
<
div
className=
"relative w-full flex flex-row justify-between items-center pt-2"
onFocus=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
div
className=
"relative w-full flex flex-row justify-between items-center pt-2"
onFocus=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
div
className=
"flex flex-row justify-start items-center opacity-80"
>
<
div
className=
"flex flex-row justify-start items-center opacity-80"
>
<
MarkdownMenu
editorRef=
{
editorRef
}
/>
<
TagSelector
editorRef=
{
editorRef
}
/>
<
TagSelector
editorRef=
{
editorRef
}
/>
<
IconButton
size=
"sm"
onClick=
{
handleUploadFileBtnClick
}
>
<
IconButton
size=
"sm"
onClick=
{
handleUploadFileBtnClick
}
>
<
Icon
.
Image
className=
"w-5 h-5 mx-auto"
/>
<
Icon
.
Image
className=
"w-5 h-5 mx-auto"
/>
...
@@ -375,7 +376,6 @@ const MemoEditor = (props: Props) => {
...
@@ -375,7 +376,6 @@ const MemoEditor = (props: Props) => {
<
IconButton
size=
"sm"
onClick=
{
handleAddMemoRelationBtnClick
}
>
<
IconButton
size=
"sm"
onClick=
{
handleAddMemoRelationBtnClick
}
>
<
Icon
.
Link
className=
"w-5 h-5 mx-auto"
/>
<
Icon
.
Link
className=
"w-5 h-5 mx-auto"
/>
</
IconButton
>
</
IconButton
>
<
MarkdownMenu
editorRef=
{
editorRef
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
<
ResourceListView
resourceList=
{
state
.
resourceList
}
setResourceList=
{
handleSetResourceList
}
/>
<
ResourceListView
resourceList=
{
state
.
resourceList
}
setResourceList=
{
handleSetResourceList
}
/>
...
...
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