fix some bugs
This commit is contained in:
@@ -43,7 +43,7 @@ export default {
|
|||||||
TextAlign(),
|
TextAlign(),
|
||||||
],
|
],
|
||||||
content: `
|
content: `
|
||||||
<h1>Heading</h1>
|
<h2>Heading</h2>
|
||||||
<p style="text-align: center">first paragraph</p>
|
<p style="text-align: center">first paragraph</p>
|
||||||
<p style="text-align: right">second paragraph</p>
|
<p style="text-align: right">second paragraph</p>
|
||||||
`,
|
`,
|
||||||
|
|||||||
@@ -25,7 +25,14 @@ function injectExtensionAttributes(parseRule: ParseRule, extensionAttributes: Ex
|
|||||||
return {
|
return {
|
||||||
...parseRule,
|
...parseRule,
|
||||||
getAttrs: node => {
|
getAttrs: node => {
|
||||||
const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : {}
|
const oldAttributes = parseRule.getAttrs
|
||||||
|
? parseRule.getAttrs(node)
|
||||||
|
: parseRule.attrs
|
||||||
|
|
||||||
|
if (oldAttributes === false) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const newAttributes = extensionAttributes
|
const newAttributes = extensionAttributes
|
||||||
.filter(item => item.attribute.rendered)
|
.filter(item => item.attribute.rendered)
|
||||||
.reduce((items, item) => ({
|
.reduce((items, item) => ({
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const TextAlign = createExtension({
|
|||||||
style: `text-align: ${attributes.textAlign}`,
|
style: `text-align: ${attributes.textAlign}`,
|
||||||
}),
|
}),
|
||||||
parseHTML: node => ({
|
parseHTML: node => ({
|
||||||
textAlign: node.style.textAlign,
|
textAlign: node.style.textAlign || 'left',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user