Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#255 closed enhancement (fixed)

No way to set minHeight of richtext when instantiating Editor

Reported by: Martin Scheffler Owned by: anonymous
Priority: lowest Milestone:
Component: Widgets Version: 0.2
Keywords: minHeight, Editor Cc:
Blocked By: Blocking:

Description

it is not possible to set minHeight when instantiating the editor with dojo.widget.fromScript. It should look something like this: editorArgs = { items: ["textGroup", "linkGroup"], minHeight:"300px"}; this.editor = dojo.widget.fromScript("Editor", editorArgs, dojo.byId("the_editor"));

This is needed because when the editor has just a single line of height, it is hard to drag&drop html to it.

Change History (4)

comment:1 Changed 14 years ago by Martin Scheffler

Priority: lowlowest
severity: minorenhancement

This is a hack to set the height without an api function.

function() {

h=80; this._richText.minHeight=h+"px"; this._richText.editNode.style.height=h+"px"; if(this._richText.iframe) {

this._richText._lastHeight=h; this._richText.iframe.height =h+"px";

}

}.bind(this.editor)

the bind function is from the prototype library, I am not fluent in dojo but I am sure there is an equivalent. Bind() sets the context in that the function will be executed.

I had to start this function with a window.setTimeout of 1000, because the iframe is not existent onload.

comment:2 Changed 14 years ago by alex

Milestone: 0.2release0.3release

Dojo does not pollute the Function object prototype and uses dojo.lang.hitch() instead. Additionally, the Editor component calls functions which we can interecept and/or listen to using dojo.event.connect(). The (much safer) Dojo way to write this would be:

var doOnCreate = dojo.lang.hitch(this.editor, function(){
   var h=80;
   this._richText.minHeight=h+"px";
   this._richText.editNode.style.height=h+"px";
   if(this._richText.iframe) {
     this._richText._lastHeight=h;
     this._richText.iframe.height =h+"px";
   }
});

// only call this method when the editor is available
dojo.event.connect(this.editor, "fillInTemplate", "doOnCreate");

comment:3 Changed 13 years ago by Dustin Machi

Resolution: fixed
Status: newclosed

Looks like a solution was provided to me on how to accomplish this.

comment:4 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.