Crud: CKEDITOR.style.addCustomHandler is not a function

Created on 23 Jun 2017  路  14Comments  路  Source: Laravel-Backpack/CRUD

Where ever there is an editor, I get the following error in my console.

Is it only me?

plugin.js?t=DBAA:3200 Uncaught TypeError: CKEDITOR.style.addCustomHandler is not a function
at http://backpack.dev/vendor/backpack/ckeditor/plugins/widget/plugin.js?t=DBAA:3200:18
at http://backpack.dev/vendor/backpack/ckeditor/plugins/widget/plugin.js?t=DBAA:3359:5
at http://backpack.dev/vendor/backpack/ckeditor/plugins/widget/plugin.js?t=DBAA:3368:4

Bug Feature help wanted

Most helpful comment

To fix this, grab the following Build config: https://gist.github.com/marconett/647ab9a3b5af1566f46e3657340330fa and upload it to http://ckeditor.com/builder. Alter languages and maybe choose another skin.

Download and replace the ckeditor folder in public/vendor/backpack/.

The build-config.js included in Laravel-Backpack/CRUD doesn't include everything that's required (namely the plugins oembed and widget).

All 14 comments

Same here. plugin.js tries to use a function available starting CKEditor 4.4, but the provided Version is 4.3.1.

To fix this, grab the following Build config: https://gist.github.com/marconett/647ab9a3b5af1566f46e3657340330fa and upload it to http://ckeditor.com/builder. Alter languages and maybe choose another skin.

Download and replace the ckeditor folder in public/vendor/backpack/.

The build-config.js included in Laravel-Backpack/CRUD doesn't include everything that's required (namely the plugins oembed and widget).

I followed the instruction but I get the following errors.

ckeditor.js:77 GET http://backpack-aktiv.dev/vendor/backpack/ckeditor/plugins/oembed/plugin.js?t=DBAA
ckeditor.js:77 GET http://backpack-aktiv.dev/vendor/backpack/ckeditor/plugins/widget/plugin.js?t=DBAA 404 (Not Found)
ckeditor.js:219 Uncaught [CKEDITOR.resourceManager.load] Resource name "oembed" was not found at "http://backpack-aktiv.dev/vendor/backpack/ckeditor/plugins/oembed/plugin.js?t=DBAA".

Might be a problem with the builder then. You need to manually select the oembed and widget plugin in the CKEditor builder.

What uses the updated function? Is it something in backpack?

The ckedit widget plugins included in backpack crud is trying to access a function that isn't available in that version of ckedit, see https://github.com/Laravel-Backpack/CRUD/search?utf8=%E2%9C%93&q=addCustomHandler&type=

This github the addCustomHandler is being called, but it's not defined (otherwise my github search should also show the function in https://github.com/Laravel-Backpack/CRUD/blob/master/src/public/ckeditor/ckeditor.js)

@indra1 I believe you had a working solution for this?

As I said, the ckeditor.js contained in this repo is too old.

https://github.com/Laravel-Backpack/CRUD/blob/master/src/public/ckeditor/plugins/widget/plugin.js uses the function CKEDITOR.style.addCustomHandler, which is not avalable in https://github.com/Laravel-Backpack/CRUD/blob/master/src/public/ckeditor/ckeditor.js.

simply upgrading the included ckeditor does the trick.

Thank you @marconett! Solved my problem.

Hi @marconett , @japracool ,

Thanks a lot. I've just updated ckeditor to 4.9.2 and it indeed fixes it. Check it out here https://github.com/Laravel-Backpack/CRUD/commit/32b31efbeda9227f250deeeffed86ec3b2bf4dbe. It will be available starting with CRUD 3.4.10, that I'll tag later today.

Thanks, cheers!

This seems to still be broken in the latest version of the Crud module.

My current version in composer.lock :

"name": "backpack/crud",
"version": "3.5.10",

I still see the error in the CMS. I can confirm that the manual fix from @marconett still solves the problem for anyone else having this issue.

It seems like the file was deleted completely from the repo? Is it generated at install time perhaps?

https://github.com/Laravel-Backpack/CRUD/commit/32b31efbeda9227f250deeeffed86ec3b2bf4dbe#diff-547b075318092905a2f51ede9235e425

Hmmm... @osmanzeki - no, just checked, the file is still there, updated, with the fix. Maybe you didn't re-publish the assets when you upgraded to 3.5?

If your public/vendor/backpack/ckeditor/ckeditor.js file starts with 2018 (Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.), you have the _new_ file. Maybe your browser cached it, try a Ctrl + Shift + R (or Cmd + Shift + R on a mac).

If your public/vendor/backpack/ckeditor/ckeditor.js file starts with 2013 (Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.) you have the _old_ file. Re-publish the assets.

Hope it helps.
Cheers!

Hmmm... @osmanzeki - no, just checked, the file is still there, updated, with the fix. Maybe you didn't re-publish the assets when you upgraded to 3.5?

If your public/vendor/backpack/ckeditor/ckeditor.js file starts with 2018 (Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.), you have the _new_ file. Maybe your browser cached it, try a Ctrl + Shift + R (or Cmd + Shift + R on a mac).

If your public/vendor/backpack/ckeditor/ckeditor.js file starts with 2013 (Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.) you have the _old_ file. Re-publish the assets.

Hope it helps.
Cheers!

I retried it and it seems to work now. I had previously done a clean install and had the problem, tried it again and now it seems to be working. I remember that I had tried to install a few unofficial add-ons and am starting to wonder if it isn't one of those that caused the problem. I'll let you know here if I find out what happened.

Thanks!
Oz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

packytagliaferro picture packytagliaferro  路  3Comments

gotrecillo picture gotrecillo  路  3Comments

lotarbo picture lotarbo  路  3Comments

mikael1000 picture mikael1000  路  3Comments

sonoftheweb picture sonoftheweb  路  3Comments