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
7ec5d07c
Commit
7ec5d07c
authored
Sep 10, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove fullscreen button
parent
2e79fe12
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
62 deletions
+8
-62
index.tsx
web/src/components/MemoEditor/Editor/index.tsx
+3
-4
index.tsx
web/src/components/MemoEditor/index.tsx
+5
-32
memo-editor.less
web/src/less/memo-editor.less
+0
-26
No files found.
web/src/components/MemoEditor/Editor/index.tsx
View file @
7ec5d07c
...
@@ -18,14 +18,13 @@ interface Props {
...
@@ -18,14 +18,13 @@ interface Props {
className
:
string
;
className
:
string
;
initialContent
:
string
;
initialContent
:
string
;
placeholder
:
string
;
placeholder
:
string
;
fullscreen
:
boolean
;
tools
?:
ReactNode
;
tools
?:
ReactNode
;
onContentChange
:
(
content
:
string
)
=>
void
;
onContentChange
:
(
content
:
string
)
=>
void
;
onPaste
:
(
event
:
React
.
ClipboardEvent
)
=>
void
;
onPaste
:
(
event
:
React
.
ClipboardEvent
)
=>
void
;
}
}
const
Editor
=
forwardRef
(
function
Editor
(
props
:
Props
,
ref
:
React
.
ForwardedRef
<
EditorRefActions
>
)
{
const
Editor
=
forwardRef
(
function
Editor
(
props
:
Props
,
ref
:
React
.
ForwardedRef
<
EditorRefActions
>
)
{
const
{
className
,
initialContent
,
placeholder
,
fullscreen
,
onPaste
,
onContentChange
:
handleContentChangeCallback
}
=
props
;
const
{
className
,
initialContent
,
placeholder
,
onPaste
,
onContentChange
:
handleContentChangeCallback
}
=
props
;
const
editorRef
=
useRef
<
HTMLTextAreaElement
>
(
null
);
const
editorRef
=
useRef
<
HTMLTextAreaElement
>
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -36,10 +35,10 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
...
@@ -36,10 +35,10 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
},
[]);
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
editorRef
.
current
&&
!
fullscreen
)
{
if
(
editorRef
.
current
)
{
updateEditorHeight
();
updateEditorHeight
();
}
}
},
[
editorRef
.
current
?.
value
,
fullscreen
]);
},
[
editorRef
.
current
?.
value
]);
const
updateEditorHeight
=
()
=>
{
const
updateEditorHeight
=
()
=>
{
if
(
editorRef
.
current
)
{
if
(
editorRef
.
current
)
{
...
...
web/src/components/MemoEditor/index.tsx
View file @
7ec5d07c
...
@@ -31,7 +31,6 @@ interface State {
...
@@ -31,7 +31,6 @@ interface State {
memoVisibility
:
Visibility
;
memoVisibility
:
Visibility
;
resourceList
:
Resource
[];
resourceList
:
Resource
[];
relationList
:
MemoRelation
[];
relationList
:
MemoRelation
[];
fullscreen
:
boolean
;
isUploadingResource
:
boolean
;
isUploadingResource
:
boolean
;
isRequesting
:
boolean
;
isRequesting
:
boolean
;
}
}
...
@@ -53,7 +52,6 @@ const MemoEditor = (props: Props) => {
...
@@ -53,7 +52,6 @@ const MemoEditor = (props: Props) => {
memoVisibility
:
"PRIVATE"
,
memoVisibility
:
"PRIVATE"
,
resourceList
:
[],
resourceList
:
[],
relationList
:
props
.
relationList
??
[],
relationList
:
props
.
relationList
??
[],
fullscreen
:
false
,
isUploadingResource
:
false
,
isUploadingResource
:
false
,
isRequesting
:
false
,
isRequesting
:
false
,
});
});
...
@@ -139,12 +137,6 @@ const MemoEditor = (props: Props) => {
...
@@ -139,12 +137,6 @@ const MemoEditor = (props: Props) => {
}
}
return
;
return
;
}
}
if
(
event
.
key
===
"Escape"
)
{
if
(
state
.
fullscreen
)
{
handleFullscreenBtnClick
();
}
return
;
}
if
(
event
.
key
===
"Tab"
)
{
if
(
event
.
key
===
"Tab"
)
{
event
.
preventDefault
();
event
.
preventDefault
();
const
tabSpace
=
" "
.
repeat
(
TAB_SPACE_WIDTH
);
const
tabSpace
=
" "
.
repeat
(
TAB_SPACE_WIDTH
);
...
@@ -304,12 +296,6 @@ const MemoEditor = (props: Props) => {
...
@@ -304,12 +296,6 @@ const MemoEditor = (props: Props) => {
await
tagStore
.
upsertTag
(
tagName
);
await
tagStore
.
upsertTag
(
tagName
);
}
}
setState
((
state
)
=>
{
return
{
...
state
,
fullscreen
:
false
,
};
});
setState
((
prevState
)
=>
({
setState
((
prevState
)
=>
({
...
prevState
,
...
prevState
,
resourceList
:
[],
resourceList
:
[],
...
@@ -352,15 +338,6 @@ const MemoEditor = (props: Props) => {
...
@@ -352,15 +338,6 @@ const MemoEditor = (props: Props) => {
editorRef
.
current
?.
scrollToCursor
();
editorRef
.
current
?.
scrollToCursor
();
};
};
const
handleFullscreenBtnClick
=
useCallback
(()
=>
{
setState
((
state
)
=>
{
return
{
...
state
,
fullscreen
:
!
state
.
fullscreen
,
};
});
},
[]);
const
handleTagSelectorClick
=
useCallback
((
tag
:
string
)
=>
{
const
handleTagSelectorClick
=
useCallback
((
tag
:
string
)
=>
{
editorRef
.
current
?.
insertText
(
`#
${
tag
}
`
);
editorRef
.
current
?.
insertText
(
`#
${
tag
}
`
);
},
[]);
},
[]);
...
@@ -374,18 +351,17 @@ const MemoEditor = (props: Props) => {
...
@@ -374,18 +351,17 @@ const MemoEditor = (props: Props) => {
className
:
`memo-editor`
,
className
:
`memo-editor`
,
initialContent
:
""
,
initialContent
:
""
,
placeholder
:
t
(
"editor.placeholder"
),
placeholder
:
t
(
"editor.placeholder"
),
fullscreen
:
state
.
fullscreen
,
onContentChange
:
handleContentChange
,
onContentChange
:
handleContentChange
,
onPaste
:
handlePasteEvent
,
onPaste
:
handlePasteEvent
,
}),
}),
[
state
.
fullscreen
,
i18n
.
language
]
[
i18n
.
language
]
);
);
const
allowSave
=
(
hasContent
||
state
.
resourceList
.
length
>
0
)
&&
!
state
.
isUploadingResource
&&
!
state
.
isRequesting
;
const
allowSave
=
(
hasContent
||
state
.
resourceList
.
length
>
0
)
&&
!
state
.
isUploadingResource
&&
!
state
.
isRequesting
;
return
(
return
(
<
div
<
div
className=
{
`${className ?? ""} memo-editor-container
${state.fullscreen ? "fullscreen" : ""}
`
}
className=
{
`${className ?? ""} memo-editor-container`
}
tabIndex=
{
0
}
tabIndex=
{
0
}
onKeyDown=
{
handleKeyDown
}
onKeyDown=
{
handleKeyDown
}
onDrop=
{
handleDropEvent
}
onDrop=
{
handleDropEvent
}
...
@@ -398,16 +374,13 @@ const MemoEditor = (props: Props) => {
...
@@ -398,16 +374,13 @@ const MemoEditor = (props: Props) => {
<
div
className=
"common-tools-container"
>
<
div
className=
"common-tools-container"
>
<
TagSelector
onTagSelectorClick=
{
(
tag
)
=>
handleTagSelectorClick
(
tag
)
}
/>
<
TagSelector
onTagSelectorClick=
{
(
tag
)
=>
handleTagSelectorClick
(
tag
)
}
/>
<
button
className=
"action-btn"
>
<
button
className=
"action-btn"
>
<
Icon
.
CheckSquare
className=
"icon-img"
onClick=
{
handleCheckBox
BtnClick
}
/>
<
Icon
.
Image
className=
"icon-img"
onClick=
{
handleUploadFile
BtnClick
}
/>
</
button
>
</
button
>
<
button
className=
"action-btn"
>
<
button
className=
"action-btn"
>
<
Icon
.
C
ode
className=
"icon-img"
onClick=
{
handleCodeBlock
BtnClick
}
/>
<
Icon
.
C
heckSquare
className=
"icon-img"
onClick=
{
handleCheckBox
BtnClick
}
/>
</
button
>
</
button
>
<
button
className=
"action-btn"
>
<
button
className=
"action-btn"
>
<
Icon
.
Image
className=
"icon-img"
onClick=
{
handleUploadFileBtnClick
}
/>
<
Icon
.
Code
className=
"icon-img"
onClick=
{
handleCodeBlockBtnClick
}
/>
</
button
>
<
button
className=
"action-btn"
onClick=
{
handleFullscreenBtnClick
}
>
{
state
.
fullscreen
?
<
Icon
.
Minimize
className=
"icon-img"
/>
:
<
Icon
.
Maximize
className=
"icon-img"
/>
}
</
button
>
</
button
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/src/less/memo-editor.less
View file @
7ec5d07c
.memo-editor-container {
.memo-editor-container {
@apply relative w-full flex flex-col justify-start items-start bg-white dark:bg-zinc-700 px-4 rounded-lg border-2 border-gray-200 dark:border-zinc-600;
@apply relative w-full flex flex-col justify-start items-start bg-white dark:bg-zinc-700 px-4 rounded-lg border-2 border-gray-200 dark:border-zinc-600;
&.fullscreen {
@apply transition-all fixed w-full h-full top-0 left-0 z-1000 border-none rounded-none sm:p-8 dark:bg-zinc-800;
> .memo-editor {
@apply p-4 mb-4 rounded-lg border shadow-lg flex flex-col flex-grow justify-start items-start relative w-full h-full bg-white dark:bg-zinc-700 dark:border-zinc-600;
> .common-editor-inputer {
@apply flex-grow w-full !h-full max-h-full;
}
}
.tag-suggestions {
margin-left: 6px;
margin-top: 18px;
}
.tag-action > .tag-list {
@apply bottom-7;
top: unset !important;
}
.items-wrapper {
@apply mb-1 bottom-full top-auto;
}
}
.tag-suggestions {
.tag-suggestions {
margin-left: -10px;
margin-left: -10px;
margin-top: 2px;
margin-top: 2px;
...
...
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