Toggle preview

Atto ::: atto_preview
Maintained by Daniel Thies
An Atto editor plugin that shows a preview of the filtered editor content.
Latest release:
952 sites
39 fans
Current versions available: 1

This plugin makes a preview button available to the Atto editor.  When the button is pressed the content of the editor is passed through the filters enabled on the editing page and the result is displayed over the editor content window.  Pressing the button again closes the preview. 

Testing status


Screenshot #0
Screenshot #1
Screenshot #2


Daniel Thies (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Tue, Mar 3, 2015, 3:24 AM
    Thanks Daniel for sharing this plugin with the Moodle community. It is really a nice and very useful feature! I did not find any approval blockers in the code. Two things that caught my eye during the code review: (1) Why do you clean the passed $content as PARAM_CLEANHTML? Should not it better be PARAM_RAW (like the Moodle does normally in this case), given that you are displaying it back processed by format_text()? (2) Why is FORMAT_MOODLE used here? The Atto editor supports the only format and that's FORMAT_HTML. These two issues could potentially lead to differences between the preview and the final result. You may want to review and eventually change them in an updated version of the plugin.
    Said that, you are cleared to land now. Welcome to the Plugins directory!
  • Tue, Mar 3, 2015, 4:42 AM
    Thanks for reviewing this David. After reading the formatting documentation, I made your suggested changes and updated the plugin.
  • Thu, Jun 11, 2015, 4:49 PM
    Hi, Is there a particular trick to internationalisation ? I added my custom fr pack to the plugin and Moodle detected it in the fr langage pack, but the tooltips are still in English.
  • Thu, Jun 11, 2015, 11:51 PM
    Hi Fancis, I just checked in French and German, and the tool tips translations are working for me with the current standard language packs. You updated your local language cache it seems, but did you try clearing the strings cache? Thanks for the translation help.
  • SG
    Wed, Aug 19, 2015, 5:15 AM
    I have a question. How to understand this message:
    Request-URI Too Large
    The request URL is over the maximum size allowed!"

    What should I do?
  • Wed, Aug 19, 2015, 7:18 AM
    Hello Sławomir,
    Thanks for reporting this. We have only test this before with small content. The GET method used is limited by web server. For default Apache this means max is about 8K characters. The server limit could be expanded with the LimitRequestLine directive, but it would probably be better if I could use the POST to implement it instead which is what is usually used to save the editor contents.
  • Wed, Sep 2, 2015, 2:18 AM
    I just added an update to fix the issue with larger text size. The filtered text is now fetched very POST method so the PHP upload_max_filesize is the limit in browsers that support srcdoc attribute on iframe. Others which includes IE will default back to old behavior.
  • Wed, Jun 15, 2016, 11:35 AM
    I just upgraded to Moodle 3.1 and I installed preview version 2016021500. However the "eyeball" icon is not showing up. Is atto_preview known to work with Moodle 3.1? (To be clear I installed Moodle 3.1 from scratch and added the preview plug-in)
  • Fri, Jun 17, 2016, 5:10 AM
    Hi Peter,
    To add any plugin in to Atto you need to remember to add the button to the list of buttons in Plugins->Text editors->Atto HTML editor->Atto toobar settings. Did you remember to do this? I have been using the preview plugin on 3.1 for some time without issue, but it is an updated site not a new one. Otherwise, it might be helpful to know whether you are using a new theme.
  • Wed, Mar 8, 2017, 4:44 AM
    Hello again,

    I had to give up on getting the Toggle Preview to work for me but now I have to get it working for my students.

    My installation is still Moodle 3.1+ and there are special themes. Yet the "eyeball" button still does not show up.

    I did check in Plugins->Text editors->Atto HTML editor->Atto toolbar settings and I do see that "Toggle Preview" in in the list that comes up.

    What I don't see is a list of actual buttons. Is there a list of buttons I can edit?


    Peter Halverson
    (I wish I could attach screen shots to these comments.)
  • Wed, Mar 8, 2017, 4:51 AM
    Hi again,
    I think I have a clue as to the problem. There is a "Toolbar Config" list that seems to have all the buttons listed. I think if I were to add the Toggle Preview button's name to that list, it might work. Question: what is the *name* of the button?
    Thanks again,
    Peter Halverson
    PS: Here are the contents of the Toolbar Config field as it is right now.
    collapse = collapse
    style1 = title, bold, italic
    list = unorderedlist, orderedlist
    links = link
    files = image, media, managefiles
    style2 = underline, strike, subscript, superscript
    align = align
    indent = indent
    insert = equation, charmap, table, clear
    undo = undo
    accessibility = accessibilitychecker, accessibilityhelper
    other = html
  • Wed, Mar 8, 2017, 5:21 AM
    I got it to work!!!!
    I made a guess...
    I appended ", preview" to the line beginning with "style1"
    So now it reads "style1 = title, bold, italic, preview"
    Logged, out and in and now it works. The "eyeball" show up and does what it is supposed to.
Please login to post comments