Skip to content

Commit

Permalink
feat: add sticky scroll feature to editor settings
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Apr 25, 2024
1 parent 100b672 commit 38d7533
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/renderer/others/setting-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ const schema: SettingSchema = ({
group: 'editor',
required: true,
},
'editor.sticky-scroll-enabled': {
defaultValue: true,
title: 'T_setting-panel.schema.editor.sticky-scroll-enabled',
type: 'boolean',
format: 'checkbox',
group: 'editor',
required: true,
},
'render.md-html': {
defaultValue: true,
title: 'T_setting-panel.schema.render.md-html',
Expand Down
1 change: 1 addition & 0 deletions src/renderer/services/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const getDefaultOptions = (): Monaco.editor.IStandaloneEditorConstruction
suggestOnTriggerCharacters: getSetting('editor.suggest-on-trigger-characters', true),
occurrencesHighlight: 'off',
renderLineHighlight: 'all',
stickyScroll: { enabled: getSetting('editor.sticky-scroll-enabled', true) },
wordSeparators: '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?。?!,、;:“”‘’()《》〈〉【】『』「」﹃﹄〔〕'
})

Expand Down
1 change: 1 addition & 0 deletions src/renderer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export interface BuildInSettings {
'editor.todo-with-time': boolean,
'editor.suggest-on-trigger-characters': boolean,
'editor.quick-suggestions': boolean,
'editor.sticky-scroll-enabled': boolean,
'render.md-html': boolean,
'render.md-breaks': boolean,
'render.md-linkify': boolean,
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ const data = {
'complete-emoji': 'Complete Emoji - Input : to display emoji list',
'todo-with-time': 'Add time when checking todo',
'suggest-on-trigger-characters': 'Suggest on trigger characters - You can also use Ctrl+Space (depending on the shortcuts) to trigger',
'sticky-scroll-enabled': 'Enable Sticky Scroll - When the editor scrolls, the document title is fixed',
'quick-suggestions': 'Quick Suggestions - Suggest as you type',
},
'render': {
Expand Down
1 change: 1 addition & 0 deletions src/share/i18n/languages/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ const data: BaseLanguage = {
'complete-emoji': '自动补全 Emoji - 输入 : 时显示 Emoji 列表',
'todo-with-time': '勾选待办事项时自动添加时间',
'suggest-on-trigger-characters': '自动提示 - 输入提示符时显示提示。如果禁用,仍可使用 Ctrl+Space (取决于快捷键配置) 触发',
'sticky-scroll-enabled': '启用粘性滚动 - 当编辑器滚动时,固定显示文档标题等',
'quick-suggestions': '快速提示 - 在输入文本时显示提示',
},
'render': {
Expand Down

0 comments on commit 38d7533

Please sign in to comment.