wysiwyg limitations

9 posts by 4 authors in: Forums > CMS Builder
Last Post: March 17, 2009   (RSS)

By Berkowitz - April 8, 2008

Hi,

I have a question about the wysiwyg boxes. Is it possible to limite the width and height of the boxes.
An example: When people create a new news event in my cms it will be shown in a Frame. That frame has a width and a height. I want to limite people to those 2 so I don't get scrollbars in my frame. Is this possible?

Thanks in advance
Berkowitz

Re: [Berkowitz] wysiwyg limitations

By Dave - April 8, 2008

Hi Berkowitz,

You can set the wysiwyg height in the field editor but not the width. You could try setting max length as well to limit the total content entered, although it would count the length of the HTML tags as well so you'd want to consider that.

Even if we restrained the size of the wysiwyg you'd users could still keep entering content until they got a scroll bar in the wysiwyg, so restraining max length seems like it might be the best way.

Some elements like long links or text without spaces will still push it wide no matter what you do though (unless you turn off scrollbars on your iframe, but then you won't see the end of a long link.

Hope that helps. Let me know if you think the max length and/or setting height will work.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] wysiwyg limitations

By Berkowitz - April 10, 2008

Thanks Dave,

I knew the height could be set but it's more the width that's giving me troubles. I just hate horizontal scrollbars [tongue].
i wanted to limite the width if people work with tables in cms. But oh well. I have 2 other questions now [tongue] but will open seperate topics for them as they don't have anything to do width this or eachother.

thanks,
Berkowitz

Re: [Berkowitz] wysiwyg limitations

By Dave - April 10, 2008

I could show you how to edit the code to do it if you're comfortable editing PHP and Javascript. It's in /lib/menus/default/edit_functions.php (search for tinyMCE.init). You can just add this to the options:

width: 200,

The problem is the buttons force it wider, so you'd have to change all those as well and you only get 3 rows to work with.

If you wanted to hardcode it to use one wysiwyg init for one field and another for another field you could do that with this code:

if ($tableName == 'yourTableName' && $name == 'yourFieldName') {

print <<<__HTML__
<script language="javascript" type="text/javascript"><!--
tinyMCE.init({
width: 200,
... wysiwyg options here ...
});
//--></script>
__HTML__;

}
else {

print <<<__HTML__
<script language="javascript" type="text/javascript"><!--
tinyMCE.init({
... wysiwyg options here (don't specify width for default width) ...
});
//--></script>
__HTML__;

}


I realize that's a little complicated, but if you really wanted to constrain the width that would be one method. Be sure to backup the file first before you make any changes!

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [ricrogram] wysiwyg limitations

By ross - March 17, 2009

Hi Richard

Thanks for posting!

One quick thing here, have you tried using the editor in full screen mode. There will be a button in the second row, over on the right that lets you toggle that on and off.

It basically makes the editor full screen so you have plenty of room to work with.

Let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ricrogram] wysiwyg limitations

By Dave - March 17, 2009

Hi Richard,

The wysiwyg configuration data is now stored in cmsAdmin/lib/wysiwyg.php

And you can find all kinds of docs for customizing the wysiwyg here: http://wiki.moxiecode.com/index.php/TinyMCE:Index

I haven't played with it lately but it looks like this is the width option: http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/width

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [ross] wysiwyg limitations

By ricrogram - March 17, 2009

Thanks Ross,

I was really after something that would make the content area exactly the same width as it appears in the site. Looks like Dave may have come up with something.

Thanks again for your help... much appreciated.

Re: [Dave] wysiwyg limitations

By ricrogram - March 17, 2009

Thanks Dave,

This is exactly what I was after. I now have the content area of the wysiwyg editor exactly the same width as the table where the content goes on the site.

I have to say that the support for this software is unbelievable... matched only by how good the software itself is. This is by far the best and most useful software package I've bought off the internet. As a web designer with very limited coding ability I'm amazed how simple yet powerful it is.

Cheers,
Richard