annotate media/js/tiny_mce/plugins/preview/editor_plugin_src.js @ 201:bc958bc3c6eb

Futzing with CSS side blocks
author Brian Neal <bgneal@gmail.com>
date Mon, 12 Apr 2010 02:56:31 +0000
parents 149c3567fec1
children
rev   line source
bgneal@45 1 /**
bgneal@183 2 * editor_plugin_src.js
bgneal@45 3 *
bgneal@183 4 * Copyright 2009, Moxiecode Systems AB
bgneal@183 5 * Released under LGPL License.
bgneal@183 6 *
bgneal@183 7 * License: http://tinymce.moxiecode.com/license
bgneal@183 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@45 9 */
bgneal@45 10
bgneal@45 11 (function() {
bgneal@45 12 tinymce.create('tinymce.plugins.Preview', {
bgneal@45 13 init : function(ed, url) {
bgneal@45 14 var t = this, css = tinymce.explode(ed.settings.content_css);
bgneal@45 15
bgneal@45 16 t.editor = ed;
bgneal@45 17
bgneal@45 18 // Force absolute CSS urls
bgneal@45 19 tinymce.each(css, function(u, k) {
bgneal@45 20 css[k] = ed.documentBaseURI.toAbsolute(u);
bgneal@45 21 });
bgneal@45 22
bgneal@45 23 ed.addCommand('mcePreview', function() {
bgneal@45 24 ed.windowManager.open({
bgneal@45 25 file : ed.getParam("plugin_preview_pageurl", url + "/preview.html"),
bgneal@45 26 width : parseInt(ed.getParam("plugin_preview_width", "550")),
bgneal@45 27 height : parseInt(ed.getParam("plugin_preview_height", "600")),
bgneal@45 28 resizable : "yes",
bgneal@45 29 scrollbars : "yes",
bgneal@45 30 popup_css : css ? css.join(',') : ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css"),
bgneal@45 31 inline : ed.getParam("plugin_preview_inline", 1)
bgneal@45 32 }, {
bgneal@45 33 base : ed.documentBaseURI.getURI()
bgneal@45 34 });
bgneal@45 35 });
bgneal@45 36
bgneal@45 37 ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'});
bgneal@45 38 },
bgneal@45 39
bgneal@45 40 getInfo : function() {
bgneal@45 41 return {
bgneal@45 42 longname : 'Preview',
bgneal@45 43 author : 'Moxiecode Systems AB',
bgneal@45 44 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 45 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',
bgneal@45 46 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45 47 };
bgneal@45 48 }
bgneal@45 49 });
bgneal@45 50
bgneal@45 51 // Register plugin
bgneal@45 52 tinymce.PluginManager.add('preview', tinymce.plugins.Preview);
bgneal@45 53 })();