Opened 15 years ago

Closed 11 years ago

#366 closed defect (inactive)

Configuration for default table width

Reported by: ianb@… Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc: ianb@…


It would be nice if the default width of new tables could be configurable. Right now it is hardcoded in the html in popups/insert_table.html, perhaps like:

{{{htmlarea_config.insert_table = {

f_width: '200',
f_unit: 'px'}


Change History (2)

comment:1 Changed 15 years ago by jkronika@…

Another possibility, perhaps using the config listed above by ianb, would be to check the values provided by a user against the defaults, where the defaults would be the maximums:

Config as above:

htmlarea_config.insert_table = {
  f_width: 200,
  f_unit: 'px'

And then to check the user vs default:

if (user_table.f_unit == htmlarea_config.insert_table.f_unit) {
 // same unit in use

 if (user_table.f_width > htmlarea_config.insert_table.f_width) {
  // user specification too wide

  // warn the user of the change
  alert('Width specified for table is larger than the maximum.\n'
      + 'Resetting value of '+user_table.f_width
      + ' to '+htmlarea_config.insert_table.f_width);

  // reduce the width specification
  user_table.f_width = htmlarea_config.insert_table.f_width;

if (user_table.f_unit == '%') {
 // user specified percentage

 if (user_table.f_width > 99) {
  // user specification greater 99%, which can break box model

  // warn the user of the change
  alert('Percentage widths should be no greater than 99%.\n'
      + 'This will help prevent erroneous display of elements\n'
      + 'and unwanted wrapping.\n'
      + 'Resetting value of '+user_table.f_width + ' to 99%');

  // decrease the width specification
  user_table.f_width = 99;

if (user_table.f_width < 0) {
 // user specification too small

 // warn the user of the change
 alert('Width specified for table cannot be negative.\n'
     + 'Resetting value of '+user_table.f_width + ' to zero [0]');

 // increase the width specification
 user_table.f_width = 0;

// set the table width = user_table.f_width + user_table.f_unit;

This doesn't account for any situations other than equivalent units or percentages, obviously, and in such situations the width specified by a user could easily be higher than the width specified in the config. However, I don't know of an easy way to check for the offsetWidth of an element being greater than the default width at this point, and there really isn't any other way to check width differences for em, cm, in, mm, and other such units against px.

comment:2 Changed 11 years ago by gogo

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

Inactive, closing. Stuff has moved on since then I think.

Note: See TracTickets for help on using tickets.