galetahub / ckeditor

Ckeditor 4.x integration gem for rails
https://ckeditor.com/ckeditor-4/
MIT License
2.22k stars 881 forks source link

editor-element-conflict when using simple_form helper #894

Closed yourtallness closed 3 years ago

yourtallness commented 4 years ago

For all inputs converted to ckeditor via the simple_form helper (`as: :ckeditor), I get:

editor-element-conflict

It appears to be getting initialized twice.

Please advise.

Loading ckeditor from CDN: //cdn.ckeditor.com/4.14.1/standard/ckeditor.js

Gem version: 5.1.0

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jbritten commented 3 years ago

I'm having the same issue (simple_form, ckeditor gem 5.1.0 loading from CDN). Did you ever find a solution?

hilarysk commented 3 years ago

Same thing here - gem 5.1.0, loading from CDN //cdn.ckeditor.com/4.15.0/basic/ckeditor.js

davelens commented 3 years ago

+1

I'm guessing it has something to do with where CK is initialized. Moving it from inside <head> to right before </body> fixes the error, but seems to ignore app/assets/javascripts/ckeditor/config.js and my toolbar settings.

kluka-CS commented 2 years ago

We also ran into this. Did anyone managed to fix this for them?

using it with version 4.17.1 basic

[CKEDITOR] Error code: editor-element-conflict. 
Object { editorName: "note_text" }
ckeditor.js:21:171
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:21
    q https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:10
    fire https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:12
    error https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:20
    _getEditorElement https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:295
    a https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:368
    replace https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:373
    replaceAll https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:374
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:377
    b https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    a https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    (Async: EventListener.handleEvent)
    domReady https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:18
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:19
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:19
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:1299
[CKEDITOR] For more information about this error go to https://ckeditor.com/docs/ckeditor4/latest/guide/dev_errors.html#editor-element-conflict ckeditor.js:21:266
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:21
    q https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:10
    fire https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:12
    error https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:20
    _getEditorElement https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:295
    a https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:368
    replace https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:373
    replaceAll https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:374
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:377
    b https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    a https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    (Async: EventListener.handleEvent)
    domReady https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:7
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:18
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:19
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:19
    <anonymous> https://cdn.ckeditor.com/4.17.1/standard/ckeditor.js:1299
akaspick commented 2 years ago

@davelens Same issue. Error goes away, but config is ignored.

I see the config defaults to standard 4.11.3: https://github.com/galetahub/ckeditor/blob/8200ccdbf789669d154b800aab329db8f46aabdc/lib/ckeditor.rb#L78

I had originally set my cdn_url to "//cdn.ckeditor.com/4.17.1/basic/ckeditor.js" and this throws an error. If I don't set the cdn_url and let it use the default (4.11.3), then I no longer have any loading issues and my custom config is loaded.

@galetahub This issue might need to be reopened to deal with the loading issue when using a custom cd_url.