Add support for CKEditor v4 with new option in admin panel to enable/disable "DIV-based" editor, instead of old iframe editor (DIV-based editor is enabled now by default - if CKEditor v4 is detected).

Also we rewrite functions responsible for generating relative and local paths for CKEditor, CKFinder and Plugins dir.

Greetings

CommentFileSizeAuthor
#15 no Moono.png34.64 KBDitiwi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dczepierga’s picture

Status: Active » Needs review

I commit all changes to GIT (diff).

It could be more changes to work with CKEditor v4, because is not released yet.
If u find any bugs pls write it here.

Greetings

dczepierga’s picture

For all who wants to review CKEditor module with new CKEditor v4 - u can download nightly build of CKE v4 library from here: http://nightly.ckeditor.com/

I will be grateful for any help.

Greetings

jcisio’s picture

Finally! Thank you! But will 6.x-1.x support v4? I think if it supports, many D6 sites won't hesistate to upgrade to v4, as the upgrade will be quite easy.

Also I quickly scan the patch. I don't quite understand about different types of path: local, relative, url... It makes me disturbed. Why don't just use the classic Drupal functions everywhere (and try to use relative path when possible):
- drupal_get_path('module', 'ckeditor') to get the path of the module
- base_path() to prefix url
- If path to the CKFinder is $path (= 'sites/all/libraries/ckfinder') then url to it is base_path() . '/' . $path.

Maybe you want to keep the same code across different CMS, but I think in this case the benefit is minimized.

dczepierga’s picture

Yes, CKEditor v4 will be supported in D6 also.

All the time CKEditor module have problems with paths on diffrent configurations and webservers - when u want to fix it u must search all places where it is and then everywhere change it, so i make one function where i generate it and call it only with specific param. Now i can fix sth with paths in one place, so it's faster and much easier to fix.

I've add 3 types of paths:
- local - for checking files using local path (reading files, checking if file/dir exists etc)
- relative - for loading some files and configure some options from CKEditor (path is with base path in the beggining)
- url - path for files where we need to add files like drupal_add_js - i cannot use here relative path, because then Drupal generate a lot of errors when u enable cache/aggregation... without cache/aggregation everything works fine with relative path, i don't know does it Drupal bug or sth else...

Also u must remember does it possible to configure local path of CKEditor, so here u must generate this path in diffrent way than in relative path of CKEditor.

Greetings

astutonet’s picture

@dczepierga, I upgraded the CKEditor to version 7.x-1.9 +21- dev, released in 2012-Nov-22.

The new version does not work in the area of ​​text editing, where we used Full HTML and PHP Code. The text editor is not displayed when creating new pages or edit.

In the comments area, where they are used Filtered HTML and plain text, the editor is displayed correctly.

If I use the full URL path to the features of editor, it does not work for new content, editing of existing ones and not in the comments.

There is no error message displayed.

This is a multilingual site and I think the problem is related to this issue.

Any help will be appreciated.

Tks

Edit: For creating or editing content, the editor works normally if I select the format Filtered HTML or plain text.

Edit 2: During the installation of CKEditor on a new local site, I notice the following error message:

Notice: Undefined index: loadPlugins in ckeditor_modules_enabled() (line 599 of C:\wamp\www\mysite\sites\all\modules\ckeditor\ckeditor.module).
Notice: Undefined index: loadPlugins in ckeditor_modules_enabled() (line 599 of C:\wamp\www\mysite\sites\all\modules\ckeditor\ckeditor.module).

dczepierga’s picture

@astutonet, really thx for your review. I fix bug from "Edit 2" here: #1844390: [D7] Undefined index: loadPlugins in ckeditor_modules_enabled()

It is possible to get any access to your site and see what happend? Or u can write here step by step what to do to configure all like u have and reproduce this bug?

Greetings

dczepierga’s picture

Title: Add support for CKEditor v4 » [D7] Add support for CKEditor v4
astutonet’s picture

Hmmmm ... The new version of the module was installed only in the backup, offline.

I must consider that I'm still using version 3.6.5 of CKEditor core.

We must also consider that if CKEditor is running ok for plain text format and for advanced text formatting there are problems, there is probably a conflict with the resources used to advanced mode.

Disable and re-enable the module does not solve the issue. I also tested the database and changed the default theme for Bartik. Nothing.

