From 16063af045c82e68daeabab5212d75bdeec9e29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 9 Aug 2023 13:24:45 +0200 Subject: [PATCH] fix: Load editor on reference pickers for card create dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/AppInfo/Application.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 3a661cae0..bf4514280 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -60,6 +60,7 @@ use OCA\Deck\Search\DeckProvider; use OCA\Deck\Service\PermissionService; use OCA\Deck\Sharing\DeckShareProvider; use OCA\Deck\Sharing\Listener; +use OCA\Text\Event\LoadEditor; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; @@ -84,6 +85,8 @@ class Application extends App implements IBootstrap { public const COMMENT_ENTITY_TYPE = 'deckCard'; + private $referenceLoaded = false; + public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); @@ -91,8 +94,12 @@ class Application extends App implements IBootstrap { // (and use a listener class) $container = $this->getContainer(); $eventDispatcher = $container->get(IEventDispatcher::class); - $eventDispatcher->addListener(RenderReferenceEvent::class, function () { + $eventDispatcher->addListener(RenderReferenceEvent::class, function (RenderReferenceEvent $e) use ($eventDispatcher) { Util::addScript(self::APP_ID, self::APP_ID . '-reference'); + if (!$this->referenceLoaded && class_exists(LoadEditor::class)) { + $this->referenceLoaded = true; + $eventDispatcher->dispatchTyped(new LoadEditor()); + } }); }