GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 395 forks source link

How to fix the height of data-editable region elements #408

Closed mallikarjuna909 closed 7 years ago

mallikarjuna909 commented 7 years ago

I've the fixed height for the data-editable element. If i press Enter/ shift+Enter it is keep increasing the height of element. So i need to stop user if data-editable region reaches height of element.

Example: <h3 style="height:20px" id="editable-regions" class="ce-element ce-element--type-text ce-element--focused" contenteditable="">Editable regions</h3>

In the above example, h3 having only 20px; if i Shift+Enter in the element, it is coming to new line inside it. But i fixed height so nothing should be happen by clicking on Shift+Enter

anthonyjb commented 7 years ago

Hi @mallikarjuna909,

One option is to consider using a fixture instead of a region, this sounds appropriate for what you are looking to do here, you can find an example of a fixture in the sandbox example HTML here: https://github.com/GetmeUK/ContentTools/blob/master/sandbox/index.html#L13