2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-19 07: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
- **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`.
- **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).
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
@ -244,10 +245,10 @@ var editor = new EasyMDE({
underscoresBreakWords: true,
},
placeholder: "Type here...",
previewClass: "my-custom-styling",
previewClass: ["my-custom-styling", "more-custom-styling"],
previewRender: function(plainText) {
return customMarkdownParser(plainText); // Returns HTML from a custom parser
},

View File

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

View File

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

1
types/easymde.d.ts vendored
View File

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