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
017bbfa6
Commit
017bbfa6
authored
Feb 05, 2022
by
email
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add lodash-es package
parent
ef803483
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
17 deletions
+27
-17
package.json
web/package.json
+2
-0
Editor.tsx
web/src/components/Editor/Editor.tsx
+1
-1
Memo.tsx
web/src/components/Memo.tsx
+3
-2
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+0
-5
marked.ts
web/src/helpers/marked.ts
+1
-7
Signin.tsx
web/src/pages/Signin.tsx
+1
-1
vite.config.ts
web/vite.config.ts
+2
-1
yarn.lock
web/yarn.lock
+17
-0
No files found.
web/package.json
View file @
017bbfa6
...
...
@@ -8,11 +8,13 @@
"lint"
:
"eslint --ext .js,.ts,.tsx, src"
},
"dependencies"
:
{
"lodash-es"
:
"^4.17.21"
,
"react"
:
"^17.0.2"
,
"react-dom"
:
"^17.0.2"
,
"tiny-undo"
:
"^0.0.8"
},
"devDependencies"
:
{
"@types/lodash-es"
:
"^4.17.5"
,
"@types/react"
:
"^17.0.2"
,
"@types/react-dom"
:
"^17.0.2"
,
"@typescript-eslint/eslint-plugin"
:
"^5.6.0"
,
...
...
web/src/components/Editor/Editor.tsx
View file @
017bbfa6
...
...
@@ -180,7 +180,7 @@ const Editor = forwardRef((props: EditorProps, ref: React.ForwardedRef<EditorRef
</
button
>
</
Only
>
<
Only
when=
{
showConfirmBtn
}
>
<
button
className=
"action-btn confirm-btn"
disabled=
{
!
editorRef
.
current
?.
value
}
onClick=
{
handleCommonConfirmBtnClick
}
>
<
button
className=
"action-btn confirm-btn"
disabled=
{
editorRef
.
current
?.
value
===
""
}
onClick=
{
handleCommonConfirmBtnClick
}
>
Save
<
span
className=
"icon-text"
>
✍️
</
span
>
</
button
>
</
Only
>
...
...
web/src/components/Memo.tsx
View file @
017bbfa6
import
{
memo
}
from
"react"
;
import
{
escape
}
from
"lodash-es"
;
import
{
IMAGE_URL_REG
,
LINK_REG
,
MEMO_LINK_REG
,
TAG_REG
}
from
"../helpers/consts"
;
import
{
encodeHtml
,
parseMarkedToHtml
,
parseRawTextToHtml
}
from
"../helpers/marked"
;
import
{
parseMarkedToHtml
,
parseRawTextToHtml
}
from
"../helpers/marked"
;
import
utils
from
"../helpers/utils"
;
import
useToggle
from
"../hooks/useToggle"
;
import
{
globalStateService
,
memoService
}
from
"../services"
;
...
...
@@ -128,7 +129,7 @@ const Memo: React.FC<Props> = (props: Props) => {
};
export
function
formatMemoContent
(
content
:
string
)
{
content
=
e
ncodeHtml
(
content
);
content
=
e
scape
(
content
);
content
=
parseRawTextToHtml
(
content
)
.
split
(
"<br>"
)
.
map
((
t
)
=>
{
...
...
web/src/components/MemoEditor.tsx
View file @
017bbfa6
...
...
@@ -175,11 +175,6 @@ const MemoEditor: React.FC<Props> = () => {
},
[]);
const
handleContentChange
=
useCallback
((
content
:
string
)
=>
{
const
tempDiv
=
document
.
createElement
(
"div"
);
tempDiv
.
innerHTML
=
content
;
if
(
tempDiv
.
innerText
.
trim
()
===
""
)
{
content
=
""
;
}
setEditorContentCache
(
content
);
if
(
editorRef
.
current
)
{
...
...
web/src/helpers/marked.ts
View file @
017bbfa6
...
...
@@ -39,10 +39,4 @@ const parseRawTextToHtml = (rawTextStr: string): string => {
return
htmlText
;
};
const
encodeHtml
=
(
htmlStr
:
string
):
string
=>
{
const
t
=
document
.
createElement
(
"div"
);
t
.
textContent
=
htmlStr
;
return
t
.
innerHTML
;
};
export
{
encodeHtml
,
parseMarkedToHtml
,
parseHtmlToRawText
,
parseRawTextToHtml
};
export
{
parseMarkedToHtml
,
parseHtmlToRawText
,
parseRawTextToHtml
};
web/src/pages/Signin.tsx
View file @
017bbfa6
...
...
@@ -121,7 +121,7 @@ const Signin: React.FC<Props> = () => {
<
div
className=
"page-container"
>
<
div
className=
"page-header-container"
>
<
p
className=
"title-text"
>
Login to Memos
<
span
className=
"icon-text"
>
✍️
</
span
>
<
span
className=
"icon-text"
>
✍️
</
span
>
Memos
</
p
>
</
div
>
{
showAutoSigninAsGuest
?
(
...
...
web/vite.config.ts
View file @
017bbfa6
...
...
@@ -13,7 +13,8 @@ export default defineConfig({
changeOrigin
:
true
,
},
"/h/"
:
{
target
:
"https://memos.justsven.top/"
,
target
:
"http://localhost:8080/"
,
// target: "https://memos.justsven.top/",
changeOrigin
:
true
,
},
},
...
...
web/yarn.lock
View file @
017bbfa6
...
...
@@ -336,6 +336,18 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz"
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
"@types/lodash-es@^4.17.5":
version "4.17.5"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.5.tgz#1c3fdd16849d84aea43890b1c60da379fb501353"
integrity sha512-SHBoI8/0aoMQWAgUHMQ599VM6ZiSKg8sh/0cFqqlQQMyY9uEplc0ULU5yQNzcvdR4ZKa0ey8+vFmahuRbOCT1A==
dependencies:
"@types/lodash" "*"
"@types/lodash@*":
version "4.14.178"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8"
integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
...
...
@@ -1645,6 +1657,11 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.npm.taobao.org/lodash.merge/download/lodash.merge-4.6.2.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