Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monaco is not defined on CP CKEditor configs #150

Closed
realjoshharrison opened this issue Nov 30, 2023 · 8 comments
Closed

monaco is not defined on CP CKEditor configs #150

realjoshharrison opened this issue Nov 30, 2023 · 8 comments
Assignees
Labels

Comments

@realjoshharrison
Copy link

Description

Hi! Small javascript error when defining CKEditor configs in the CP. monaco is not defined. This seems to have stopped some features of the config editor fields from working properly, e.g. autocompletion on the JSON mode, and config text field auto-sizing.

Steps to reproduce

  1. Clean Craft install, install CKEditor plugin
  2. Go to define a config in settings/ckeditor
  3. Look at dev console – a javascript reference error is thrown.

Additional info

  • Craft version: 4.5.11.1 Pro
  • PHP version: 8.2.0
  • Database driver & version: MySQL 5.7.39
  • Plugins & versions: CKEditor 3.6.0, CP Field Inspect 1.4.4

Thanks for taking a look :)

@realjoshharrison realjoshharrison changed the title monaco is not defined when defining CKEditor config monaco is not defined on CP CKEditor configs Nov 30, 2023
@justinholtweb
Copy link

+1 I am experiencing this also on a brand new install of CK Editor.

To note: this is a multisite and I am also getting an additional JS error:

linkui.js:40 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'join')
    at a.value (linkui.js:40:48)

Attaching a screenshot of the editor screen

Screen Shot 2023-11-30 at 11 17 59 AM

@i-just
Copy link
Contributor

i-just commented Dec 1, 2023

Hi, thanks for getting in touch!

Looks like this is fixed in the latest version of nystudio107/craft-code-editor (see changelog: https://github.com/nystudio107/craft-code-editor/blob/develop/CHANGELOG.md#1016---20231130).

It worked as expected up to and including 1.0.13 and is fixed in 1.0.16, but 1.0.16 is not yet available on Packagist.

You can temporarily fix this by requiring "nystudio107/craft-code-editor": "1.0.13" or "nystudio107/craft-code-editor": "dev-develop#58e469ba2c2798150706bd11ae7fa6b854006208 as 1.0.15" in your composer.json and running composer update.

(I also raised a PR to update the composer requirement for the CKEditor plugin to skip over versions 1.0.14 and 1.0.15.)

@realjoshharrison
Copy link
Author

Hi Iwona, thank you for taking a look so quickly, and the explanation!

I'll wait for the update, and use your fix if I run into problems 🙂

@realjoshharrison
Copy link
Author

Hi @i-just - I have added "nystudio107/craft-code-editor": "1.0.13" to my composer.jsonand updated, which all works as expected. Can I ask whether I need to do remove it again once the proper fix ships?

@i-just
Copy link
Contributor

i-just commented Dec 5, 2023

@realjoshharrison, yes, it would be best to remove it then.

@khalwat
Copy link

khalwat commented Dec 8, 2023

The fix has already shipped; apparently there's a bug downstream in the Monaco editor package which no longer exposes the global API, but I put in a fix already.

You just got unlucky if you ran into this, updating within the window that the regression went unnoticed.

The semver in the CK Editor's composer.json is:

    "nystudio107/craft-code-editor": "^1.0.8"

...which means it will get updates to the latest version automatically, so you don't need to put it in your project's composer.json, you can just do:

composer update nystudio107/craft-code-editor

...to update to the latest version at any time.

@khalwat
Copy link

khalwat commented Dec 8, 2023

This issue should be closed, it's already been addressed downstream in craft-code-editor nystudio107/craft-code-editor@dea2736

@khalwat
Copy link

khalwat commented Dec 8, 2023

It worked as expected up to and including 1.0.13 and is fixed in 1.0.16, but 1.0.16 is not yet available on Packagist.

I didn't tag that release properly, thanks for the heads up. I've re-tagged it, we should be good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants