mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-03 08:04:29 -06:00
Merge pull request #333 from smundro/custom-spellchecker
Allow for specifying a custom spell-checker
This commit is contained in:
commit
c1d35b04c5
@ -194,7 +194,7 @@ easyMDE.value('New input for **EasyMDE**');
|
|||||||
- **sanitizerFunction**: Custom function for sanitizing the HTML output of markdown renderer.
|
- **sanitizerFunction**: Custom function for sanitizing the HTML output of markdown renderer.
|
||||||
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
|
- **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.
|
- **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`.
|
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`. Optionally pass a CodeMirrorSpellChecker-compliant function.
|
||||||
- **inputStyle**: `textarea` or `contenteditable`. Defaults to `textarea` for desktop and `contenteditable` for mobile. `contenteditable` option is necessary to 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`.
|
- **nativeSpellcheck**: If set to `false`, disable native spell checker. Defaults to `true`.
|
||||||
- **sideBySideFullscreen**: If set to `false`, allows side-by-side editing without going into fullscreen. Defaults to `true`.
|
- **sideBySideFullscreen**: If set to `false`, allows side-by-side editing without going into fullscreen. Defaults to `true`.
|
||||||
|
@ -2052,10 +2052,16 @@ EasyMDE.prototype.render = function (el) {
|
|||||||
backdrop.name = 'gfm';
|
backdrop.name = 'gfm';
|
||||||
backdrop.gitHubSpice = false;
|
backdrop.gitHubSpice = false;
|
||||||
|
|
||||||
|
if (typeof options.spellChecker === 'function') {
|
||||||
|
options.spellChecker({
|
||||||
|
codeMirrorInstance: CodeMirror,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
CodeMirrorSpellChecker({
|
CodeMirrorSpellChecker({
|
||||||
codeMirrorInstance: CodeMirror,
|
codeMirrorInstance: CodeMirror,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function configureMouse(cm, repeat, event) {
|
function configureMouse(cm, repeat, event) {
|
||||||
|
6
types/easymde.d.ts
vendored
6
types/easymde.d.ts
vendored
@ -165,6 +165,10 @@ declare namespace EasyMDE {
|
|||||||
combine?: boolean
|
combine?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface SpellCheckerOptions {
|
||||||
|
codeMirrorInstance: CodeMirror.Editor
|
||||||
|
}
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
autoDownloadFontAwesome?: boolean;
|
autoDownloadFontAwesome?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
@ -190,7 +194,7 @@ declare namespace EasyMDE {
|
|||||||
renderingConfig?: RenderingOptions;
|
renderingConfig?: RenderingOptions;
|
||||||
shortcuts?: Shortcuts;
|
shortcuts?: Shortcuts;
|
||||||
showIcons?: ReadonlyArray<ToolbarButton>;
|
showIcons?: ReadonlyArray<ToolbarButton>;
|
||||||
spellChecker?: boolean;
|
spellChecker?: boolean | ((options: SpellCheckerOptions) => void);
|
||||||
inputStyle?: 'textarea' | 'contenteditable';
|
inputStyle?: 'textarea' | 'contenteditable';
|
||||||
nativeSpellcheck?: boolean;
|
nativeSpellcheck?: boolean;
|
||||||
sideBySideFullscreen?: boolean;
|
sideBySideFullscreen?: boolean;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user