Skip to content

Commit

Permalink
Merge pull request #267 from nhymxu/patch-1
Browse files Browse the repository at this point in the history
Allow modify lineNumbers via config options
  • Loading branch information
Ionaru committed Nov 11, 2020
2 parents 11f805f + b06d1fe commit e087158
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- CodeMirror autorefresh plugin and autoRefresh option (Thanks to [@mbolli], [#249]).
- `lineNumbers` option to display line numbers in the editor (Thanks to [@nhymxu], [#267]).

### Fixed
- CSS scoping issues when the editor is used in combination with other CodeMirror instances ([#252]).
Expand Down Expand Up @@ -195,6 +196,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
[#9]: https://github.com/Ionaru/easy-markdown-editor/issues/9

<!-- Linked PRs -->
[#267]: https://github.com/Ionaru/easy-markdown-editor/pull/267
[#249]: https://github.com/Ionaru/easy-markdown-editor/pull/249
[#244]: https://github.com/Ionaru/easy-markdown-editor/pull/244
[#235]: https://github.com/Ionaru/easy-markdown-editor/pull/235
Expand Down Expand Up @@ -229,6 +231,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
[#19]: https://github.com/Ionaru/easy-markdown-editor/pull/19

<!-- Linked users -->
[@nhymxu]: https://github.com/nhymxu
[@mbolli]: https://github.com/mbolli
[@ivictbor]: https://github.com/ivictbor
[@JoshuaLicense]: https://github.com/JoshuaLicense
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ easyMDE.value('New input for **EasyMDE**');
- image
- link
- table
- **lineNumbers**: If set to `true`, enables line numbers in the editor.
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
- **minHeight**: Sets the minimum height for the composition area, before it starts auto-growing. Should be a string containing a valid CSS value like `"500px"`. Defaults to `"300px"`.
- **maxHeight**: Sets fixed height for the composition area. `minHeight` option will be ignored. Should be a string containing a valid CSS value like `"500px"`. Defaults to `undefined`.
Expand Down
2 changes: 1 addition & 1 deletion src/js/easymde.js
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ EasyMDE.prototype.render = function (el) {
tabSize: (options.tabSize != undefined) ? options.tabSize : 2,
indentUnit: (options.tabSize != undefined) ? options.tabSize : 2,
indentWithTabs: (options.indentWithTabs === false) ? false : true,
lineNumbers: false,
lineNumbers: (options.lineNumbers === true) ? true : false,
autofocus: (options.autofocus === true) ? true : false,
extraKeys: keyMaps,
lineWrapping: (options.lineWrapping === false) ? false : true,
Expand Down
2 changes: 2 additions & 0 deletions types/easymde-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const editorImagesCustom = new EasyMDE({

new EasyMDE({
sideBySideFullscreen: true,
lineNumbers: false,
autosave: {
enabled: true,
delay: 2000,
Expand All @@ -186,6 +187,7 @@ new EasyMDE({

new EasyMDE({
sideBySideFullscreen: false,
lineNumbers: true,
maxHeight: '500px',
toolbar: [
'bold',
Expand Down
1 change: 1 addition & 0 deletions types/easymde.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ declare namespace EasyMDE {
indentWithTabs?: boolean;
initialValue?: string;
insertTexts?: InsertTextOptions;
lineNumbers?: boolean;
lineWrapping?: boolean;
minHeight?: string;
maxHeight?: string;
Expand Down

0 comments on commit e087158

Please sign in to comment.