craftcms / ckeditor

Edit rich text content in Craft CMS using CKEditor.
https://plugins.craftcms.com/ckeditor
GNU General Public License v3.0
46 stars 23 forks source link

Cannot read properties of undefined (reading 'onDidPaste') #215

Closed jcdarwin closed 3 months ago

jcdarwin commented 4 months ago

Description

After upgrading craftcms/ckeditor (3.0.0 => 3.8.3), I find that when I visit the settings page (either for an existing configuration, or for a new configuration), I don't see any toolbar items either in the top area (i.e. under "Drag toolbar items into the editor") or bottom area (the toolbar).

I notice that there is an error in the dev tools console:

jquery.js?v=1714800000:2 jQuery.Deferred exception: Cannot read properties of undefined (reading 'onDidPaste') TypeError: Cannot read properties of undefined (reading 'onDidPaste')
    at s.constructor.init (https://localhost.chinacapable.org.nz/cpresources/b22f9e9e/ckeconfig.js?v=1713667100:2:4289)
    at s.constructor.constructor (https://localhost.chinacapable.org.nz/cpresources/e6dedc42/garnish.js?v=1714800000:2:2989)
    at s.constructor (https://localhost.chinacapable.org.nz/cpresources/e6dedc42/garnish.js?v=1714800000:2:1243)
    at new s.constructor (https://localhost.chinacapable.org.nz/cpresources/e6dedc42/garnish.js?v=1714800000:2:1243)
    at HTMLDocument.<anonymous> (https://localhost.chinacapable.org.nz/manage/settings/ckeditor/new:803:23)
    at l (https://localhost.chinacapable.org.nz/cpresources/5a4f71eb/jquery.js?v=1714800000:2:30361)
    at c (https://localhost.chinacapable.org.nz/cpresources/5a4f71eb/jquery.js?v=1714800000:2:30663) undefined

jquery.js?v=1714800000:2 Uncaught TypeError: Cannot read properties of undefined (reading 'onDidPaste')
    at s.constructor.init (ConfigOptions.js:93:21)
    at s.constructor.constructor (Base.js:20:15)
    at s.constructor (Base.js:32:21)
    at new s.constructor (Base.js:32:21)
    at HTMLDocument.<anonymous> (new:803:23)
    at l (jquery.js?v=1714800000:2:30361)
    at c (jquery.js?v=1714800000:2:30663)

I can confirm that this error did not appear in the devtools console in the previously-installed version (3.0.0)

However, the toolbar in a ckeditor field in an entry looks OK.

Steps to reproduce

  1. Upgrade to 3.8.3
  2. Visit /admin/settings/ckeditor/new
  3. See that there is no toolbar / toolbar icons showing, and the error mentioned above appears in the devtools console.

Additional info

i-just commented 4 months ago

Hi, thanks for reaching out! I can replicate this problem, but the error I see is different. For me, the issue was resolved after I cleared the “Compiled templates” cache. Could you please try that and let me know if it solved the problem? (You can clear the caches via Control Panel > Utilities > Caches or via the command line.)

jcdarwin commented 3 months ago

Thanks @i-just -- that worked perfectly -- closing this issue.