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
898b3c37
Commit
898b3c37
authored
Mar 01, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update gomark.wasm
parent
8eb01adb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
69 deletions
+64
-69
gomark.wasm
web/src/assets/gomark.wasm
+0
-0
Renderer.tsx
web/src/components/MemoContent/Renderer.tsx
+31
-30
node.ts
web/src/types/node.ts
+33
-39
No files found.
web/src/assets/gomark.wasm
View file @
898b3c37
No preview for this file type
web/src/components/MemoContent/Renderer.tsx
View file @
898b3c37
...
@@ -62,66 +62,67 @@ interface Props {
...
@@ -62,66 +62,67 @@ interface Props {
node
:
Node
;
node
:
Node
;
}
}
const
Renderer
:
React
.
FC
<
Props
>
=
({
index
,
node
}:
Props
)
=>
{
const
Renderer
:
React
.
FC
<
Props
>
=
({
index
,
node
:
rawNode
}:
Props
)
=>
{
switch
(
node
.
type
)
{
const
{
type
,
node
}
=
rawNode
;
switch
(
type
)
{
case
NodeType
.
LINE_BREAK
:
case
NodeType
.
LINE_BREAK
:
return
<
LineBreak
index=
{
index
}
/>;
return
<
LineBreak
index=
{
index
}
/>;
case
NodeType
.
PARAGRAPH
:
case
NodeType
.
PARAGRAPH
:
return
<
Paragraph
index=
{
index
}
{
...
(
node
.
paragraphNode
as
ParagraphNode
)}
/>;
return
<
Paragraph
index=
{
index
}
{
...
(
node
as
ParagraphNode
)}
/>;
case
NodeType
.
CODE_BLOCK
:
case
NodeType
.
CODE_BLOCK
:
return
<
CodeBlock
index=
{
index
}
{
...
(
node
.
codeBlockNode
as
CodeBlockNode
)}
/>;
return
<
CodeBlock
index=
{
index
}
{
...
(
node
as
CodeBlockNode
)}
/>;
case
NodeType
.
HEADING
:
case
NodeType
.
HEADING
:
return
<
Heading
index=
{
index
}
{
...
(
node
.
headingNode
as
HeadingNode
)}
/>;
return
<
Heading
index=
{
index
}
{
...
(
node
as
HeadingNode
)}
/>;
case
NodeType
.
HORIZONTAL_RULE
:
case
NodeType
.
HORIZONTAL_RULE
:
return
<
HorizontalRule
index=
{
index
}
{
...
(
node
.
horizontalRuleNode
as
HorizontalRuleNode
)}
/>;
return
<
HorizontalRule
index=
{
index
}
{
...
(
node
as
HorizontalRuleNode
)}
/>;
case
NodeType
.
BLOCKQUOTE
:
case
NodeType
.
BLOCKQUOTE
:
return
<
Blockquote
index=
{
index
}
{
...
(
node
.
blockquoteNode
as
BlockquoteNode
)}
/>;
return
<
Blockquote
index=
{
index
}
{
...
(
node
as
BlockquoteNode
)}
/>;
case
NodeType
.
ORDERED_LIST
:
case
NodeType
.
ORDERED_LIST
:
return
<
OrderedList
index=
{
index
}
{
...
(
node
.
orderedListNode
as
OrderedListNode
)}
/>;
return
<
OrderedList
index=
{
index
}
{
...
(
node
as
OrderedListNode
)}
/>;
case
NodeType
.
UNORDERED_LIST
:
case
NodeType
.
UNORDERED_LIST
:
return
<
UnorderedList
{
...
(
node
.
unorderedListNode
as
UnorderedListNode
)}
/>;
return
<
UnorderedList
{
...
(
node
as
UnorderedListNode
)}
/>;
case
NodeType
.
TASK_LIST
:
case
NodeType
.
TASK_LIST
:
return
<
TaskList
index=
{
index
}
{
...
(
node
.
taskListNode
as
TaskListNode
)}
/>;
return
<
TaskList
index=
{
index
}
{
...
(
node
as
TaskListNode
)}
/>;
case
NodeType
.
MATH_BLOCK
:
case
NodeType
.
MATH_BLOCK
:
return
<
Math
{
...
(
node
.
mathBlockNode
as
MathNode
)}
block=
{
true
}
/>;
return
<
Math
{
...
(
node
as
MathNode
)}
block=
{
true
}
/>;
case
NodeType
.
TABLE
:
case
NodeType
.
TABLE
:
return
<
Table
{
...
(
node
.
tableNode
as
TableNode
)}
/>;
return
<
Table
{
...
(
node
as
TableNode
)}
/>;
case
NodeType
.
EMBEDDED_CONTENT
:
case
NodeType
.
EMBEDDED_CONTENT
:
return
<
EmbeddedContent
{
...
(
node
.
embeddedContentNode
as
EmbeddedContentNode
)}
/>;
return
<
EmbeddedContent
{
...
(
node
as
EmbeddedContentNode
)}
/>;
case
NodeType
.
TEXT
:
case
NodeType
.
TEXT
:
return
<
Text
{
...
(
node
.
textNode
as
TextNode
)}
/>;
return
<
Text
{
...
(
node
as
TextNode
)}
/>;
case
NodeType
.
BOLD
:
case
NodeType
.
BOLD
:
return
<
Bold
{
...
(
node
.
boldNode
as
BoldNode
)}
/>;
return
<
Bold
{
...
(
node
as
BoldNode
)}
/>;
case
NodeType
.
ITALIC
:
case
NodeType
.
ITALIC
:
return
<
Italic
{
...
(
node
.
italicNode
as
ItalicNode
)}
/>;
return
<
Italic
{
...
(
node
as
ItalicNode
)}
/>;
case
NodeType
.
BOLD_ITALIC
:
case
NodeType
.
BOLD_ITALIC
:
return
<
BoldItalic
{
...
(
node
.
boldItalicNode
as
BoldItalicNode
)}
/>;
return
<
BoldItalic
{
...
(
node
as
BoldItalicNode
)}
/>;
case
NodeType
.
CODE
:
case
NodeType
.
CODE
:
return
<
Code
{
...
(
node
.
codeNode
as
CodeNode
)}
/>;
return
<
Code
{
...
(
node
as
CodeNode
)}
/>;
case
NodeType
.
IMAGE
:
case
NodeType
.
IMAGE
:
return
<
Image
{
...
(
node
.
imageNode
as
ImageNode
)}
/>;
return
<
Image
{
...
(
node
as
ImageNode
)}
/>;
case
NodeType
.
LINK
:
case
NodeType
.
LINK
:
return
<
Link
{
...
(
node
.
linkNode
as
LinkNode
)}
/>;
return
<
Link
{
...
(
node
as
LinkNode
)}
/>;
case
NodeType
.
AUTO_LINK
:
case
NodeType
.
AUTO_LINK
:
return
<
Link
{
...
(
node
.
autoLinkNode
as
AutoLinkNode
)}
/>;
return
<
Link
{
...
(
node
as
AutoLinkNode
)}
/>;
case
NodeType
.
TAG
:
case
NodeType
.
TAG
:
return
<
Tag
{
...
(
node
.
tagNode
as
TagNode
)}
/>;
return
<
Tag
{
...
(
node
as
TagNode
)}
/>;
case
NodeType
.
STRIKETHROUGH
:
case
NodeType
.
STRIKETHROUGH
:
return
<
Strikethrough
{
...
(
node
.
strikethroughNode
as
StrikethroughNode
)}
/>;
return
<
Strikethrough
{
...
(
node
as
StrikethroughNode
)}
/>;
case
NodeType
.
MATH
:
case
NodeType
.
MATH
:
return
<
Math
{
...
(
node
.
mathNode
as
MathNode
)}
/>;
return
<
Math
{
...
(
node
as
MathNode
)}
/>;
case
NodeType
.
HIGHLIGHT
:
case
NodeType
.
HIGHLIGHT
:
return
<
Highlight
{
...
(
node
.
highlightNode
as
HighlightNode
)}
/>;
return
<
Highlight
{
...
(
node
as
HighlightNode
)}
/>;
case
NodeType
.
ESCAPING_CHARACTER
:
case
NodeType
.
ESCAPING_CHARACTER
:
return
<
EscapingCharacter
{
...
(
node
.
escapingCharacterNode
as
EscapingCharacterNode
)}
/>;
return
<
EscapingCharacter
{
...
(
node
as
EscapingCharacterNode
)}
/>;
case
NodeType
.
SUBSCRIPT
:
case
NodeType
.
SUBSCRIPT
:
return
<
Subscript
{
...
(
node
.
subscriptNode
as
SubscriptNode
)}
/>;
return
<
Subscript
{
...
(
node
as
SubscriptNode
)}
/>;
case
NodeType
.
SUPERSCRIPT
:
case
NodeType
.
SUPERSCRIPT
:
return
<
Superscript
{
...
(
node
.
superscriptNode
as
SuperscriptNode
)}
/>;
return
<
Superscript
{
...
(
node
as
SuperscriptNode
)}
/>;
case
NodeType
.
REFERENCED_CONTENT
:
case
NodeType
.
REFERENCED_CONTENT
:
return
<
ReferencedContent
{
...
(
node
.
referencedContentNode
as
ReferencedContentNode
)}
/>;
return
<
ReferencedContent
{
...
(
node
as
ReferencedContentNode
)}
/>;
case
NodeType
.
SPOILER
:
case
NodeType
.
SPOILER
:
return
<
Spoiler
{
...
(
node
.
spoilerNode
as
SpoilerNode
)}
/>;
return
<
Spoiler
{
...
(
node
as
SpoilerNode
)}
/>;
default
:
default
:
return
null
;
return
null
;
}
}
...
...
web/src/types/node.ts
View file @
898b3c37
/* eslint-disable */
export
const
protobufPackage
=
"gomark.node.v1"
;
export
enum
NodeType
{
export
enum
NodeType
{
NODE_UNSPECIFIED
=
"NODE_UNSPECIFIED"
,
LINE_BREAK
=
"LINE_BREAK"
,
LINE_BREAK
=
"LINE_BREAK"
,
PARAGRAPH
=
"PARAGRAPH"
,
PARAGRAPH
=
"PARAGRAPH"
,
CODE_BLOCK
=
"CODE_BLOCK"
,
CODE_BLOCK
=
"CODE_BLOCK"
,
...
@@ -33,44 +28,43 @@ export enum NodeType {
...
@@ -33,44 +28,43 @@ export enum NodeType {
SUPERSCRIPT
=
"SUPERSCRIPT"
,
SUPERSCRIPT
=
"SUPERSCRIPT"
,
REFERENCED_CONTENT
=
"REFERENCED_CONTENT"
,
REFERENCED_CONTENT
=
"REFERENCED_CONTENT"
,
SPOILER
=
"SPOILER"
,
SPOILER
=
"SPOILER"
,
UNRECOGNIZED
=
"UNRECOGNIZED"
,
}
}
export
interface
Node
{
export
interface
Node
{
type
:
NodeType
;
type
:
NodeType
;
lineBreakNode
?:
LineBreakNode
|
undefined
;
node
:
paragraphNode
?:
ParagraphNode
|
undefined
;
|
LineBreakNode
codeBlockNode
?:
CodeBlockNode
|
undefined
;
|
ParagraphNode
headingNode
?:
HeadingNode
|
undefined
;
|
CodeBlockNode
horizontalRuleNode
?:
HorizontalRuleNode
|
undefined
;
|
HeadingNode
blockquoteNode
?:
BlockquoteNode
|
undefined
;
|
HorizontalRuleNode
orderedListNode
?:
OrderedListNode
|
undefined
;
|
BlockquoteNode
unorderedListNode
?:
UnorderedListNode
|
undefined
;
|
OrderedListNode
taskListNode
?:
TaskListNode
|
undefined
;
|
UnorderedListNode
mathBlockNode
?:
MathBlockNode
|
undefined
;
|
TaskListNode
tableNode
?:
TableNode
|
undefined
;
|
MathBlockNode
embeddedContentNode
?:
EmbeddedContentNode
|
undefined
;
|
TableNode
textNode
?:
TextNode
|
undefined
;
|
EmbeddedContentNode
boldNode
?:
BoldNode
|
undefined
;
|
TextNode
italicNode
?:
ItalicNode
|
undefined
;
|
BoldNode
boldItalicNode
?:
BoldItalicNode
|
undefined
;
|
ItalicNode
codeNode
?:
CodeNode
|
undefined
;
|
BoldItalicNode
imageNode
?:
ImageNode
|
undefined
;
|
CodeNode
linkNode
?:
LinkNode
|
undefined
;
|
ImageNode
autoLinkNode
?:
AutoLinkNode
|
undefined
;
|
LinkNode
tagNode
?:
TagNode
|
undefined
;
|
AutoLinkNode
strikethroughNode
?:
StrikethroughNode
|
undefined
;
|
TagNode
escapingCharacterNode
?:
EscapingCharacterNode
|
undefined
;
|
StrikethroughNode
mathNode
?:
MathNode
|
undefined
;
|
EscapingCharacterNode
highlightNode
?:
HighlightNode
|
undefined
;
|
MathNode
subscriptNode
?:
SubscriptNode
|
undefined
;
|
HighlightNode
superscriptNode
?:
SuperscriptNode
|
undefined
;
|
SubscriptNode
referencedContentNode
?:
ReferencedContentNode
|
undefined
;
|
SuperscriptNode
spoilerNode
?:
SpoilerNode
|
undefined
;
|
ReferencedContentNode
}
|
SpoilerNode
;
}
export
interface
LineBreakNode
{
}
export
interface
LineBreakNode
{
}
export
interface
ParagraphNode
{
export
interface
ParagraphNode
{
children
:
Node
[];
children
:
Node
[];
...
...
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