CKEditor 3.0.1 brought, amongst other things, the ability to use more than one custom stylesheet in the editing area. We need to take advantage of that!

As agentdcooper pointed out in #462146: Add editor: CKeditor, Wysiwyg module thinks 3.0.1 is older than 3.0 because we account for the revision as well. (I thought his fix for this was just a typo, sorry about that.)

Here's a patch to fix the above. Checking for versions below 3.0.1 and reverting to using a single stylesheet might seem like overkill, but I don't want to take the risk of suddenly breaking a stable release of CKEditor just becuause the theme in reality used more than one stylesheet.
Using the same thinking with keeping the revisions check, it's also easier to parse than alpha/beta/rc tags...

Patch below is for 7.x-3.x, those changes will be the same for all branches. Just need someone to confirm this please.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Moved the call to the originalToDataFormat function before the plugin calls, this makes a big difference for plugins dealing with whitespaces as the CKEditor HTML parser/writer won't reformat it all this way.

agentdcooper’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

thanks TwoD! tested working here ... I'm on drupal 6.14, -- this is what I did (I telling you, to ensure I did everything right) ;;

I deleted my wysiwyg module directory and started anew from CVS with DRUPAL-6--2 (6.x-2.x-dev) + implementing your patch here, all went well, and is well! ;;

<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules/wysiwyg)> drush status
  PHP configuration : /etc/httpd/php.ini
  Drupal Root       : /var/www/htdocs/drupal
  Drupal version    : 6.14
  Site Path         : sites/default
  .... .... .... ....

<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules)> rm -rf wysiwyg
<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules)> cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d wysiwyg-DRUPAL-6--2 -r DRUPAL-6--2 contributions/modules/wysiwyg/

<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules)> wget http://drupal.org/files/issues/wysiwyg-HEAD-ckeditor-3.0.1-2.patch
<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules)> mv wysiwyg-DRUPAL-6--2 wysiwyg
<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules)> cd wysiwyg/editors

<(root@leviathan:/var/www/htdocs/drupal/sites/all/modules/wysiwyg/editors)> patch -p1 < /path/to/wysiwyg-HEAD-ckeditor-3.0.1-2.patch
patching file ckeditor.inc
patching file js/ckeditor-3.0.js

in my web browser, I goto => http://$drupalroot/admin/settings/wysiwyg/profile
shows CKeditor 3.0.1.4391 properly! I can also edit nodes and my ckeditor is operational. muchas gracias for all your work.

CinemaSaville’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

I updated WYSIWYG module to the latest dev version, and it says it doesn't support 3.0.1. How can I get it to work with this version? I don't know how to implement patches. Is there just a zip file I can download? Thanks.

CinemaSaville’s picture

OK, figured out how to patch, (I think) but when I tried to apply your patch to 6.2 Dev I received the following message:

can't find file to patch at input line 8
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: editors/ckeditor.inc
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/ckeditor.inc,v
|retrieving revision 1.3
|diff -u -p -r1.3 ckeditor.inc
|--- editors/ckeditor.inc 20 Oct 2009 02:46:59 -0000 1.3
|+++ editors/ckeditor.inc 21 Oct 2009 05:20:53 -0000

Can you help me out? Thanks

agentdcooper’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

CinemaSaville my reply above shows you how... easiest way to explain is look there.
but... I think you just need to goto the proper directory to apply the patch, specifically ;;

cd /$drupalroot/sites/all/modules/wysiwyg/editors
patch -p1 < /path/to/wysiwyg-HEAD-ckeditor-3.0.1-2.patch
CinemaSaville’s picture

OK, so do I have to patch this on the server the drupal install is on, or can I just patch on my local machine, and then upload? That's what I've been doing, and it hasn't worked, so apparently I do need to patch on the server, but it's just that I'm clueless on how to do it. I'm running Snow Leopard with Drupal 6.14. Any help on this would really be appreciated. Thanks, agentdcooper.

TwoD’s picture

It does not matter where you do the patching. It works for me when I cd to the wysiwyg directory, then patch -p0 < wysiwyg-HEAD-ckeditor-3.0.1-2.patch, given the patch is in the wysiwyg directory. Also make sure you have the latest code, before #462146: Add editor: CKeditor, the ckeditor fiels did not exist in 2.x-dev.

