Reputation: 125
I'm trying to extend Rich Text Widgets Style in Apostrophe but it doesn't work.
In home.html
{ apos.area(data.page, 'body', {
widgets: {
'apostrophe-rich-text': {
toolbar: [ 'Styles', 'Bold', 'Italic', 'Link',
'Unlink'],
styles: [
{ name: 'Heading', element: 'h2'},
{ name: 'Subheading', element: 'h3'},
{ name: 'Paragraph', element: 'p'}
]
}
}
}) }}
In lib/modules/apostrophe-rich-text-widgets/index.js
module.exports = {
// The standard list copied from the module, plus sup and sub
sanitizeHtml: {
allowedTags: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a',
'ul', 'ol', 'li', 'b', 'i', 'strong', 'em', 'strike',
'code', 'hr', 'br', 'div', 'table', 'thead', 'caption',
'tbody', 'tr', 'th', 'td', 'pre', 'sup', 'sub'
],
allowedAttributes: {
a: [ 'href', 'name', 'target' ],
// We don't currently allow img itself by default, but this
// would make sense if we did
img: [ 'src' ]
},
// Lots of these won't come up by default because we don't allow them
selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont',
'input', 'link', 'meta' ],
// URL schemes we permit
allowedSchemes: [ 'http', 'https', 'ftp', 'mailto' ],
allowedSchemesByTag: {}
}
};
The HTML tags h3 and p work correctly but h2 work like p. It's there something that I don't put correctly?
Thanks!
Upvotes: 2
Views: 169
Reputation: 125
I fixed it adding a style for the h2 tag. I've noticed that h3 have its own style in site.less
h3 {
font-size: 24px;
margin-bottom: 12px;
}
h4 {
font-size: 20px;
margin-bottom: 10px;
}
strong { font-weight: bold; }
em { font-style: italic; }
So I added the style I wanted to my h2 tag, and it worked.
Upvotes: 1