[Tag] Strip code from tag entries in publish form
Posted: 06 July 2007 08:43 PM   [ Ignore ]
Newbie
Avatar
Rank
Total Posts:  25
Joined  2007-06-11

Let me explain. maybe this is something i can fix?

In EE I have been forced to install the TinyMCE module and extension because the people I have posting are not code people. There’s a LOT of cut and paste stuff that just needs the editor or they wouldn’t post.

This presents a problem because the way this works is ANY ‘textarea’ in the publish form grabs the TinyMCE stuff.

So if you enter keywords, one per line, it adds HTML markup which gets included, and it totally hoses the tags. To the point one time I had to disable the whole module to clear it out. I could have just emptied directly fromt he DB but I wasn’t sure of the structure.

So, and it really makes sense anyway, those entries should get stripped before they’re inserted. Or am I crazy?

EDIT: Disregard this. I just edited the mod.tag.php and changed the text area to a text input. Then changed the preferences to use commas, not line breaks.

Seems ok now.

Profile
 
 
Posted: 16 February 2008 09:27 AM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-04-30

Hey there,

I ran in to this same issue, but lack the knowledge (or will) to modify the tag module code.  However, I found a much easier solution if anyone else is having the same problem…

In the TinyMCE extension settings, you can add the following line to the configuration:

editor_deselector "tag_f",

which will disable the WYSIWYG editor for the tags textarea.

Cheers,

Ira

Profile
 
 
Posted: 13 June 2008 07:39 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  5
Joined  2008-06-02

Hey

ira42, I tried your method to no avail. Could you possibly post your TinyMCE configuration here?

Profile
 
 
Posted: 13 June 2008 07:49 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-04-30

Sure, here you go:

browsers "msie,gecko,opera,safari",
mode "textareas",
editor_deselector "tag_f|field_id_244|field_id_245|field_id_91|field_id_112|field_id_26",
theme "advanced",
elements 'nourlconvert',
remove_script_host false,
relative_urls false,
content_css '/tinymce/jscripts/tiny_mce/themes/advanced/css/xxxxx.css',
plugins "blockproperties,advhr,ibrowser,filemanager,media,style,layer,table,advlink,zoom,searchreplace,contextmenu,paste,fullscreen,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1 "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,styleselect,|,advhr",
theme_advanced_buttons2 "cut,copy,paste,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,code,|preview",
theme_advanced_buttons3 "tablecontrols,|,hr|,sub,sup,|,charmap,iespell,|,print,|,ibrowser,insertfile,media,|,fullscreen",
theme_advanced_toolbar_location "top",
theme_advanced_toolbar_align "left",
theme_advanced_path_location "bottom",
theme_advanced_resize_horizontal false,
theme_advanced_resizing true,
theme_advanced_blockformats "p,div,h1,h2,h3,h4,h5,h6,blockquote,pre"

Pretty sure that’s all it took for me.  May have also cleared my browser cache after the change, but can’t remember.

I guess make sure that it’s placed near the top, that mode is set to textareas, and that you include the comma at the end of the deselector line.

Cheers,

Ira

Profile
 
 
Posted: 16 June 2008 07:20 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  5
Joined  2008-06-02

Thanks for that. i guess that the field_id numbers you list on the same line are the fields you want the TinyMCE attached to?

Profile
 
 
Posted: 16 June 2008 08:14 AM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-04-30
spiritbased - 16 June 2008 07:20 AM

Thanks for that. i guess that the field_id numbers you list on the same line are the fields you want the TinyMCE attached to?

Hey there,

It’s actually a de-selector, so by default, all textareas in the edit/publish pages have TinyMCE applied to them, except the ones specified in that setting.  So the field ids (of my custom fields) listed there are displayed as regular textareas, without the TinyMCE toolbar.

Ira

Profile
 
 
Posted: 16 June 2008 10:44 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  5
Joined  2008-06-02

Okay, cool… so how do I find the field_id number for the Tag Entry field in order to deselect it?

Profile
 
 
Posted: 16 June 2008 10:50 AM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-04-30

You only need the field_id_# for other custom fields, if you want to disable them.

To disable the tag field, you only need to use tag_f:

editor_deselector "tag_f",

Profile
 
 
Posted: 17 June 2008 05:24 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  5
Joined  2008-06-02

Hey Ira

Thanks for your help, but it’s just not working for me. Here’s my settings:

mode "textareas",
editor_deselector "tag_f",
theme"advanced",
theme_advanced_toolbar_location 'top',
theme_advanced_blockformats "p,h2",
theme_advanced_buttons1:  "bold, italic, bullist, numlist, undo, redo, link, unlink, cleanup, removeformat, formatselect, separator, code",
theme_advanced_disable"anchor, sub, sup, outdent, indent, image, help, charmap, hr, visualaid",
theme_advanced_buttons2"",

Anything jump out of that at you?

Profile
 
 
Posted: 17 June 2008 05:50 AM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  50
Joined  2007-04-30

Ahh… Found the issue.

I’m using an older version of TinyMCE which uses the field ID to determine the deselector, but newer versions look for the textarea’s CLASS tag.  So i my case, the ID tag is id="tag_f”, so this field is disabled.

In your case, it’s looking for the class="....", which is class="textarea".  Not sure why they changed this, and unfortunately, all of the textareas in the EE have the class name “textarea”.

Really sorry about that, I hadn’t realized how long it’s been since I’ve upgraded tinymce!

You have a couple of options:

1) Install the LG TinyMCE extension for ExpressionEngine (search the EE forums).  This creates a new field format called “TinyMCE textarea”.  With this installed, all of the control panel textareas become non-wysiwyg until you specifically create a field using this field type.

2) AT YOUR OWN RISK.  You could easily modify the TinyMCE code to look for the ID name rather than the Class name, when checking for which textareas to deselect.  To do this, open tiny_mce.js AND tiny_mce_src.js, and find these two lines:

if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;

...and...

if(new 
RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;

and change “class” to “id”:

if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"id")))continue;

...and...

if(new 
RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"id")))continue;

Now, you’ll be able to deselect the fields based on ID name (eg:  tag_f or field_id_xx), like you could in the previous versions of TinyMCE.

Hope this helps!

Ira

Profile