[contrib] Adding options to TinyMCE with TINYMCEOPTS

3rd party code for phpList

[contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby afeuer » 8:01am, Mon 13 Nov, 2006

tinyMCE editor is more stable than the FCK. It is best when you can use most of tinyMCE options.

To add all the options use the below "TINYMCEOPTS" located in the "config.php" file (after enabling tinyMCE).

*************

define "TINYMCEOPTS", ",plugins : 'devkit,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras', theme_advanced_buttons1_add_before : 'save,separator',
theme_advanced_buttons1_add : 'fontselect,fontsizeselect',
theme_advanced_buttons2_add : 'separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor',
theme_advanced_buttons2_add_before: 'cut,copy,paste,separator,search,replace,separator',
theme_advanced_buttons3_add_before : 'tablecontrols,separator',
theme_advanced_buttons3_add : 'emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen',
theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_path_location : 'bottom',
plugin_insertdate_dateFormat : '%m-%d-%Y',
plugin_insertdate_timeFormat : '%H:%M:%S',
extended_valid_elements : 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'
");
afeuer
phpLister
 
Posts: 5
Joined: 12:47am, Thu 22 Dec, 2005

Postby H2B2 » 12:38am, Tue 14 Nov, 2006

Thanks for sharing!

I have added this to the tinyMCE documentation page. As you use tinyMCE you might want to review that page, and change it or add paragraphs if necessary.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby afeuer » 7:24pm, Tue 14 Nov, 2006

I found out that with above optione tinymce uses only relative links and not absolute links (it truncate the http:\\).

To over come this issue oleas add the folloing to optins:

relative_urls : 'false' ,
remove_script_host : 'false' ,

The full text for "TINYMCEOPTS" become:

define("TINYMCEOPTS", ",plugins : 'devkit,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras',
theme_advanced_buttons1_add_before : 'save,separator',
theme_advanced_buttons1_add : 'fontselect,fontsizeselect',
theme_advanced_buttons2_add : 'separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor',
theme_advanced_buttons2_add_before: 'cut,copy,paste,separator,search,replace,separator',
theme_advanced_buttons3_add_before : 'tablecontrols,separator',
theme_advanced_buttons3_add : 'emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen', theme_advanced_toolbar_location : 'top',
theme_advanced_toolbar_align : 'left',
theme_advanced_path_location : 'bottom',
plugin_insertdate_dateFormat : '%m-%d-%Y',
plugin_insertdate_timeFormat : '%H:%M:%S',
relative_urls : 'false' ,
remove_script_host : 'false' ,
extended_valid_elements : 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'
");
afeuer
phpLister
 
Posts: 5
Joined: 12:47am, Thu 22 Dec, 2005

Postby H2B2 » 1:49am, Wed 15 Nov, 2006

afeuer wrote:I found out that with above optione tinymce uses only relative links and not absolute links (it truncate the http:\\).
OK, I updated the docs.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby nymisoa » 4:46pm, Sun 25 Feb, 2007

If you make a minor change as so:
Code: Select all
theme_advanced_buttons3_add : 'pastetext,pasteword,selectall,emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen',
This adds the nice Paste From Word and Paste as Text buttons. Helpful if you draft messages in another application and just want to bring the text over without the underlying code. The code from copying from Microsoft Word will likely break any CSS your using.

These buttons are enabled in the 'paste' plugin.
afeuer wrote:relative_urls : 'false' ,
remove_script_host : 'false' ,
Not sure if it's just my installation, but I have to remove the quotes around the above two to get them to work:
Code: Select all
relative_urls : false ,
remove_script_host : false ,

YMMV
nymisoa
PL Nut
 
Posts: 28
Joined: 2:39pm, Thu 07 Dec, 2006

Postby nymisoa » 5:27pm, Fri 14 Mar, 2008

I don't remember writing this but you do have to remove the quotes when you pass booleans to the TinyMCE config.

The new 3.x version of TinyMCE is particularly finicky if you don't.
nymisoa
PL Nut
 
Posts: 28
Joined: 2:39pm, Thu 07 Dec, 2006

Postby avibodha » 6:42pm, Fri 28 Mar, 2008

I'd also recommend removing the 'save' plugin and button. They don't save the currently edited message and could confuse users.

I had to remove it after users complained they thought they had saved their message - but it didn't.
avibodha
phpLister
 
Posts: 9
Joined: 4:13pm, Wed 12 Oct, 2005

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby bradley » 2:24am, Sat 22 Aug, 2009

I found out that with above options, tinymce does allow for image alignment. I added: style (after 'alt' and before 'title')
to the img tag, and now alignment seems to be working.

Code: Select all
extended_valid_elements : 'a[name|href|target|title|onclick],img[class|src|border=0|alt|style|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'


I got the tip from the tinymce forum:
tinymce.moxiecode.com/punbb/viewtopic.php?id=12326
bradley
phpList newbie
 
Posts: 1
Joined: 2:16am, Sat 22 Aug, 2009

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby joekaz » 12:17pm, Sun 19 Sep, 2010

I had trouble getting this to work - whenever I added the TINYMCEOPTS listed here, I would get no toolbar at all. I finally figured out the problem - remove "devkit" from the plugins list, and everything then worked fine.

According to this:
http://wiki.moxiecode.com/index.php/Tin ... ins/devkit
the devkit plugin was removed as of TinyMCE 3.0
joekaz
phpList newbie
 
Posts: 2
Joined: 12:08pm, Sun 19 Sep, 2010

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby flug » 12:06am, Mon 21 Mar, 2011

I just wanted to share this in case it helps anyone else--we got TinyMCE working with the following options:
Code: Select all
define("TINYMCEOPTS", ",

theme : 'advanced',

plugins : 'style,advhr,advimage,iespell,preview,searchreplace,contextmenu,paste,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras',

theme_advanced_buttons1: 'bold,italic,underline, link, unlink, anchor, image, nonbreaking, forecolor, backcolor',
theme_advanced_buttons2: 'removeformat, charmap, blockquote,outdent,indent, visualrchars,cut,copy,paste,search,replace, fullscreen, code  ',
theme_advanced_buttons3: '',
theme_advanced_toolbar_location : 'top',


relative_urls : 'false',
convert_urls : 'false',
remove_script_host : 'false',

force_p_newlines : true, 
remove_linebreaks : true,
convert_newlines_to_brs : false,

extended_valid_elements : 'img[longdesc|usemap|src|border|style|alt=|title|hspace|vspace|width|height|align]'


");


Not the only way to do it, for sure, but one way.

What we wanted is a very simple HTML editor so that there is no trouble when all the fancy HTML stuff is stripped in order to make the plain text version. 90% or more of our ~17K subscribers are signed up in plain text mode now, so having the plain text mode work well is important.

The only issue we don't really have solved is the issue of URLs. When you put a link in the HTML text it looks great there but the automatic translation to plain text is less than good.

For now, the only solution I can come up with is to tweak the plain text by hand.
flug
PL Nut
 
Posts: 25
Joined: 12:17am, Mon 28 Aug, 2006

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby H2B2 » 12:20am, Mon 21 Mar, 2011

Thanks for sharing!

flug wrote:The only issue we don't really have solved is the issue of URLs. When you put a link in the HTML text it looks great there but the automatic translation to plain text is less than good.

I'd suggest to pass this on to the developers by filing a report in http://mantis.phplist.com with one or two examples of what goes wrong during conversion to plain-text.

flug wrote:For now, the only solution I can come up with is to tweak the plain text by hand.

This is a bit off-topic of course: Since text messages are that important, you'd probably be better off enabling this setting in your config.php file:
Code: Select all
# Manual text part, will give you an input box for the text version of the message
# instead of trying to create it by parsing the HTML version into plain text
define("USE_MANUAL_TEXT_PART",0);
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby flug » 5:57pm, Mon 21 Mar, 2011

H2B2 wrote:Thanks for sharing!

flug wrote:The only issue we don't really have solved is the issue of URLs. When you put a link in the HTML text it looks great there but the automatic translation to plain text is less than good.

I'd suggest to pass this on to the developers by filing a report in http://mantis.phplist.com with one or two examples of what goes wrong during conversion to plain-text.


I don't think it is a matter of a software problem so much as you simply *write* things differently when you're doing it as HTML (where you can embed the link in some other text), like this:



Vs in plain text email (where you use your text to introduce the link and then (for our purposes, anyway), usually set off the link itself, like:
Follow this link to send your message to the Governor:

http://talktothegovernor.org


I just don't think there is any way to transfer between those two situations automatically.

flug wrote:For now, the only solution I can come up with is to tweak the plain text by hand.

This is a bit off-topic of course: Since text messages are that important, you'd probably be better off enabling this setting in your config.php file:
Code: Select all
# Manual text part, will give you an input box for the text version of the message
# instead of trying to create it by parsing the HTML version into plain text
define("USE_MANUAL_TEXT_PART",0);


Yes, that's what we're doing and it seems to work OK.

(I didn't realize that you can choose to show the plain text box and if you just leave it empty it will send the automatically-generated plain text version.

That is really the best of both worlds--you can just go with that auto-generated version if that works, or substitute it with something different if it doesn't.)
flug
PL Nut
 
Posts: 25
Joined: 12:17am, Mon 28 Aug, 2006

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby Dr1337 » 11:19am, Mon 02 May, 2011

flug,

thanks for your follow up so far. If you find any workaround to make it happen automatically, be sure to report back.
Myself and maybe others are watching out for it.
Image
Cheers,
Steve
Dr1337
phpList newbie
 
Posts: 2
Joined: 11:06am, Mon 02 May, 2011

Re: [contrib] Adding options to TinyMCE with TINYMCEOPTS

Postby Dragonrider » 5:30pm, Tue 17 May, 2011

I have just spent several hours a day working on adding tinyMCE to phpList for someone and having finally got to the stage that once uploaded, I can now install tinyMCE in a matter of minutes, I put together a howto for anyone else struggling with it.

viewtopic.php?f=15&t=36249
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom


Return to Contributions: Plug-ins, Add-ons, Mods

Who is online

Users browsing this forum: No registered users and 1 guest