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
2b5ee783
Commit
2b5ee783
authored
Mar 20, 2022
by
email
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: layout style(1)
parent
8ad98291
Changes
34
Show whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
70 additions
and
194 deletions
+70
-194
package.json
web/package.json
+1
-2
Editor.tsx
web/src/components/Editor/Editor.tsx
+2
-59
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+1
-1
MemoList.tsx
web/src/components/MemoList.tsx
+2
-2
MenuBtnsPopup.tsx
web/src/components/MenuBtnsPopup.tsx
+1
-1
PreferencesSection.tsx
web/src/components/PreferencesSection.tsx
+1
-19
ShortcutList.tsx
web/src/components/ShortcutList.tsx
+6
-3
Sidebar.tsx
web/src/components/Sidebar.tsx
+0
-2
TagList.tsx
web/src/components/TagList.tsx
+1
-1
UsageHeatMap.tsx
web/src/components/UsageHeatMap.tsx
+1
-1
storage.ts
web/src/helpers/storage.ts
+0
-10
editor.less
web/src/less/editor.less
+2
-11
global.less
web/src/less/global.less
+1
-1
home.less
web/src/less/home.less
+1
-6
memo-editor.less
web/src/less/memo-editor.less
+2
-9
memo-filter.less
web/src/less/memo-filter.less
+3
-19
memo-list.less
web/src/less/memo-list.less
+1
-1
memo-trash.less
web/src/less/memo-trash.less
+1
-0
memo.less
web/src/less/memo.less
+3
-14
memos.less
web/src/less/memos.less
+15
-0
search-bar.less
web/src/less/search-bar.less
+2
-7
setting.less
web/src/less/setting.less
+1
-1
siderbar.less
web/src/less/siderbar.less
+1
-1
Home.tsx
web/src/pages/Home.tsx
+1
-1
Memos.tsx
web/src/pages/Memos.tsx
+11
-6
Trash.tsx
web/src/pages/Trash.tsx
+2
-2
homeRouter.tsx
web/src/routers/homeRouter.tsx
+2
-2
globalStateService.ts
web/src/services/globalStateService.ts
+1
-2
locationService.ts
web/src/services/locationService.ts
+1
-1
shortcutService.ts
web/src/services/shortcutService.ts
+1
-0
globalStateStore.ts
web/src/stores/globalStateStore.ts
+0
-2
locationStore.ts
web/src/stores/locationStore.ts
+1
-1
location.d.ts
web/src/types/location.d.ts
+1
-1
yarn.lock
web/yarn.lock
+0
-5
No files found.
web/package.json
View file @
2b5ee783
...
@@ -10,8 +10,7 @@
...
@@ -10,8 +10,7 @@
"dependencies"
:
{
"dependencies"
:
{
"lodash-es"
:
"^4.17.21"
,
"lodash-es"
:
"^4.17.21"
,
"react"
:
"^17.0.2"
,
"react"
:
"^17.0.2"
,
"react-dom"
:
"^17.0.2"
,
"react-dom"
:
"^17.0.2"
"tiny-undo"
:
"^0.0.8"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/lodash-es"
:
"^4.17.5"
,
"@types/lodash-es"
:
"^4.17.5"
,
...
...
web/src/components/Editor/Editor.tsx
View file @
2b5ee783
import
{
forwardRef
,
ReactNode
,
useCallback
,
useContext
,
useEffect
,
useImperativeHandle
,
useRef
}
from
"react"
;
import
{
forwardRef
,
ReactNode
,
useCallback
,
useEffect
,
useImperativeHandle
,
useRef
}
from
"react"
;
import
TinyUndo
from
"tiny-undo"
;
import
appContext
from
"../../stores/appContext"
;
import
{
storage
}
from
"../../helpers/storage"
;
import
useRefresh
from
"../../hooks/useRefresh"
;
import
useRefresh
from
"../../hooks/useRefresh"
;
import
Only
from
"../common/OnlyWhen"
;
import
Only
from
"../common/OnlyWhen"
;
import
"../../less/editor.less"
;
import
"../../less/editor.less"
;
...
@@ -28,9 +25,6 @@ interface EditorProps {
...
@@ -28,9 +25,6 @@ interface EditorProps {
// eslint-disable-next-line react/display-name
// eslint-disable-next-line react/display-name
const
Editor
=
forwardRef
((
props
:
EditorProps
,
ref
:
React
.
ForwardedRef
<
EditorRefActions
>
)
=>
{
const
Editor
=
forwardRef
((
props
:
EditorProps
,
ref
:
React
.
ForwardedRef
<
EditorRefActions
>
)
=>
{
const
{
globalState
:
{
useTinyUndoHistoryCache
},
}
=
useContext
(
appContext
);
const
{
const
{
className
,
className
,
initialContent
,
initialContent
,
...
@@ -42,59 +36,14 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
...
@@ -42,59 +36,14 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
onContentChange
:
handleContentChangeCallback
,
onContentChange
:
handleContentChangeCallback
,
}
=
props
;
}
=
props
;
const
editorRef
=
useRef
<
HTMLTextAreaElement
>
(
null
);
const
editorRef
=
useRef
<
HTMLTextAreaElement
>
(
null
);
const
tinyUndoRef
=
useRef
<
TinyUndo
|
null
>
(
null
);
// NOTE: auto-justify textarea height
const
refresh
=
useRefresh
();
const
refresh
=
useRefresh
();
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
editorRef
.
current
)
{
if
(
editorRef
.
current
&&
initialContent
)
{
return
;
}
if
(
initialContent
)
{
editorRef
.
current
.
value
=
initialContent
;
editorRef
.
current
.
value
=
initialContent
;
refresh
();
}
}
},
[]);
},
[]);
useEffect
(()
=>
{
if
(
useTinyUndoHistoryCache
)
{
if
(
!
editorRef
.
current
)
{
return
;
}
const
{
tinyUndoActionsCache
,
tinyUndoIndexCache
}
=
storage
.
get
([
"tinyUndoActionsCache"
,
"tinyUndoIndexCache"
]);
tinyUndoRef
.
current
=
new
TinyUndo
(
editorRef
.
current
,
{
interval
:
5000
,
initialActions
:
tinyUndoActionsCache
,
initialIndex
:
tinyUndoIndexCache
,
});
tinyUndoRef
.
current
.
subscribe
((
actions
,
index
)
=>
{
storage
.
set
({
tinyUndoActionsCache
:
actions
,
tinyUndoIndexCache
:
index
,
});
});
return
()
=>
{
tinyUndoRef
.
current
?.
destroy
();
};
}
else
{
tinyUndoRef
.
current
?.
destroy
();
tinyUndoRef
.
current
=
null
;
storage
.
remove
([
"tinyUndoActionsCache"
,
"tinyUndoIndexCache"
]);
}
},
[
useTinyUndoHistoryCache
]);
useEffect
(()
=>
{
if
(
editorRef
.
current
)
{
editorRef
.
current
.
style
.
height
=
"auto"
;
editorRef
.
current
.
style
.
height
=
(
editorRef
.
current
.
scrollHeight
??
0
)
+
"px"
;
}
},
[
editorRef
.
current
?.
value
]);
useImperativeHandle
(
useImperativeHandle
(
ref
,
ref
,
()
=>
({
()
=>
({
...
@@ -111,13 +60,11 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
...
@@ -111,13 +60,11 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
editorRef
.
current
.
value
=
editorRef
.
current
.
value
=
prevValue
.
slice
(
0
,
editorRef
.
current
.
selectionStart
)
+
rawText
+
prevValue
.
slice
(
editorRef
.
current
.
selectionStart
);
prevValue
.
slice
(
0
,
editorRef
.
current
.
selectionStart
)
+
rawText
+
prevValue
.
slice
(
editorRef
.
current
.
selectionStart
);
handleContentChangeCallback
(
editorRef
.
current
.
value
);
handleContentChangeCallback
(
editorRef
.
current
.
value
);
refresh
();
},
},
setContent
:
(
text
:
string
)
=>
{
setContent
:
(
text
:
string
)
=>
{
if
(
editorRef
.
current
)
{
if
(
editorRef
.
current
)
{
editorRef
.
current
.
value
=
text
;
editorRef
.
current
.
value
=
text
;
handleContentChangeCallback
(
editorRef
.
current
.
value
);
handleContentChangeCallback
(
editorRef
.
current
.
value
);
refresh
();
}
}
},
},
getContent
:
():
string
=>
{
getContent
:
():
string
=>
{
...
@@ -140,7 +87,6 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
...
@@ -140,7 +87,6 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
handleCommonConfirmBtnClick
();
handleCommonConfirmBtnClick
();
}
}
}
}
refresh
();
},
[]);
},
[]);
const
handleCommonConfirmBtnClick
=
useCallback
(()
=>
{
const
handleCommonConfirmBtnClick
=
useCallback
(()
=>
{
...
@@ -150,9 +96,6 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
...
@@ -150,9 +96,6 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
handleConfirmBtnClickCallback
(
editorRef
.
current
.
value
);
handleConfirmBtnClickCallback
(
editorRef
.
current
.
value
);
editorRef
.
current
.
value
=
""
;
editorRef
.
current
.
value
=
""
;
refresh
();
// After confirm btn clicked, tiny-undo should reset state(clear actions and index)
tinyUndoRef
.
current
?.
resetState
();
},
[]);
},
[]);
const
handleCommonCancelBtnClick
=
useCallback
(()
=>
{
const
handleCommonCancelBtnClick
=
useCallback
(()
=>
{
...
...
web/src/components/MemoEditor.tsx
View file @
2b5ee783
...
@@ -276,7 +276,7 @@ const MemoEditor: React.FC<Props> = () => {
...
@@ -276,7 +276,7 @@ const MemoEditor: React.FC<Props> = () => {
);
);
return
(
return
(
<
div
className=
{
"memo-editor-
wrapp
er "
+
(
showEditStatus
?
"edit-ing"
:
""
)
}
>
<
div
className=
{
"memo-editor-
contain
er "
+
(
showEditStatus
?
"edit-ing"
:
""
)
}
>
<
p
className=
{
"tip-text "
+
(
showEditStatus
?
""
:
"hidden"
)
}
>
Editting...
</
p
>
<
p
className=
{
"tip-text "
+
(
showEditStatus
?
""
:
"hidden"
)
}
>
Editting...
</
p
>
<
Editor
<
Editor
ref=
{
editorRef
}
ref=
{
editorRef
}
...
...
web/src/components/MemoList.tsx
View file @
2b5ee783
...
@@ -6,7 +6,7 @@ import utils from "../helpers/utils";
...
@@ -6,7 +6,7 @@ import utils from "../helpers/utils";
import
{
checkShouldShowMemoWithFilters
}
from
"../helpers/filter"
;
import
{
checkShouldShowMemoWithFilters
}
from
"../helpers/filter"
;
import
Memo
from
"./Memo"
;
import
Memo
from
"./Memo"
;
import
toastHelper
from
"./Toast"
;
import
toastHelper
from
"./Toast"
;
import
"../less/memolist.less"
;
import
"../less/memo
-
list.less"
;
interface
Props
{}
interface
Props
{}
...
@@ -105,7 +105,7 @@ const MemoList: React.FC<Props> = () => {
...
@@ -105,7 +105,7 @@ const MemoList: React.FC<Props> = () => {
}
, []);
}
, []);
return (
return (
<
div
className=
{
`memo
list-wrapp
er ${isFetching ? "" : "completed"}`
}
onClick=
{
handleMemoListClick
}
ref=
{
wrapperElement
}
>
<
div
className=
{
`memo
-list-contain
er ${isFetching ? "" : "completed"}`
}
onClick=
{
handleMemoListClick
}
ref=
{
wrapperElement
}
>
{
shownMemos
.
map
((
memo
)
=>
(
{
shownMemos
.
map
((
memo
)
=>
(
<
Memo
key=
{
`${memo.id}-${memo.updatedAt}`
}
memo=
{
memo
}
/>
<
Memo
key=
{
`${memo.id}-${memo.updatedAt}`
}
memo=
{
memo
}
/>
))
}
))
}
...
...
web/src/components/MenuBtnsPopup.tsx
View file @
2b5ee783
...
@@ -33,7 +33,7 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
...
@@ -33,7 +33,7 @@ const MenuBtnsPopup: React.FC<Props> = (props: Props) => {
};
};
const
handleMemosTrashBtnClick
=
()
=>
{
const
handleMemosTrashBtnClick
=
()
=>
{
locationService
.
pushHistory
(
"/
recycle
"
);
locationService
.
pushHistory
(
"/
trash
"
);
};
};
const
handleAboutBtnClick
=
()
=>
{
const
handleAboutBtnClick
=
()
=>
{
...
...
web/src/components/PreferencesSection.tsx
View file @
2b5ee783
...
@@ -9,16 +9,10 @@ interface Props {}
...
@@ -9,16 +9,10 @@ interface Props {}
const
PreferencesSection
:
React
.
FC
<
Props
>
=
()
=>
{
const
PreferencesSection
:
React
.
FC
<
Props
>
=
()
=>
{
const
{
globalState
}
=
useContext
(
appContext
);
const
{
globalState
}
=
useContext
(
appContext
);
const
{
useTinyUndoHistoryCache
,
shouldHideImageUrl
,
shouldSplitMemoWord
,
shouldUseMarkdownParser
}
=
globalState
;
const
{
shouldHideImageUrl
,
shouldSplitMemoWord
,
shouldUseMarkdownParser
}
=
globalState
;
const
demoMemoContent
=
"👋 Hiya, welcome to memos!
\n
* ✨ **Open source project**;
\n
* 😋 What do you think;
\n
* 📑 Tell me something plz;"
;
const
demoMemoContent
=
"👋 Hiya, welcome to memos!
\n
* ✨ **Open source project**;
\n
* 😋 What do you think;
\n
* 📑 Tell me something plz;"
;
const
handleOpenTinyUndoChanged
=
()
=>
{
globalStateService
.
setAppSetting
({
useTinyUndoHistoryCache
:
!
useTinyUndoHistoryCache
,
});
};
const
handleSplitWordsValueChanged
=
()
=>
{
const
handleSplitWordsValueChanged
=
()
=>
{
globalStateService
.
setAppSetting
({
globalStateService
.
setAppSetting
({
shouldSplitMemoWord
:
!
shouldSplitMemoWord
,
shouldSplitMemoWord
:
!
shouldSplitMemoWord
,
...
@@ -83,18 +77,6 @@ const PreferencesSection: React.FC<Props> = () => {
...
@@ -83,18 +77,6 @@ const PreferencesSection: React.FC<Props> = () => {
<
img
className=
"icon-img"
src=
{
shouldHideImageUrl
?
"/icons/checkbox-active.svg"
:
"/icons/checkbox.svg"
}
/>
<
img
className=
"icon-img"
src=
{
shouldHideImageUrl
?
"/icons/checkbox-active.svg"
:
"/icons/checkbox.svg"
}
/>
</
label
>
</
label
>
</
div
>
</
div
>
<
div
className=
"section-container preferences-section-container"
>
<
p
className=
"title-text"
>
Editor Extensions
</
p
>
<
label
className=
"form-label checkbox-form-label"
onClick=
{
handleOpenTinyUndoChanged
}
>
<
span
className=
"normal-text"
>
Use
{
" "
}
<
a
target=
"_blank"
href=
"https://github.com/boojack/tiny-undo"
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
rel=
"noreferrer"
>
tiny-undo
</
a
>
</
span
>
<
img
className=
"icon-img"
src=
{
useTinyUndoHistoryCache
?
"/icons/checkbox-active.svg"
:
"/icons/checkbox.svg"
}
/>
</
label
>
</
div
>
<
div
className=
"section-container"
>
<
div
className=
"section-container"
>
<
p
className=
"title-text"
>
Others
</
p
>
<
p
className=
"title-text"
>
Others
</
p
>
<
div
className=
"w-full flex flex-row justify-start items-center"
>
<
div
className=
"w-full flex flex-row justify-start items-center"
>
...
...
web/src/components/ShortcutList.tsx
View file @
2b5ee783
...
@@ -67,11 +67,14 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
...
@@ -67,11 +67,14 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
const
{
shortcut
,
isActive
}
=
props
;
const
{
shortcut
,
isActive
}
=
props
;
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
handleQueryClick
=
()
=>
{
console
.
log
(
props
);
const
handleShortcutClick
=
()
=>
{
console
.
log
(
"here"
);
if
(
isActive
)
{
if
(
isActive
)
{
locationService
.
setMemoShortcut
(
""
);
locationService
.
setMemoShortcut
(
""
);
}
else
{
}
else
{
if
(
!
[
"/"
,
"/
recycle
"
].
includes
(
locationService
.
getState
().
pathname
))
{
if
(
!
[
"/"
,
"/
trash
"
].
includes
(
locationService
.
getState
().
pathname
))
{
locationService
.
setPathname
(
"/"
);
locationService
.
setPathname
(
"/"
);
}
}
locationService
.
setMemoShortcut
(
shortcut
.
id
);
locationService
.
setMemoShortcut
(
shortcut
.
id
);
...
@@ -125,7 +128,7 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
...
@@ -125,7 +128,7 @@ const ShortcutContainer: React.FC<ShortcutContainerProps> = (props: ShortcutCont
return
(
return
(
<>
<>
<
div
className=
{
`shortcut-container ${isActive ? "active" : ""}`
}
onClick=
{
handle
Query
Click
}
>
<
div
className=
{
`shortcut-container ${isActive ? "active" : ""}`
}
onClick=
{
handle
Shortcut
Click
}
>
<
div
className=
"shortcut-text-container"
>
<
div
className=
"shortcut-text-container"
>
<
span
className=
"icon-text"
>
#
</
span
>
<
span
className=
"icon-text"
>
#
</
span
>
<
span
className=
"shortcut-text"
>
{
shortcut
.
title
}
</
span
>
<
span
className=
"shortcut-text"
>
{
shortcut
.
title
}
</
span
>
...
...
web/src/components/Sidebar.tsx
View file @
2b5ee783
import
{
useRef
}
from
"react"
;
import
{
useRef
}
from
"react"
;
import
UserBanner
from
"./UserBanner"
;
import
UserBanner
from
"./UserBanner"
;
import
ShortcutList
from
"./ShortcutList"
;
import
ShortcutList
from
"./ShortcutList"
;
import
TagList
from
"./TagList"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
import
UsageHeatMap
from
"./UsageHeatMap"
;
import
"../less/siderbar.less"
;
import
"../less/siderbar.less"
;
...
@@ -15,7 +14,6 @@ const Sidebar: React.FC<Props> = () => {
...
@@ -15,7 +14,6 @@ const Sidebar: React.FC<Props> = () => {
<
UserBanner
/>
<
UserBanner
/>
<
UsageHeatMap
/>
<
UsageHeatMap
/>
<
ShortcutList
/>
<
ShortcutList
/>
<
TagList
/>
</
aside
>
</
aside
>
);
);
};
};
...
...
web/src/components/TagList.tsx
View file @
2b5ee783
...
@@ -101,7 +101,7 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
...
@@ -101,7 +101,7 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
locationService
.
setTagQuery
(
""
);
locationService
.
setTagQuery
(
""
);
}
else
{
}
else
{
utils
.
copyTextToClipboard
(
`#
${
tag
.
text
}
`
);
utils
.
copyTextToClipboard
(
`#
${
tag
.
text
}
`
);
if
(
!
[
"/"
,
"/
recycle
"
].
includes
(
locationService
.
getState
().
pathname
))
{
if
(
!
[
"/"
,
"/
trash
"
].
includes
(
locationService
.
getState
().
pathname
))
{
locationService
.
setPathname
(
"/"
);
locationService
.
setPathname
(
"/"
);
}
}
locationService
.
setTagQuery
(
tag
.
text
);
locationService
.
setTagQuery
(
tag
.
text
);
...
...
web/src/components/UsageHeatMap.tsx
View file @
2b5ee783
...
@@ -76,7 +76,7 @@ const UsageHeatMap: React.FC<Props> = () => {
...
@@ -76,7 +76,7 @@ const UsageHeatMap: React.FC<Props> = () => {
locationService
.
setFromAndToQuery
(
0
,
0
);
locationService
.
setFromAndToQuery
(
0
,
0
);
setCurrentStat
(
null
);
setCurrentStat
(
null
);
}
else
if
(
item
.
count
>
0
)
{
}
else
if
(
item
.
count
>
0
)
{
if
(
!
[
"/"
,
"/
recycle
"
].
includes
(
locationService
.
getState
().
pathname
))
{
if
(
!
[
"/"
,
"/
trash
"
].
includes
(
locationService
.
getState
().
pathname
))
{
locationService
.
setPathname
(
"/"
);
locationService
.
setPathname
(
"/"
);
}
}
locationService
.
setFromAndToQuery
(
item
.
timestamp
,
item
.
timestamp
+
DAILY_TIMESTAMP
);
locationService
.
setFromAndToQuery
(
item
.
timestamp
,
item
.
timestamp
+
DAILY_TIMESTAMP
);
...
...
web/src/helpers/storage.ts
View file @
2b5ee783
import
{
InputAction
}
from
"tiny-undo"
;
/**
/**
* Define storage data type
* Define storage data type
*/
*/
...
@@ -9,14 +7,6 @@ interface StorageData {
...
@@ -9,14 +7,6 @@ interface StorageData {
shouldSplitMemoWord
:
boolean
;
shouldSplitMemoWord
:
boolean
;
shouldHideImageUrl
:
boolean
;
shouldHideImageUrl
:
boolean
;
shouldUseMarkdownParser
:
boolean
;
shouldUseMarkdownParser
:
boolean
;
// Editor setting
useTinyUndoHistoryCache
:
boolean
;
// tiny undo actions cache
tinyUndoActionsCache
:
InputAction
[];
// tiny undo index cache
tinyUndoIndexCache
:
number
;
}
}
type
StorageKey
=
keyof
StorageData
;
type
StorageKey
=
keyof
StorageData
;
...
...
web/src/less/editor.less
View file @
2b5ee783
...
@@ -2,18 +2,10 @@
...
@@ -2,18 +2,10 @@
.common-editor-wrapper {
.common-editor-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
position: relative;
@apply relative w-full h-full bg-white grow;
width: 100%;
height: auto;
background-color: white;
> .common-editor-inputer {
> .common-editor-inputer {
display: inline-block;
@apply w-full h-full pt-1 pb-3 grow;
width: 100%;
padding-top: 4px;
padding-bottom: 12px;
min-height: 40px;
max-height: 300px;
font-size: 15px;
font-size: 15px;
line-height: 24px;
line-height: 24px;
resize: none;
resize: none;
...
@@ -22,7 +14,6 @@
...
@@ -22,7 +14,6 @@
background-color: transparent;
background-color: transparent;
z-index: 1;
z-index: 1;
white-space: pre-wrap;
white-space: pre-wrap;
.hide-scroll-bar();
&::placeholder {
&::placeholder {
padding-left: 2px;
padding-left: 2px;
...
...
web/src/less/global.less
View file @
2b5ee783
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
body,
body,
html {
html {
@apply w-
full h-full
overflow-hidden text-base;
@apply w-
screen h-screen
overflow-hidden text-base;
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei",
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei",
"WenQuanYi Micro Hei", sans-serif, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"WenQuanYi Micro Hei", sans-serif, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
"Noto Color Emoji";
...
...
web/src/less/home.less
View file @
2b5ee783
...
@@ -6,10 +6,5 @@
...
@@ -6,10 +6,5 @@
#page-wrapper {
#page-wrapper {
.flex(row, flex-start, flex-start);
.flex(row, flex-start, flex-start);
@apply w-full max-w-4xl h-full m-auto -translate-x-4;
@apply w-full h-full m-auto;
> .content-wrapper {
.flex(column, flex-start, flex-start);
@apply relative flex-grow h-auto;
}
}
}
web/src/less/memo-editor.less
View file @
2b5ee783
@import "./mixin.less";
@import "./mixin.less";
.memo-editor-wrapper {
.memo-editor-container {
.flex(column, flex-start, flex-start);
@apply relative w-full h-96 max-h-full flex flex-col justify-start items-start grow bg-white p-4 rounded-lg border-2 border-gray-200;
position: relative;
width: 100%;
height: auto;
background-color: white;
padding: 16px;
border-radius: 8px;
border: 2px solid @bg-gray;
&.edit-ing {
&.edit-ing {
border-color: @text-blue;
border-color: @text-blue;
...
...
web/src/less/memo-filter.less
View file @
2b5ee783
...
@@ -2,34 +2,18 @@
...
@@ -2,34 +2,18 @@
.filter-query-container {
.filter-query-container {
.flex(row, flex-start, flex-start);
.flex(row, flex-start, flex-start);
width: 100%;
@apply w-full flex-wrap p-3 pb-1 text-sm leading-7;
flex-wrap: wrap;
padding: 12px 12px;
padding-bottom: 4px;
font-size: 13px;
line-height: 1.8;
> .tip-text {
> .tip-text {
padding: 2px 0
;
@apply mr-2
;
}
}
> .filter-item-container {
> .filter-item-container {
padding: 2px 8px;
@apply px-2 mr-2 cursor-pointer bg-gray-200 rounded whitespace-nowrap truncate hover:line-through;
margin-right: 6px;
cursor: pointer;
background-color: @bg-gray;
border-radius: 4px;
max-width: 200px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
> .icon-text {
> .icon-text {
letter-spacing: 2px;
letter-spacing: 2px;
}
}
&:hover {
text-decoration: line-through;
}
}
}
}
}
web/src/less/memolist.less
→
web/src/less/memo
-
list.less
View file @
2b5ee783
@import "./mixin.less";
@import "./mixin.less";
.memo
list-wrapp
er {
.memo
-list-contain
er {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
flex-grow: 1;
flex-grow: 1;
width: 100%;
width: 100%;
...
...
web/src/less/memo-trash.less
View file @
2b5ee783
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
@import "./memos-header.less";
@import "./memos-header.less";
.memo-trash-wrapper {
.memo-trash-wrapper {
@apply px-8;
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
width: 100%;
width: 100%;
height: 100%;
height: 100%;
...
...
web/src/less/memo.less
View file @
2b5ee783
...
@@ -3,16 +3,7 @@
...
@@ -3,16 +3,7 @@
.memo-wrapper {
.memo-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
width: 100%;
@apply w-full p-4 px-6 mt-2 bg-white rounded-lg border border-transparent hover:border-gray-200;
padding: 12px 18px;
background-color: white;
margin-top: 8px;
border-radius: 8px;
border: 1px solid transparent;
&:hover {
border-color: @bg-gray;
}
> .memo-top-wrapper {
> .memo-top-wrapper {
.flex(row, space-between, center);
.flex(row, space-between, center);
...
@@ -21,10 +12,8 @@
...
@@ -21,10 +12,8 @@
margin-bottom: 4px;
margin-bottom: 4px;
> .time-text {
> .time-text {
font-size: 12px;
@apply text-xs;
line-height: 24px;
color: gray;
color: gray;
flex-shrink: 0;
cursor: pointer;
cursor: pointer;
}
}
...
@@ -114,7 +103,7 @@
...
@@ -114,7 +103,7 @@
}
}
> .memo-content-text {
> .memo-content-text {
width: 100%
;
@apply w-full
;
}
}
> .images-wrapper {
> .images-wrapper {
...
...
web/src/less/memos.less
0 → 100644
View file @
2b5ee783
@import "./mixin.less";
@import "./memos-header.less";
.memos-wrapper {
.flex(row, flex-start, flex-start);
@apply w-auto h-full grow;
> .memo-editor-wrapper {
@apply w-96 h-full shrink-0 py-16 px-8 bg-white;
}
> .memo-list-wrapper {
@apply w-auto h-full grow px-16 flex flex-col justify-start items-start;
}
}
web/src/less/search-bar.less
View file @
2b5ee783
@import "./mixin.less";
@import "./mixin.less";
.search-bar-container {
.search-bar-container {
width: 160px
;
@apply relative w-40
;
> .search-bar-inputer {
> .search-bar-inputer {
.flex(row, flex-start, center);
.flex(row, flex-start, center);
...
@@ -30,13 +30,8 @@
...
@@ -30,13 +30,8 @@
}
}
> .quickly-action-wrapper {
> .quickly-action-wrapper {
display: none;
@apply hidden absolute top-9 -right-2 p-2 w-80;
position: absolute;
top: 52px;
right: -8px;
z-index: 2;
z-index: 2;
padding: 8px;
width: 320px;
> .quickly-action-container {
> .quickly-action-container {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
...
...
web/src/less/setting.less
View file @
2b5ee783
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
.preference-wrapper {
.preference-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
@apply w-full h-full grow overflow-y-scroll;
@apply w-full h-full grow overflow-y-scroll
px-8
;
.hide-scroll-bar();
.hide-scroll-bar();
> .section-header-container {
> .section-header-container {
...
...
web/src/less/siderbar.less
View file @
2b5ee783
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.sidebar-wrapper {
.sidebar-wrapper {
.flex(column, flex-start, flex-start);
.flex(column, flex-start, flex-start);
@apply w-60 h-
auto
py-4 overflow-x-hidden overflow-y-auto shrink-0;
@apply w-60 h-
full
py-4 overflow-x-hidden overflow-y-auto shrink-0;
.hide-scroll-bar();
.hide-scroll-bar();
> * {
> * {
...
...
web/src/pages/Home.tsx
View file @
2b5ee783
...
@@ -37,7 +37,7 @@ function Home() {
...
@@ -37,7 +37,7 @@ function Home() {
{
loadingState
.
isLoading
?
null
:
(
{
loadingState
.
isLoading
?
null
:
(
<
section
id=
"page-wrapper"
>
<
section
id=
"page-wrapper"
>
<
Sidebar
/>
<
Sidebar
/>
<
main
className=
"content-wrapper"
>
{
homeRouterSwitch
(
pathname
)
}
</
main
>
{
homeRouterSwitch
(
pathname
)
}
</
section
>
</
section
>
)
}
)
}
</>
</>
...
...
web/src/pages/Memos.tsx
View file @
2b5ee783
...
@@ -2,15 +2,20 @@ import MemoEditor from "../components/MemoEditor";
...
@@ -2,15 +2,20 @@ import MemoEditor from "../components/MemoEditor";
import
MemosHeader
from
"../components/MemosHeader"
;
import
MemosHeader
from
"../components/MemosHeader"
;
import
MemoFilter
from
"../components/MemoFilter"
;
import
MemoFilter
from
"../components/MemoFilter"
;
import
MemoList
from
"../components/MemoList"
;
import
MemoList
from
"../components/MemoList"
;
import
"../less/memos.less"
;
function
Memos
()
{
function
Memos
()
{
return
(
return
(
<>
<
main
className=
"memos-wrapper"
>
<
MemosHeader
/
>
<
div
className=
"memo-editor-wrapper"
>
<
MemoEditor
/>
<
MemoEditor
/>
</
div
>
<
div
className=
"memo-list-wrapper"
>
<
MemosHeader
/>
<
MemoFilter
/>
<
MemoFilter
/>
<
MemoList
/>
<
MemoList
/>
</>
</
div
>
</
main
>
);
);
}
}
...
...
web/src/pages/
Memo
Trash.tsx
→
web/src/pages/Trash.tsx
View file @
2b5ee783
...
@@ -12,7 +12,7 @@ import "../less/memo-trash.less";
...
@@ -12,7 +12,7 @@ import "../less/memo-trash.less";
interface
Props
{}
interface
Props
{}
const
Memo
Trash
:
React
.
FC
<
Props
>
=
()
=>
{
const
Trash
:
React
.
FC
<
Props
>
=
()
=>
{
const
{
const
{
locationState
:
{
query
},
locationState
:
{
query
},
}
=
useContext
(
appContext
);
}
=
useContext
(
appContext
);
...
@@ -126,4 +126,4 @@ const MemoTrash: React.FC<Props> = () => {
...
@@ -126,4 +126,4 @@ const MemoTrash: React.FC<Props> = () => {
);
);
};
};
export default
Memo
Trash;
export default Trash;
web/src/routers/homeRouter.tsx
View file @
2b5ee783
import
Memos
from
"../pages/Memos"
;
import
Memos
from
"../pages/Memos"
;
import
MemoTrash
from
"../pages/Memo
Trash"
;
import
Trash
from
"../pages/
Trash"
;
import
Setting
from
"../pages/Setting"
;
import
Setting
from
"../pages/Setting"
;
const
homeRouter
=
{
const
homeRouter
=
{
"/
recycle"
:
<
Memo
Trash
/>
,
"/
trash"
:
<
Trash
/>
,
"/setting"
:
<
Setting
/>
,
"/setting"
:
<
Setting
/>
,
"*"
:
<
Memos
/>
,
"*"
:
<
Memos
/>
,
};
};
...
...
web/src/services/globalStateService.ts
View file @
2b5ee783
...
@@ -4,12 +4,11 @@ import { AppSetting } from "../stores/globalStateStore";
...
@@ -4,12 +4,11 @@ import { AppSetting } from "../stores/globalStateStore";
class
GlobalStateService
{
class
GlobalStateService
{
constructor
()
{
constructor
()
{
const
cachedSetting
=
storage
.
get
([
"shouldSplitMemoWord"
,
"shouldHideImageUrl"
,
"shouldUseMarkdownParser"
,
"useTinyUndoHistoryCache"
]);
const
cachedSetting
=
storage
.
get
([
"shouldSplitMemoWord"
,
"shouldHideImageUrl"
,
"shouldUseMarkdownParser"
]);
const
defaultAppSetting
=
{
const
defaultAppSetting
=
{
shouldSplitMemoWord
:
cachedSetting
.
shouldSplitMemoWord
??
true
,
shouldSplitMemoWord
:
cachedSetting
.
shouldSplitMemoWord
??
true
,
shouldHideImageUrl
:
cachedSetting
.
shouldHideImageUrl
??
true
,
shouldHideImageUrl
:
cachedSetting
.
shouldHideImageUrl
??
true
,
shouldUseMarkdownParser
:
cachedSetting
.
shouldUseMarkdownParser
??
true
,
shouldUseMarkdownParser
:
cachedSetting
.
shouldUseMarkdownParser
??
true
,
useTinyUndoHistoryCache
:
cachedSetting
.
useTinyUndoHistoryCache
??
false
,
};
};
this
.
setAppSetting
(
defaultAppSetting
);
this
.
setAppSetting
(
defaultAppSetting
);
...
...
web/src/services/locationService.ts
View file @
2b5ee783
...
@@ -185,7 +185,7 @@ class LocationService {
...
@@ -185,7 +185,7 @@ class LocationService {
};
};
public
getValidPathname
=
(
pathname
:
string
):
AppRouter
=>
{
public
getValidPathname
=
(
pathname
:
string
):
AppRouter
=>
{
if
([
"/"
,
"/signin"
,
"/
recycle
"
,
"/setting"
].
includes
(
pathname
))
{
if
([
"/"
,
"/signin"
,
"/
trash
"
,
"/setting"
].
includes
(
pathname
))
{
return
pathname
as
AppRouter
;
return
pathname
as
AppRouter
;
}
else
{
}
else
{
return
"/"
;
return
"/"
;
...
...
web/src/services/shortcutService.ts
View file @
2b5ee783
...
@@ -82,6 +82,7 @@ class ShortcutService {
...
@@ -82,6 +82,7 @@ class ShortcutService {
public
convertResponseModelShortcut
(
shortcut
:
Model
.
Shortcut
):
Model
.
Shortcut
{
public
convertResponseModelShortcut
(
shortcut
:
Model
.
Shortcut
):
Model
.
Shortcut
{
return
{
return
{
...
shortcut
,
...
shortcut
,
id
:
String
(
shortcut
.
id
),
createdAt
:
utils
.
getDataStringWithTs
(
shortcut
.
createdTs
),
createdAt
:
utils
.
getDataStringWithTs
(
shortcut
.
createdTs
),
updatedAt
:
utils
.
getDataStringWithTs
(
shortcut
.
updatedTs
),
updatedAt
:
utils
.
getDataStringWithTs
(
shortcut
.
updatedTs
),
};
};
...
...
web/src/stores/globalStateStore.ts
View file @
2b5ee783
...
@@ -2,7 +2,6 @@ export interface AppSetting {
...
@@ -2,7 +2,6 @@ export interface AppSetting {
shouldSplitMemoWord
:
boolean
;
shouldSplitMemoWord
:
boolean
;
shouldHideImageUrl
:
boolean
;
shouldHideImageUrl
:
boolean
;
shouldUseMarkdownParser
:
boolean
;
shouldUseMarkdownParser
:
boolean
;
useTinyUndoHistoryCache
:
boolean
;
}
}
export
interface
State
extends
AppSetting
{
export
interface
State
extends
AppSetting
{
...
@@ -71,5 +70,4 @@ export const defaultState: State = {
...
@@ -71,5 +70,4 @@ export const defaultState: State = {
shouldSplitMemoWord
:
true
,
shouldSplitMemoWord
:
true
,
shouldHideImageUrl
:
true
,
shouldHideImageUrl
:
true
,
shouldUseMarkdownParser
:
true
,
shouldUseMarkdownParser
:
true
,
useTinyUndoHistoryCache
:
false
,
};
};
web/src/stores/locationStore.ts
View file @
2b5ee783
...
@@ -165,7 +165,7 @@ export function reducer(state: State, action: Actions) {
...
@@ -165,7 +165,7 @@ export function reducer(state: State, action: Actions) {
...
state
,
...
state
,
query
:
{
query
:
{
...
state
.
query
,
...
state
.
query
,
filter
:
action
.
payload
,
shortcutId
:
action
.
payload
,
},
},
};
};
}
}
...
...
web/src/types/location.d.ts
View file @
2b5ee783
...
@@ -11,7 +11,7 @@ interface Query {
...
@@ -11,7 +11,7 @@ interface Query {
shortcutId
:
string
;
shortcutId
:
string
;
}
}
type
AppRouter
=
"/"
|
"/signin"
|
"/
recycle
"
|
"/setting"
;
type
AppRouter
=
"/"
|
"/signin"
|
"/
trash
"
|
"/setting"
;
interface
AppLocation
{
interface
AppLocation
{
pathname
:
AppRouter
;
pathname
:
AppRouter
;
...
...
web/yarn.lock
View file @
2b5ee783
...
@@ -2294,11 +2294,6 @@ text-table@^0.2.0:
...
@@ -2294,11 +2294,6 @@ text-table@^0.2.0:
resolved "https://registry.nlark.com/text-table/download/text-table-0.2.0.tgz?cache=0&sync_timestamp=1618846790938&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftext-table%2Fdownload%2Ftext-table-0.2.0.tgz"
resolved "https://registry.nlark.com/text-table/download/text-table-0.2.0.tgz?cache=0&sync_timestamp=1618846790938&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftext-table%2Fdownload%2Ftext-table-0.2.0.tgz"
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
tiny-undo@^0.0.8:
version "0.0.8"
resolved "https://registry.npmjs.org/tiny-undo/-/tiny-undo-0.0.8.tgz"
integrity sha512-x/zUWVVoehq0TTLTLngUCvg41bssl5OYloNOE6sRz/2fsEetB87zpj4kEZyrmvzI3Rsq+t9olujqXprlu+lbvw==
to-fast-properties@^2.0.0:
to-fast-properties@^2.0.0:
version "2.0.0"
version "2.0.0"
resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz"
resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz"
...
...
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