Search code examples
javascriptmedium-editor

How to increase height of textarea in npm medium-editor?


Even after defining row height a single line textarea appears.

<textarea rows="10" id="" name="" class="editable "></textarea>
<script>var editor = new MediumEditor('.editable');                             
</script>

Solution

  • You can use two different way to increase the height of an medium editor, Not a textarea.

    Medium will shows a contenteditable div instead of textarea in the editor.

    .medium-editor-textarea {
        min-height: 150px;
    }
    

    OR

    <textarea class="editable medium-editor-textarea">
        <p><br></p>
        <p><br></p>
        <p><br></p>
    </textarea>
    

    Contenteditable div will introduce p tag for each line.

    Ref: https://github.com/yabwe/medium-editor/blob/master/demo/textarea.html