Text Format - Full HTML:

I can anticipate that I enabled and have disabled individually all options used in the roles and the editor was not displayed in any of the situations.

Filters installed: Pathologic and WYSIWYG (Base Path & Domains List are identical).

In WYSIWYG, the Rules for URLs used within inline styles only contains "/*".

Installing CKEditor:

The module is installed in CKEditor: sites/all/modules/ckeditor.

The core CKEditor is in: sites/all/modules/ckeditor/ckeditor.

Global Profile - CKEditor:

Path to CKEditor: %m/ckeditor/ckeditor

Local path to CKEditor: Empty

Path to the CKEditor plugins directory: %m/ckeditor/plugins

Path to the directory location of the CKEditor plugins: empty

NOTE: If I downgrade to old a version, the problems dissapear.

Any ideas?

mkesicki’s picture

New CKEditor 4 was released yesterday . More info about it: http://ckeditor.com/blog/CKEditor-4-Launched-Inline-Editing-New-Skin-and-More

astutonet’s picture

Ok.

Using CKE nightly build v4, with new release of our CKE DEV Module, released today, so far no problems. Let's to test.

Tks

lmeurs’s picture

So far, so good!

I had to change the path to the editor at admin/config/content/ckeditor/editg (I use a version of the editor outside the modules folder). Now when I tested the editor without success, this happened to be caused by skin files that could not be loaded. This was since the new editor comes with skin Moono, and I had 'the old' Kama skin selected at admin/config/content/ckeditor/edit/Full (full HTML profile). I opened this settings page, Moona was automatically selected and saved this page. Now I could use the editor.

I did some tests with CKFinder (copied this folder from the stable module to the development version) and CKEditor Link, and it all seemed to work.

The only big difference is that we bought a Corporate License, but in the modules downloaded from Drupal.org the form fields for entering license data are gone. Because of this CKFinder offers less options since it is in demo mode. I copied / pasted them from the our original module and fiddled some with filemanager.config.php, but without success. Is there a solution to this?

mkesicki’s picture

@lmeurs,
commercial version of CKEditor module for Drupal from http://cksource.com/ckeditor-for-drupal has build in support and configuration for CKFinder and has it's own license type. There is no way to use license from commercial version in open source module. In this moment we are working hard to add support of CKEditor 4 to CKEditor module (both OS & Commercial versions). You should use dedicated support channel to get help with commercial version of CKEditor for Drupal module.

lmeurs’s picture

@michal_cksource: Thank you for the response and clarification. I already contacted Jakub Swiderski about it, he told me the release should be ready within a month. I tried the opensource module since I am so anxious to finally offer our clients an editor that works well with Chrome. We have contacted your support desk about the bugs months ago and posted bug reports, we have been told to wait for v4 which would no longer contain the Chrome bugs (ie. inserting paragraphs containing paragraphs on paste, inserting wrapping div elements on shift+paste). I understand that you guys are pretty busy and do love your work (congratulations on the new editor and site!), but cannot wait to install a correctly working editor for our clients! (sorry for the off topic comment)

mkesicki’s picture

@lmeurs,
glad that everything is clear now. We are pretty busy now , so please be patient :)

Ditiwi’s picture

FileSize
34.64 KB

With Drupal 7.17 and CKEditor 7.x-1.x-dev module and CKEditor 4 in /libraries work fine... but the new skin Moono is not loaded (html but no CSS). Although Moono is selected in the profiles. I set

config.skin = 'moono';

in config.js and the text editor is correctly displayed.

quicksketch’s picture

I've been working with CKEditor 4.x as a candidate for Drupal 8 core, which I've got demonstrated at: http://quicksketch.org/wysiwyg. I'd love to backport these changes into Drupal 7 too to get more eyeballs on the project. However this module takes a fairly different tack than the existing CKEditor module. Rather than showering the user with options it only exposes the most relevant configuration. Some options could certainly be extended.

In any case that version of the module has been written specifically for the 4.x version of CKEditor. The code for the project is in my WYSIWYG in core sandbox: http://drupal.org/sandbox/quicksketch/1088256

anrikun’s picture

Drupal 7.17
CKEditor 7.x-1.x-dev (from GIT)
ckeditor-dev (from GIT)
=> get JS error on node edit:

