mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
🐛 Fixed paste into product card descriptions not stripping header formatting
closes https://github.com/TryGhost/Ghost/issues/14018 - product card descriptions and toggle card content both use `<KoeingBasicHtmlTextarea>` which is a stripped down Koenig editor with basic formatting support where heading sections are not expected - when pasting into or updating the content in `<KoeingBasicHtmlTextarea>`, convert any headings, blockquotes, or other markerable section types to standard paragraphs so the content formatting matches what is possible through the editing interface
This commit is contained in:
parent
8ac5bb5b48
commit
cab7f2cd74
@ -351,6 +351,7 @@ export default class KoenigBasicHtmlTextarea extends Component {
|
||||
// post.toRange() can fail if a list item was just removed
|
||||
// TODO: mobiledoc-kit bug?
|
||||
}
|
||||
|
||||
markers.forEach((marker) => {
|
||||
let {markups} = marker;
|
||||
if (markups.length > 1 && marker.hasMarkup('code')) {
|
||||
@ -362,6 +363,11 @@ export default class KoenigBasicHtmlTextarea extends Component {
|
||||
|
||||
// remove any non-markerable/non-list sections
|
||||
post.sections.forEach((section) => {
|
||||
// headings are not supported so convert them to paragraphs
|
||||
if (section.isMarkerable) {
|
||||
section.tagName = 'p';
|
||||
}
|
||||
|
||||
if (!section.isMarkerable && !section.isListSection) {
|
||||
let reposition = section === editor.activeSection;
|
||||
postEditor.removeSection(section);
|
||||
|
Loading…
Reference in New Issue
Block a user