Opened 12 years ago

Closed 10 years ago

#322 closed enhancement (fixed)

Create plugin to set width of iframe smaller than available config.width

Reported by: wymsy Owned by: gogo
Priority: low Milestone: 2.0
Component: Plugin_Other Version: trunk
Severity: normal Keywords: plugin width iframe
Cc:

Description

In previous versions of htmlarea/xinha, the width configuration parameter was applied to the iframe, so if you specified a width in pixels, the wysiwyg area was always displayed at that width. If the toolbar needed more width to show all the buttons, that was fine, the iframe still kept the specified width below the wider toolbar.

In the rewritten framework in the most recent version of xinha, however, the width configuration is being applied to the entire htmlarea container. This makes it impossible to have a wysiwyg area narrower than the toolbar. This can be a problem if you want to work on a relatively narrow column of text and maintain the layout in the editor - the toolbar forces the iframe to stretch, and line breaks, etc. are changed. You can let the toolbar flow to minimize the problem, but I would rather not use that feature because it results in an inconsistent user interface where buttons are not always in the same place.

Can we change the new framework to behave similarly to the original, where the widths of the toolbar and the iframe are independent?

Change History (7)

comment:1 Changed 12 years ago by anonymous

  • Component changed from Documentation to Xinha Core
  • Owner changed from akaEdge to gogo

comment:2 Changed 12 years ago by gogo

  • Resolution set to invalid
  • Status changed from new to closed

Please see the configuration, this is a configurable option.

  // Width and Height
  //  you may set these as follows
  //  width = 'auto'      -- the width of the original textarea will be used
  //  width = 'toolbar'   -- the width of the toolbar will be used
  //  width = '<css measure>' -- use any css measurement, eg width = '75%'
  //
  //  height = 'auto'     -- the height of the original textarea
  //  height = '<css measure>' -- any css measurement, eg height = '480px'
  this.width  = "auto";
  this.height = "auto";

  // the next parameter specifies whether the toolbar should be included
  // in the size above, or are extra to it.  If false then it's recommended
  // to have explicit pixel sizes above (or on your textarea and have auto above)
  this.sizeIncludesBars = true;

  // the next parameter specifies whether the panels should be included
  // in the size above, or are extra to it.  If false then it's recommended
  // to have explicit pixel sizes above (or on your textarea and have auto above)
  this.sizeIncludesPanels = true;

comment:3 Changed 12 years ago by gogo

Oh wait, I see what you mean. And. No, I don't think that will be happening, the past ability for the toolbar to be wider than the editor has always been seen as a bug to be fixed, not a feature, part of the reason for the new framework was specifically to fix that problem (and more importantly resizing problems).

There is no reason you couldn't do this yourself though, simply set the iframe size specifically after generating the editor

xinha_editors.myEditor._iframe.style.width='100px';

You probably want to override sizeEditor actually...

 HTMLArea.prototype._origSizeEditor = HTMLArea.prototype.sizeEditor;
 HTMLArea.prototype.sizeEditor = function(width, height, includingBars, includingPanels)
 {
   this._origSizeEditor(width,height,includingVars,includingPanels);
   this._iframe.style.width = '100px';
 }

comment:4 Changed 12 years ago by wymsy

  • Resolution invalid deleted
  • Status changed from closed to reopened

I think this boils down to a disagreement as to what the width configuration parameter should mean. In my mind, it means "how wide is the editable area", where you are saying it means "how wide is the space occupied by the entire editor". In the majority of cases this turns out to be the same thing, but in the case of narrow columns it doesn't. It seems to me that for this to be a truly wysiwyg editor, if the developer cares enough about the width to specify it in a config parameter, we ought to honor that width wherever possible. To let the toolbar override the developer's specification seems arbitrary and unnecessary.

As you point out, I can fix it myself, and I have because it is critical to my application. I also have fixed the FullScreen? plugin to do the same thing (you declined to consider a similar request on that a while back). But I think it would make Xinha a better product if this could be made, if not the default behavior, at least a configurable option.

(I'm reopenning this just because I don't know if you look at closed tickets. If I haven't convinced you, close it again and I'll live with it.)

comment:5 Changed 12 years ago by gogo

  • Component changed from Xinha Core to Plugin_Other
  • Keywords plugin width iframe added
  • Milestone Version 1.0 deleted
  • Severity changed from normal to enhancement
  • Version set to trunk

I think that this functionality can be implemented as a (trivial) plugin using the code above. Therefore it would not be included in the core.

I'll set the ticket to be for creating a plugin to do this.

comment:6 Changed 12 years ago by gogo

  • Milestone set to 2.0
  • Priority changed from normal to low
  • Summary changed from config.width problem in new framework to Create plugin to set width of iframe smaller than available config.width

comment:7 Changed 10 years ago by wymsy

  • Resolution set to fixed
  • Status changed from reopened to closed

Created config variable iframeWidth in changeset:817.

Note: See TracTickets for help on using tickets.