question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set editor width and height?

See original GitHub issue

I’m sorry if it’s not the place to ask but I can’t seem to be able to set the editor to have a fixed width and height. My code is

$('#myEditor').summernote({
    height: 20,
    width: 320,
    disableResizeEditor: true,
    airMode: true,
    popover: {
        air: [
            // [groupName, [list of button]]
            ['style', ['bold', 'italic', 'underline', 'clear']],
            ['font', ['strikethrough', 'superscript', 'subscript']],
            ['insert', ['link']]
        ],
        link: [
            ['link', ['linkDialogShow', 'unlink']]
        ]
    },
    callbacks: {
        onEnter: function (e) {
            e.preventDefault();
        },
        onPaste: function (e) {
            var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
            e.preventDefault();
            document.execCommand('insertText', false, bufferText.replace(/\n/g, ''));
        }
    }
});

The editor width is not set using the config above. Note that I am also using Bootstrap, if that makes a difference (I saw some issues about this). As soon as I type more text the editor grows. Basically I would like the field to behave like an input text field. Is there a way to set the width and height in the config? Do I have to try to set the DOM properties myself?

steps to reproduce

  1. See code above

browser version and os version and summernote version

What is your browser and OS? Chrome latest version What is your summernote version? 0.8.7

screenshot of issue

Add screenshots which shows your issue(if needed).image See Help Text box

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MCSXVcommented, Jun 9, 2018

Pelo que entendi a altura é de padrão automática. Só precisei definir uma largura.

2reactions
imsmart-techcommented, Mar 4, 2018

I fixed it by setting the div containing summernote with style=“width:320px; max-width:320px;”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Editor Size - CKEditor 4 Documentation
The easiest way to achieve that is to use the CKEDITOR.config.width and CKEDITOR.config.height settings to adjust the editor user interface size. The image ......
Read more >
Settings | Height and Width - Imperavi
This setting allows to set minimum height for Redactor. ... This setting defines maximum width of content inside of Redactor. This setting doesn't...
Read more >
Summernote, set editor width and height - Stack Overflow
I can't seem to be able to set the editor to have a fixed width and height. My code is $('#myEditor').summernote({ height: 20,...
Read more >
Editor size and resize options | TinyMCE Documentation
height sets the height of the entire editor, including the menu bar, toolbars, and status bar. ... TinyMCE sets the width in pixels...
Read more >
Measurements in Editor X | Wix Fix - YouTube
Learn about all the different types of measurements inside of Editor X. Editor X has pixels, percentages, viewport width & viewport heights.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found