- Issue created by @leducdubleuet
- 🇮🇳India someshver Panchkula
I am also getting the same issue. Do we have any fix for this issue?
- 🇦🇺Australia Feng-Shui
Bumping the codemirror/codemirror package in composer.libraries.json from 5.65.8 to 5.65.19 (latest version on the 5.x branch) seems to resolve this issue.
- 🇨🇦Canada leducdubleuet Chicoutimi QC
I tried the patch in the MR but even with codemirror/codemirror version 5.65.19, it still does not work and I get the same error when clicking the "Source" button in the browser's console :
Uncaught CKEditorError: obj.hasOwnProperty is not a function
Thank you.
- 🇺🇸United States CMS_MacGyver
Tried the MR as well.
I even pulled down https://registry.npmjs.org/codemirror/-/codemirror-5.65.19.tgz
and updated libraries/codemirror, but I still get the error. - 🇺🇸United States CMS_MacGyver
update libraries/codemirror/lib/codemirror.js
replace the copyObj function with the following
function copyObj(obj, target, overwrite) {
if (!target) { target = {}; }
for (var prop in obj)
{
if (Object.prototype.hasOwnProperty.call(obj, prop) && (overwrite !== false || !Object.prototype.hasOwnProperty.call(target, prop)))
{
target[prop] = obj[prop];
}
}
return target
}be sure to clear Drupal caches before testing the change.
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
It would be helpful for this to be added as a patch that can be applied with Composer.
- 🇦🇺Australia Feng-Shui
I'll try and get some more time on this today, I was working on that MR in the context of an existing site, I need to pull it into a clean D11 site.
- 🇦🇺Australia reepy
@liam-morland if you add `.diff` on the end of the MR you get a patch for composer. Just be aware it can change when the MR changes.
https://git.drupalcode.org/project/ckeditor_codemirror/-/merge_requests/...
- 🇦🇺Australia Feng-Shui
Issue is upstream: https://github.com/cdubz/ckeditor5-source-editing-codemirror/issues/1
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
@#10 I was referring to the patch in #8, which is not a patch to this module.
- 🇦🇺Australia Feng-Shui
We've resolved this temporarily by building the patched version of the upstream library from the MR, adding a copy of the built js to our site, and then patching this module's ckeditor_codemirror.libraries.yml to load our local version.
- 🇺🇸United States nkasprak
Issue has been fixed upstream: https://github.com/cdubz/ckeditor5-source-editing-codemirror/issues/1#is...
- 🇺🇸United States wisneskit
Question -- can someone in the thread be more specific at to what the actual fix for this issue is. Also, what file to update (much appreciated). Thanks.
- 🇺🇸United States protitude
#8 worked for me, but this is an upstream issue as already stated so I had to hack it in there. Here is what I did to fix the issue temporarily for myself in case it's helpful to others. I patched the file (libraries/codemirror/lib/codemirror.js) as described in #8 — here's a gist in case someone just wants the full file: https://gist.github.com/protitude/9d2992291f86109d5806dbcd1ac5f999
Then I committed that fixed file to my patches directory and updated my composer file to copy the updated file under the scripts section, here's a snippet:
"scripts": { "post-drupal-scaffold-cmd": [ "rm web/libraries/codemirror/lib/codemirror.js && cp patches/codemirror.js web/libraries/codemirror/lib/codemirror.js" ], }
Now everything is working happily in my deployment. Hopefully this will help others until we get a proper fix upstream
- 🇺🇸United States wisneskit
The fix does work that #8 had presented, but for me only after making the subsequent change that #17 suggested in the libraries/codemirror/lib/codemirror.js file. Thanks.
@reepy, you can download the file to the patches directory and reference the downloaded patch/diff file.
- 🇨🇦Canada leducdubleuet Chicoutimi QC
I tried the proposed temporary manual fix with no success...
If this is fixed upstream, what's left to be done in the module to make it work?
Would it be possible to have a new version of this module using the fixed library?
Thank you!