Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I use Bower to install/keep track of my libraries, and for whatever reason, the Bower version of TinyMCE 4 installs without the '/js/tinymce' path structure. I'm going to attach a patch to account for this.
Comment | File | Size | Author |
---|---|---|---|
#2 | wysiwyg_tinymce4_bower-2852729-1.patch | 1022 bytes | Ambient.Impact |
Comments
Comment #2
Ambient.ImpactComment #3
Ambient.ImpactComment #4
TwoDWhat does your Bower file look like?
Comment #5
Ambient.ImpactThanks for getting back to me.
This is my bower.json:
This file sits just outside of the Drupal root directory. I also have a .bowerrc alongside it with these contents:
Comment #6
TwoDI've tested a couple of package managers and it seems most of them, if not all, leave out the 'js' folder but some (like composer) will still have a nested 'tinymce' folder. (I only tried installing it into the default 'vendor' folder though so that may be possible to adjust.)
Your patch unfortunately breaks paths to plugins and themes when not using a package manager as they're all relative to 'library path'.
You can implement
hook_wysiwyg_editor_alter(&$editors)
to change the library definition to work around this in your installations.Comment #7
Ambient.ImpactThanks for pointing me in the right direction, I'll do that.
Comment #8
Ambient.ImpactHI there. I finally got around to trying your advice, but it didn't seem to stick, which made me fall back to relying on patching the module. First off, I modified the TinyMCE info via
hook_wysiwyg_editor_alter()
. I updated the library path and also added my own version callback since the one you have hard codes the '/js/tinymce' path. :( That all worked, in that the info was correct and updated, but for whatever reason the module wasn't reflecting my changes, despite clearing the cache and all. Yes, I did check that the function was running, usingdpm()
to check that I had changed the info correctly, and&$editors
was indeed a reference (I hadn't forgotten the ampersand), but no luck. Let me know if this is something you'd be able to look into. Thanks.Comment #9
dkh CreditAttribution: dkh at NREL commentedI tested this patch and it works great with asset-packagist.
"require": {
"bower-asset/tinymce": "4.5.7",
}
Comment #10
TwoDHmm, I should have left this as "Needs work" due to #6.
@dhk, does asset-packagist keep the same folder structure as the normal TinyMCE releases do?
I've had issues with some packages there being severely bloated and holding the source, release builds, minified release builds, and zips of both release builds so I've seen it as too much of an overhead compared to simply manually downloading and committing in the libs to git directly. You don't get automated updates that way, but there's also no risk of deploying all the bloat (example scripts allowing insecure file uploads, anyone?).