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
db93710f
Unverified
Commit
db93710f
authored
Nov 12, 2022
by
boojack
Committed by
GitHub
Nov 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove mobile editor style user setting (#455)
parent
241c93c6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 addition
and
70 deletions
+1
-70
user_setting.go
api/user_setting.go
+0
-22
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+1
-2
PreferencesSection.tsx
web/src/components/Settings/PreferencesSection.tsx
+0
-24
memo-editor.less
web/src/less/memo-editor.less
+0
-20
userService.ts
web/src/services/userService.ts
+0
-1
setting.d.ts
web/src/types/modules/setting.d.ts
+0
-1
No files found.
api/user_setting.go
View file @
db93710f
...
@@ -12,8 +12,6 @@ const (
...
@@ -12,8 +12,6 @@ const (
UserSettingLocaleKey
UserSettingKey
=
"locale"
UserSettingLocaleKey
UserSettingKey
=
"locale"
// UserSettingMemoVisibilityKey is the key type for user preference memo default visibility.
// UserSettingMemoVisibilityKey is the key type for user preference memo default visibility.
UserSettingMemoVisibilityKey
UserSettingKey
=
"memoVisibility"
UserSettingMemoVisibilityKey
UserSettingKey
=
"memoVisibility"
// UserSettingMobileEditorStyleKey is the key type for mobile editor style.
UserSettingMobileEditorStyleKey
UserSettingKey
=
"mobileEditorStyle"
// UserSettingMemoDisplayTsOptionKey is the key type for memo display ts option.
// UserSettingMemoDisplayTsOptionKey is the key type for memo display ts option.
UserSettingMemoDisplayTsOptionKey
UserSettingKey
=
"memoDisplayTsOption"
UserSettingMemoDisplayTsOptionKey
UserSettingKey
=
"memoDisplayTsOption"
)
)
...
@@ -25,8 +23,6 @@ func (key UserSettingKey) String() string {
...
@@ -25,8 +23,6 @@ func (key UserSettingKey) String() string {
return
"locale"
return
"locale"
case
UserSettingMemoVisibilityKey
:
case
UserSettingMemoVisibilityKey
:
return
"memoVisibility"
return
"memoVisibility"
case
UserSettingMobileEditorStyleKey
:
return
"mobileEditorStyle"
case
UserSettingMemoDisplayTsOptionKey
:
case
UserSettingMemoDisplayTsOptionKey
:
return
"memoDisplayTsOption"
return
"memoDisplayTsOption"
}
}
...
@@ -37,7 +33,6 @@ var (
...
@@ -37,7 +33,6 @@ var (
UserSettingLocaleValue
=
[]
string
{
"en"
,
"zh"
,
"vi"
}
UserSettingLocaleValue
=
[]
string
{
"en"
,
"zh"
,
"vi"
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Privite
,
Protected
,
Public
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Privite
,
Protected
,
Public
}
UserSettingEditorFontStyleValue
=
[]
string
{
"normal"
,
"mono"
}
UserSettingEditorFontStyleValue
=
[]
string
{
"normal"
,
"mono"
}
UserSettingMobileEditorStyleValue
=
[]
string
{
"normal"
,
"float"
}
UserSettingMemoDisplayTsOptionKeyValue
=
[]
string
{
"created_ts"
,
"updated_ts"
}
UserSettingMemoDisplayTsOptionKeyValue
=
[]
string
{
"created_ts"
,
"updated_ts"
}
)
)
...
@@ -89,23 +84,6 @@ func (upsert UserSettingUpsert) Validate() error {
...
@@ -89,23 +84,6 @@ func (upsert UserSettingUpsert) Validate() error {
if
invalid
{
if
invalid
{
return
fmt
.
Errorf
(
"invalid user setting memo visibility value"
)
return
fmt
.
Errorf
(
"invalid user setting memo visibility value"
)
}
}
}
else
if
upsert
.
Key
==
UserSettingMobileEditorStyleKey
{
mobileEditorStyleValue
:=
"normal"
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
mobileEditorStyleValue
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to unmarshal user setting mobile editor style"
)
}
invalid
:=
true
for
_
,
value
:=
range
UserSettingMobileEditorStyleValue
{
if
mobileEditorStyleValue
==
value
{
invalid
=
false
break
}
}
if
invalid
{
return
fmt
.
Errorf
(
"invalid user setting mobile editor style value"
)
}
}
else
if
upsert
.
Key
==
UserSettingMemoDisplayTsOptionKey
{
}
else
if
upsert
.
Key
==
UserSettingMemoDisplayTsOptionKey
{
memoDisplayTsOption
:=
"created_ts"
memoDisplayTsOption
:=
"created_ts"
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
memoDisplayTsOption
)
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
memoDisplayTsOption
)
...
...
web/src/components/MemoEditor.tsx
View file @
db93710f
...
@@ -53,7 +53,6 @@ const MemoEditor = () => {
...
@@ -53,7 +53,6 @@ const MemoEditor = () => {
const
prevGlobalStateRef
=
useRef
(
editorState
);
const
prevGlobalStateRef
=
useRef
(
editorState
);
const
editorRef
=
useRef
<
EditorRefActions
>
(
null
);
const
editorRef
=
useRef
<
EditorRefActions
>
(
null
);
const
tagSeletorRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
tagSeletorRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
mobileEditorStyle
=
user
?.
setting
.
mobileEditorStyle
||
"normal"
;
const
memoVisibilityOptionSelectorItems
=
VISIBILITY_SELECTOR_ITEMS
.
map
((
item
)
=>
{
const
memoVisibilityOptionSelectorItems
=
VISIBILITY_SELECTOR_ITEMS
.
map
((
item
)
=>
{
return
{
return
{
value
:
item
.
value
,
value
:
item
.
value
,
...
@@ -408,7 +407,7 @@ const MemoEditor = () => {
...
@@ -408,7 +407,7 @@ const MemoEditor = () => {
return
(
return
(
<
div
<
div
className=
{
`memo-editor-container ${
mobileEditorStyle} ${
isEditing ? "edit-ing" : ""} ${state.fullscreen ? "fullscreen" : ""}`
}
className=
{
`memo-editor-container ${isEditing ? "edit-ing" : ""} ${state.fullscreen ? "fullscreen" : ""}`
}
tabIndex=
{
0
}
tabIndex=
{
0
}
onKeyDown=
{
handleKeyDown
}
onKeyDown=
{
handleKeyDown
}
onDrop=
{
handleDropEvent
}
onDrop=
{
handleDropEvent
}
...
...
web/src/components/Settings/PreferencesSection.tsx
View file @
db93710f
...
@@ -20,17 +20,6 @@ const localeSelectorItems = [
...
@@ -20,17 +20,6 @@ const localeSelectorItems = [
},
},
];
];
const
mobileEditorStyleSelectorItems
=
[
{
text
:
"Normal"
,
value
:
"normal"
,
},
{
text
:
"Float"
,
value
:
"float"
,
},
];
const
PreferencesSection
=
()
=>
{
const
PreferencesSection
=
()
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
{
setting
}
=
useAppSelector
((
state
)
=>
state
.
user
.
user
as
User
);
const
{
setting
}
=
useAppSelector
((
state
)
=>
state
.
user
.
user
as
User
);
...
@@ -57,10 +46,6 @@ const PreferencesSection = () => {
...
@@ -57,10 +46,6 @@ const PreferencesSection = () => {
await
userService
.
upsertUserSetting
(
"memoVisibility"
,
value
);
await
userService
.
upsertUserSetting
(
"memoVisibility"
,
value
);
};
};
const
handleMobileEditorStyleChanged
=
async
(
value
:
string
)
=>
{
await
userService
.
upsertUserSetting
(
"mobileEditorStyle"
,
value
);
};
const
handleMemoDisplayTsOptionChanged
=
async
(
value
:
string
)
=>
{
const
handleMemoDisplayTsOptionChanged
=
async
(
value
:
string
)
=>
{
await
userService
.
upsertUserSetting
(
"memoDisplayTsOption"
,
value
);
await
userService
.
upsertUserSetting
(
"memoDisplayTsOption"
,
value
);
};
};
...
@@ -82,15 +67,6 @@ const PreferencesSection = () => {
...
@@ -82,15 +67,6 @@ const PreferencesSection = () => {
handleValueChanged=
{
handleDefaultMemoVisibilityChanged
}
handleValueChanged=
{
handleDefaultMemoVisibilityChanged
}
/>
/>
</
label
>
</
label
>
<
label
className=
"form-label selector"
>
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.mobile-editor-style"
)
}
</
span
>
<
Selector
className=
"ml-2 w-32"
value=
{
setting
.
mobileEditorStyle
}
dataSource=
{
mobileEditorStyleSelectorItems
}
handleValueChanged=
{
handleMobileEditorStyleChanged
}
/>
</
label
>
<
label
className=
"form-label selector"
>
<
label
className=
"form-label selector"
>
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.default-memo-sort-option"
)
}
</
span
>
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.default-memo-sort-option"
)
}
</
span
>
<
Selector
<
Selector
...
...
web/src/less/memo-editor.less
View file @
db93710f
...
@@ -3,26 +3,6 @@
...
@@ -3,26 +3,6 @@
.memo-editor-container {
.memo-editor-container {
@apply transition-all relative w-full flex flex-col justify-start items-start bg-white p-4 pt-3 rounded-lg border-2 border-gray-200;
@apply transition-all relative w-full flex flex-col justify-start items-start bg-white p-4 pt-3 rounded-lg border-2 border-gray-200;
&.float {
@media (max-width: 640px) {
@apply fixed w-full bottom-0 left-0 border-none rounded-none;
background-color: #f6f5f4;
> .memo-editor {
@apply p-4 mb-2 rounded-lg border-2 flex flex-col flex-grow justify-start items-start relative w-full h-full bg-white;
}
.tag-action > .tag-list {
@apply bottom-7;
top: unset !important;
}
.emoji-picker-react {
@apply !bottom-8;
top: unset !important;
}
}
}
&.fullscreen {
&.fullscreen {
@apply fixed w-full h-full top-0 left-0 z-1000 border-none rounded-none sm:p-8;
@apply fixed w-full h-full top-0 left-0 z-1000 border-none rounded-none sm:p-8;
background-color: #f6f5f4;
background-color: #f6f5f4;
...
...
web/src/services/userService.ts
View file @
db93710f
...
@@ -7,7 +7,6 @@ import { setUser, patchUser, setHost, setOwner } from "../store/modules/user";
...
@@ -7,7 +7,6 @@ import { setUser, patchUser, setHost, setOwner } from "../store/modules/user";
const
defauleSetting
:
Setting
=
{
const
defauleSetting
:
Setting
=
{
locale
:
"en"
,
locale
:
"en"
,
memoVisibility
:
"PRIVATE"
,
memoVisibility
:
"PRIVATE"
,
mobileEditorStyle
:
"normal"
,
memoDisplayTsOption
:
"created_ts"
,
memoDisplayTsOption
:
"created_ts"
,
};
};
...
...
web/src/types/modules/setting.d.ts
View file @
db93710f
interface
Setting
{
interface
Setting
{
locale
:
Locale
;
locale
:
Locale
;
memoVisibility
:
Visibility
;
memoVisibility
:
Visibility
;
mobileEditorStyle
:
"normal"
|
"float"
;
memoDisplayTsOption
:
"created_ts"
|
"updated_ts"
;
memoDisplayTsOption
:
"created_ts"
|
"updated_ts"
;
}
}
...
...
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