Skip to content

Instantly share code, notes, and snippets.

@rafpyprog
Last active November 5, 2019 13:36
Show Gist options
  • Save rafpyprog/9a949eca56e16fd072ebdb48186db3a6 to your computer and use it in GitHub Desktop.
Save rafpyprog/9a949eca56e16fd072ebdb48186db3a6 to your computer and use it in GitHub Desktop.
Justify text inside Evernote notes
function justifyDoc() {
/* Justify all the paragraphs in a note */
iframe = document.getElementsByClassName("RichTextArea-entinymce")[0];
paragraphs = iframe.contentWindow.document.getElementsByTagName('p');
for (p of paragraphs) {
p.style['text-align'] = 'justify';
};
};
function hilightSelectedText(color='#fffaa5') {
/* Hilight selected text */
iframe = document.getElementsByClassName("RichTextArea-entinymce")[0];
iframe.contentWindow.document.execCommand('hiliteColor', false, color);
};
function clearHighlight() {
/* Clear hilight from selected text */
iframe = document.getElementsByClassName("RichTextArea-entinymce")[0];
var color = "#fffaa5";
iframe.contentWindow.doc.execCommand('hiliteColor', false, 'white');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment