diff --git a/system/typemill/Controllers/ControllerApiAuthorArticle.php b/system/typemill/Controllers/ControllerApiAuthorArticle.php index 70f4390..02c9258 100644 --- a/system/typemill/Controllers/ControllerApiAuthorArticle.php +++ b/system/typemill/Controllers/ControllerApiAuthorArticle.php @@ -14,6 +14,7 @@ use Typemill\Models\Sitemap; use Typemill\Static\Slug; use Typemill\Static\Translations; use Typemill\Events\OnPagePublished; +use Typemill\Events\OnPageUpdated; use Typemill\Events\OnPageUnpublished; use Typemill\Events\OnPageDeleted; use Typemill\Events\OnPageSorted; @@ -258,6 +259,8 @@ class ControllerApiAuthorArticle extends Controller $markdownArray = $content->markdownTextToArray($markdown); $content->saveDraftMarkdown($item, $markdownArray); + $this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated'); + $naviFileName = $navigation->getNaviFileNameForPath($item->path); $navigation->clearNavigation([$naviFileName]); diff --git a/system/typemill/Controllers/ControllerApiAuthorBlock.php b/system/typemill/Controllers/ControllerApiAuthorBlock.php index 17f1500..96d11f7 100644 --- a/system/typemill/Controllers/ControllerApiAuthorBlock.php +++ b/system/typemill/Controllers/ControllerApiAuthorBlock.php @@ -10,6 +10,7 @@ use Typemill\Models\Validation; use Typemill\Models\Content; use Typemill\Models\Meta; use Typemill\Static\Translations; +use Typemill\Events\OnPageUpdated; class ControllerApiAuthorBlock extends Controller { @@ -96,6 +97,9 @@ class ControllerApiAuthorBlock extends Controller return $response->withHeader('Content-Type', 'application/json')->withStatus(500); } + $markdown = $content->markdownArrayToText($draftMarkdown); + $this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated'); + $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); # if it was published before, then we need to refresh the navigation @@ -197,6 +201,9 @@ class ControllerApiAuthorBlock extends Controller return $response->withHeader('Content-Type', 'application/json')->withStatus(500); } + $markdown = $content->markdownArrayToText($draftMarkdown); + $this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated'); + $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); # if it was published before, then we need to refresh the navigation @@ -311,6 +318,9 @@ class ControllerApiAuthorBlock extends Controller return $response->withHeader('Content-Type', 'application/json')->withStatus(500); } + $markdown = $content->markdownArrayToText($draftMarkdown); + $this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated'); + $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); # if it was published before, then we need to refresh the navigation @@ -416,6 +426,9 @@ class ControllerApiAuthorBlock extends Controller return $response->withHeader('Content-Type', 'application/json')->withStatus(500); } + $markdown = $content->markdownArrayToText($draftMarkdown); + $this->c->get('dispatcher')->dispatch(new OnPageUpdated($markdown), 'onPageUpdated'); + $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); # if it was published before, then we need to refresh the navigation diff --git a/system/typemill/Events/OnPageUpdated.php b/system/typemill/Events/OnPageUpdated.php new file mode 100644 index 0000000..03f13ce --- /dev/null +++ b/system/typemill/Events/OnPageUpdated.php @@ -0,0 +1,14 @@ +