From b03f72c59eda5afd98ce84cfc733bb5fe32da708 Mon Sep 17 00:00:00 2001 From: Thibaut Patel Date: Wed, 8 Dec 2021 14:22:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20pasting=20html=20into=20?= =?UTF-8?q?a=20`KoenigBasicHtmlInput`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Team/issues/1245 - Several inputs where dismissing the content when pasting HTML without the expected input tag - The inputs where: the caption of the feature image; the email footer; the caption in the bookmark, code, embed, gallery, image, video cards; the callout card title; the product card header and description; the toggle header - This makes sure the wrapper html tag is the expected one. Co-authored-by: - Kevin Ansfield (@kevinansfield) --- .../addon/components/koenig-basic-html-input.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-basic-html-input.js b/ghost/admin/lib/koenig-editor/addon/components/koenig-basic-html-input.js index c70320e558..7037d0edc3 100644 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-basic-html-input.js +++ b/ghost/admin/lib/koenig-editor/addon/components/koenig-basic-html-input.js @@ -363,6 +363,11 @@ export default Component.extend({ } // ----------------------------------------------------------------- + // convert first section to the expected tag type (might be a heading, blockquote, etc) + if (pastedPost.sections.head) { + pastedPost.sections.head.tagName = this.defaultTag; + } + // same as default editor.run((postEditor) => { const newPosition = postEditor.insertPost(position, pastedPost);