From 6f08ae86ed97f7577e6c23565dcf4867a9296477 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 22 May 2018 13:28:34 -0700 Subject: [PATCH] Explicitly add RTL `dir` tag when rendering to HTML #869 --- .../composer-editor/base-block-plugins.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/components/composer-editor/base-block-plugins.jsx b/app/src/components/composer-editor/base-block-plugins.jsx index b0a45cd65..1d8a6520d 100644 --- a/app/src/components/composer-editor/base-block-plugins.jsx +++ b/app/src/components/composer-editor/base-block-plugins.jsx @@ -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
; } return ( -
+
{children}
);