From b09a0c60f38012348f7534584c76e7354e9c050b Mon Sep 17 00:00:00 2001 From: Vaidehi Joshi Date: Tue, 4 Feb 2020 08:32:06 -0800 Subject: [PATCH] Add comment to highlight difference between previewing in v1 and v2 editors (#5894) A follow-up to https://github.com/thepracticaldev/dev.to/pull/5873. --- app/javascript/article-form/elements/bodyPreview.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/article-form/elements/bodyPreview.jsx b/app/javascript/article-form/elements/bodyPreview.jsx index a85c8717e..f7c25a97e 100644 --- a/app/javascript/article-form/elements/bodyPreview.jsx +++ b/app/javascript/article-form/elements/bodyPreview.jsx @@ -29,6 +29,10 @@ function titleArea(previewResponse, version, articleState) { }); } + // The v2 editor stores its cover image in articleState.mainImage, while the v1 editor + // stores it as previewRespose.cover_image. When previewing, we handle both by + // defaulting to setting the cover image to the mainImage on the article (v2), + // and only using the cover image from the previewResponse if it exists (v1). let coverImage = articleState.mainImage || ''; if (articleState.previewShowing) { // In preview state, use the cover_image from previewResponse.