Skip to content

Commit

Permalink
feat: add line wrapping option
Browse files Browse the repository at this point in the history
Closes #45
  • Loading branch information
Skaiir committed Jun 4, 2024
1 parent 1b3a5be commit 3f0d8b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { lightTheme, darkTheme } from '@bpmn-io/cm-theme';
* @param {Boolean} [config.readOnly] Set to true to make the editor read-only.
* @param {String} [config.value] Initial value of the editor.
* @param {Boolean} [config.enableGutters] Set to true to enable gutter decorations (e.g., line numbers).
* @param {Boolean} [config.singleLine] Set to true to limit the editor to a single line.
* @param {Boolean} [config.lineWrap] Set to true to enable line wrapping.
* @param {Boolean} [config.darkMode] Set to true to use the dark theme for the editor.
*
* @returns {Object} editor An instance of the FeelersEditor class.
Expand All @@ -43,6 +45,7 @@ export default function FeelersEditor({
value = '',
enableGutters = false,
singleLine = false,
lineWrap = false,
darkMode = false
}) {

Expand Down Expand Up @@ -118,6 +121,9 @@ export default function FeelersEditor({
] : []),
...(singleLine ? [
EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr)
] : []),
...(lineWrap ? [
EditorView.lineWrapping
] : [])
];

Expand Down
3 changes: 2 additions & 1 deletion test/spec/singleStart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ describe('CodeEditor', function() {
// when
const editor = new FeelersEditor({
container: container,
value: initialTemplate
value: initialTemplate,
lineWrap: true,
});

// then
Expand Down

0 comments on commit 3f0d8b0

Please sign in to comment.