If you get it to work, please change the status to RTBC.

agentdcooper’s picture

Status: Needs review » Reviewed & tested by the community

well, works for me for sure... and thanks TwoD I noticed I was using -p1, and u suggest -p0 -- I read the patch "man" page and figured out that -p1 takes the first / out. hence in my instructions I mentioned that one should be in the /$drupalroot/sites/all/modules/wysiwyg/editors when applying the patch. as TwoD mentioned, just goto the /$drupalroot/sites/all/modules/wysiwyg folder and run

patch -p0 < /path/to/wysiwyg-HEAD-ckeditor-3.0.1-2.patch

w00t, so I am learning how this whole drupal code review thing works n all. I am as TwoD said, going to mark as STATUS = reviewed & tested by the community (even tho I am just one person of the community, anyone should be able to duplicate mine and TwoD's successes). I am still learning...

CinemaSaville’s picture

TwoD, can you tell me where to place the syntax module? Do I need to include that with the patch and .js and .inc files? Thanks, it's a little tricky doing all this, but with your help I'll figure it out.

CinemaSaville’s picture

OK, success with the patching, I got confused with the directories and -p1 and -p0. Just goes to show you should read closely. But now that I've done it, I'm able to get the editor recognized, and editing nodes, but when I install the imce_wysiwg bridge module, and select all the buttons, they don't all show up. This is the same in Safari 4.0.3 and Firefox 3.5.3. I'm including a picture to show you what I mean. Is this an issue with CKEditor 3.0.1, the imce_wysiwg patch or your patch. Gets a little complicated, but you guys are doing a phenomenal job of sorting it out. Thanks again.

agentdcooper’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Fixed » Reviewed & tested by the community

the "syntax module" I think you are referencing here => http://drupal.org/node/462146#comment-2167374 was something TwoD was helping me with, for getting the ckeditor v3 plugin syntaxhilighter working with drupal 6 + wysiwyg(-6.x-2.x-dev) module + ckeditor v3. actually it was a working "general-use" example of howto get a ckeditor v3 plugin to work with his & sun's wysiwyg module. and it was a beautifully crafted example at that! easy enuff, that for me to learn further, I was able to take that wysiwyg_syntaxhilight module code, and create a similar module "wysiwyg_aspell" for a GNU aspell-based spellchecker ckeditor v3 plugin created by user keilaron @ the cksource (ckeditor support) forums. it's kinda cool, plus it allowed me to learn, which is what this drupal project is all about =)
-- TwoD, I'd like to contribute the wysiwyg_aspell module, so u can do whatever u like with it... how to do that? it's nearly identical to yr syntax_hilight module.

so that "syntax module" is NOT required, but if you do want use it I can show you here (works for me, ymmv);

  1. download, and extract TwoD's syntax_module.zip to your /$drupalroot/sites/all/modules directory, which will create a wysiwyg_syntaxhilight directory/module.
  2. download, and extract ckeditor-syntaxhighlight-1.0.tar.bz2 to a temporary directory.
  3. move the folder /$tempdir/ckeditor-syntaxhighlight/plugins/syntaxhighlight to your /$drupalroot/sites/all/libraries/ckeditor/plugins directory
  4. goto your webpage http://$drupalroot/admin/settings/wysiwyg and enable the "Syntax hilighting" button in your settings for each input filter you want it enabled for, within the "buttons and plugins" section
agentdcooper’s picture

CinemaSaville @ #10, might wanna slow down, and patch one at a time and see at what point things "break" and work from there... I am suggesting to start over with the wysiwyg module and yr patching. not hard now that you know howto do it, as a very similar setup to you with it working fine. just my 2 cents...

SimonEast’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

(Updated the issue version number to 7.x instead of 6.x -- would love a patch for 6.x too though!!)

TwoD’s picture

Status: Reviewed & tested by the community » Fixed

@SimonEast: The patch can be applied to all versions as the editor implementations are currently identical. But that is no longer needed.

This is now committed to all branches and should be in the -dev snapshot within a few hours. Thanks for helping out!

@agentdcooper: I don't have time to maintain another module at the moment (even a small one). If you want to, you can add that module to drupal.org and maintain it yourself, there's a quick guide at Start or Maintain Modules, Themes or Installation Profiles or you could just

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Reviewed & tested by the community » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.