Add support for text direction in PastePad

PastePad has no button to switch text direction (LTR/RTL). It also cuts off (at least in preview) any attempt to use “dir=rtl” or style=“direction: rtl”.

Could you please add support for that? Basically PastePad is now unusable for RTL texts.


1 Like

Did you get a chance to see this request?

Thanks for this. We’re going to take a look and see if we can improve things.

It’s now a year later. Is there any progress? Until then it’s not usable for RTL users (Arabic, Hebrew, etc.).

Have you tried clicking Push to Kindle to see what the preview looks like? In my test the language was detected as RTL in Push to Kindle, even when it was displayed left-to-right in Paste Pad. If this doesn’t work for you, please give us the URLs of the articles so we can look into it some more.

Not sure I understand. Push to Kindle does support RTL, but I’m talking about PastePad.
I want to paste content there and make sure it’s RTL before sending it to Kindle.

There is currently no toolbar button on Paste Pad to change text direction. But one of the main ways Push to Kindle sets text direction is by trying to detect the language of the text and then see if it’s an RTL language or not. So my suggestion was to ignore the text direction in Paste Pad when you paste your RTL text and hit ‘Push to Kindle’ anyway. You should then get directed to Push to Kindle’s preview of the content. If Push to Kindle detects an RTL language, the text direction should show correctly. At least it did in my test. So if it doesn’t for you, please feel free to share URLs so we can look into it.

I don’t mind ignoring the toolbar and doing it myself with CSS or HTML statements. But such attempts are being ignored when sending to Push to Kindle.

Here’s a link, in which the dot (".") should be on the left side.

Hmm, that’s odd. It looks like Push to Kindle isn’t detecting Hebrew properly. When I try copying and pasting Arabic and Persian text for example, it’s shown as left-to-right in PastePad, but right-to-left in the Push to Kindle preview window. That doesn’t seem to happen with Hebrew - I get the same results as you - left-to-right in both PastePad and Push to Kindle.

In Push to Kindle we look to see if a language has been specified in the source document and if not, we’ll try to detect it. So something seems to be up with the detection.

I tried manually inserting <html lang="he"> in PastePad, to signal Hebrew text, and that seemed to work. But I had to do it after clicking the ‘Source’ button and then submitting to Push to Kindle from that view. If you want to try that, here are the rough steps:

  1. Copy Hebrew text
  2. Paste into PastePad
  3. Click ‘Source’ to reveal the source HTML
  4. Copy and paste <html lang="he"> at the top of the HTML
  5. Click ‘Push to Kindle’

Let us know if you have any trouble with this. PastePad isn’t our priority right now, but when we get around to updating it, we’ll try to make RTL handling easier.

It worked, thanks!
Didn’t know I can use html/head/body tags in PastePad, plus I always tried dir="rtl", not lang="he".
The downside with this interim solution is you can’t preview (i.e. click “Source” again) before clicking “Push to Kindle”.

But download aside, good news - and I’ve even opened my own username for this - I’ve developed a code that adds Hebrew declaration to your editor when needed!

The involved steps:

  1. Attach a click event to your submit buttons (it took me hours to realize I can’t attach a submit event because it clashes with the existing submit events).
    So change
    <input type="submit" name="action" class="btn large ppxtralarge" value="...">
    <input onclick="add_heb_support()" type="submit" name="action" class="btn large ppxtralarge" value="...">
  2. Upon clicking the submit buttons, detect if Hebrew was used. If not, do nothing special. If yes, add the prefix. In order to do that, add the following script to PastePad:
     function add_heb_support() {
        var prefix='<html lang="he" />', source_value = CKEDITOR.instances.body.getData(), source = '#cke_contents_body>textarea', source_btn = '#cke_34';
        if (document.querySelectorAll(source).length==0) // Open the Source editor
        if(source_value.indexOf(prefix) == -1 && contains_heb(source_value)) // Add Hebrew support if needed
           CKEDITOR.instances.body.setData(prefix + source_value);

    function contains_heb(str) {
        return (/[\u0590-\u05FF]/).test(str);

To demonstrate this, I’ve even prepared a Bookmarklet (you love those, right?) that anyone can use right now:

Fantastic! Nice bookmarklet solution there.

I think the only way to preview RTL in PastePad is to first go into source and add <article dir="rtl"></article> or <article dir="auto"></article> around the content. You can then click out of source view to view RTL text in PastePad. But you’ll still have to go back into source view to add <html lang="he"> and submit from the source view for Push to Kindle to recognise the text as Hebrew.

We’ve added the Hebrew language detection issue in our list of things to look into, so hopefully we’ll have a solution for it soon.

Actually, any <tag dir="auto"> or <tag dir="rtl"> fixes the preview.
Hope you’ll embed lang=“he” soon because you basically have the code already. :grinning:

BTW, it’s a bit let down that the Bookmarklet’s preview shows an outdated version and can’t be edited.

I’ve modified my bookmarklet so it’ll:

  1. Redirect you to PastePad, in case you ran the bookmarklet in another website.
  2. Ask if you want to Push to Kindle. You can choose No and then manually choose PDF or ePUB instead. I just figured Push to Kindle should be the default since it’s your specialty after all.
1 Like

Hi, more than 2 years later and PastePad still doesn’t natively support RTL. Will you consider at least taking my bookmarklette and putting it as a button around PastePad?

Hi there, sorry for the slow update. We do have plans for updating the Paste Pad, and we intend to fix this issue when we do.

1 Like