0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Koenig - Fixed pasting of rich-text image captions losing formatting

refs https://github.com/TryGhost/Ghost/issues/9724
- caption payload changed from `textContent` to a cleaned `innerHTML` in our `figureToImageCard` parser plugin
This commit is contained in:
Kevin Ansfield 2018-08-13 10:41:01 +01:00
parent e082d40d56
commit 22d07c9692

View file

@ -1,3 +1,5 @@
import {cleanBasicHtml} from 'koenig-editor/helpers/clean-basic-html';
// mobiledoc by default ignores <BR> tags but we have a custom SoftReturn atom // mobiledoc by default ignores <BR> tags but we have a custom SoftReturn atom
export function brToSoftBreakAtom(node, builder, {addMarkerable, nodeFinished}) { export function brToSoftBreakAtom(node, builder, {addMarkerable, nodeFinished}) {
if (node.nodeType !== 1 || node.tagName !== 'BR') { if (node.nodeType !== 1 || node.tagName !== 'BR') {
@ -40,8 +42,8 @@ export function figureToImageCard(node, builder, {addSection, nodeFinished}) {
}; };
if (figcaption) { if (figcaption) {
// TODO: Allow rich text in captions let cleanHtml = cleanBasicHtml(figcaption.innerHTML);
payload.caption = figcaption.textContent; payload.caption = cleanHtml;
} }
let cardSection = builder.createCardSection('image', payload); let cardSection = builder.createCardSection('image', payload);