Skip to content

Commit

Permalink
✨ Trigger event when saving drafts
Browse files Browse the repository at this point in the history
This is useful for plugins that want to replace the default editor and
use their own editor instead and need some work before their output can
be saved as syntax.
  • Loading branch information
micgro42 committed Jun 6, 2018
1 parent 8458d4b commit 59e1bba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inc/Ajax.php
Expand Up @@ -153,9 +153,13 @@ protected function call_lock() {
'client' => $client,
);
$cname = getCacheName($draft['client'] . $ID, '.draft');
if(io_saveFile($cname, serialize($draft))) {
echo $lang['draftdate'] . ' ' . dformat();
$event = new \Doku_Event('AJAX_SAVE_DRAFT', $draft);
if ($event->advise_before()) {
if (io_saveFile($cname, serialize($draft))) {
echo $lang['draftdate'] . ' ' . dformat();
}
}
$event->advise_after();
}

}
Expand Down

0 comments on commit 59e1bba

Please sign in to comment.