TypeError: ev.editor.addCss is not a function
ev.editor.addCss(ev.editor.config.extraCss);
line 52 in ckeditor.utils.js

Note that this error does not occur when using the standard package of CKEditor 4. So I guess this is related to some plugin that comes with the full package.

dczepierga’s picture

@anrikun, could u add in includes/ckeditor.utils.js after Drupal.ckeditor_ver = CKEDITOR.version.split('.')[0]; (line 47) following code:
console.log("CKE version: " + Drupal.ckeditor_ver); ?

After add this refresh page and check console (Firebug, Chrome Console...) which version of CKE do u see there and write it here, because it's look like it doesn't parse CKE version or do it wrong...

Greetings

dczepierga’s picture

I change choosing skin and uicolor - now it works in iframe - it was needed for CKEditor v4 because it not possible to change skin or use few editors with diffrent skins on one page. Of course it works also with CKEditor v3.

I commit all changes to GIT (diff)

Greetings and again really thx for help

---------------------------------------------------------------
EDIT:
New feature - checking skin availibility on CKEditor configuration page.
I've add this because CKEditor v4 doesn't has "kama" skin in default package (it is available in CKEditor builder or addons), so now if user has selected skin which not exists (skin files not found) warning will be displayed in CKEditor configuration page.

Changes commited to GIT (diff).

Greetings

anrikun’s picture

@dczepierga (#18)
It reports "%VERSION%" because ckeditor-dev does not have any fixed version.
I guess there's nothing to do about this :-(
Or maybe change condition to:

        if (Drupal.ckeditor_ver == 3) {
          ev.editor.addCss(ev.editor.config.extraCss);
        }
        else {
          CKEDITOR.addCss(ev.editor.config.extraCss);
        }
dczepierga’s picture

You have right, it's better to change this condition... it will be much easier for developers to use it if they write sth for Drupal and using CKEv4 from GIT.

Changes commited to GIT (diff)

dczepierga’s picture

I add next changes:
- cleaup code in ckeditor.admin.js - related with uicolor
- disable config field in uicolor plugin
- set skin of profile if saved not exists, then select default one (moono or kama) or select first on the list

All changes commited to GIT (diff)

dczepierga’s picture

Fix CKEditor version detect for configuration options in admin panel.
Changes commited to GIT (diff).

dczepierga’s picture

I commit fix for MediaEmbed plugin (diff).

Greetings

------------------------------
EDIT:
Add check if divarea plugin exists. If not configuration option in CKEditor profile is not visible.
Changes commited to GIT (diff).

mkesicki’s picture

Status: Needs review » Closed (fixed)
Optalgin’s picture

Status: Closed (fixed) » Active

Editor doesn't load when using latest CKEditor 4.0

I copied ckeditor 4 into sites/all/modules/ckeditor/ckeditor4 and
change the editor directory under admin/config/content/ckeditor/editg into %m/ckeditor4
Then instead of getting editor I get white area

I tried to edit and resave all my profiles (basic and advanced) - Nothing worked
Reverting to 3.x.x %m/ckeditor worked

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

@Optalgin, could u write here your errors in Firebug (Firefox addon)?

Greetings

Optalgin’s picture

TypeError: ev.editor.addCss is not a function
ev.editor.addCss(ev.editor.config.extraCss);

ckeditor.utils.js line 46

42   textarea_settings['on'] =
43  {
44      configLoaded : function(ev)
45      {
46          ev.editor.addCss(ev.editor.config.extraCss);
47      },
48      instanceReady : function(ev) 
49      { 

Let me know if you need more info

Optalgin’s picture

Status: Postponed (maintainer needs more info) » Fixed

Sorry, my mistake. Looks like my module upgrade failed
Using the latest 7.x-1.11 solved my problem

However upgrade didn't work right away
I got the following errors regarding the skin

"NetworkError: 404 Not Found - http://---/sites/all/modules/ckeditor/ckeditor/skins/kama/skin.js?t=CAPD" | skin.js?t=CAPD
"NetworkError: 404 Not Found - http://---/sites/all/modules/ckeditor/ckeditor/skins/kama/editor_gecko.css?t=CAPD"

I re-saved all profiles and also saved my user profile as described in #1854454: CKEditor interface not showing up on clean Drupal 7 install
Now everything works fine

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

more info