Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.39k stars 316 forks source link

maxHeight affecting only preview size, not composition #206

Closed mMerlin closed 4 years ago

mMerlin commented 4 years ago

Describe the bug

The maxHeight option is not putting a limit on the height of the composition area. Instead, it is limiting the height of the preview display area in side-by-side mode

To Reproduce

    <textarea id="project_description"></textarea>
    <script>
      new EasyMDE({
        element: document.getElementById('project_description'),
        autoDownloadFontAwesome: false,
        autosave: {
          enabled: true,
          uniqueId: "EditProjectDescription",
          text: "Autosaved: "
        },
        uploadImage: true,
        showIcons: ["upload-image", "code"],
        hideIcons: ["image"],
        blockStyles:
          {
            code: "~~~"
          },
          maxHeight: "150px",
        sideBySideFullscreen: false,
      });
    </script>

Expected behavior

Setting maxHeight should set the editing area to the specified height. Side-by-side preview should use the full height of the composition area.

Screenshots

easymde

Version information

quinnzipse commented 4 years ago

Here's a work around I use. I think might help your problem. I referenced the SimpleMDE docs. @mMerlin

.CodeMirror {
            height: 85vh;
            overflow-y: auto;
        }
nick-denry commented 4 years ago

I guess it's because minHeight for the composition area is set to 300px by default. maxHeight value set to 150px is just too small and less than default 300px value. You could try to set minHeight to 150px, it's not ignored in this case.

try

new EasyMDE({
          minHeight: "150px",
          maxHeight: "150px",
          sideBySideFullscreen: false,
      });
mMerlin commented 4 years ago

That works. So the documentation needs to be updated. Currently says:

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.

Obviously the minHeight is not being ignored. It needs to be equal or less than maxHeight. Which should probably be handed by the code.

nick-denry commented 4 years ago

So the documentation needs to be updated.

Or minHeight option must be set equal to maxHeight always. I think pr needed.

@Ionaru ?