*/ // See help: // * https://www.dokuwiki.org/devel:section_editor // * https://www.dokuwiki.org/devel:releases:refactor2021 use dokuwiki\Form\Form; use dokuwiki\Utf8; class action_plugin_bpmnio_editor extends DokuWiki_Action_Plugin { public function register(Doku_Event_Handler $controller) { $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'secedit_button'); $controller->register_hook('EDIT_FORM_ADDTEXTAREA', 'BEFORE', $this, 'handle_form'); $controller->register_hook('HTML_EDIT_FORMSELECTION', 'BEFORE', $this, 'handle_form'); $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_post'); } function secedit_button(Doku_Event $event) { if ($this->_shall_ignore($event)) return; $event->data['name'] = $this->getLang('edit_diagram'); } function handle_form(Doku_Event $event) { if ($this->_shall_ignore($event)) return; global $TEXT; global $RANGE; global $INPUT; if (!$RANGE) { // section editing failed, use default editor instead $event->data['target'] = 'section'; return; } $event->stopPropagation(); $event->preventDefault(); $form = &$event->data['form']; $data = base64_encode($TEXT); $type = 'bpmn'; if ($event->data['target'] === 'plugin_bpmnio_dmn') $type = 'dmn'; $this->_addHidden($form, 'plugin_bpmnio_data', $data); $this->_addHTML($form, <<