Commit 4ede8d6a by cahrens

tiny_mce

parent f95499b1
input.radio {border:1px none #000; background:transparent; vertical-align:middle;} input.radio {border:1px none #000; background:transparent; vertical-align:middle;}
.panel_wrapper div.current {height:80px;} .panel_wrapper div.current {height:80px;}
#width {width:50px; vertical-align:middle;} #width {width:50px; vertical-align:middle;}
#width2 {width:50px; vertical-align:middle;} #width2 {width:50px; vertical-align:middle;}
#size {width:100px;} #size {width:100px;}
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.AdvancedHRPlugin', { tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
init : function(ed, url) { init : function(ed, url) {
// Register commands // Register commands
ed.addCommand('mceAdvancedHr', function() { ed.addCommand('mceAdvancedHr', function() {
ed.windowManager.open({ ed.windowManager.open({
file : url + '/rule.htm', file : url + '/rule.htm',
width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)), width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)), height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
plugin_url : url plugin_url : url
}); });
}); });
// Register buttons // Register buttons
ed.addButton('advhr', { ed.addButton('advhr', {
title : 'advhr.advhr_desc', title : 'advhr.advhr_desc',
cmd : 'mceAdvancedHr' cmd : 'mceAdvancedHr'
}); });
ed.onNodeChange.add(function(ed, cm, n) { ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('advhr', n.nodeName == 'HR'); cm.setActive('advhr', n.nodeName == 'HR');
}); });
ed.onClick.add(function(ed, e) { ed.onClick.add(function(ed, e) {
e = e.target; e = e.target;
if (e.nodeName === 'HR') if (e.nodeName === 'HR')
ed.selection.select(e); ed.selection.select(e);
}); });
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Advanced HR', longname : 'Advanced HR',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin); tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
})(); })();
\ No newline at end of file
var AdvHRDialog = { var AdvHRDialog = {
init : function(ed) { init : function(ed) {
var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w; var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
w = dom.getAttrib(n, 'width'); w = dom.getAttrib(n, 'width');
f.width.value = w ? parseInt(w) : (dom.getStyle('width') || ''); f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || ''; f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width'); f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px'); selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
}, },
update : function() { update : function() {
var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = ''; var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
h = '<hr'; h = '<hr';
if (f.size.value) { if (f.size.value) {
h += ' size="' + f.size.value + '"'; h += ' size="' + f.size.value + '"';
st += ' height:' + f.size.value + 'px;'; st += ' height:' + f.size.value + 'px;';
} }
if (f.width.value) { if (f.width.value) {
h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"'; h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';'; st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
} }
if (f.noshade.checked) { if (f.noshade.checked) {
h += ' noshade="noshade"'; h += ' noshade="noshade"';
st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;'; st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
} }
if (ed.settings.inline_styles) if (ed.settings.inline_styles)
h += ' style="' + tinymce.trim(st) + '"'; h += ' style="' + tinymce.trim(st) + '"';
h += ' />'; h += ' />';
ed.execCommand("mceInsertContent", false, h); ed.execCommand("mceInsertContent", false, h);
tinyMCEPopup.close(); tinyMCEPopup.close();
} }
}; };
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog); tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{#advhr.advhr_desc}</title> <title>{#advhr.advhr_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/rule.js"></script> <script type="text/javascript" src="js/rule.js"></script>
<script type="text/javascript" src="../../utils/mctabs.js"></script> <script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="../../utils/form_utils.js"></script> <script type="text/javascript" src="../../utils/form_utils.js"></script>
<link href="css/advhr.css" rel="stylesheet" type="text/css" /> <link href="css/advhr.css" rel="stylesheet" type="text/css" />
</head> </head>
<body role="application"> <body role="application">
<form onsubmit="AdvHRDialog.update();return false;" action="#"> <form onsubmit="AdvHRDialog.update();return false;" action="#">
<div class="tabs"> <div class="tabs">
<ul> <ul>
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li> <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>
</ul> </ul>
</div> </div>
<div class="panel_wrapper"> <div class="panel_wrapper">
<div id="general_panel" class="panel current"> <div id="general_panel" class="panel current">
<table role="presentation" border="0" cellpadding="4" cellspacing="0"> <table role="presentation" border="0" cellpadding="4" cellspacing="0">
<tr role="group" aria-labelledby="width_label"> <tr role="group" aria-labelledby="width_label">
<td><label id="width_label" for="width">{#advhr_dlg.width}</label></td> <td><label id="width_label" for="width">{#advhr_dlg.width}</label></td>
<td class="nowrap"> <td class="nowrap">
<input id="width" name="width" type="text" value="" class="mceFocus" /> <input id="width" name="width" type="text" value="" class="mceFocus" />
<span style="display:none;" id="width_unit_label">{#advhr_dlg.widthunits}</span> <span style="display:none;" id="width_unit_label">{#advhr_dlg.widthunits}</span>
<select name="width2" id="width2" aria-labelledby="width_unit_label"> <select name="width2" id="width2" aria-labelledby="width_unit_label">
<option value="">px</option> <option value="">px</option>
<option value="%">%</option> <option value="%">%</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><label for="size">{#advhr_dlg.size}</label></td> <td><label for="size">{#advhr_dlg.size}</label></td>
<td><select id="size" name="size"> <td><select id="size" name="size">
<option value="">{#advhr_dlg.normal}</option> <option value="">{#advhr_dlg.normal}</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option> <option value="3">3</option>
<option value="4">4</option> <option value="4">4</option>
<option value="5">5</option> <option value="5">5</option>
</select></td> </select></td>
</tr> </tr>
<tr> <tr>
<td><label for="noshade">{#advhr_dlg.noshade}</label></td> <td><label for="noshade">{#advhr_dlg.noshade}</label></td>
<td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td> <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#insert}" /> <input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div> </div>
</form> </form>
</body> </body>
</html> </html>
#src_list, #over_list, #out_list {width:280px;} #src_list, #over_list, #out_list {width:280px;}
.mceActionPanel {margin-top:7px;} .mceActionPanel {margin-top:7px;}
.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;} .alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}
.checkbox {border:0;} .checkbox {border:0;}
.panel_wrapper div.current {height:305px;} .panel_wrapper div.current {height:305px;}
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;} #prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
#align, #classlist {width:150px;} #align, #classlist {width:150px;}
#width, #height {vertical-align:middle; width:50px; text-align:center;} #width, #height {vertical-align:middle; width:50px; text-align:center;}
#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;} #vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}
#class_list {width:180px;} #class_list {width:180px;}
input {width: 280px;} input {width: 280px;}
#constrain, #onmousemovecheck {width:auto;} #constrain, #onmousemovecheck {width:auto;}
#id, #dir, #lang, #usemap, #longdesc {width:200px;} #id, #dir, #lang, #usemap, #longdesc {width:200px;}
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.AdvancedImagePlugin', { tinymce.create('tinymce.plugins.AdvancedImagePlugin', {
init : function(ed, url) { init : function(ed, url) {
// Register commands // Register commands
ed.addCommand('mceAdvImage', function() { ed.addCommand('mceAdvImage', function() {
// Internal image object like a flash placeholder // Internal image object like a flash placeholder
if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1) if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
return; return;
ed.windowManager.open({ ed.windowManager.open({
file : url + '/image.htm', file : url + '/image.htm',
width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)), width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)), height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
plugin_url : url plugin_url : url
}); });
}); });
// Register buttons // Register buttons
ed.addButton('image', { ed.addButton('image', {
title : 'advimage.image_desc', title : 'advimage.image_desc',
cmd : 'mceAdvImage' cmd : 'mceAdvImage'
}); });
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Advanced image', longname : 'Advanced image',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin); tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);
})(); })();
\ No newline at end of file
.mceLinkList, .mceAnchorList, #targetlist {width:280px;} .mceLinkList, .mceAnchorList, #targetlist {width:280px;}
.mceActionPanel {margin-top:7px;} .mceActionPanel {margin-top:7px;}
.panel_wrapper div.current {height:320px;} .panel_wrapper div.current {height:320px;}
#classlist, #title, #href {width:280px;} #classlist, #title, #href {width:280px;}
#popupurl, #popupname {width:200px;} #popupurl, #popupname {width:200px;}
#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;} #popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}
#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;} #id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}
#events_panel input {width:200px;} #events_panel input {width:200px;}
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
init : function(ed, url) { init : function(ed, url) {
this.editor = ed; this.editor = ed;
// Register commands // Register commands
ed.addCommand('mceAdvLink', function() { ed.addCommand('mceAdvLink', function() {
var se = ed.selection; var se = ed.selection;
// No selection and not in link // No selection and not in link
if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
return; return;
ed.windowManager.open({ ed.windowManager.open({
file : url + '/link.htm', file : url + '/link.htm',
width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
plugin_url : url plugin_url : url
}); });
}); });
// Register buttons // Register buttons
ed.addButton('link', { ed.addButton('link', {
title : 'advlink.link_desc', title : 'advlink.link_desc',
cmd : 'mceAdvLink' cmd : 'mceAdvLink'
}); });
ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
ed.onNodeChange.add(function(ed, cm, n, co) { ed.onNodeChange.add(function(ed, cm, n, co) {
cm.setDisabled('link', co && n.nodeName != 'A'); cm.setDisabled('link', co && n.nodeName != 'A');
cm.setActive('link', n.nodeName == 'A' && !n.name); cm.setActive('link', n.nodeName == 'A' && !n.name);
}); });
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Advanced link', longname : 'Advanced link',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
})(); })();
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
var each = tinymce.each; var each = tinymce.each;
tinymce.create('tinymce.plugins.AdvListPlugin', { tinymce.create('tinymce.plugins.AdvListPlugin', {
init : function(ed, url) { init : function(ed, url) {
var t = this; var t = this;
t.editor = ed; t.editor = ed;
function buildFormats(str) { function buildFormats(str) {
var formats = []; var formats = [];
each(str.split(/,/), function(type) { each(str.split(/,/), function(type) {
formats.push({ formats.push({
title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')), title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),
styles : { styles : {
listStyleType : type == 'default' ? '' : type listStyleType : type == 'default' ? '' : type
} }
}); });
}); });
return formats; return formats;
}; };
// Setup number formats from config or default // Setup number formats from config or default
t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"); t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square"); t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent)) if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))
t.isIE7 = true; t.isIE7 = true;
}, },
createControl: function(name, cm) { createControl: function(name, cm) {
var t = this, btn, format, editor = t.editor; var t = this, btn, format, editor = t.editor;
if (name == 'numlist' || name == 'bullist') { if (name == 'numlist' || name == 'bullist') {
// Default to first item if it's a default item // Default to first item if it's a default item
if (t[name][0].title == 'advlist.def') if (t[name][0].title == 'advlist.def')
format = t[name][0]; format = t[name][0];
function hasFormat(node, format) { function hasFormat(node, format) {
var state = true; var state = true;
each(format.styles, function(value, name) { each(format.styles, function(value, name) {
// Format doesn't match // Format doesn't match
if (editor.dom.getStyle(node, name) != value) { if (editor.dom.getStyle(node, name) != value) {
state = false; state = false;
return false; return false;
} }
}); });
return state; return state;
}; };
function applyListFormat() { function applyListFormat() {
var list, dom = editor.dom, sel = editor.selection; var list, dom = editor.dom, sel = editor.selection;
// Check for existing list element // Check for existing list element
list = dom.getParent(sel.getNode(), 'ol,ul'); list = dom.getParent(sel.getNode(), 'ol,ul');
// Switch/add list type if needed // Switch/add list type if needed
if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format)) if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList'); editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
// Append styles to new list element // Append styles to new list element
if (format) { if (format) {
list = dom.getParent(sel.getNode(), 'ol,ul'); list = dom.getParent(sel.getNode(), 'ol,ul');
if (list) { if (list) {
dom.setStyles(list, format.styles); dom.setStyles(list, format.styles);
list.removeAttribute('data-mce-style'); list.removeAttribute('data-mce-style');
} }
} }
editor.focus(); editor.focus();
}; };
btn = cm.createSplitButton(name, { btn = cm.createSplitButton(name, {
title : 'advanced.' + name + '_desc', title : 'advanced.' + name + '_desc',
'class' : 'mce_' + name, 'class' : 'mce_' + name,
onclick : function() { onclick : function() {
applyListFormat(); applyListFormat();
} }
}); });
btn.onRenderMenu.add(function(btn, menu) { btn.onRenderMenu.add(function(btn, menu) {
menu.onHideMenu.add(function() { menu.onHideMenu.add(function() {
if (t.bookmark) { if (t.bookmark) {
editor.selection.moveToBookmark(t.bookmark); editor.selection.moveToBookmark(t.bookmark);
t.bookmark = 0; t.bookmark = 0;
} }
}); });
menu.onShowMenu.add(function() { menu.onShowMenu.add(function() {
var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList; var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;
if (list || format) { if (list || format) {
fmtList = t[name]; fmtList = t[name];
// Unselect existing items // Unselect existing items
each(menu.items, function(item) { each(menu.items, function(item) {
var state = true; var state = true;
item.setSelected(0); item.setSelected(0);
if (list && !item.isDisabled()) { if (list && !item.isDisabled()) {
each(fmtList, function(fmt) { each(fmtList, function(fmt) {
if (fmt.id == item.id) { if (fmt.id == item.id) {
if (!hasFormat(list, fmt)) { if (!hasFormat(list, fmt)) {
state = false; state = false;
return false; return false;
} }
} }
}); });
if (state) if (state)
item.setSelected(1); item.setSelected(1);
} }
}); });
// Select the current format // Select the current format
if (!list) if (!list)
menu.items[format.id].setSelected(1); menu.items[format.id].setSelected(1);
} }
editor.focus(); editor.focus();
// IE looses it's selection so store it away and restore it later // IE looses it's selection so store it away and restore it later
if (tinymce.isIE) { if (tinymce.isIE) {
t.bookmark = editor.selection.getBookmark(1); t.bookmark = editor.selection.getBookmark(1);
} }
}); });
menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1); menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
each(t[name], function(item) { each(t[name], function(item) {
// IE<8 doesn't support lower-greek, skip it // IE<8 doesn't support lower-greek, skip it
if (t.isIE7 && item.styles.listStyleType == 'lower-greek') if (t.isIE7 && item.styles.listStyleType == 'lower-greek')
return; return;
item.id = editor.dom.uniqueId(); item.id = editor.dom.uniqueId();
menu.add({id : item.id, title : item.title, onclick : function() { menu.add({id : item.id, title : item.title, onclick : function() {
format = item; format = item;
applyListFormat(); applyListFormat();
}}); }});
}); });
}); });
return btn; return btn;
} }
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Advanced lists', longname : 'Advanced lists',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin); tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);
})(); })();
\ No newline at end of file
tinyMCE.addI18n('en.autosave',{ tinyMCE.addI18n('en.autosave',{
restore_content: "Restore auto-saved content", restore_content: "Restore auto-saved content",
warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?" warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"
}); });
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.BBCodePlugin', { tinymce.create('tinymce.plugins.BBCodePlugin', {
init : function(ed, url) { init : function(ed, url) {
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase(); var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
ed.onBeforeSetContent.add(function(ed, o) { ed.onBeforeSetContent.add(function(ed, o) {
o.content = t['_' + dialect + '_bbcode2html'](o.content); o.content = t['_' + dialect + '_bbcode2html'](o.content);
}); });
ed.onPostProcess.add(function(ed, o) { ed.onPostProcess.add(function(ed, o) {
if (o.set) if (o.set)
o.content = t['_' + dialect + '_bbcode2html'](o.content); o.content = t['_' + dialect + '_bbcode2html'](o.content);
if (o.get) if (o.get)
o.content = t['_' + dialect + '_html2bbcode'](o.content); o.content = t['_' + dialect + '_html2bbcode'](o.content);
}); });
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'BBCode Plugin', longname : 'BBCode Plugin',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
}, },
// Private methods // Private methods
// HTML -> BBCode in PunBB dialect // HTML -> BBCode in PunBB dialect
_punbb_html2bbcode : function(s) { _punbb_html2bbcode : function(s) {
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
s = s.replace(re, str); s = s.replace(re, str);
}; };
// example: <strong> to [b] // example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"); rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"); rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"); rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"); rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
rep(/<font>(.*?)<\/font>/gi,"$1"); rep(/<font>(.*?)<\/font>/gi,"$1");
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"); rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"); rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"); rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"); rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"); rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"); rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"); rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"); rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"); rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
rep(/<\/(strong|b)>/gi,"[/b]"); rep(/<\/(strong|b)>/gi,"[/b]");
rep(/<(strong|b)>/gi,"[b]"); rep(/<(strong|b)>/gi,"[b]");
rep(/<\/(em|i)>/gi,"[/i]"); rep(/<\/(em|i)>/gi,"[/i]");
rep(/<(em|i)>/gi,"[i]"); rep(/<(em|i)>/gi,"[i]");
rep(/<\/u>/gi,"[/u]"); rep(/<\/u>/gi,"[/u]");
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"); rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");
rep(/<u>/gi,"[u]"); rep(/<u>/gi,"[u]");
rep(/<blockquote[^>]*>/gi,"[quote]"); rep(/<blockquote[^>]*>/gi,"[quote]");
rep(/<\/blockquote>/gi,"[/quote]"); rep(/<\/blockquote>/gi,"[/quote]");
rep(/<br \/>/gi,"\n"); rep(/<br \/>/gi,"\n");
rep(/<br\/>/gi,"\n"); rep(/<br\/>/gi,"\n");
rep(/<br>/gi,"\n"); rep(/<br>/gi,"\n");
rep(/<p>/gi,""); rep(/<p>/gi,"");
rep(/<\/p>/gi,"\n"); rep(/<\/p>/gi,"\n");
rep(/&nbsp;|\u00a0/gi," "); rep(/&nbsp;|\u00a0/gi," ");
rep(/&quot;/gi,"\""); rep(/&quot;/gi,"\"");
rep(/&lt;/gi,"<"); rep(/&lt;/gi,"<");
rep(/&gt;/gi,">"); rep(/&gt;/gi,">");
rep(/&amp;/gi,"&"); rep(/&amp;/gi,"&");
return s; return s;
}, },
// BBCode -> HTML from PunBB dialect // BBCode -> HTML from PunBB dialect
_punbb_bbcode2html : function(s) { _punbb_bbcode2html : function(s) {
s = tinymce.trim(s); s = tinymce.trim(s);
function rep(re, str) { function rep(re, str) {
s = s.replace(re, str); s = s.replace(re, str);
}; };
// example: [b] to <strong> // example: [b] to <strong>
rep(/\n/gi,"<br />"); rep(/\n/gi,"<br />");
rep(/\[b\]/gi,"<strong>"); rep(/\[b\]/gi,"<strong>");
rep(/\[\/b\]/gi,"</strong>"); rep(/\[\/b\]/gi,"</strong>");
rep(/\[i\]/gi,"<em>"); rep(/\[i\]/gi,"<em>");
rep(/\[\/i\]/gi,"</em>"); rep(/\[\/i\]/gi,"</em>");
rep(/\[u\]/gi,"<u>"); rep(/\[u\]/gi,"<u>");
rep(/\[\/u\]/gi,"</u>"); rep(/\[\/u\]/gi,"</u>");
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>"); rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>"); rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />"); rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>"); rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;"); rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span>&nbsp;");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;"); rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span>&nbsp;");
return s; return s;
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
})(); })();
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.Directionality', { tinymce.create('tinymce.plugins.Directionality', {
init : function(ed, url) { init : function(ed, url) {
var t = this; var t = this;
t.editor = ed; t.editor = ed;
function setDir(dir) { function setDir(dir) {
var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks(); var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
if (blocks.length) { if (blocks.length) {
curDir = dom.getAttrib(blocks[0], "dir"); curDir = dom.getAttrib(blocks[0], "dir");
tinymce.each(blocks, function(block) { tinymce.each(blocks, function(block) {
// Add dir to block if the parent block doesn't already have that dir // Add dir to block if the parent block doesn't already have that dir
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) { if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
if (curDir != dir) { if (curDir != dir) {
dom.setAttrib(block, "dir", dir); dom.setAttrib(block, "dir", dir);
} else { } else {
dom.setAttrib(block, "dir", null); dom.setAttrib(block, "dir", null);
} }
} }
}); });
ed.nodeChanged(); ed.nodeChanged();
} }
} }
ed.addCommand('mceDirectionLTR', function() { ed.addCommand('mceDirectionLTR', function() {
setDir("ltr"); setDir("ltr");
}); });
ed.addCommand('mceDirectionRTL', function() { ed.addCommand('mceDirectionRTL', function() {
setDir("rtl"); setDir("rtl");
}); });
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
ed.onNodeChange.add(t._nodeChange, t); ed.onNodeChange.add(t._nodeChange, t);
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Directionality', longname : 'Directionality',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
}, },
// Private methods // Private methods
_nodeChange : function(ed, cm, n) { _nodeChange : function(ed, cm, n) {
var dom = ed.dom, dir; var dom = ed.dom, dir;
n = dom.getParent(n, dom.isBlock); n = dom.getParent(n, dom.isBlock);
if (!n) { if (!n) {
cm.setDisabled('ltr', 1); cm.setDisabled('ltr', 1);
cm.setDisabled('rtl', 1); cm.setDisabled('rtl', 1);
return; return;
} }
dir = dom.getAttrib(n, 'dir'); dir = dom.getAttrib(n, 'dir');
cm.setActive('ltr', dir == "ltr"); cm.setActive('ltr', dir == "ltr");
cm.setDisabled('ltr', 0); cm.setDisabled('ltr', 0);
cm.setActive('rtl', dir == "rtl"); cm.setActive('rtl', dir == "rtl");
cm.setDisabled('rtl', 0); cm.setDisabled('rtl', 0);
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
})(); })();
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function(tinymce) { (function(tinymce) {
tinymce.create('tinymce.plugins.EmotionsPlugin', { tinymce.create('tinymce.plugins.EmotionsPlugin', {
init : function(ed, url) { init : function(ed, url) {
// Register commands // Register commands
ed.addCommand('mceEmotion', function() { ed.addCommand('mceEmotion', function() {
ed.windowManager.open({ ed.windowManager.open({
file : url + '/emotions.htm', file : url + '/emotions.htm',
width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)), width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)),
height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)), height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
plugin_url : url plugin_url : url
}); });
}); });
// Register buttons // Register buttons
ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'}); ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Emotions', longname : 'Emotions',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin); tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
})(tinymce); })(tinymce);
\ No newline at end of file
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var EmotionsDialog = { var EmotionsDialog = {
addKeyboardNavigation: function(){ addKeyboardNavigation: function(){
var tableElm, cells, settings; var tableElm, cells, settings;
cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table"); cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");
settings ={ settings ={
root: "emoticon_table", root: "emoticon_table",
items: cells items: cells
}; };
cells[0].tabindex=0; cells[0].tabindex=0;
tinyMCEPopup.dom.addClass(cells[0], "mceFocus"); tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
if (tinymce.isGecko) { if (tinymce.isGecko) {
cells[0].focus(); cells[0].focus();
} else { } else {
setTimeout(function(){ setTimeout(function(){
cells[0].focus(); cells[0].focus();
}, 100); }, 100);
} }
tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom); tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
}, },
init : function(ed) { init : function(ed) {
tinyMCEPopup.resizeToInnerSize(); tinyMCEPopup.resizeToInnerSize();
this.addKeyboardNavigation(); this.addKeyboardNavigation();
}, },
insert : function(file, title) { insert : function(file, title) {
var ed = tinyMCEPopup.editor, dom = ed.dom; var ed = tinyMCEPopup.editor, dom = ed.dom;
tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', { tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {
src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file, src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,
alt : ed.getLang(title), alt : ed.getLang(title),
title : ed.getLang(title), title : ed.getLang(title),
border : 0 border : 0
})); }));
tinyMCEPopup.close(); tinyMCEPopup.close();
} }
}; };
tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog); tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{#example_dlg.title}</title> <title>{#example_dlg.title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/dialog.js"></script> <script type="text/javascript" src="js/dialog.js"></script>
</head> </head>
<body> <body>
<form onsubmit="ExampleDialog.insert();return false;" action="#"> <form onsubmit="ExampleDialog.insert();return false;" action="#">
<p>Here is a example dialog.</p> <p>Here is a example dialog.</p>
<p>Selected text: <input id="someval" name="someval" type="text" class="text" /></p> <p>Selected text: <input id="someval" name="someval" type="text" class="text" /></p>
<p>Custom arg: <input id="somearg" name="somearg" type="text" class="text" /></p> <p>Custom arg: <input id="somearg" name="somearg" type="text" class="text" /></p>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="button" id="insert" name="insert" value="{#insert}" onclick="ExampleDialog.insert();" /> <input type="button" id="insert" name="insert" value="{#insert}" onclick="ExampleDialog.insert();" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div> </div>
</form> </form>
</body> </body>
</html> </html>
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
// Load plugin specific language pack // Load plugin specific language pack
tinymce.PluginManager.requireLangPack('example'); tinymce.PluginManager.requireLangPack('example');
tinymce.create('tinymce.plugins.ExamplePlugin', { tinymce.create('tinymce.plugins.ExamplePlugin', {
/** /**
* Initializes the plugin, this will be executed after the plugin has been created. * Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the editor instance has finished it's initialization so use the onInit event * This call is done before the editor instance has finished it's initialization so use the onInit event
* of the editor instance to intercept that event. * of the editor instance to intercept that event.
* *
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
* @param {string} url Absolute URL to where the plugin is located. * @param {string} url Absolute URL to where the plugin is located.
*/ */
init : function(ed, url) { init : function(ed, url) {
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
ed.addCommand('mceExample', function() { ed.addCommand('mceExample', function() {
ed.windowManager.open({ ed.windowManager.open({
file : url + '/dialog.htm', file : url + '/dialog.htm',
width : 320 + parseInt(ed.getLang('example.delta_width', 0)), width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
height : 120 + parseInt(ed.getLang('example.delta_height', 0)), height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
plugin_url : url, // Plugin absolute URL plugin_url : url, // Plugin absolute URL
some_custom_arg : 'custom arg' // Custom argument some_custom_arg : 'custom arg' // Custom argument
}); });
}); });
// Register example button // Register example button
ed.addButton('example', { ed.addButton('example', {
title : 'example.desc', title : 'example.desc',
cmd : 'mceExample', cmd : 'mceExample',
image : url + '/img/example.gif' image : url + '/img/example.gif'
}); });
// Add a node change handler, selects the button in the UI when a image is selected // Add a node change handler, selects the button in the UI when a image is selected
ed.onNodeChange.add(function(ed, cm, n) { ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('example', n.nodeName == 'IMG'); cm.setActive('example', n.nodeName == 'IMG');
}); });
}, },
/** /**
* Creates control instances based in the incomming name. This method is normally not * Creates control instances based in the incomming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those. * method can be used to create those.
* *
* @param {String} n Name of the control to create. * @param {String} n Name of the control to create.
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control. * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
* @return {tinymce.ui.Control} New control instance or null if no control was created. * @return {tinymce.ui.Control} New control instance or null if no control was created.
*/ */
createControl : function(n, cm) { createControl : function(n, cm) {
return null; return null;
}, },
/** /**
* Returns information about the plugin as a name/value array. * Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version. * The current keys are longname, author, authorurl, infourl and version.
* *
* @return {Object} Name/value array containing information about the plugin. * @return {Object} Name/value array containing information about the plugin.
*/ */
getInfo : function() { getInfo : function() {
return { return {
longname : 'Example plugin', longname : 'Example plugin',
author : 'Some author', author : 'Some author',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
version : "1.0" version : "1.0"
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin); tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
})(); })();
\ No newline at end of file
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var ExampleDialog = { var ExampleDialog = {
init : function() { init : function() {
var f = document.forms[0]; var f = document.forms[0];
// Get the selected contents as text and place it in the input // Get the selected contents as text and place it in the input
f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'}); f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg'); f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');
}, },
insert : function() { insert : function() {
// Insert the contents from the input into the document // Insert the contents from the input into the document
tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value); tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);
tinyMCEPopup.close(); tinyMCEPopup.close();
} }
}; };
tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog); tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);
tinyMCE.addI18n('en.example',{ tinyMCE.addI18n('en.example',{
desc : 'This is just a template button' desc : 'This is just a template button'
}); });
tinyMCE.addI18n('en.example_dlg',{ tinyMCE.addI18n('en.example_dlg',{
title : 'This is just a example title' title : 'This is just a example title'
}); });
/* Hide the advanced tab */ /* Hide the advanced tab */
#advanced_tab { #advanced_tab {
display: none; display: none;
} }
#metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright { #metatitle, #metakeywords, #metadescription, #metaauthor, #metacopyright {
width: 280px; width: 280px;
} }
#doctype, #docencoding { #doctype, #docencoding {
width: 200px; width: 200px;
} }
#langcode { #langcode {
width: 30px; width: 30px;
} }
#bgimage { #bgimage {
width: 220px; width: 220px;
} }
#fontface { #fontface {
width: 240px; width: 240px;
} }
#leftmargin, #rightmargin, #topmargin, #bottommargin { #leftmargin, #rightmargin, #topmargin, #bottommargin {
width: 50px; width: 50px;
} }
.panel_wrapper div.current { .panel_wrapper div.current {
height: 400px; height: 400px;
} }
#stylesheet, #style { #stylesheet, #style {
width: 240px; width: 240px;
} }
#doctypes { #doctypes {
width: 200px; width: 200px;
} }
/* Head list classes */ /* Head list classes */
.headlistwrapper { .headlistwrapper {
width: 100%; width: 100%;
} }
.selected { .selected {
border: 1px solid #0A246A; border: 1px solid #0A246A;
background-color: #B6BDD2; background-color: #B6BDD2;
} }
.toolbar { .toolbar {
width: 100%; width: 100%;
} }
#headlist { #headlist {
width: 100%; width: 100%;
margin-top: 3px; margin-top: 3px;
font-size: 11px; font-size: 11px;
} }
#info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element { #info, #title_element, #meta_element, #script_element, #style_element, #base_element, #link_element, #comment_element, #unknown_element {
display: none; display: none;
} }
#addmenu { #addmenu {
position: absolute; position: absolute;
border: 1px solid gray; border: 1px solid gray;
display: none; display: none;
z-index: 100; z-index: 100;
background-color: white; background-color: white;
} }
#addmenu a { #addmenu a {
display: block; display: block;
width: 100%; width: 100%;
line-height: 20px; line-height: 20px;
text-decoration: none; text-decoration: none;
background-color: white; background-color: white;
} }
#addmenu a:hover { #addmenu a:hover {
background-color: #B6BDD2; background-color: #B6BDD2;
color: black; color: black;
} }
#addmenu span { #addmenu span {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
} }
#updateElementPanel { #updateElementPanel {
display: none; display: none;
} }
#script_element .panel_wrapper div.current { #script_element .panel_wrapper div.current {
height: 108px; height: 108px;
} }
#style_element .panel_wrapper div.current { #style_element .panel_wrapper div.current {
height: 108px; height: 108px;
} }
#link_element .panel_wrapper div.current { #link_element .panel_wrapper div.current {
height: 140px; height: 140px;
} }
#element_script_value { #element_script_value {
width: 100%; width: 100%;
height: 100px; height: 100px;
} }
#element_comment_value { #element_comment_value {
width: 100%; width: 100%;
height: 120px; height: 120px;
} }
#element_style_value { #element_style_value {
width: 100%; width: 100%;
height: 100px; height: 100px;
} }
#element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title { #element_title, #element_script_src, #element_meta_name, #element_meta_content, #element_base_href, #element_link_href, #element_link_title {
width: 250px; width: 250px;
} }
.updateElementButton { .updateElementButton {
margin-top: 3px; margin-top: 3px;
} }
/* MSIE specific styles */ /* MSIE specific styles */
* html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton { * html .addbutton, * html .removebutton, * html .moveupbutton, * html .movedownbutton {
width: 22px; width: 22px;
height: 22px; height: 22px;
} }
textarea { textarea {
height: 55px; height: 55px;
} }
.panel_wrapper div.current {height:420px;} .panel_wrapper div.current {height:420px;}
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title></title> <title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script type="text/javascript" src="../../tiny_mce.js"></script> <script type="text/javascript" src="../../tiny_mce.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function patchCallback(settings, key) { function patchCallback(settings, key) {
if (settings[key]) if (settings[key])
settings[key] = "window.opener." + settings[key]; settings[key] = "window.opener." + settings[key];
} }
var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id; var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
// Clone array // Clone array
for (var n in paSe) for (var n in paSe)
settings[n] = paSe[n]; settings[n] = paSe[n];
// Override options for fullscreen // Override options for fullscreen
for (var n in paSe.fullscreen_settings) for (var n in paSe.fullscreen_settings)
settings[n] = paSe.fullscreen_settings[n]; settings[n] = paSe.fullscreen_settings[n];
// Patch callbacks, make them point to window.opener // Patch callbacks, make them point to window.opener
patchCallback(settings, 'urlconverter_callback'); patchCallback(settings, 'urlconverter_callback');
patchCallback(settings, 'insertlink_callback'); patchCallback(settings, 'insertlink_callback');
patchCallback(settings, 'insertimage_callback'); patchCallback(settings, 'insertimage_callback');
patchCallback(settings, 'setupcontent_callback'); patchCallback(settings, 'setupcontent_callback');
patchCallback(settings, 'save_callback'); patchCallback(settings, 'save_callback');
patchCallback(settings, 'onchange_callback'); patchCallback(settings, 'onchange_callback');
patchCallback(settings, 'init_instance_callback'); patchCallback(settings, 'init_instance_callback');
patchCallback(settings, 'file_browser_callback'); patchCallback(settings, 'file_browser_callback');
patchCallback(settings, 'cleanup_callback'); patchCallback(settings, 'cleanup_callback');
patchCallback(settings, 'execcommand_callback'); patchCallback(settings, 'execcommand_callback');
patchCallback(settings, 'oninit'); patchCallback(settings, 'oninit');
// Set options // Set options
delete settings.id; delete settings.id;
settings['mode'] = 'exact'; settings['mode'] = 'exact';
settings['elements'] = 'fullscreenarea'; settings['elements'] = 'fullscreenarea';
settings['add_unload_trigger'] = false; settings['add_unload_trigger'] = false;
settings['ask'] = false; settings['ask'] = false;
settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI(); settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
settings['fullscreen_is_enabled'] = true; settings['fullscreen_is_enabled'] = true;
settings['fullscreen_editor_id'] = oeID; settings['fullscreen_editor_id'] = oeID;
settings['theme_advanced_resizing'] = false; settings['theme_advanced_resizing'] = false;
settings['strict_loading_mode'] = true; settings['strict_loading_mode'] = true;
settings.save_onsavecallback = function() { settings.save_onsavecallback = function() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'}); window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
window.opener.tinyMCE.get(oeID).execCommand('mceSave'); window.opener.tinyMCE.get(oeID).execCommand('mceSave');
window.close(); window.close();
}; };
function unloadHandler(e) { function unloadHandler(e) {
moveContent(); moveContent();
} }
function moveContent() { function moveContent() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent()); window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
} }
function closeFullscreen() { function closeFullscreen() {
moveContent(); moveContent();
window.close(); window.close();
} }
function doParentSubmit() { function doParentSubmit() {
moveContent(); moveContent();
if (window.opener.tinyMCE.selectedInstance.formElement.form) if (window.opener.tinyMCE.selectedInstance.formElement.form)
window.opener.tinyMCE.selectedInstance.formElement.form.submit(); window.opener.tinyMCE.selectedInstance.formElement.form.submit();
window.close(); window.close();
return false; return false;
} }
function render() { function render() {
var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM; var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
e.value = window.opener.tinyMCE.get(oeID).getContent(); e.value = window.opener.tinyMCE.get(oeID).getContent();
vp = dom.getViewPort(); vp = dom.getViewPort();
settings.width = vp.w; settings.width = vp.w;
settings.height = vp.h - 15; settings.height = vp.h - 15;
tinymce.dom.Event.add(window, 'resize', function() { tinymce.dom.Event.add(window, 'resize', function() {
var vp = dom.getViewPort(); var vp = dom.getViewPort();
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h); tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
}); });
tinyMCE.init(settings); tinyMCE.init(settings);
} }
// Add onunload // Add onunload
tinymce.dom.Event.add(window, "beforeunload", unloadHandler); tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
</script> </script>
</head> </head>
<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no"> <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
<form onsubmit="doParentSubmit();"> <form onsubmit="doParentSubmit();">
<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea> <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
render(); render();
</script> </script>
</body> </body>
</html> </html>
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.IESpell', { tinymce.create('tinymce.plugins.IESpell', {
init : function(ed, url) { init : function(ed, url) {
var t = this, sp; var t = this, sp;
if (!tinymce.isIE) if (!tinymce.isIE)
return; return;
t.editor = ed; t.editor = ed;
// Register commands // Register commands
ed.addCommand('mceIESpell', function() { ed.addCommand('mceIESpell', function() {
try { try {
sp = new ActiveXObject("ieSpell.ieSpellExtension"); sp = new ActiveXObject("ieSpell.ieSpellExtension");
sp.CheckDocumentNode(ed.getDoc().documentElement); sp.CheckDocumentNode(ed.getDoc().documentElement);
} catch (e) { } catch (e) {
if (e.number == -2146827859) { if (e.number == -2146827859) {
ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) { ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) {
if (s) if (s)
window.open('http://www.iespell.com/download.php', 'ieSpellDownload', ''); window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');
}); });
} else } else
ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number); ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number);
} }
}); });
// Register buttons // Register buttons
ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'}); ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'});
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'IESpell (IE Only)', longname : 'IESpell (IE Only)',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell); tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);
})(); })();
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.InsertDateTime', { tinymce.create('tinymce.plugins.InsertDateTime', {
init : function(ed, url) { init : function(ed, url) {
var t = this; var t = this;
t.editor = ed; t.editor = ed;
ed.addCommand('mceInsertDate', function() { ed.addCommand('mceInsertDate', function() {
var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_dateFormat", ed.getLang('insertdatetime.date_fmt'))); var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_dateFormat", ed.getLang('insertdatetime.date_fmt')));
ed.execCommand('mceInsertContent', false, str); ed.execCommand('mceInsertContent', false, str);
}); });
ed.addCommand('mceInsertTime', function() { ed.addCommand('mceInsertTime', function() {
var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_timeFormat", ed.getLang('insertdatetime.time_fmt'))); var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_timeFormat", ed.getLang('insertdatetime.time_fmt')));
ed.execCommand('mceInsertContent', false, str); ed.execCommand('mceInsertContent', false, str);
}); });
ed.addButton('insertdate', {title : 'insertdatetime.insertdate_desc', cmd : 'mceInsertDate'}); ed.addButton('insertdate', {title : 'insertdatetime.insertdate_desc', cmd : 'mceInsertDate'});
ed.addButton('inserttime', {title : 'insertdatetime.inserttime_desc', cmd : 'mceInsertTime'}); ed.addButton('inserttime', {title : 'insertdatetime.inserttime_desc', cmd : 'mceInsertTime'});
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Insert date/time', longname : 'Insert date/time',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
}, },
// Private methods // Private methods
_getDateTime : function(d, fmt) { _getDateTime : function(d, fmt) {
var ed = this.editor; var ed = this.editor;
function addZeros(value, len) { function addZeros(value, len) {
value = "" + value; value = "" + value;
if (value.length < len) { if (value.length < len) {
for (var i=0; i<(len-value.length); i++) for (var i=0; i<(len-value.length); i++)
value = "0" + value; value = "0" + value;
} }
return value; return value;
}; };
fmt = fmt.replace("%D", "%m/%d/%y"); fmt = fmt.replace("%D", "%m/%d/%y");
fmt = fmt.replace("%r", "%I:%M:%S %p"); fmt = fmt.replace("%r", "%I:%M:%S %p");
fmt = fmt.replace("%Y", "" + d.getFullYear()); fmt = fmt.replace("%Y", "" + d.getFullYear());
fmt = fmt.replace("%y", "" + d.getYear()); fmt = fmt.replace("%y", "" + d.getYear());
fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
fmt = fmt.replace("%B", "" + ed.getLang("insertdatetime.months_long").split(',')[d.getMonth()]); fmt = fmt.replace("%B", "" + ed.getLang("insertdatetime.months_long").split(',')[d.getMonth()]);
fmt = fmt.replace("%b", "" + ed.getLang("insertdatetime.months_short").split(',')[d.getMonth()]); fmt = fmt.replace("%b", "" + ed.getLang("insertdatetime.months_short").split(',')[d.getMonth()]);
fmt = fmt.replace("%A", "" + ed.getLang("insertdatetime.day_long").split(',')[d.getDay()]); fmt = fmt.replace("%A", "" + ed.getLang("insertdatetime.day_long").split(',')[d.getDay()]);
fmt = fmt.replace("%a", "" + ed.getLang("insertdatetime.day_short").split(',')[d.getDay()]); fmt = fmt.replace("%a", "" + ed.getLang("insertdatetime.day_short").split(',')[d.getDay()]);
fmt = fmt.replace("%%", "%"); fmt = fmt.replace("%%", "%");
return fmt; return fmt;
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('insertdatetime', tinymce.plugins.InsertDateTime); tinymce.PluginManager.add('insertdatetime', tinymce.plugins.InsertDateTime);
})(); })();
\ No newline at end of file
#id, #name, #hspace, #vspace, #class_name, #align { width: 100px } #id, #name, #hspace, #vspace, #class_name, #align { width: 100px }
#hspace, #vspace { width: 50px } #hspace, #vspace { width: 50px }
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px } #flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
#flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px } #flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }
#width, #height { width: 40px } #width, #height { width: 40px }
#src, #media_type { width: 250px } #src, #media_type { width: 250px }
#class { width: 120px } #class { width: 120px }
#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto } #prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }
.panel_wrapper div.current { height: 420px; overflow: auto } .panel_wrapper div.current { height: 420px; overflow: auto }
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none } #flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
.mceAddSelectValue { background-color: #DDDDDD } .mceAddSelectValue { background-color: #DDDDDD }
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px } #qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px } #wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px } #rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px } #shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
#qt_qtsrc { width: 200px } #qt_qtsrc { width: 200px }
iframe {border: 1px solid gray} iframe {border: 1px solid gray}
/** /**
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
*/ */
function writeFlash(p) { function writeFlash(p) {
writeEmbed( writeEmbed(
'D27CDB6E-AE6D-11cf-96B8-444553540000', 'D27CDB6E-AE6D-11cf-96B8-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'application/x-shockwave-flash', 'application/x-shockwave-flash',
p p
); );
} }
function writeShockWave(p) { function writeShockWave(p) {
writeEmbed( writeEmbed(
'166B1BCA-3F9C-11CF-8075-444553540000', '166B1BCA-3F9C-11CF-8075-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
'application/x-director', 'application/x-director',
p p
); );
} }
function writeQuickTime(p) { function writeQuickTime(p) {
writeEmbed( writeEmbed(
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
'video/quicktime', 'video/quicktime',
p p
); );
} }
function writeRealMedia(p) { function writeRealMedia(p) {
writeEmbed( writeEmbed(
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'audio/x-pn-realaudio-plugin', 'audio/x-pn-realaudio-plugin',
p p
); );
} }
function writeWindowsMedia(p) { function writeWindowsMedia(p) {
p.url = p.src; p.url = p.src;
writeEmbed( writeEmbed(
'6BF52A52-394A-11D3-B153-00C04F79FAA6', '6BF52A52-394A-11D3-B153-00C04F79FAA6',
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
'application/x-mplayer2', 'application/x-mplayer2',
p p
); );
} }
function writeEmbed(cls, cb, mt, p) { function writeEmbed(cls, cb, mt, p) {
var h = '', n; var h = '', n;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
h += '>'; h += '>';
for (n in p) for (n in p)
h += '<param name="' + n + '" value="' + p[n] + '">'; h += '<param name="' + n + '" value="' + p[n] + '">';
h += '<embed type="' + mt + '"'; h += '<embed type="' + mt + '"';
for (n in p) for (n in p)
h += n + '="' + p[n] + '" '; h += n + '="' + p[n] + '" ';
h += '></embed></object>'; h += '></embed></object>';
document.write(h); document.write(h);
} }
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.Nonbreaking', { tinymce.create('tinymce.plugins.Nonbreaking', {
init : function(ed, url) { init : function(ed, url) {
var t = this; var t = this;
t.editor = ed; t.editor = ed;
// Register commands // Register commands
ed.addCommand('mceNonBreaking', function() { ed.addCommand('mceNonBreaking', function() {
ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;'); ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span data-mce-bogus="1" class="mceItemHidden mceItemNbsp">&nbsp;</span>' : '&nbsp;');
}); });
// Register buttons // Register buttons
ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'}); ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
if (ed.getParam('nonbreaking_force_tab')) { if (ed.getParam('nonbreaking_force_tab')) {
ed.onKeyDown.add(function(ed, e) { ed.onKeyDown.add(function(ed, e) {
if (e.keyCode == 9) { if (e.keyCode == 9) {
e.preventDefault(); e.preventDefault();
ed.execCommand('mceNonBreaking'); ed.execCommand('mceNonBreaking');
ed.execCommand('mceNonBreaking'); ed.execCommand('mceNonBreaking');
ed.execCommand('mceNonBreaking'); ed.execCommand('mceNonBreaking');
} }
}); });
} }
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Nonbreaking space', longname : 'Nonbreaking space',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
// Private methods // Private methods
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking); tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
})(); })();
\ No newline at end of file
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.PageBreakPlugin', { tinymce.create('tinymce.plugins.PageBreakPlugin', {
init : function(ed, url) { init : function(ed, url) {
var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE; var pb = '<img src="' + ed.theme.url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE;
pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g'); pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
// Register commands // Register commands
ed.addCommand('mcePageBreak', function() { ed.addCommand('mcePageBreak', function() {
ed.execCommand('mceInsertContent', 0, pb); ed.execCommand('mceInsertContent', 0, pb);
}); });
// Register buttons // Register buttons
ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls}); ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls});
ed.onInit.add(function() { ed.onInit.add(function() {
if (ed.theme.onResolveName) { if (ed.theme.onResolveName) {
ed.theme.onResolveName.add(function(th, o) { ed.theme.onResolveName.add(function(th, o) {
if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls)) if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls))
o.name = 'pagebreak'; o.name = 'pagebreak';
}); });
} }
}); });
ed.onClick.add(function(ed, e) { ed.onClick.add(function(ed, e) {
e = e.target; e = e.target;
if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls)) if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls))
ed.selection.select(e); ed.selection.select(e);
}); });
ed.onNodeChange.add(function(ed, cm, n) { ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls)); cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls));
}); });
ed.onBeforeSetContent.add(function(ed, o) { ed.onBeforeSetContent.add(function(ed, o) {
o.content = o.content.replace(pbRE, pb); o.content = o.content.replace(pbRE, pb);
}); });
ed.onPostProcess.add(function(ed, o) { ed.onPostProcess.add(function(ed, o) {
if (o.get) if (o.get)
o.content = o.content.replace(/<img[^>]+>/g, function(im) { o.content = o.content.replace(/<img[^>]+>/g, function(im) {
if (im.indexOf('class="mcePageBreak') !== -1) if (im.indexOf('class="mcePageBreak') !== -1)
im = sep; im = sep;
return im; return im;
}); });
}); });
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'PageBreak', longname : 'PageBreak',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin); tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin);
})(); })();
\ No newline at end of file
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var PasteTextDialog = { var PasteTextDialog = {
init : function() { init : function() {
this.resize(); this.resize();
}, },
insert : function() { insert : function() {
var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines; var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
// Convert linebreaks into paragraphs // Convert linebreaks into paragraphs
if (document.getElementById('linebreaks').checked) { if (document.getElementById('linebreaks').checked) {
lines = h.split(/\r?\n/); lines = h.split(/\r?\n/);
if (lines.length > 1) { if (lines.length > 1) {
h = ''; h = '';
tinymce.each(lines, function(row) { tinymce.each(lines, function(row) {
h += '<p>' + row + '</p>'; h += '<p>' + row + '</p>';
}); });
} }
} }
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h}); tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
tinyMCEPopup.close(); tinyMCEPopup.close();
}, },
resize : function() { resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el; var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('content'); el = document.getElementById('content');
el.style.width = (vp.w - 20) + 'px'; el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px'; el.style.height = (vp.h - 90) + 'px';
} }
}; };
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog); tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var PasteWordDialog = { var PasteWordDialog = {
init : function() { init : function() {
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = ''; var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
// Create iframe // Create iframe
el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>'; el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
ifr = document.getElementById('iframe'); ifr = document.getElementById('iframe');
doc = ifr.contentWindow.document; doc = ifr.contentWindow.document;
// Force absolute CSS urls // Force absolute CSS urls
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")]; css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
css = css.concat(tinymce.explode(ed.settings.content_css) || []); css = css.concat(tinymce.explode(ed.settings.content_css) || []);
tinymce.each(css, function(u) { tinymce.each(css, function(u) {
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />'; cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
}); });
// Write content into iframe // Write content into iframe
doc.open(); doc.open();
doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>'); doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
doc.close(); doc.close();
doc.designMode = 'on'; doc.designMode = 'on';
this.resize(); this.resize();
window.setTimeout(function() { window.setTimeout(function() {
ifr.contentWindow.focus(); ifr.contentWindow.focus();
}, 10); }, 10);
}, },
insert : function() { insert : function() {
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML; var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true}); tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
tinyMCEPopup.close(); tinyMCEPopup.close();
}, },
resize : function() { resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el; var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('iframe'); el = document.getElementById('iframe');
if (el) { if (el) {
el.style.width = (vp.w - 20) + 'px'; el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px'; el.style.height = (vp.h - 90) + 'px';
} }
} }
}; };
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog); tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{#paste.paste_text_desc}</title> <title>{#paste.paste_text_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/pastetext.js"></script> <script type="text/javascript" src="js/pastetext.js"></script>
</head> </head>
<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;"> <body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">
<form name="source" onsubmit="return PasteTextDialog.insert();" action="#"> <form name="source" onsubmit="return PasteTextDialog.insert();" action="#">
<div style="float: left" class="title">{#paste.paste_text_desc}</div> <div style="float: left" class="title">{#paste.paste_text_desc}</div>
<div style="float: right"> <div style="float: right">
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label> <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
</div> </div>
<br style="clear: both" /> <br style="clear: both" />
<div>{#paste_dlg.text_title}</div> <div>{#paste_dlg.text_title}</div>
<textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea> <textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" name="insert" value="{#insert}" id="insert" /> <input type="submit" name="insert" value="{#insert}" id="insert" />
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div> </div>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{#paste.paste_word_desc}</title> <title>{#paste.paste_word_desc}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/pasteword.js"></script> <script type="text/javascript" src="js/pasteword.js"></script>
</head> </head>
<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;"> <body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">
<form name="source" onsubmit="return PasteWordDialog.insert();" action="#"> <form name="source" onsubmit="return PasteWordDialog.insert();" action="#">
<div class="title">{#paste.paste_word_desc}</div> <div class="title">{#paste.paste_word_desc}</div>
<div>{#paste_dlg.word_title}</div> <div>{#paste_dlg.word_title}</div>
<div id="iframecontainer"></div> <div id="iframecontainer"></div>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#insert}" /> <input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div> </div>
</form> </form>
</body> </body>
</html> </html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<script language="javascript" src="../../tiny_mce_popup.js"></script> <script language="javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="jscripts/embed.js"></script> <script type="text/javascript" src="jscripts/embed.js"></script>
<script type="text/javascript"> <script type="text/javascript">
tinyMCEPopup.onInit.add(function(ed) { tinyMCEPopup.onInit.add(function(ed) {
var dom = tinyMCEPopup.dom; var dom = tinyMCEPopup.dom;
// Load editor content_css // Load editor content_css
tinymce.each(ed.settings.content_css.split(','), function(u) { tinymce.each(ed.settings.content_css.split(','), function(u) {
dom.loadCSS(ed.documentBaseURI.toAbsolute(u)); dom.loadCSS(ed.documentBaseURI.toAbsolute(u));
}); });
// Place contents inside div container // Place contents inside div container
dom.setHTML('content', ed.getContent()); dom.setHTML('content', ed.getContent());
}); });
</script> </script>
<title>Example of a custom preview page</title> <title>Example of a custom preview page</title>
</head> </head>
<body> <body>
Editor contents: <br /> Editor contents: <br />
<div id="content"> <div id="content">
<!-- Gets filled with editor contents --> <!-- Gets filled with editor contents -->
</div> </div>
</body> </body>
</html> </html>
/** /**
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
*/ */
function writeFlash(p) { function writeFlash(p) {
writeEmbed( writeEmbed(
'D27CDB6E-AE6D-11cf-96B8-444553540000', 'D27CDB6E-AE6D-11cf-96B8-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'application/x-shockwave-flash', 'application/x-shockwave-flash',
p p
); );
} }
function writeShockWave(p) { function writeShockWave(p) {
writeEmbed( writeEmbed(
'166B1BCA-3F9C-11CF-8075-444553540000', '166B1BCA-3F9C-11CF-8075-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
'application/x-director', 'application/x-director',
p p
); );
} }
function writeQuickTime(p) { function writeQuickTime(p) {
writeEmbed( writeEmbed(
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
'video/quicktime', 'video/quicktime',
p p
); );
} }
function writeRealMedia(p) { function writeRealMedia(p) {
writeEmbed( writeEmbed(
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'audio/x-pn-realaudio-plugin', 'audio/x-pn-realaudio-plugin',
p p
); );
} }
function writeWindowsMedia(p) { function writeWindowsMedia(p) {
p.url = p.src; p.url = p.src;
writeEmbed( writeEmbed(
'6BF52A52-394A-11D3-B153-00C04F79FAA6', '6BF52A52-394A-11D3-B153-00C04F79FAA6',
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
'application/x-mplayer2', 'application/x-mplayer2',
p p
); );
} }
function writeEmbed(cls, cb, mt, p) { function writeEmbed(cls, cb, mt, p) {
var h = '', n; var h = '', n;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
h += '>'; h += '>';
for (n in p) for (n in p)
h += '<param name="' + n + '" value="' + p[n] + '">'; h += '<param name="' + n + '" value="' + p[n] + '">';
h += '<embed type="' + mt + '"'; h += '<embed type="' + mt + '"';
for (n in p) for (n in p)
h += n + '="' + p[n] + '" '; h += n + '="' + p[n] + '" ';
h += '></embed></object>'; h += '></embed></object>';
document.write(h); document.write(h);
} }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="jscripts/embed.js"></script> <script type="text/javascript" src="jscripts/embed.js"></script>
<script type="text/javascript"><!-- <script type="text/javascript"><!--
document.write('<base href="' + tinyMCEPopup.getWindowArg("base") + '">'); document.write('<base href="' + tinyMCEPopup.getWindowArg("base") + '">');
// --> // -->
</script> </script>
<title>{#preview.preview_desc}</title> <title>{#preview.preview_desc}</title>
</head> </head>
<body id="content"> <body id="content">
<script type="text/javascript"> <script type="text/javascript">
document.write(tinyMCEPopup.editor.getContent()); document.write(tinyMCEPopup.editor.getContent());
</script> </script>
</body> </body>
</html> </html>
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.Print', { tinymce.create('tinymce.plugins.Print', {
init : function(ed, url) { init : function(ed, url) {
ed.addCommand('mcePrint', function() { ed.addCommand('mcePrint', function() {
ed.getWin().print(); ed.getWin().print();
}); });
ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'}); ed.addButton('print', {title : 'print.print_desc', cmd : 'mcePrint'});
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Print', longname : 'Print',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/print',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('print', tinymce.plugins.Print); tinymce.PluginManager.add('print', tinymce.plugins.Print);
})(); })();
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.Save', { tinymce.create('tinymce.plugins.Save', {
init : function(ed, url) { init : function(ed, url) {
var t = this; var t = this;
t.editor = ed; t.editor = ed;
// Register commands // Register commands
ed.addCommand('mceSave', t._save, t); ed.addCommand('mceSave', t._save, t);
ed.addCommand('mceCancel', t._cancel, t); ed.addCommand('mceCancel', t._cancel, t);
// Register buttons // Register buttons
ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'}); ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'});
ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'}); ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'});
ed.onNodeChange.add(t._nodeChange, t); ed.onNodeChange.add(t._nodeChange, t);
ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave'); ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave');
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Save', longname : 'Save',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
}, },
// Private methods // Private methods
_nodeChange : function(ed, cm, n) { _nodeChange : function(ed, cm, n) {
var ed = this.editor; var ed = this.editor;
if (ed.getParam('save_enablewhendirty')) { if (ed.getParam('save_enablewhendirty')) {
cm.setDisabled('save', !ed.isDirty()); cm.setDisabled('save', !ed.isDirty());
cm.setDisabled('cancel', !ed.isDirty()); cm.setDisabled('cancel', !ed.isDirty());
} }
}, },
// Private methods // Private methods
_save : function() { _save : function() {
var ed = this.editor, formObj, os, i, elementId; var ed = this.editor, formObj, os, i, elementId;
formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form'); formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form');
if (ed.getParam("save_enablewhendirty") && !ed.isDirty()) if (ed.getParam("save_enablewhendirty") && !ed.isDirty())
return; return;
tinyMCE.triggerSave(); tinyMCE.triggerSave();
// Use callback instead // Use callback instead
if (os = ed.getParam("save_onsavecallback")) { if (os = ed.getParam("save_onsavecallback")) {
if (ed.execCallback('save_onsavecallback', ed)) { if (ed.execCallback('save_onsavecallback', ed)) {
ed.startContent = tinymce.trim(ed.getContent({format : 'raw'})); ed.startContent = tinymce.trim(ed.getContent({format : 'raw'}));
ed.nodeChanged(); ed.nodeChanged();
} }
return; return;
} }
if (formObj) { if (formObj) {
ed.isNotDirty = true; ed.isNotDirty = true;
if (formObj.onsubmit == null || formObj.onsubmit() != false) if (formObj.onsubmit == null || formObj.onsubmit() != false)
formObj.submit(); formObj.submit();
ed.nodeChanged(); ed.nodeChanged();
} else } else
ed.windowManager.alert("Error: No form element found."); ed.windowManager.alert("Error: No form element found.");
}, },
_cancel : function() { _cancel : function() {
var ed = this.editor, os, h = tinymce.trim(ed.startContent); var ed = this.editor, os, h = tinymce.trim(ed.startContent);
// Use callback instead // Use callback instead
if (os = ed.getParam("save_oncancelcallback")) { if (os = ed.getParam("save_oncancelcallback")) {
ed.execCallback('save_oncancelcallback', ed); ed.execCallback('save_oncancelcallback', ed);
return; return;
} }
ed.setContent(h); ed.setContent(h);
ed.undoManager.clear(); ed.undoManager.clear();
ed.nodeChanged(); ed.nodeChanged();
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('save', tinymce.plugins.Save); tinymce.PluginManager.add('save', tinymce.plugins.Save);
})(); })();
\ No newline at end of file
.panel_wrapper {height:85px;} .panel_wrapper {height:85px;}
.panel_wrapper div.current {height:85px;} .panel_wrapper div.current {height:85px;}
/* IE */ /* IE */
* html .panel_wrapper {height:100px;} * html .panel_wrapper {height:100px;}
* html .panel_wrapper div.current {height:100px;} * html .panel_wrapper div.current {height:100px;}
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.SearchReplacePlugin', { tinymce.create('tinymce.plugins.SearchReplacePlugin', {
init : function(ed, url) { init : function(ed, url) {
function open(m) { function open(m) {
// Keep IE from writing out the f/r character to the editor // Keep IE from writing out the f/r character to the editor
// instance while initializing a new dialog. See: #3131190 // instance while initializing a new dialog. See: #3131190
window.focus(); window.focus();
ed.windowManager.open({ ed.windowManager.open({
file : url + '/searchreplace.htm', file : url + '/searchreplace.htm',
width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)), height : 170 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
inline : 1, inline : 1,
auto_focus : 0 auto_focus : 0
}, { }, {
mode : m, mode : m,
search_string : ed.selection.getContent({format : 'text'}), search_string : ed.selection.getContent({format : 'text'}),
plugin_url : url plugin_url : url
}); });
}; };
// Register commands // Register commands
ed.addCommand('mceSearch', function() { ed.addCommand('mceSearch', function() {
open('search'); open('search');
}); });
ed.addCommand('mceReplace', function() { ed.addCommand('mceReplace', function() {
open('replace'); open('replace');
}); });
// Register buttons // Register buttons
ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Search/Replace', longname : 'Search/Replace',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
})(); })();
\ No newline at end of file
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var SearchReplaceDialog = { var SearchReplaceDialog = {
init : function(ed) { init : function(ed) {
var t = this, f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); var t = this, f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");
t.switchMode(m); t.switchMode(m);
f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");
// Focus input field // Focus input field
f[m + '_panel_searchstring'].focus(); f[m + '_panel_searchstring'].focus();
mcTabs.onChange.add(function(tab_id, panel_id) { mcTabs.onChange.add(function(tab_id, panel_id) {
t.switchMode(tab_id.substring(0, tab_id.indexOf('_'))); t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));
}); });
}, },
switchMode : function(m) { switchMode : function(m) {
var f, lm = this.lastMode; var f, lm = this.lastMode;
if (lm != m) { if (lm != m) {
f = document.forms[0]; f = document.forms[0];
if (lm) { if (lm) {
f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;
f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;
f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;
f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;
} }
mcTabs.displayTab(m + '_tab', m + '_panel'); mcTabs.displayTab(m + '_tab', m + '_panel');
document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";
document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";
this.lastMode = m; this.lastMode = m;
} }
}, },
searchNext : function(a) { searchNext : function(a) {
var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
// Get input // Get input
f = document.forms[0]; f = document.forms[0];
s = f[m + '_panel_searchstring'].value; s = f[m + '_panel_searchstring'].value;
b = f[m + '_panel_backwardsu'].checked; b = f[m + '_panel_backwardsu'].checked;
ca = f[m + '_panel_casesensitivebox'].checked; ca = f[m + '_panel_casesensitivebox'].checked;
rs = f['replace_panel_replacestring'].value; rs = f['replace_panel_replacestring'].value;
if (tinymce.isIE) { if (tinymce.isIE) {
r = ed.getDoc().selection.createRange(); r = ed.getDoc().selection.createRange();
} }
if (s == '') if (s == '')
return; return;
function fix() { function fix() {
// Correct Firefox graphics glitches // Correct Firefox graphics glitches
// TODO: Verify if this is actually needed any more, maybe it was for very old FF versions? // TODO: Verify if this is actually needed any more, maybe it was for very old FF versions?
r = se.getRng().cloneRange(); r = se.getRng().cloneRange();
ed.getDoc().execCommand('SelectAll', false, null); ed.getDoc().execCommand('SelectAll', false, null);
se.setRng(r); se.setRng(r);
}; };
function replace() { function replace() {
ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE
}; };
// IE flags // IE flags
if (ca) if (ca)
fl = fl | 4; fl = fl | 4;
switch (a) { switch (a) {
case 'all': case 'all':
// Move caret to beginning of text // Move caret to beginning of text
ed.execCommand('SelectAll'); ed.execCommand('SelectAll');
ed.selection.collapse(true); ed.selection.collapse(true);
if (tinymce.isIE) { if (tinymce.isIE) {
ed.focus(); ed.focus();
r = ed.getDoc().selection.createRange(); r = ed.getDoc().selection.createRange();
while (r.findText(s, b ? -1 : 1, fl)) { while (r.findText(s, b ? -1 : 1, fl)) {
r.scrollIntoView(); r.scrollIntoView();
r.select(); r.select();
replace(); replace();
fo = 1; fo = 1;
if (b) { if (b) {
r.moveEnd("character", -(rs.length)); // Otherwise will loop forever r.moveEnd("character", -(rs.length)); // Otherwise will loop forever
} }
} }
tinyMCEPopup.storeSelection(); tinyMCEPopup.storeSelection();
} else { } else {
while (w.find(s, ca, b, false, false, false, false)) { while (w.find(s, ca, b, false, false, false, false)) {
replace(); replace();
fo = 1; fo = 1;
} }
} }
if (fo) if (fo)
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced')); tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));
else else
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
return; return;
case 'current': case 'current':
if (!ed.selection.isCollapsed()) if (!ed.selection.isCollapsed())
replace(); replace();
break; break;
} }
se.collapse(b); se.collapse(b);
r = se.getRng(); r = se.getRng();
// Whats the point // Whats the point
if (!s) if (!s)
return; return;
if (tinymce.isIE) { if (tinymce.isIE) {
ed.focus(); ed.focus();
r = ed.getDoc().selection.createRange(); r = ed.getDoc().selection.createRange();
if (r.findText(s, b ? -1 : 1, fl)) { if (r.findText(s, b ? -1 : 1, fl)) {
r.scrollIntoView(); r.scrollIntoView();
r.select(); r.select();
} else } else
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
tinyMCEPopup.storeSelection(); tinyMCEPopup.storeSelection();
} else { } else {
if (!w.find(s, ca, b, false, false, false, false)) if (!w.find(s, ca, b, false, false, false, false))
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
else else
fix(); fix();
} }
} }
}; };
tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);
.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;} .mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
#text_font {width:250px;} #text_font {width:250px;}
#text_size {width:70px;} #text_size {width:70px;}
.mceAddSelectValue {background:#DDD;} .mceAddSelectValue {background:#DDD;}
select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padding_right, #box_padding_bottom, #box_padding_left {width:70px;} select, #block_text_indent, #box_width, #box_height, #box_padding_top, #box_padding_right, #box_padding_bottom, #box_padding_left {width:70px;}
#box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;} #box_margin_top, #box_margin_right, #box_margin_bottom, #box_margin_left, #positioning_width, #positioning_height, #positioning_zindex {width:70px;}
#positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;} #positioning_placement_top, #positioning_placement_right, #positioning_placement_bottom, #positioning_placement_left {width:70px;}
#positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;} #positioning_clip_top, #positioning_clip_right, #positioning_clip_bottom, #positioning_clip_left {width:70px;}
.panel_toggle_insert_span {padding-top:10px;} .panel_toggle_insert_span {padding-top:10px;}
.panel_wrapper div.current {padding-top:10px;height:230px;} .panel_wrapper div.current {padding-top:10px;height:230px;}
.delim {border-left:1px solid gray;} .delim {border-left:1px solid gray;}
.tdelim {border-bottom:1px solid gray;} .tdelim {border-bottom:1px solid gray;}
#block_display {width:145px;} #block_display {width:145px;}
#list_type {width:115px;} #list_type {width:115px;}
.disabled {background:#EEE;} .disabled {background:#EEE;}
/** /**
* editor_plugin_src.js * editor_plugin_src.js
* *
* Copyright 2009, Moxiecode Systems AB * Copyright 2009, Moxiecode Systems AB
* Released under LGPL License. * Released under LGPL License.
* *
* License: http://tinymce.moxiecode.com/license * License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing * Contributing: http://tinymce.moxiecode.com/contributing
*/ */
(function() { (function() {
tinymce.create('tinymce.plugins.StylePlugin', { tinymce.create('tinymce.plugins.StylePlugin', {
init : function(ed, url) { init : function(ed, url) {
// Register commands // Register commands
ed.addCommand('mceStyleProps', function() { ed.addCommand('mceStyleProps', function() {
var applyStyleToBlocks = false; var applyStyleToBlocks = false;
var blocks = ed.selection.getSelectedBlocks(); var blocks = ed.selection.getSelectedBlocks();
var styles = []; var styles = [];
if (blocks.length === 1) { if (blocks.length === 1) {
styles.push(ed.selection.getNode().style.cssText); styles.push(ed.selection.getNode().style.cssText);
} }
else { else {
tinymce.each(blocks, function(block) { tinymce.each(blocks, function(block) {
styles.push(ed.dom.getAttrib(block, 'style')); styles.push(ed.dom.getAttrib(block, 'style'));
}); });
applyStyleToBlocks = true; applyStyleToBlocks = true;
} }
ed.windowManager.open({ ed.windowManager.open({
file : url + '/props.htm', file : url + '/props.htm',
width : 480 + parseInt(ed.getLang('style.delta_width', 0)), width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
height : 340 + parseInt(ed.getLang('style.delta_height', 0)), height : 340 + parseInt(ed.getLang('style.delta_height', 0)),
inline : 1 inline : 1
}, { }, {
applyStyleToBlocks : applyStyleToBlocks, applyStyleToBlocks : applyStyleToBlocks,
plugin_url : url, plugin_url : url,
styles : styles styles : styles
}); });
}); });
ed.addCommand('mceSetElementStyle', function(ui, v) { ed.addCommand('mceSetElementStyle', function(ui, v) {
if (e = ed.selection.getNode()) { if (e = ed.selection.getNode()) {
ed.dom.setAttrib(e, 'style', v); ed.dom.setAttrib(e, 'style', v);
ed.execCommand('mceRepaint'); ed.execCommand('mceRepaint');
} }
}); });
ed.onNodeChange.add(function(ed, cm, n) { ed.onNodeChange.add(function(ed, cm, n) {
cm.setDisabled('styleprops', n.nodeName === 'BODY'); cm.setDisabled('styleprops', n.nodeName === 'BODY');
}); });
// Register buttons // Register buttons
ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
}, },
getInfo : function() { getInfo : function() {
return { return {
longname : 'Style', longname : 'Style',
author : 'Moxiecode Systems AB', author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com', authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
version : tinymce.majorVersion + "." + tinymce.minorVersion version : tinymce.majorVersion + "." + tinymce.minorVersion
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
})(); })();
/* CSS file for cell dialog in the table plugin */ /* CSS file for cell dialog in the table plugin */
.panel_wrapper div.current { .panel_wrapper div.current {
height: 200px; height: 200px;
} }
.advfield { .advfield {
width: 200px; width: 200px;
} }
#action { #action {
margin-bottom: 3px; margin-bottom: 3px;
} }
#class { #class {
width: 150px; width: 150px;
} }
\ No newline at end of file
/* CSS file for row dialog in the table plugin */ /* CSS file for row dialog in the table plugin */
.panel_wrapper div.current { .panel_wrapper div.current {
height: 200px; height: 200px;
} }
.advfield { .advfield {
width: 200px; width: 200px;
} }
#action { #action {
margin-bottom: 3px; margin-bottom: 3px;
} }
#rowtype,#align,#valign,#class,#height { #rowtype,#align,#valign,#class,#height {
width: 150px; width: 150px;
} }
#height { #height {
width: 50px; width: 50px;
} }
.col2 { .col2 {
padding-left: 20px; padding-left: 20px;
} }
/* CSS file for table dialog in the table plugin */ /* CSS file for table dialog in the table plugin */
.panel_wrapper div.current { .panel_wrapper div.current {
height: 245px; height: 245px;
} }
.advfield { .advfield {
width: 200px; width: 200px;
} }
#class { #class {
width: 150px; width: 150px;
} }
tinyMCEPopup.requireLangPack(); tinyMCEPopup.requireLangPack();
var MergeCellsDialog = { var MergeCellsDialog = {
init : function() { init : function() {
var f = document.forms[0]; var f = document.forms[0];
f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1); f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);
f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1); f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);
}, },
merge : function() { merge : function() {
var func, f = document.forms[0]; var func, f = document.forms[0];
tinyMCEPopup.restoreSelection(); tinyMCEPopup.restoreSelection();
func = tinyMCEPopup.getWindowArg('onaction'); func = tinyMCEPopup.getWindowArg('onaction');
func({ func({
cols : f.numcols.value, cols : f.numcols.value,
rows : f.numrows.value rows : f.numrows.value
}); });
tinyMCEPopup.close(); tinyMCEPopup.close();
} }
}; };
tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog); tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{#table_dlg.merge_cells_title}</title> <title>{#table_dlg.merge_cells_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script> <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="../../utils/mctabs.js"></script> <script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="../../utils/validate.js"></script> <script type="text/javascript" src="../../utils/validate.js"></script>
<script type="text/javascript" src="js/merge_cells.js"></script> <script type="text/javascript" src="js/merge_cells.js"></script>
</head> </head>
<body style="margin: 8px" role="application"> <body style="margin: 8px" role="application">
<form onsubmit="MergeCellsDialog.merge();return false;" action="#"> <form onsubmit="MergeCellsDialog.merge();return false;" action="#">
<fieldset> <fieldset>
<legend>{#table_dlg.merge_cells_title}</legend> <legend>{#table_dlg.merge_cells_title}</legend>
<table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%"> <table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">
<tr> <tr>
<td><label for="numcols">{#table_dlg.cols}</label>:</td> <td><label for="numcols">{#table_dlg.cols}</label>:</td>
<td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td> <td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>
</tr> </tr>
<tr> <tr>
<td><label for="numrows">{#table_dlg.rows}</label>:</td> <td><label for="numrows">{#table_dlg.rows}</label>:</td>
<td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td> <td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
<div class="mceActionPanel"> <div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="{#update}" /> <input type="submit" id="insert" name="insert" value="{#update}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div> </div>
</form> </form>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment