Last active
          November 5, 2019 13:36 
        
      - 
      
- 
        Save rafpyprog/9a949eca56e16fd072ebdb48186db3a6 to your computer and use it in GitHub Desktop. 
    Justify text inside Evernote notes
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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