Closed (fixed)
Project:
TinyMCE
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2007 at 05:12 UTC
Updated:
18 Feb 2007 at 01:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
kreynen commentedI have a hack allows you to enable different TinyMCE themes for 2 different roles on your site, but can be expanded. Look for this code around line 102 in tinymce.module...
Replace it with the if statement wrapped in this if/elseif changing the YOURROLENAME(s) to the roles you want to use the different TinyMCE themes...
There might be a cleaner way to do this, but I haven't seen it posted this is one that works. It doesn't seem like it would be too difficult to add this functionality to the module the way "Enable TinyMCE for this node types:" was added. If YOURROLENAME(s) were variables set in the module interface, they'd be available in the module like the universal $editor_mode variable that's available now.
Comment #2
farzan commentedThank you very much; your hack is perfect for my need.
Comment #3
ardas commentedYes, this hack is helpful.
A question to authors: How about to implement three settings for this module each of which will be a PHP snippet to evaluate should FULL, COMPACT or SIMPLE editor be loaded? This will give us an ability to specify any logic not only chosing a role.
Comment #4
Frando commentedNo need to close it yet, let's first get this into CVS ;)
Comment #5
kreynen commentedThis hack was intended give people (including me) back functionality they lost when upgrading from 4.7 to 5 until a better solution is developed. It shouldn't be committed to CVS because there are hard coded variables in the code.
Someone (NOT IT!) could write a patch that uses this approach, but they need to add textboxes to the TinyMCE admin interface allowing users to set the TinyMCE theme assigned to each role (the role assigned to each theme). I'm not sure which way makes more sense since you can have unlimited roles and TinyMCE themes. Listing the available themes would require generating a select list based on the files found in /modules/tinymce/includes/themes since that list doesn't exist in the database, but allowing users to choose a theme from that list for each role they create seems like it would be the easiest. Then there is the issue of hierarchy. How do you know which TinyMCE theme has more functionality? If I'm a web editor and a site admin, which theme do I get? ASFAIK, Roles have no weight. The only order is the order they were created in. For this to be truly useful, users would need a way to order the hierarchy of their roles.
What I don't think we need is to develop a full blown GUI button selector again (at least not right now). Editing the .js themes isn't rocket science and makes the TinyMCE part of this module more compatible with updates to TinyMCE. There are dozens of TinyMCE plugins to do everything from something simple like adding a blockquote to more complex features like a PHP editor. My point is that TinyMCE is a framework for WYSIWYG toolbar functionality. Just like the Drupal community expects developers to learn to do things the Druapl way, I think it would be more beneficial to users in the long run to learn to customize their TinyMCE themes the TinyMCE way.
Comment #6
scafmac commentedFunny you should mention that...
I just finished a patch that does most of what you request. The only thing it doesn't do is look for more tinymce profiles - it only uses the full, compact, and simple ones defined. That is enough for me.
As far as the hierarchy question, this isn't ideal, but I did implement a hack to have multiple roles with different tinymce profiles. The most important one for me is to be able overload any tinymce profile for the authenticated user. Generally I give that role the most "simple" version, but other roles also have that role. So while checking role-specific tinymce profiles, I do a reverse key sort (anonymous role = 1 & authenticated user = 2, all others go up from there). As soon as a role - tinymce profile is found, it aborts any other checks. So if you are careful with the order that you create roles, you should have pretty fine control of which tinymce profiles a user ends up with.
The only thing that is missing is the ability to assign different filters for the different tinymce profiles. I would rather not have content creators having to remember to switch from the default filter to a WYSIWYG filter to correspond with their "advanced" tinymce profile. There used to be a problem in core that prevented this, though I haven't checked recently.
Comment #7
scafmac commentedDon't bother with that patch. I didn't have the latest version of tinymce - anyone else notice head is an old 4-7 version?
The new patch will be uploaded soon.
Comment #8
matt@antinomia commentedtagging this thread for reference... Thanks for the patches for this very important item.
Comment #9
scafmac commentedAttached is the updated patch. It is based on the 1.90.4.12 version of TinyMCE. The previous patch was against ...11.
I haven't tested this super extensively, but it is working on our test site and some of the production sites are just starting to use it. Let me know if anyone finds any bugs.
I'd like to second Kreynen's support of the 'TinyMCE' way of creating and controlling tinyMCE profiles. The old button picker GUI just didn't give the functionality I wanted. I had in fact turned away from TinyMCE in 4.7 because of the button picker & it's lack of flexibility. I would argue admins do not need the button picker gui, but rather some good, clear documentation about changing and creating TinyMCE profiles.
I'll happily update this patch to work for a random number of randomly named TinyMCE profiles (currently simple, compact, & full) if someone creates clear, Drupal-focused, documentation on creating TinyMCE profiles. Any takers?
Cheers
Comment #10
kreynen commented