| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/dashboard/webadmin/editor/plugins/preview/ |
Upload File : |
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('preview', function(editor) {
var settings = editor.settings;
editor.addCommand('mcePreview', function() {
editor.windowManager.open({
title: 'Preview',
width : parseInt(editor.getParam("plugin_preview_width", "650"), 10),
height : parseInt(editor.getParam("plugin_preview_height", "500"), 10),
html: '<iframe src="javascript:\'\'" frameborder="0"></iframe>',
buttons: {
text: 'Close',
onclick: function() {
this.parent().parent().close();
}
},
onPostRender: function() {
var doc = this.getEl('body').firstChild.contentWindow.document, previewHtml, headHtml = '';
tinymce.each(editor.contentCSS, function(url) {
headHtml += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
});
var bodyId = settings.body_id || 'tinymce';
if (bodyId.indexOf('=') != -1) {
bodyId = editor.getParam('body_id', '', 'hash');
bodyId = bodyId[editor.id] || bodyId;
}
var bodyClass = settings.body_class || '';
if (bodyClass.indexOf('=') != -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
previewHtml = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
headHtml +
'</head>' +
'<body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '">' +
editor.getContent() +
'</body>' +
'</html>'
);
doc.open();
doc.write(previewHtml);
doc.close();
}
});
});
editor.addButton('preview', {
title : 'Preview',
cmd : 'mcePreview'
});
editor.addMenuItem('preview', {
text : 'Preview',
cmd : 'mcePreview',
context: 'view'
});
});