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
d663313c
Commit
d663313c
authored
Sep 17, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix frontend linter
parent
fbe0251e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
index.tsx
web/src/components/MemoEditor/Editor/index.tsx
+8
-8
No files found.
web/src/components/MemoEditor/Editor/index.tsx
View file @
d663313c
...
@@ -2,7 +2,7 @@ import clsx from "clsx";
...
@@ -2,7 +2,7 @@ import clsx from "clsx";
import
{
last
}
from
"lodash-es"
;
import
{
last
}
from
"lodash-es"
;
import
{
forwardRef
,
ReactNode
,
useCallback
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
}
from
"react"
;
import
{
forwardRef
,
ReactNode
,
useCallback
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
}
from
"react"
;
import
{
markdownServiceClient
}
from
"@/grpcweb"
;
import
{
markdownServiceClient
}
from
"@/grpcweb"
;
import
{
NodeType
,
OrderedList
Node
,
TaskListNode
,
UnorderedList
Node
}
from
"@/types/proto/api/v1/markdown_service"
;
import
{
NodeType
,
OrderedList
ItemNode
,
TaskListItemNode
,
UnorderedListItem
Node
}
from
"@/types/proto/api/v1/markdown_service"
;
import
TagSuggestions
from
"./TagSuggestions"
;
import
TagSuggestions
from
"./TagSuggestions"
;
export
interface
EditorRefActions
{
export
interface
EditorRefActions
{
...
@@ -159,20 +159,20 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
...
@@ -159,20 +159,20 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
const
cursorPosition
=
editorActions
.
getCursorPosition
();
const
cursorPosition
=
editorActions
.
getCursorPosition
();
const
prevContent
=
editorActions
.
getContent
().
substring
(
0
,
cursorPosition
);
const
prevContent
=
editorActions
.
getContent
().
substring
(
0
,
cursorPosition
);
const
{
nodes
}
=
await
markdownServiceClient
.
parseMarkdown
({
markdown
:
prevContent
});
const
{
nodes
}
=
await
markdownServiceClient
.
parseMarkdown
({
markdown
:
prevContent
});
const
lastNode
=
last
(
nodes
);
const
lastNode
=
last
(
last
(
nodes
)?.
listNode
?.
children
);
if
(
!
lastNode
)
{
if
(
!
lastNode
)
{
return
;
return
;
}
}
let
insertText
=
""
;
let
insertText
=
""
;
if
(
lastNode
.
type
===
NodeType
.
TASK_LIST
)
{
if
(
lastNode
.
type
===
NodeType
.
TASK_LIST
_ITEM
)
{
const
{
complete
}
=
lastNode
.
taskList
Node
as
TaskList
Node
;
const
{
complete
}
=
lastNode
.
taskList
ItemNode
as
TaskListItem
Node
;
insertText
=
complete
?
"- [x] "
:
"- [ ] "
;
insertText
=
complete
?
"- [x] "
:
"- [ ] "
;
}
else
if
(
lastNode
.
type
===
NodeType
.
UNORDERED_LIST
)
{
}
else
if
(
lastNode
.
type
===
NodeType
.
UNORDERED_LIST
_ITEM
)
{
const
{
symbol
}
=
lastNode
.
unorderedList
Node
as
UnorderedList
Node
;
const
{
symbol
}
=
lastNode
.
unorderedList
ItemNode
as
UnorderedListItem
Node
;
insertText
=
`
${
symbol
}
`
;
insertText
=
`
${
symbol
}
`
;
}
else
if
(
lastNode
.
type
===
NodeType
.
ORDERED_LIST
)
{
}
else
if
(
lastNode
.
type
===
NodeType
.
ORDERED_LIST
_ITEM
)
{
const
{
number
}
=
lastNode
.
orderedList
Node
as
OrderedList
Node
;
const
{
number
}
=
lastNode
.
orderedList
ItemNode
as
OrderedListItem
Node
;
insertText
=
`
${
Number
(
number
)
+
1
}
. `
;
insertText
=
`
${
Number
(
number
)
+
1
}
. `
;
}
}
if
(
insertText
)
{
if
(
insertText
)
{
...
...
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