Prevent autosave exports and preserve raw Markdown

This commit is contained in:
interlope committed 2026-11-01 19:36:09 +01:00
1 parent c56ae0ced2
commit 2343999485
4 files changed
+27 -7

No files matched your search

+7 -5
View File
@@ -112,10 +112,11 @@ class pluginBluditGithub extends Plugin
public function afterPageCreate($key)
{
try {
if ($this->importing || empty($key) || !$this->isConfigured()) {
if ($this->importing || empty($key) || strpos($key, 'autosave-') === 0 || !$this->isConfigured()) {
return;
}
$page = new Page($key);
if ($page->getValue('type') === 'autosave') { return; }
$isDraft = $page->getValue('type') === 'draft';
$shouldAutoExport = $isDraft ? $this->getValue('exportDraftsAuto') : $this->getValue('exportPublishedAuto');
@@ -130,10 +131,11 @@ class pluginBluditGithub extends Plugin
public function afterPageModify($key)
{
try {
if ($this->importing || empty($key) || !$this->isConfigured()) {
if ($this->importing || empty($key) || strpos($key, 'autosave-') === 0 || !$this->isConfigured()) {
return;
}
$page = new Page($key);
if ($page->getValue('type') === 'autosave') { return; }
$isDraft = $page->getValue('type') === 'draft';
$shouldAutoExport = $isDraft ? $this->getValue('exportDraftsAuto') : $this->getValue('exportPublishedAuto');
@@ -148,7 +150,7 @@ class pluginBluditGithub extends Plugin
public function afterPageDelete($key)
{
try {
if ($this->importing || empty($key) || !$this->isConfigured()) {
if ($this->importing || empty($key) || strpos($key, 'autosave-') === 0 || !$this->isConfigured()) {
return;
}
@@ -486,7 +488,7 @@ class pluginBluditGithub extends Plugin
private function exportPage($page, $saveStatus = true)
{
$key = $page->getValue('key');
$rawContent = $page->content();
$rawContent = $page->contentRaw();
// Export images using URLs found in the content (before rewriting)
$this->exportImages($key, $rawContent . "\n" . $page->coverImage());
@@ -623,7 +625,7 @@ class pluginBluditGithub extends Plugin
private function buildMarkdown($page, $key, $rawContent = null)
{
$content = $rawContent ?? $page->content();
$content = $rawContent ?? $page->contentRaw();
// Rewrite absolute Bludit upload URLs to relative img/ paths
// e.g. https://domain/bl-content/uploads/pages/UUID/image.png → ../img/image.png