How to access the entry editor's text from a dialog in Movable Type

When in a modal dialog, the parent window has an object called "app" which is of type MT.App. This object in turn has a property called "editor" which is of type Editor. You can find the files for these objects under mt-static/js/common. From the modal dialog, you can access them with calls like this:

<script type="text/javascript">
    window.parent.app.insertHTML("<strong>I just inserted text!</strong>");
    alert("Now things are about to be reset!");
    window.parent.app.editor.setHTML("");
    //Now everything should be cleared out of the editor.
</script>

The MT.App class has an insertHTML method which is a thin wrapper around the one provided by Editor. Editor has two other methods, get and setHTML, which are of value for developers who want to manipulate the contents of the text editor.

Leave a comment

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Recent Entries

Google's lossy compiler
Google's closure compiler service gets a little too frisky under ADVANCED_OPTIMIZATIONS. Original code: With advanced optimizations enabled, it was able…
The three purposes of the federal income tax law
Businesses will spend about 3.4 billion man-hours and individuals about 1.7 billion hours figuring out their taxes this year.…
Progress of a different sort
You know we have reached a level of decadence seldom seen in the history of the West when our women…

Subscribe

Advertisements

OpenID accepted here Learn more about OpenID