upgrading tinymce to 1.45

This commit is contained in:
JT Smith 2005-08-05 20:25:22 +00:00
parent c351096b73
commit 677558fe71
46 changed files with 664 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>blank_page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript">
function init() {
document.designMode = 'on';
}
</script>
</head>
<body onload="init();">
</body>
</html>

View file

@ -0,0 +1,24 @@
// Tiny MCE Paste Plugin
tinyMCE.importPluginLanguagePack('paste','en,sv,cs,zh_cn,fr_ca');function TinyMCE_paste_getControlHTML(control_name){switch(control_name){case "pastetext":return '<img id="{$editor_id}pastetext" src="{$pluginurl}/images/pastetext.gif" title="{$lang_paste_text_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteText\');" />';case "pasteword":return '<img id="{$editor_id}pasteword" src="{$pluginurl}/images/pasteword.gif" title="{$lang_paste_word_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteWord\');" />';case "selectall":return '<img id="{$editor_id}selectall" src="{$pluginurl}/images/selectall.gif" title="{$lang_selectall_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSelectAll\');" />';}return '';}function TinyMCE_paste_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mcePasteText":if(tinyMCE.isMSIE&&!tinyMCE.getParam('paste_use_dialog',false))TinyMCE_paste__insertText(clipboardData.getData("Text"),true);else{var template=new Array();template['file']='../../plugins/paste/pastetext.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",mceDo:'insert'});}return true;case "mcePasteWord":if(tinyMCE.isMSIE&&!tinyMCE.getParam('paste_use_dialog',false)){var html=TinyMCE_paste__clipboardHTML();if(html&&html.length>0)TinyMCE_paste__insertWordContent(html);}else{var template=new Array();template['file']='../../plugins/paste/pasteword.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",mceDo:'insert'});}return true;case "mceSelectAll":tinyMCE.execInstanceCommand(editor_id,'selectall');return true;}return false;}function TinyMCE_paste__insertText(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(tinyMCE.getParam("plaintext_create_paragraphs",true)){content=tinyMCE.regexpReplace(content,"\r\n\r\n","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\r\r","</p><p>","gi");content=tinyMCE.regexpReplace(content,"\n\n","</p><p>","gi");if((pos=content.indexOf('</p><p>'))!=-1){tinyMCE.execCommand("Delete");var node=tinyMCE.selectedInstance.getFocusElement();var breakElms=new Array();do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}tinyMCE.execCommand("mceInsertRawHTML",false,content);}}function TinyMCE_paste__insertWordContent(content){if(content&&content.length>0){content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");content=content.replace(/<\/?span[^>]*>/gi,"");content=content.replace(/<(\w[^>]*)style="([^"]*)"([^>]*)/gi, "<$1$3");
content = content.replace(/<\/?font[^>]*>/gi, "");
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
content = content.replace(/\/?&nbsp;*/gi, "");
content = content.replace('<p>&nbsp;</p>', '' ,'g');
if (!tinyMCE.settings['force_p_newlines']) {
content = content.replace('', '' ,'gi');
content = content.replace('</p>', '<br /><br />' ,'gi');
}
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
content = content.replace(/<\/?p[^>]*>/gi, "");
}
content = content.replace(/<\/?div[^>]*>/gi, "");
// Insert cleaned content
tinyMCE.execCommand("mceAddUndoLevel");
tinyMCE.execCommand("mceInsertContent",false,content);}}function TinyMCE_paste__clipboardHTML(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}

View file

