mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 16:25:52 +08:00
Explicitly add RTL dir
tag when rendering to HTML #869
This commit is contained in:
parent
ff60c12b5e
commit
6f08ae86ed
1 changed files with 14 additions and 1 deletions
|
@ -57,11 +57,24 @@ export const BLOCK_CONFIG = {
|
|||
type: 'div',
|
||||
tagNames: ['div', 'br', 'p'],
|
||||
render: ({ node, attributes, children, targetIsHTML }) => {
|
||||
let explicitHTMLAttributes = undefined;
|
||||
|
||||
if (targetIsHTML) {
|
||||
explicitHTMLAttributes = {};
|
||||
if (node.isLeafBlock() && node.getTextDirection() === 'rtl') {
|
||||
explicitHTMLAttributes.dir = 'rtl';
|
||||
}
|
||||
}
|
||||
|
||||
if (targetIsHTML && nodeIsEmpty(node)) {
|
||||
return <br {...attributes} />;
|
||||
}
|
||||
return (
|
||||
<div {...attributes} className={node.data.className || node.data.get('className')}>
|
||||
<div
|
||||
{...attributes}
|
||||
{...explicitHTMLAttributes}
|
||||
className={node.data.className || node.data.get('className')}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue