Problem/Motivation

Download codemirror library in the right directory and see that the codemirror element won't work as expected.

Steps to reproduce

1) Create a webform with a codemirror element.
2) Check the webform and see that it works.
3) Download codemirror library.
4) Check the element won't display properly anymore.

Comments

paulocs created an issue. See original summary.

jrockowitz’s picture

Status: Active » Postponed (maintainer needs more info)

I am not able to reproduce this issue.

paulocs’s picture

Status: Postponed (maintainer needs more info) » Active

That is the error I get when I download https://github.com/codemirror/CodeMirror/releases/tag/5.61.1 library.

paulocs’s picture

StatusFileSize
new107.25 KB
jrockowitz’s picture

Issue summary: View changes
StatusFileSize
new288.82 KB

I am not able to reproduce this issue. Can you look and confirm the file does not exist?

paulocs’s picture

Am I downloading the library from the right link? https://github.com/codemirror/CodeMirror/releases/tag/5.61.1

Do I have to download anything else?

Because if you check the lib folder in the repo tag page, it does not have the codemirror.js file. See: https://github.com/codemirror/CodeMirror/tree/5.61.1/lib.

jrockowitz’s picture

When I download https://github.com/components/codemirror/archive/5.61.1.zip it container the lib/codemirror.js file. Later versions are missing the file.

paulocs’s picture

aaah, I'm downloading from the wrong repository....

In webform.libraries.yml, the repository is: https://github.com/codemirror/codemirror
See:

libraries.codemirror.text:
  remote: https://github.com/codemirror/codemirror
  version: &webform_codemirror_version '5.61.1'
  license: &webform_codemirror_license
    name: MIT
    url: http://codemirror.net/LICENSE
    gpl-compatible: true
  directory: &webform_codemirror_directory codemirror
  cdn: &webform_codemirror_cdn
    /libraries/codemirror/lib/: https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.61.1/
    /libraries/codemirror/: https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.61.1/
  css:
    component:
      /libraries/codemirror/lib/codemirror.css: {}
  js:
    /libraries/codemirror/lib/codemirror.js: { weight: -1 }
    /libraries/codemirror/addon/runmode/runmode.js: {}
    /libraries/codemirror/addon/display/placeholder.js: {}

Shouldn't it be remote: https://github.com/components/codemirror?

jrockowitz’s picture

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new430 bytes

The best compromise is to add a download property to the webform.libraries.yml definition.

paulocs’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense. Thanks a lot @jrockowitz

  • jrockowitz authored 30a5abd on 6.x
    Issue #3254993 by jrockowitz, paulocs: Codemirror does not work when the...

  • jrockowitz authored 30a5abd on 6.1.x
    Issue #3254993 by jrockowitz, paulocs: Codemirror does not work when the...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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