mirror of
https://github.com/livebook-dev/livebook.git
synced 2026-01-06 15:44:54 +08:00
Add an option for wrapping words in Markdown editor by default (#1107)
This commit is contained in:
parent
d486dbb86b
commit
39a294abbe
4 changed files with 17 additions and 0 deletions
|
|
@ -262,6 +262,10 @@ class LiveEditor {
|
|||
// of the line we would get "defmodule" as a word completion.
|
||||
wordBasedSuggestions: !this.intellisense,
|
||||
parameterHints: this.intellisense && settings.editor_auto_signature,
|
||||
wordWrap:
|
||||
this.language === "markdown" && settings.editor_markdown_word_wrap
|
||||
? "on"
|
||||
: "off",
|
||||
});
|
||||
|
||||
this.editor.addAction({
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ const EditorSettings = {
|
|||
const editorHighContrastCheckbox = this.el.querySelector(
|
||||
`[name="editor_high_contrast"][value="true"]`
|
||||
);
|
||||
const editorMarkdownWordWrapCheckbox = this.el.querySelector(
|
||||
`[name="editor_markdown_word_wrap"][value="true"]`
|
||||
);
|
||||
|
||||
editorAutoCompletionCheckbox.checked = settings.editor_auto_completion;
|
||||
editorAutoSignatureCheckbox.checked = settings.editor_auto_signature;
|
||||
|
|
@ -30,6 +33,7 @@ const EditorSettings = {
|
|||
settings.editor_font_size === EDITOR_FONT_SIZE.large ? true : false;
|
||||
editorHighContrastCheckbox.checked =
|
||||
settings.editor_theme === EDITOR_THEME.highContrast ? true : false;
|
||||
editorMarkdownWordWrapCheckbox.checked = settings.editor_markdown_word_wrap;
|
||||
|
||||
editorAutoCompletionCheckbox.addEventListener("change", (event) => {
|
||||
settingsStore.update({ editor_auto_completion: event.target.checked });
|
||||
|
|
@ -54,6 +58,10 @@ const EditorSettings = {
|
|||
: EDITOR_THEME.default,
|
||||
});
|
||||
});
|
||||
|
||||
editorMarkdownWordWrapCheckbox.addEventListener("change", (event) => {
|
||||
settingsStore.update({ editor_markdown_word_wrap: event.target.checked });
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const DEFAULT_SETTINGS = {
|
|||
editor_auto_signature: true,
|
||||
editor_font_size: EDITOR_FONT_SIZE.normal,
|
||||
editor_theme: EDITOR_THEME.default,
|
||||
editor_markdown_word_wrap: true,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -121,6 +121,10 @@ defmodule LivebookWeb.SettingsLive do
|
|||
name="editor_high_contrast"
|
||||
label="Use high contrast theme"
|
||||
checked={false} />
|
||||
<.switch_checkbox
|
||||
name="editor_markdown_word_wrap"
|
||||
label="Wrap words in Markdown"
|
||||
checked={false} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue