[Bug 43622] New: Advanced cataloguing editor (cataloguing/editor.pl) loads RequireJS and can conflict with plugins
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43622 Bug ID: 43622 Summary: Advanced cataloguing editor (cataloguing/editor.pl) loads RequireJS and can conflict with plugins Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Plugin architecture Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org CC: kyle@bywatersolutions.com, martin.renvoize@openfifth.co.uk, tomascohen@gmail.com Target Milestone: --- The "Ask the manual" plugin generating JS errors on the advanced editor view: Uncaught ReferenceError: docsearch is not defined <anonymous> http://dev-intra.localhost/api/v1/contrib/ask_the_manual/static/static_files... EventListener.handleEvent* http://dev-intra.localhost/api/v1/contrib/ask_the_manual/static/static_files... Uncaught TypeError: TextMARC.RecordToText is not a function Note that I fixed that in the plugin already but that may affect other plugins https://gitlab.com/joubu/koha-plugin-ask-the-manual/-/commit/5b53927ef2db5f2... -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43622 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43622 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 206668 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206668&action=edit Bug 43622: Prevent plugin UMD scripts from conflicting with RequireJS The advanced cataloguing editor (cataloguing/editor.pl) loads RequireJS. Plugin JavaScript injected via intranet_js is loaded afterwards with plain script tags. UMD bundles detect define.amd and register themselves as anonymous AMD modules instead of setting their global, which makes RequireJS throw "Mismatched anonymous define() module" and leaves the plugin code without the library it expects. This patch hides define.amd while plugin JavaScript is loaded, and restores it afterwards. define itself is kept so the editor's own asynchronously loaded modules keep working. Test plan: 1. Install a plugin that loads a UMD library from intranet_js (e.g. the "Ask the manual" plugin, which uses typesense-docsearch) 2. Go to Cataloguing > Advanced editor (cataloguing/editor.pl#catalog/4) 3. Notice the JS errors in the console: "Mismatched anonymous define() module" and "docsearch is not defined" 4. Apply this patch 5. Reload the page 6. No more JS errors, the plugin works and the editor loads the record Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org