Skip to content

Commit 56b87c5

Browse files
Devesh0129Logende
andauthored
884 implement word wrap for text view (#918)
* initial comit for wordwrap in text view * word wrap - handling resize * update comment --------- Co-authored-by: Felix Neubauer <[email protected]>
1 parent 91f3866 commit 56b87c5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

meta_configurator/src/components/panels/code-editor/AceEditor.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ let editor: Ref<Editor | undefined> = ref(undefined);
3535
3636
onMounted(() => {
3737
editor.value = ace.edit(editor_id);
38+
39+
editor.value.getSession().setUseWrapMode(true);
40+
editor.value.setOption('wrap', true);
41+
editor.value.setOption('hScrollBarAlwaysVisible', false);
42+
3843
setupAceMode(editor.value, settings.value);
3944
setupAceProperties(editor.value, settings.value);
4045
@@ -45,6 +50,13 @@ onMounted(() => {
4550
if (isEditorReadOnly()) {
4651
editor.value.setReadOnly(true);
4752
}
53+
54+
// watch for changes in the editor container size and resize the editor accordingly
55+
const observer = new ResizeObserver(() => {
56+
editor.value?.resize();
57+
});
58+
const el = document.getElementById(editor_id);
59+
if (el) observer.observe(el);
4860
});
4961
5062
// watch for changes in the data format and update the editor accordingly

0 commit comments

Comments
 (0)