diff --git a/src/public/app/widgets/type_widgets/options/appearance/code_block.js b/src/public/app/widgets/type_widgets/options/appearance/code_block.js
index 2a371938d..388f902dd 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/code_block.js
+++ b/src/public/app/widgets/type_widgets/options/appearance/code_block.js
@@ -23,6 +23,13 @@ const TPL = `
+
+
@@ -51,6 +58,9 @@ export default class CodeBlockOptions extends OptionsWidget {
library_loader.loadHighlightingTheme(newTheme);
await server.put(`options/codeBlockTheme/${newTheme}`);
});
+
+ this.$wordWrap = this.$widget.find(".word-wrap");
+ this.$wordWrap.on("change", () => this.updateCheckboxOption("codeBlockWordWrap", this.$wordWrap));
// Set up preview
const sampleEl = this.$widget.find(".code-sample");
@@ -74,5 +84,6 @@ export default class CodeBlockOptions extends OptionsWidget {
.text(theme.title));
}
this.$themeSelect.val(options.codeBlockTheme);
+ this.setCheckboxState(this.$wordWrap, options.codeBlockWordWrap);
}
}
\ No newline at end of file
diff --git a/src/routes/api/options.ts b/src/routes/api/options.ts
index d028e7c0e..227d5c8af 100644
--- a/src/routes/api/options.ts
+++ b/src/routes/api/options.ts
@@ -17,6 +17,7 @@ const ALLOWED_OPTIONS = new Set([
'zoomFactor',
'theme',
'codeBlockTheme',
+ "codeBlockWordWrap",
'syncServerHost',
'syncServerTimeout',
'syncProxy',
diff --git a/src/services/options_init.ts b/src/services/options_init.ts
index f649b4e05..a9743ac0b 100644
--- a/src/services/options_init.ts
+++ b/src/services/options_init.ts
@@ -100,7 +100,9 @@ const defaultOptions: DefaultOption[] = [
// Internationalization
{ name: 'locale', value: 'en', isSynced: true },
- { name: 'firstDayOfWeek', value: '1', isSynced: true }
+ { name: 'firstDayOfWeek', value: '1', isSynced: true },
+
+ { name: "codeBlockWordWrap", value: "false", isSynced: true }
];
function initStartupOptions() {