From a1b607db80e9a3a9f79ec7bab3855f6a9216baae Mon Sep 17 00:00:00 2001 From: Keegan George Date: Tue, 27 Feb 2024 15:13:46 -0800 Subject: [PATCH] FIX: Composer service call breaking shared edits (#494) --- assets/javascripts/initializers/ai-image-caption.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/initializers/ai-image-caption.js b/assets/javascripts/initializers/ai-image-caption.js index f099d530..5b3d61e8 100644 --- a/assets/javascripts/initializers/ai-image-caption.js +++ b/assets/javascripts/initializers/ai-image-caption.js @@ -12,7 +12,6 @@ export default apiInitializer("1.25.0", (api) => { }; const imageCaptionPopup = api.container.lookup("service:imageCaptionPopup"); const settings = api.container.lookup("service:site-settings"); - const composer = api.container.lookup("service:composer"); const appEvents = api.container.lookup("service:app-events"); const site = api.container.lookup("site:main"); @@ -56,6 +55,8 @@ export default apiInitializer("1.25.0", (api) => { if (site.mobileView) { // Auto-saves caption on mobile view + const composer = api.container.lookup("service:composer"); + const matchingPlaceholder = composer.model.reply.match(IMAGE_MARKDOWN_REGEX); const match = matchingPlaceholder[imageIndex];