Closed (fixed)
Project:
FCKeditor - WYSIWYG HTML editor
Version:
master
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
28 Sep 2006 at 09:44 UTC
Updated:
13 Feb 2007 at 13:15 UTC
Sorry for not commiting a patch, but my FCKeditor is currently not standard.
This is a simple fix to make the exclude function simpler and work better.
This allows exlude filters like */add/* or node/*_issue etc.
In my code this starts at line 494 to the end of the file.
I am including the original code - commented out.
// $Number_of_excludes = count($paths_excluded_array)+1;
// check each array item to see if it matches an excluded path
// for($i=0; $i<$Number_of_excludes; $i++){
// $paths_excluded_array[$i] = rtrim($paths_excluded_array[$i]);
# // IF WILDCARD in excluded path
# if(strpos( $paths_excluded_array[$i] , '*' )){
# //remove /* frpm excluded_path
# $excluded_path = substr($paths_excluded_array[$i], 0, -2);
#
# // see if the page path contains the excluded path
# if(substr_count ( $page_path, $excluded_path)){
# $path_match = 0;
# break;
# }
# //IF no wildcard check to see if Page path = excluded path
# }else{
# if($paths_excluded_array[$i] == $page_path){
# $path_match = 0;
# break;
# }
# }
// by regx - Wow, lets just use a regx instead!
foreach($paths_excluded_array as $expath){
$expath = preg_replace('/[^a-zA-Z0-9*]/','\\/',$expath);
$expath = preg_replace('/\*/','.*',$expath);
//print "$expath<br/>"; # for debugging
if (preg_match("/$expath/",$page_path)){
$path_match = 0;
break;
}
}
return($path_match);
}
Comments
Comment #1
ontwerpwerk commentedOkay, this patch will manage exclusion for certain paths - which will disable the FCKeditor on whole pages.
At the moment the FCKeditor module has a more finegrained control which tells it to exclude certain fields on a page (don't show FCKeditor on all fields with *mail* in the form id)
I have two questions first:
Comment #2
regx commentedWhen was this added?
The code I replaced only seemed to remove the editor if the path matched, and the wildcard did not work if it was in the middle or beginning of the path, but only at the end. If I am correct in this, then the code posted is more consice and does what I needed.
Finer grained control would be very nice, but most of the time I want to remove it for the whole page.
The code I commented out exluded the editor on the whole page correct?
Comment #3
regx commentedthinking about this a liitle more, it wouldn't be to hard to come up with a convention that would allow either case.
one method could be to look for / if it is there then assume a node path, otherwise assume a field name.
Comment #4
regx commentedJust wanted to add that I love this module - nice work!
FCK editor is the best editor in my opinion, so thanks for your work making this module.
Comment #5
ontwerpwerk commentedIt was added a few weeks ago - along with the posssibility to have (two) different toolbars that are configurable for roles.
Adding slashes for a combined approach would greatly complicate the logic, so I'd like to wait and see what the 'RTE field controller' module (http://drupal.org/node/81297#comment-137803) will do with that - it will probably be the best place to build that kind of function.
Thanx for your praise, but it's not only for me, I just recently took over, so jtite, FredCK and others deserve a lot of credit too.
Comment #6
ontwerpwerk commentedwaiting for 'RTE field controller'
Comment #7
JoshLangner commentedThis functionality is necessary. http://drupal.org/node/101664
Should work similarly to TinyMCE exclusion settings, although it's nice to have the per-field control.
Comment #8
ontwerpwerk commentedIt's now number 3 on my list of things to do with FCKeditor
Comment #9
JoshLangner commentedI think I've come up with a quick & easy solution: http://drupal.org/node/101996
Code and concept still needs help, but the end result is we get more control than TinyMCE!
Comment #10
ontwerpwerk commentedan option to filter by paths is in the current development release
Comment #11
(not verified) commented