@ -0,0 +1,173 @@
// Tiny MCE Paste Plugin
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('paste', 'en,sv,cs,zh_cn,fr_ca');
function TinyMCE_paste_getControlHTML(control_name) {
switch (control_name) {
case "pastetext":
return '<img id="{$editor_id}pastetext" src="{$pluginurl}/images/pastetext.gif" title="{$lang_paste_text_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteText\');" />';
case "pasteword":
return '<img id="{$editor_id}pasteword" src="{$pluginurl}/images/pasteword.gif" title="{$lang_paste_word_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePasteWord\');" />';
case "selectall":
return '<img id="{$editor_id}selectall" src="{$pluginurl}/images/selectall.gif" title="{$lang_selectall_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSelectAll\');" />';
}
return '';
}
function TinyMCE_paste_execCommand(editor_id, element, command, user_interface, value) {
switch (command) {
case "mcePasteText":
if (tinyMCE.isMSIE && !tinyMCE.getParam('paste_use_dialog', false))
TinyMCE_paste__insertText(clipboardData.getData("Text"), true);
else {
var template = new Array();
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", mceDo : 'insert'});
}
return true;
case "mcePasteWord":
if (tinyMCE.isMSIE && !tinyMCE.getParam('paste_use_dialog', false)) {
var html = TinyMCE_paste__clipboardHTML();
if (html && html.length > 0)
TinyMCE_paste__insertWordContent(html);
} else {
var template = new Array();
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", mceDo : 'insert'});
}
return true;
case "mceSelectAll":
tinyMCE.execInstanceCommand(editor_id, 'selectall');
return true;
}
// Pass to next handler in chain
return false;
}
function TinyMCE_paste__insertText(content, bLinebreaks) {
if (content && content.length > 0) {
if (bLinebreaks) {
// Special paragraph treatment
if (tinyMCE.getParam("plaintext_create_paragraphs", true)) {
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
// Has paragraphs
if ((pos = content.indexOf('</p><p>')) != -1) {
tinyMCE.execCommand("Delete");
var node = tinyMCE.selectedInstance.getFocusElement();
// Get list of elements to break
var breakElms = new Array();
do {
if (node.nodeType == 1) {
// Don't break tables and break at body
if (node.nodeName == "TD" || node.nodeName == "BODY")
break;
breakElms[breakElms.length] = node;
}
} while(node = node.parentNode);
var before = "", after = "</p>";
before += content.substring(0, pos);
for (var i=0; i<breakElms.length; i++) {
before += "</" + breakElms[i].nodeName + ">";
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
}
before += "<p>";
content = before + content.substring(pos+7) + after;
}
}
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
}
tinyMCE.execCommand("mceInsertRawHTML", false, content);
}
}
function TinyMCE_paste__insertWordContent(content) {
if (content && content.length > 0) {
// Cleanup Word content
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
content = content.replace(/<\/?span[^>]*>/gi, "");
content = content.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3");
content = content.replace(/<\/?font[^>]*>/gi, "");
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
content = content.replace(/\/?&nbsp;*/gi, "");
content = content.replace('<p>&nbsp;</p>', '' ,'g');
if (!tinyMCE.settings['force_p_newlines']) {
content = content.replace('', '' ,'gi');
content = content.replace('</p>', '<br /><br />' ,'gi');
}
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
content = content.replace(/<\/?p[^>]*>/gi, "");
}
content = content.replace(/<\/?div[^>]*>/gi, "");
// Insert cleaned content
tinyMCE.execCommand("mceAddUndoLevel");
tinyMCE.execCommand("mceInsertContent", false, content);
}
}
function TinyMCE_paste__clipboardHTML() {
var div = document.getElementById('_TinyMCE_clipboardHTML');
if (!div) {
var div = document.createElement('DIV');
div.id = '_TinyMCE_clipboardHTML';
with (div.style) {
visibility = 'hidden';
overflow = 'hidden';
position = 'absolute';
width = 1;
height = 1;
}
document.body.appendChild(div);
}
div.innerHTML = '';
var rng = document.body.createTextRange();
rng.moveToElementText(div);
rng.execCommand('Paste');
var html = div.innerHTML;
div.innerHTML = '';
return html;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

View file

@ -0,0 +1,8 @@
// CS lang variables
tinyMCELang['lang_paste_text_desc'] = 'Vložit neformátovaný text';
tinyMCELang['lang_paste_text_title'] = 'Použi CTRL+V na klávesnici pro vložení textu do okna.';
tinyMCELang['lang_paste_text_linebreaks'] = 'Nechej pr(erušení r(ádku*';
tinyMCELang['lang_paste_word_desc'] = 'Vložit text z aplikace Word';
tinyMCELang['lang_paste_word_title'] = 'Použi CTRL+V na klávesnici pro vložení textu do okna.';
tinyMCELang['lang_selectall_desc'] = 'Oznac(it vše';

View file

@ -0,0 +1,8 @@
// UK lang variables
tinyMCELang['lang_paste_text_desc'] = 'Paste as Plain Text';
tinyMCELang['lang_paste_text_title'] = 'Use CTRL+V on your keyboard to paste the text into the window.';
tinyMCELang['lang_paste_text_linebreaks'] = 'Keep linebreaks';
tinyMCELang['lang_paste_word_desc'] = 'Paste from Word';
tinyMCELang['lang_paste_word_title'] = 'Use CTRL+V on your keyboard to paste the text into the window.';
tinyMCELang['lang_selectall_desc'] = 'Select All';

View file

@ -0,0 +1,8 @@
// Canadian French lang variables by Virtuelcom last modification: 2005-06-15
tinyMCELang['lang_paste_text_desc'] = 'Coller texte seulement';
tinyMCELang['lang_paste_text_title'] = 'Utilisez CTRL+V sur votre clavier pour coller le texte dans la fenêtre.';
tinyMCELang['lang_paste_text_linebreaks'] = 'Garder les sauts de ligne';
tinyMCELang['lang_paste_word_desc'] = 'Coller à partir de Word';
tinyMCELang['lang_paste_word_title'] = 'Utilisez CTRL+V sur votre clavier pour coller le texte dans la fenêtre.';
tinyMCELang['lang_selectall_desc'] = 'Selectionner tout';

View file

@ -0,0 +1,8 @@
// SV lang variables
tinyMCELang['lang_paste_text_desc'] = 'Klistra in som vanlig text'
tinyMCELang['lang_paste_text_title'] = 'Anv&auml;nd CTRL+V p&aring; ditt tangentbord f&ouml;r att klistra in i detta f&ouml;nster.';
tinyMCELang['lang_paste_text_linebreaks'] = 'Spara radbrytningar';
tinyMCELang['lang_paste_word_desc'] = 'Klistra in fr&aring;n Word'
tinyMCELang['lang_paste_word_title'] = 'Anv&auml;nd CTRL+V p&aring; ditt tangentbord f&ouml;r att klistra in i detta f&ouml;nster.';
tinyMCELang['lang_selectall_desc'] = 'Select All';

View file

@ -0,0 +1,9 @@
// Simplified Chinese lang variables contributed by cube316 (cube316@gmail.com)
//请访问 http://www.cube316.net/ 以获取TinyMCE的中文支持
tinyMCELang['lang_paste_text_desc'] = '作为纯文本粘贴';
tinyMCELang['lang_paste_text_title'] = '使用快捷键 CTRL+V 将文本粘贴到以下窗口中.';
tinyMCELang['lang_paste_text_linebreaks'] = '保留换行符';
tinyMCELang['lang_paste_word_desc'] = '从Word粘贴';
tinyMCELang['lang_paste_word_title'] = '使用快捷键 CTRL+V 将文本粘贴到以下窗口中.';
tinyMCELang['lang_selectall_desc'] = '全选';

View file

@ -0,0 +1,76 @@
<html>
<head>
<title>{$lang_paste_text_desc}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" />
<meta http-equiv="Expires" content="Fri, Oct 24 1976 00:00:00 GMT" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript">
<!--
// Ryan Demmer 12/05/2005 (ryandemmer@gmail.com)
// Pretty much a hack of the HTML Source Editor
// Updated by speednet 24 May 2005
tinyMCE.setWindowArg('mce_windowresize', false);
function saveContent() {
if (window.opener) {
if (document.forms[0].htmlSource.value == ''){
window.close();
return false;
} else
window.opener.TinyMCE_paste__insertText(document.forms[0].htmlSource.value, document.forms[0].linebreaks.checked);
window.close();
}
}
function onLoadInit() {
resizeInputs();
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-25;
}
else {
wHeight = document.body.clientHeight-80;
wWidth = document.body.clientWidth-25;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}
//--></script>
</head>
<body scroll="no" onload="onLoadInit();" onresize="resizeInputs();">
<form name="source" onsubmit="saveContent();">
<table border="0" cellpadding="0" cellspacing="2" align="center">
<tr>
<td class="title">{$lang_paste_text_desc}</td>
<td align="right" nowrap="nowrap">
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{$lang_paste_text_linebreaks}</label>
</td>
</tr>
<tr>
<td colspan="2">{$lang_paste_text_title}</td>
</tr>
<tr>
<td colspan="2" align="center">
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft"></textarea>
</td>
</tr>
<tr>
<td width="50%" align="left"><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="saveContent();" /></td>
<td width="50%" align="right"><input type="button" value="{$lang_cancel}" onclick="window.close();" /></td>
</tr>
</table>
</form>
</body>
</html>

View file

@ -0,0 +1,111 @@
<html>
<head>
<title>{$lang_paste_word_desc}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" />
<meta http-equiv="Expires" content="Fri, Oct 24 1976 00:00:00 GMT" />
<script type="text/javascript" src="../../tiny_mce.js"></script>
<script type="text/javascript">
<!--
// Updated by speednet 25 May 2005
// Because we can't load tiny_mce_popup.js.
// Get tinyMCE window
var win = window.opener ? window.opener : window.dialogArguments;
var tinyMCE = null;
var tinyMCELang = null;
// Use top window if not defined
if (!win)
win = top;
// Setup window opener
window.opener = win;
var tinyMCE = win.tinyMCE;
var tinyMCELang = win.tinyMCELang;
if (!tinyMCE)
alert("tinyMCE object reference not found from popup.");
// Setup dir
if (tinyMCELang['lang_dir'])
document.dir = tinyMCELang['lang_dir'];
// Setup title
var re = new RegExp('{|\\\$|}', 'g');
var title = document.title.replace(re, "");
if (typeof tinyMCELang[title] != "undefined") {
var divElm = document.createElement("div");
divElm.innerHTML = tinyMCELang[title];
document.title = divElm.innerHTML;
}
function saveContent() {
if (win) {
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
if (html == ''){
window.close();
return false;
}
win.TinyMCE_paste__insertWordContent(html);
window.close();
}
}
function onLoadInit() {
document.body.innerHTML = tinyMCE.applyTemplate(document.body.innerHTML, tinyMCE.windowArgs);
document.getElementById("frmData").contentWindow.document.designMode='on';
document.getElementById("frmData").src = "blank.htm";
resizeInputs();
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight - 80;
wWidth = self.innerWidth - 25;
}
else {
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 25;
}
document.getElementById('frmData').style.height = Math.abs(wHeight) + 'px';
document.getElementById('frmData').style.width = Math.abs(wWidth) + 'px';
}
// Output Popup CSS class
document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
//--></script>
</head>
<body scroll="no" onload="onLoadInit();" onresize="resizeInputs();">
<form name="source" onsubmit="saveContent();">
<table border="0" cellpadding="0" cellspacing="2" align="center">
<tr>
<td colspan="2" class="title">{$lang_paste_word_desc}</td>
</tr>
<tr>
<td colspan="2">{$lang_paste_word_title}</td>
</tr>
<tr>
<td colspan="2" align="center">
<iframe id="frmData" name="frmData" src="blank.htm" height="280" width="400" style="font-family:'Courier New',Courier,mono; font-size:10px; background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>
</td>
</tr>
<tr>
<td width="50%" align="left"><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="saveContent();" /></td>
<td width="50%" align="right"><input type="button" value="{$lang_cancel}" onclick="window.close();" /></td>
</tr>
</table>
</form>
</body>
</html>

View file

@ -0,0 +1 @@
Check the TinyMCE documentation for details on this plugin.