From 4f09eb3f80b1f03a9f71e46e642c391034fd12b4 Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Thu, 14 Nov 2024 15:42:17 +0000 Subject: [PATCH] pkp/pkp-lib#10578 Fix: Can't upload images to TinyMCE at site level --- TinyMCEPlugin.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TinyMCEPlugin.php b/TinyMCEPlugin.php index 92c491c..2e4a351 100644 --- a/TinyMCEPlugin.php +++ b/TinyMCEPlugin.php @@ -96,9 +96,8 @@ public function registerJS(string $hookName, array $args): bool ]; } $context = $request->getContext(); - if ($context) { - $data['uploadUrl'] = $request->getDispatcher()->url($request, Application::ROUTE_API, $context->getPath(), '_uploadPublicFile'); - } + $contextPath = $context ? $context->getPath() : Application::SITE_CONTEXT_PATH; + $data['uploadUrl'] = $request->getDispatcher()->url($request, Application::ROUTE_API, $contextPath, '_uploadPublicFile'); $templateManager->addJavaScript( 'tinymceData', '$.pkp.plugins.generic = $.pkp.plugins.generic || {};' .