From 4245da6eae4a4d211436530f0b08d28ce6d346ce Mon Sep 17 00:00:00 2001 From: firm1 Date: Sat, 25 Jan 2020 03:40:03 +0100 Subject: [PATCH 1/3] add two options inputStyle and nativeSpellcheck --- README.md | 2 ++ src/js/easymde.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 00e3be3..34a8ee8 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,8 @@ easyMDE.value('New input for **EasyMDE**'); - **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts). - **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar. - **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`. +- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessarry for enable nativeSpellcheck. +- **nativeSpellcheck**: If set to `false`, disable native spell checker. Defaults to `true`. - **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items. - Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items. - **styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`. diff --git a/src/js/easymde.js b/src/js/easymde.js index 0a73bdd..f034b23 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -1858,6 +1858,8 @@ EasyMDE.prototype.render = function (el) { placeholder: options.placeholder || el.getAttribute('placeholder') || '', styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : !isMobile(), configureMouse: configureMouse, + inputStyle: (options.inputStyle != undefined) ? options.inputStyle : (!isMobile()) ? 'textarea' : 'contenteditable', + spellcheck: (options.nativeSpellcheck != undefined) ? options.nativeSpellcheck : true, }); this.codemirror.getScrollerElement().style.minHeight = options.minHeight; From b6301f397614afad669a2eda987d26f3fe2dfab4 Mon Sep 17 00:00:00 2001 From: firm1 Date: Sun, 26 Jan 2020 20:26:32 +0100 Subject: [PATCH 2/3] update Changelog and @situphen 's review ! --- CHANGELOG.md | 6 +++++- README.md | 2 +- src/js/easymde.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b19580..f63c399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to easymde will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - +## [Unreleased] +### Added +- `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser. [#52] + + ## [2.9.0] - 2020-01-13 ### Added - Missing minHeight option in type definition (Thanks to [@t49tran], [#123]). diff --git a/README.md b/README.md index 34a8ee8..de3e349 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ easyMDE.value('New input for **EasyMDE**'); - **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts). - **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar. - **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`. -- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessarry for enable nativeSpellcheck. +- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessary to enable nativeSpellcheck. - **nativeSpellcheck**: If set to `false`, disable native spell checker. Defaults to `true`. - **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items. - Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items. diff --git a/src/js/easymde.js b/src/js/easymde.js index f034b23..9a70e00 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -1858,7 +1858,7 @@ EasyMDE.prototype.render = function (el) { placeholder: options.placeholder || el.getAttribute('placeholder') || '', styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : !isMobile(), configureMouse: configureMouse, - inputStyle: (options.inputStyle != undefined) ? options.inputStyle : (!isMobile()) ? 'textarea' : 'contenteditable', + inputStyle: (options.inputStyle != undefined) ? options.inputStyle : isMobile() ? 'contenteditable' : 'textarea', spellcheck: (options.nativeSpellcheck != undefined) ? options.nativeSpellcheck : true, }); From 1bb6f6dd0d0acf4931b1adb74e0507eee612f216 Mon Sep 17 00:00:00 2001 From: firm1 Date: Sun, 26 Jan 2020 21:25:52 +0100 Subject: [PATCH 3/3] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38dc8ca..cbb2dbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser. [#52] +- `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#52]). ### Changed - Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]).