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
7cd474db
Unverified
Commit
7cd474db
authored
Feb 07, 2023
by
Zeng1998
Committed by
GitHub
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add setting for double-click of memos (#1036)
* feat: add setting for double-click of memos * update * update
parent
9bf86976
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
0 deletions
+17
-0
Memo.tsx
web/src/components/Memo.tsx
+4
-0
PreferencesSection.tsx
web/src/components/Settings/PreferencesSection.tsx
+9
-0
en.json
web/src/locales/en.json
+1
-0
zh.json
web/src/locales/zh.json
+1
-0
user.ts
web/src/store/module/user.ts
+1
-0
setting.d.ts
web/src/types/modules/setting.d.ts
+1
-0
No files found.
web/src/components/Memo.tsx
View file @
7cd474db
...
...
@@ -34,6 +34,7 @@ const Memo: React.FC<Props> = (props: Props) => {
const
locationStore
=
useLocationStore
();
const
userStore
=
useUserStore
();
const
memoStore
=
useMemoStore
();
const
{
localSetting
}
=
userStore
.
state
.
user
as
User
;
const
[
displayTimeStr
,
setDisplayTimeStr
]
=
useState
<
string
>
(
getFormatedMemoTimeStr
(
memo
.
displayTs
,
i18n
.
language
));
const
memoContainerRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
isVisitorMode
=
userStore
.
isVisitorMode
();
...
...
@@ -151,6 +152,9 @@ const Memo: React.FC<Props> = (props: Props) => {
};
const
handleMemoContentDoubleClick
=
(
e
:
React
.
MouseEvent
)
=>
{
if
(
!
localSetting
.
enableDoubleClickEditing
)
{
return
;
}
const
targetEl
=
e
.
target
as
HTMLElement
;
if
(
targetEl
.
className
===
"tag-span"
)
{
...
...
web/src/components/Settings/PreferencesSection.tsx
View file @
7cd474db
...
...
@@ -5,6 +5,7 @@ import { VISIBILITY_SELECTOR_ITEMS, MEMO_DISPLAY_TS_OPTION_SELECTOR_ITEMS } from
import
AppearanceSelect
from
"../AppearanceSelect"
;
import
LocaleSelect
from
"../LocaleSelect"
;
import
"../../less/settings/preferences-section.less"
;
import
React
from
"react"
;
const
PreferencesSection
=
()
=>
{
const
{
t
}
=
useTranslation
();
...
...
@@ -52,6 +53,10 @@ const PreferencesSection = () => {
userStore
.
upsertLocalSetting
({
...
localSetting
,
enablePowerfulEditor
:
event
.
target
.
checked
});
};
const
handleDoubleClickEnabledChanged
=
(
event
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
userStore
.
upsertLocalSetting
({
...
localSetting
,
enableDoubleClickEditing
:
event
.
target
.
checked
});
};
return
(
<
div
className=
"section-container preferences-section-container"
>
<
p
className=
"title-text"
>
{
t
(
"common.basic"
)
}
</
p
>
...
...
@@ -108,6 +113,10 @@ const PreferencesSection = () => {
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.enable-powerful-editor"
)
}
</
span
>
<
Switch
className=
"ml-2"
checked=
{
localSetting
.
enablePowerfulEditor
}
onChange=
{
handlePowerfulEditorEnabledChanged
}
/>
</
label
>
<
label
className=
"form-label selector"
>
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.enable-double-click"
)
}
</
span
>
<
Switch
className=
"ml-2"
checked=
{
localSetting
.
enableDoubleClickEditing
}
onChange=
{
handleDoubleClickEnabledChanged
}
/>
</
label
>
</
div
>
);
};
...
...
web/src/locales/en.json
View file @
7cd474db
...
...
@@ -162,6 +162,7 @@
"default-memo-visibility"
:
"Default memo visibility"
,
"enable-folding-memo"
:
"Enable folding memo"
,
"enable-powerful-editor"
:
"Enable powerful editor"
,
"enable-double-click"
:
"Enable double-click to edit"
,
"editor-font-style"
:
"Editor font style"
,
"mobile-editor-style"
:
"Mobile editor style"
,
"default-memo-sort-option"
:
"Memo display time"
,
...
...
web/src/locales/zh.json
View file @
7cd474db
...
...
@@ -162,6 +162,7 @@
"default-memo-visibility"
:
"默认 Memo 可见性"
,
"enable-folding-memo"
:
"开启折叠 Memo"
,
"enable-powerful-editor"
:
"开启编辑器自动补全"
,
"enable-double-click"
:
"开启双击编辑"
,
"editor-font-style"
:
"编辑器字体样式"
,
"mobile-editor-style"
:
"移动端编辑器样式"
,
"default-memo-sort-option"
:
"Memo 显示时间"
,
...
...
web/src/store/module/user.ts
View file @
7cd474db
...
...
@@ -16,6 +16,7 @@ const defaultSetting: Setting = {
const
defaultLocalSetting
:
LocalSetting
=
{
enableFoldMemo
:
true
,
enablePowerfulEditor
:
true
,
enableDoubleClickEditing
:
true
,
};
export
const
convertResponseModelUser
=
(
user
:
User
):
User
=>
{
...
...
web/src/types/modules/setting.d.ts
View file @
7cd474db
...
...
@@ -10,6 +10,7 @@ interface Setting {
interface
LocalSetting
{
enableFoldMemo
:
boolean
;
enablePowerfulEditor
:
boolean
;
enableDoubleClickEditing
:
boolean
;
}
interface
UserLocaleSetting
{
...
...
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