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: [Dave] wysiwyg limitations

By ricrogram - March 16, 2009

Hi Dave,

I'm trying to set the width of the wysiwyg editor panel CMS Builder). I want the view in the editor to best reflect how it will look in the site. The tool buttons pushing it wider than I want it is not a problem as I need it wider anyway.

I thought I had found the answer with this post however the code you mention in edit_functions.php is not there anymore. Are you able to let me know how to set the width for the wysiwyg editor. I don't know any php as such although I have managed to change a few small things (remove/add wysiwyg tools etc) which have worked out really well.

Cheers,
Richard

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.