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
0bb0407f
Commit
0bb0407f
authored
Nov 17, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add overflow tips to tag
parent
8bc117bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
TagSelector.tsx
web/src/components/MemoEditor/ActionButton/TagSelector.tsx
+5
-4
TagSuggestions.tsx
web/src/components/MemoEditor/Editor/TagSuggestions.tsx
+4
-3
No files found.
web/src/components/MemoEditor/ActionButton/TagSelector.tsx
View file @
0bb0407f
import
{
IconButton
}
from
"@mui/joy"
;
import
Icon
from
"@/components/Icon"
;
import
OverflowTip
from
"@/components/kit/OverflowTip"
;
import
{
useTagStore
}
from
"@/store/module"
;
interface
Props
{
...
...
@@ -18,13 +19,13 @@ const TagSelector = (props: Props) => {
{
tags
.
length
>
0
?
(
tags
.
map
((
tag
)
=>
{
return
(
<
span
className=
"w-auto max-w-full t
runcate t
ext-black dark:text-gray-300 cursor-pointer rounded text-sm leading-6 px-2 hover:bg-zinc-300 dark:hover:bg-zinc-700 shrink-0"
<
div
className=
"w-auto max-w-full text-black dark:text-gray-300 cursor-pointer rounded text-sm leading-6 px-2 hover:bg-zinc-300 dark:hover:bg-zinc-700 shrink-0"
onClick=
{
()
=>
onTagSelectorClick
(
tag
)
}
key=
{
tag
}
>
#
{
tag
}
</
span
>
<
OverflowTip
>
#
{
tag
}
</
OverflowTip
>
</
div
>
);
})
)
:
(
...
...
web/src/components/MemoEditor/Editor/TagSuggestions.tsx
View file @
0bb0407f
import
classNames
from
"classnames"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
getCaretCoordinates
from
"textarea-caret"
;
import
OverflowTip
from
"@/components/kit/OverflowTip"
;
import
{
useTagStore
}
from
"@/store/module"
;
import
{
EditorRefActions
}
from
"."
;
...
...
@@ -8,6 +9,7 @@ type Props = {
editorRef
:
React
.
RefObject
<
HTMLTextAreaElement
>
;
editorActions
:
React
.
ForwardedRef
<
EditorRefActions
>
;
};
type
Position
=
{
left
:
number
;
top
:
number
;
height
:
number
};
const
TagSuggestions
=
({
editorRef
,
editorActions
}:
Props
)
=>
{
...
...
@@ -53,7 +55,6 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => {
};
const
matchedTags
=
tagsRef
.
current
.
filter
((
tag
)
=>
customMatches
(
tag
,
input
));
return
matchedTags
.
slice
(
0
,
5
);
})();
...
...
@@ -113,7 +114,7 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => {
if
(
!
isVisibleRef
.
current
||
!
position
)
return
null
;
return
(
<
div
className=
"z-20 p-1 mt-1 -ml-2 absolute max-w-[12rem]
rounded font-mon
o shadow bg-zinc-200 dark:bg-zinc-600"
className=
"z-20 p-1 mt-1 -ml-2 absolute max-w-[12rem]
gap-px rounded font-mono flex flex-col justify-start items-start overflow-aut
o shadow bg-zinc-200 dark:bg-zinc-600"
style=
{
{
left
:
position
.
left
,
top
:
position
.
top
+
position
.
height
}
}
>
{
suggestionsRef
.
current
.
map
((
tag
,
i
)
=>
(
...
...
@@ -125,7 +126,7 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => {
i
===
selected
?
"bg-zinc-300 dark:bg-zinc-700"
:
""
)
}
>
#
{
tag
}
<
OverflowTip
>
#
{
tag
}
</
OverflowTip
>
</
div
>
))
}
</
div
>
...
...
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