Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust default height JQTE

Tags:

jquery

css

jqte

How can I change the default height of a JQTE editor?
I've tried:

$("textarea").jqte({
height:"400px"
});

The document does not say anything about this.

like image 941
dsynkd Avatar asked Apr 13 '14 06:04

dsynkd


People also ask

What does the height () method do in jQuery?

The height() method sets or returns the height of the selected elements. When this method is used to return height, it returns the height of the FIRST matched element.

How do I set the height of a selector in HTML?

Set the height: $ (selector).height (value) Set the height using a function: $ (selector).height (function (index,currentheight))

What is the use of height in HTML?

Definition and Usage. The height property sets the height of an element. The height of an element does not include padding, borders, or margins! If height: auto; the element will automatically adjust its height to allow its content to be displayed correctly. If height is set to a numeric value (like pixels, (r)em,...

What is the default row height for only one line text?

If I select the entire sheet and then select "Autofit row height," the rows having only one line of text will default to 12.75 points. I would like that default to be bigger, say 15.75, so that there's a little more white space (easier to read).


2 Answers

You should try changing the min-height value for jqte_editor in jqte stylesheet:

 /* editor area */
.jqte_editor, .jqte_source {
    min-height:300px;
}
like image 124
Shrolox Avatar answered Sep 19 '22 19:09

Shrolox


To lock editors height so a scrollbar appears instead of the editor expanding, you need to set .jqte_editor height or min-height. You also need to set max-height.

What happends next is a jqte bug:

  • Select a text and add bold/italic or some other formatting
  • Remove the formatting
  • The selected text suddenly inherits the .jqte_editor height values and pushes every element (text) beneath further down

Fix (jqte version 1.4.0)

Open the javascript file jquery-te-1.4.0.js.

Search and find function affectStyleAround(element,style)

Replace:

if(selectedTag && style==false)
{
    // apply to the selected node with parent tag's styles
    if(selectedTag.parent().is("[style]"))
        selectedTag.attr("style",selectedTag.parent().attr("style"));

    // apply to child tags with parent tag's styles
    if(selectedTag.is("[style]"))
        selectedTag.find("*").attr("style",selectedTag.attr("style"));
}

With this:

if(selectedTag && style==false)
{
    // apply to the selected node with parent tag's styles
    if(selectedTag.parent().is("[style]") && !selectedTag.parent().is(".jqte_editor"))
        selectedTag.attr("style",selectedTag.parent().attr("style"));

    // apply to child tags with parent tag's styles
    if(selectedTag.is("[style]") && !selectedTag.parent().is(".jqte_editor"))
        selectedTag.find("*").attr("style",selectedTag.attr("style"));
}

Notice the added code:

 && !selectedTag.parent().is(".jqte_editor")

Good luck!

like image 30
VKS Avatar answered Sep 18 '22 19:09

VKS