mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05: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
1 changed files with 6 additions and 0 deletions
|
@ -351,6 +351,7 @@ export default class KoenigBasicHtmlTextarea extends Component {
|
||||||
// post.toRange() can fail if a list item was just removed
|
// post.toRange() can fail if a list item was just removed
|
||||||
// TODO: mobiledoc-kit bug?
|
// TODO: mobiledoc-kit bug?
|
||||||
}
|
}
|
||||||
|
|
||||||
markers.forEach((marker) => {
|
markers.forEach((marker) => {
|
||||||
let {markups} = marker;
|
let {markups} = marker;
|
||||||
if (markups.length > 1 && marker.hasMarkup('code')) {
|
if (markups.length > 1 && marker.hasMarkup('code')) {
|
||||||
|
@ -362,6 +363,11 @@ export default class KoenigBasicHtmlTextarea extends Component {
|
||||||
|
|
||||||
// remove any non-markerable/non-list sections
|
// remove any non-markerable/non-list sections
|
||||||
post.sections.forEach((section) => {
|
post.sections.forEach((section) => {
|
||||||
|
// headings are not supported so convert them to paragraphs
|
||||||
|
if (section.isMarkerable) {
|
||||||
|
section.tagName = 'p';
|
||||||
|
}
|
||||||
|
|
||||||
if (!section.isMarkerable && !section.isListSection) {
|
if (!section.isMarkerable && !section.isListSection) {
|
||||||
let reposition = section === editor.activeSection;
|
let reposition = section === editor.activeSection;
|
||||||
postEditor.removeSection(section);
|
postEditor.removeSection(section);
|
||||||
|
|
Loading…
Add table
Reference in a new issue