2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-21 08:54:28 -06:00

Merge pull request #201 from nick-denry/describe_maxheight_option

Describe maxHeight option
This commit is contained in:
Jeroen Akkerman 2020-06-03 22:18:48 +02:00 committed by GitHub
commit 9dbb1dbe8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View File

@ -140,6 +140,7 @@ easyMDE.value('New input for **EasyMDE**');
- table - table
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`. - **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"`. - **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`.
- **onToggleFullScreen**: A function that gets called when the editor's full screen mode is toggled. The function will be passed a boolean as parameter, `true` when the editor is currently going into full screen mode, or `false`. - **onToggleFullScreen**: A function that gets called when the editor's full screen mode is toggled. The function will be passed a boolean as parameter, `true` when the editor is currently going into full screen mode, or `false`.
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing). - **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`. - **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.

View File

@ -342,13 +342,11 @@ function toggleFullScreen(editor) {
} }
// Remove or set maxHeight // Remove or set maxHeight
if (typeof editor.options.maxHeight !== 'undefined') {
if (cm.getOption('fullScreen')) { if (cm.getOption('fullScreen')) {
if (editor.options.maxHeight !== false) {
cm.getScrollerElement().style.removeProperty('height'); cm.getScrollerElement().style.removeProperty('height');
sidebyside.style.removeProperty('height'); sidebyside.style.removeProperty('height');
}
} else { } else {
if (editor.options.maxHeight !== false) {
cm.getScrollerElement().style.height = editor.options.maxHeight; cm.getScrollerElement().style.height = editor.options.maxHeight;
editor.setPreviewMaxHeight(); editor.setPreviewMaxHeight();
} }
@ -1721,7 +1719,7 @@ function EasyMDE(options) {
options.shortcuts = extend({}, shortcuts, options.shortcuts || {}); options.shortcuts = extend({}, shortcuts, options.shortcuts || {});
options.minHeight = options.minHeight || '300px'; options.minHeight = options.minHeight || '300px';
options.maxHeight = options.maxHeight || false; options.maxHeight = options.maxHeight || undefined;
options.errorCallback = options.errorCallback || function (errorMessage) { options.errorCallback = options.errorCallback || function (errorMessage) {
alert(errorMessage); alert(errorMessage);
@ -2009,7 +2007,7 @@ EasyMDE.prototype.render = function (el) {
this.codemirror.getScrollerElement().style.minHeight = options.minHeight; this.codemirror.getScrollerElement().style.minHeight = options.minHeight;
if (options.maxHeight !== false) { if (typeof options.maxHeight !== 'undefined') {
this.codemirror.getScrollerElement().style.height = options.maxHeight; this.codemirror.getScrollerElement().style.height = options.maxHeight;
} }
@ -2330,7 +2328,7 @@ EasyMDE.prototype.createSideBySide = function () {
wrapper.parentNode.insertBefore(preview, wrapper.nextSibling); wrapper.parentNode.insertBefore(preview, wrapper.nextSibling);
} }
if (this.options.maxHeight !== false) { if (typeof this.options.maxHeight !== 'undefined') {
this.setPreviewMaxHeight(); this.setPreviewMaxHeight();
} }

View File

@ -182,6 +182,7 @@ new EasyMDE({
new EasyMDE({ new EasyMDE({
sideBySideFullscreen: false, sideBySideFullscreen: false,
maxHeight: '500px',
toolbar: [ toolbar: [
'bold', 'bold',
'italic', 'italic',

1
types/easymde.d.ts vendored
View File

@ -172,6 +172,7 @@ declare namespace EasyMDE {
insertTexts?: InsertTextOptions; insertTexts?: InsertTextOptions;
lineWrapping?: boolean; lineWrapping?: boolean;
minHeight?: string; minHeight?: string;
maxHeight?: string;
parsingConfig?: ParsingOptions; parsingConfig?: ParsingOptions;
placeholder?: string; placeholder?: string;
previewClass?: string | ReadonlyArray<string>; previewClass?: string | ReadonlyArray<string>;