[Bug 42347] New: Generalise advanced editor's value_builder shortcut to all framework-defined plugins
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42347 Bug ID: 42347 Summary: Generalise advanced editor's value_builder shortcut to all framework-defined plugins Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Depends on: 40633 Bug 40633 added a Shift-Ctrl-H shortcut in the advanced cataloging editor that opens the helper popup for the four MARC21 fixed-length fields (Leader, 006, 007, 008). The dispatch is hard-coded by tag because those control fields have no marc_subfield_structure rows. This bug proposes extending the same shortcut so that, when the cursor is on any subfield whose framework definition has a value_builder set, the editor opens that plugin too. This would bring the advanced editor closer to feature parity with the basic editor's value_builder integration (call number browser, organisation code, accession date, custom site plugins, etc). Suggested approach ================== 1. Add KohaBackend.GetValueBuilder(frameworkcode, tag, code) to koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js. The framework JSON returned by svc/cataloguing/framework already carries the value_builder column on each marc_subfield_structure row (see koha-backend.js:56-61), so this is a small lookup helper. 2. Extend _editorKeys[open_helper_plugin] in marc-editor.js: - Existing tag-keyed map continues to handle control fields. - Otherwise call field.getSubfieldAt(cursor.ch) and look up value_builder for the current (framework, tag, code). - Use a unique buffer id per invocation (or a shared buffer plus a 'pending writeback target' pointer) and call EditorSubfield.setText() for the writeback so only the current subfield is replaced, not the whole line. 3. Compatibility filtering. Some plugins are not safe to run standalone: - Plugins with a meaningful Focus<id> half (e.g. barcode.pl auto-fills on focus) - without the basic editor's focus binding the side effect is silently lost. See Koha::FrameworkPlugin::_generate_js (Koha/FrameworkPlugin.pm:320-388) for the convention. - Plugins that mutate sibling DOM inputs. Suggested mitigations, in order of preference: - Add a metadata flag to plugin definitions and skip plugins that do not opt in. - Maintain an explicit safelist in JS as a stop-gap. 4. (Stretch) Apply the same tag-keyed dispatch to UNIMARC control fields (100, 105, 106, 110, 115, ...), gated on the marcflavour resource already loaded by the editor. Out of scope: changes to existing plugin templates, or any change to basic-editor behaviour. Test plan: to be completed once the implementation approach is agreed. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40633 [Bug 40633] Add keyboard shortcut to advanced cataloging editor for fixed length field plugins -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org