HTML editing fixes, upgrade to TinyMCE v3.0.6
@ -1,9 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>blank_page</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body class="mceContentBody">
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,41 +1,154 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('',{
|
||||
bold_desc : 'Bold (Ctrl+B)',
|
||||
italic_desc : 'Italic (Ctrl+I)',
|
||||
underline_desc : 'Underline (Ctrl+U)',
|
||||
striketrough_desc : 'Strikethrough',
|
||||
justifyleft_desc : 'Align left',
|
||||
justifycenter_desc : 'Align center',
|
||||
justifyright_desc : 'Align right',
|
||||
justifyfull_desc : 'Align full',
|
||||
bullist_desc : 'Unordered list',
|
||||
numlist_desc : 'Ordered list',
|
||||
outdent_desc : 'Outdent',
|
||||
indent_desc : 'Indent',
|
||||
undo_desc : 'Undo (Ctrl+Z)',
|
||||
redo_desc : 'Redo (Ctrl+Y)',
|
||||
link_desc : 'Insert/edit link',
|
||||
unlink_desc : 'Unlink',
|
||||
image_desc : 'Insert/edit image',
|
||||
cleanup_desc : 'Cleanup messy code',
|
||||
focus_alert : 'A editor instance must be focused before using this command.',
|
||||
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
|
||||
insert_link_title : 'Insert/edit link',
|
||||
insert : 'Insert',
|
||||
update : 'Update',
|
||||
cancel : 'Cancel',
|
||||
insert_link_url : 'Link URL',
|
||||
insert_link_target : 'Target',
|
||||
insert_link_target_same : 'Open link in the same window',
|
||||
insert_link_target_blank : 'Open link in a new window',
|
||||
insert_image_title : 'Insert/edit image',
|
||||
insert_image_src : 'Image URL',
|
||||
insert_image_alt : 'Image description',
|
||||
help_desc : 'Help',
|
||||
bold_img : "bold.gif",
|
||||
italic_img : "italic.gif",
|
||||
underline_img : "underline.gif",
|
||||
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
|
||||
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
|
||||
});
|
||||
tinyMCE.addI18n({en:{
|
||||
common:{
|
||||
edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
|
||||
apply:"Apply",
|
||||
insert:"Insert",
|
||||
update:"Update",
|
||||
cancel:"Cancel",
|
||||
close:"Close",
|
||||
browse:"Browse",
|
||||
class_name:"Class",
|
||||
not_set:"-- Not set --",
|
||||
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
|
||||
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
|
||||
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
|
||||
invalid_data:"Error: Invalid values entered, these are marked in red.",
|
||||
more_colors:"More colors"
|
||||
},
|
||||
contextmenu:{
|
||||
align:"Alignment",
|
||||
left:"Left",
|
||||
center:"Center",
|
||||
right:"Right",
|
||||
full:"Full"
|
||||
},
|
||||
insertdatetime:{
|
||||
date_fmt:"%Y-%m-%d",
|
||||
time_fmt:"%H:%M:%S",
|
||||
insertdate_desc:"Insert date",
|
||||
inserttime_desc:"Insert time",
|
||||
months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
|
||||
months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
|
||||
day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
|
||||
day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
|
||||
},
|
||||
print:{
|
||||
print_desc:"Print"
|
||||
},
|
||||
preview:{
|
||||
preview_desc:"Preview"
|
||||
},
|
||||
directionality:{
|
||||
ltr_desc:"Direction left to right",
|
||||
rtl_desc:"Direction right to left"
|
||||
},
|
||||
layer:{
|
||||
insertlayer_desc:"Insert new layer",
|
||||
forward_desc:"Move forward",
|
||||
backward_desc:"Move backward",
|
||||
absolute_desc:"Toggle absolute positioning",
|
||||
content:"New layer..."
|
||||
},
|
||||
save:{
|
||||
save_desc:"Save",
|
||||
cancel_desc:"Cancel all changes"
|
||||
},
|
||||
nonbreaking:{
|
||||
nonbreaking_desc:"Insert non-breaking space character"
|
||||
},
|
||||
iespell:{
|
||||
iespell_desc:"Run spell checking",
|
||||
download:"ieSpell not detected. Do you want to install it now?"
|
||||
},
|
||||
advhr:{
|
||||
advhr_desc:"Horizontale rule"
|
||||
},
|
||||
emotions:{
|
||||
emotions_desc:"Emotions"
|
||||
},
|
||||
searchreplace:{
|
||||
search_desc:"Find",
|
||||
replace_desc:"Find/Replace"
|
||||
},
|
||||
advimage:{
|
||||
image_desc:"Insert/edit image"
|
||||
},
|
||||
advlink:{
|
||||
link_desc:"Insert/edit link"
|
||||
},
|
||||
xhtmlxtras:{
|
||||
cite_desc:"Citation",
|
||||
abbr_desc:"Abbreviation",
|
||||
acronym_desc:"Acronym",
|
||||
del_desc:"Deletion",
|
||||
ins_desc:"Insertion",
|
||||
attribs_desc:"Insert/Edit Attributes"
|
||||
},
|
||||
style:{
|
||||
desc:"Edit CSS Style"
|
||||
},
|
||||
paste:{
|
||||
paste_text_desc:"Paste as Plain Text",
|
||||
paste_word_desc:"Paste from Word",
|
||||
selectall_desc:"Select All"
|
||||
},
|
||||
paste_dlg:{
|
||||
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
|
||||
text_linebreaks:"Keep linebreaks",
|
||||
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
|
||||
},
|
||||
table:{
|
||||
desc:"Inserts a new table",
|
||||
row_before_desc:"Insert row before",
|
||||
row_after_desc:"Insert row after",
|
||||
delete_row_desc:"Delete row",
|
||||
col_before_desc:"Insert column before",
|
||||
col_after_desc:"Insert column after",
|
||||
delete_col_desc:"Remove column",
|
||||
split_cells_desc:"Split merged table cells",
|
||||
merge_cells_desc:"Merge table cells",
|
||||
row_desc:"Table row properties",
|
||||
cell_desc:"Table cell properties",
|
||||
props_desc:"Table properties",
|
||||
paste_row_before_desc:"Paste table row before",
|
||||
paste_row_after_desc:"Paste table row after",
|
||||
cut_row_desc:"Cut table row",
|
||||
copy_row_desc:"Copy table row",
|
||||
del:"Delete table",
|
||||
row:"Row",
|
||||
col:"Column",
|
||||
cell:"Cell"
|
||||
},
|
||||
autosave:{
|
||||
unload_msg:"The changes you made will be lost if you navigate away from this page."
|
||||
},
|
||||
fullscreen:{
|
||||
desc:"Toggle fullscreen mode"
|
||||
},
|
||||
media:{
|
||||
desc:"Insert / edit embedded media",
|
||||
edit:"Edit embedded media"
|
||||
},
|
||||
fullpage:{
|
||||
desc:"Document properties"
|
||||
},
|
||||
template:{
|
||||
desc:"Insert predefined template content"
|
||||
},
|
||||
visualchars:{
|
||||
desc:"Visual control characters on/off."
|
||||
},
|
||||
spellchecker:{
|
||||
desc:"Toggle spellchecker",
|
||||
menu:"Spellchecker settings",
|
||||
ignore_word:"Ignore word",
|
||||
ignore_words:"Ignore all",
|
||||
langs:"Languages",
|
||||
wait:"Please wait...",
|
||||
sug:"Suggestions",
|
||||
no_sug:"No suggestions",
|
||||
no_mpell:"No misspellings found."
|
||||
},
|
||||
pagebreak:{
|
||||
desc:"Insert page break."
|
||||
}}});
|
@ -1,9 +0,0 @@
|
||||
Beginning with version 2.0.5 the language packs are no
|
||||
longer included with the core distribution.
|
||||
Language packs can be downloaded from the TinyMCE website:
|
||||
http://tinymce.moxiecode.com/download.php
|
||||
|
||||
The language pack codes are based on ISO-639-1:
|
||||
http://www.loc.gov/standards/iso639-2/englangn.html
|
||||
|
||||
Plrease try using entities if possible. Like å etc for non a-z characters.
|
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Experimental plugin for new Cleanup routine, this logic will be moved into the core ones it's stable enougth.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Dummy file since cleanup is now moved to core */
|
@ -1 +0,0 @@
|
||||
Dummy plugin since cleanup is now moved into core.
|
@ -0,0 +1,613 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
|
||||
|
||||
tinymce.create('tinymce.plugins.Compat2x', {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Compat2x',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
(function() {
|
||||
// Extend tinyMCE/EditorManager
|
||||
tinymce.extend(tinyMCE, {
|
||||
addToLang : function(p, l) {
|
||||
each(l, function(v, k) {
|
||||
tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v;
|
||||
});
|
||||
},
|
||||
|
||||
getInstanceById : function(n) {
|
||||
return this.get(n);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var EditorManager = tinymce.EditorManager;
|
||||
|
||||
tinyMCE.instances = {};
|
||||
tinyMCE.plugins = {};
|
||||
tinymce.PluginManager.onAdd.add(function(pm, n, p) {
|
||||
tinyMCE.plugins[n] = p;
|
||||
});
|
||||
|
||||
tinyMCE.majorVersion = tinymce.majorVersion;
|
||||
tinyMCE.minorVersion = tinymce.minorVersion;
|
||||
tinyMCE.releaseDate = tinymce.releaseDate;
|
||||
tinyMCE.baseURL = tinymce.baseURL;
|
||||
tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera;
|
||||
tinyMCE.isMSIE5 = tinymce.isIE;
|
||||
tinyMCE.isMSIE5_0 = tinymce.isIE;
|
||||
tinyMCE.isMSIE7 = tinymce.isIE;
|
||||
tinyMCE.isGecko = tinymce.isGecko;
|
||||
tinyMCE.isSafari = tinymce.isWebKit;
|
||||
tinyMCE.isOpera = tinymce.isOpera;
|
||||
tinyMCE.isMac = false;
|
||||
tinyMCE.isNS7 = false;
|
||||
tinyMCE.isNS71 = false;
|
||||
tinyMCE.compat = true;
|
||||
|
||||
// Extend tinyMCE class
|
||||
TinyMCE_Engine = tinyMCE;
|
||||
tinymce.extend(tinyMCE, {
|
||||
getParam : function(n, dv) {
|
||||
return this.activeEditor.getParam(n, dv);
|
||||
},
|
||||
|
||||
addEvent : function(e, na, f, sc) {
|
||||
tinymce.dom.Event.add(e, na, f, sc || this);
|
||||
},
|
||||
|
||||
getControlHTML : function(n) {
|
||||
return EditorManager.activeEditor.controlManager.createControl(n);
|
||||
},
|
||||
|
||||
loadCSS : function(u) {
|
||||
tinymce.DOM.loadCSS(u);
|
||||
},
|
||||
|
||||
importCSS : function(doc, u) {
|
||||
if (doc == document)
|
||||
this.loadCSS(u);
|
||||
else
|
||||
new tinymce.dom.DOMUtils(doc).loadCSS(u);
|
||||
},
|
||||
|
||||
log : function() {
|
||||
console.debug.apply(console, arguments);
|
||||
},
|
||||
|
||||
getLang : function(n, dv) {
|
||||
var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv);
|
||||
|
||||
// Is number
|
||||
if (/^[0-9\-.]+$/g.test(v))
|
||||
return parseInt(v);
|
||||
|
||||
return v;
|
||||
},
|
||||
|
||||
isInstance : function(o) {
|
||||
return o != null && typeof(o) == "object" && o.execCommand;
|
||||
},
|
||||
|
||||
triggerNodeChange : function() {
|
||||
EditorManager.activeEditor.nodeChanged();
|
||||
},
|
||||
|
||||
regexpReplace : function(in_str, reg_exp, replace_str, opts) {
|
||||
var re;
|
||||
|
||||
if (in_str == null)
|
||||
return in_str;
|
||||
|
||||
if (typeof(opts) == "undefined")
|
||||
opts = 'g';
|
||||
|
||||
re = new RegExp(reg_exp, opts);
|
||||
|
||||
return in_str.replace(re, replace_str);
|
||||
},
|
||||
|
||||
trim : function(s) {
|
||||
return tinymce.trim(s);
|
||||
},
|
||||
|
||||
xmlEncode : function(s) {
|
||||
return tinymce.DOM.encode(s);
|
||||
},
|
||||
|
||||
explode : function(s, d) {
|
||||
var o = [];
|
||||
|
||||
tinymce.each(s.split(d), function(v) {
|
||||
if (v != '')
|
||||
o.push(v);
|
||||
});
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
switchClass : function(id, cls) {
|
||||
var b;
|
||||
|
||||
if (/^mceButton/.test(cls)) {
|
||||
b = EditorManager.activeEditor.controlManager.get(id);
|
||||
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
switch (cls) {
|
||||
case "mceButtonNormal":
|
||||
b.setDisabled(false);
|
||||
b.setActive(false);
|
||||
return;
|
||||
|
||||
case "mceButtonDisabled":
|
||||
b.setDisabled(true);
|
||||
return;
|
||||
|
||||
case "mceButtonSelected":
|
||||
b.setActive(true);
|
||||
b.setDisabled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addCSSClass : function(e, n, b) {
|
||||
return tinymce.DOM.addClass(e, n, b);
|
||||
},
|
||||
|
||||
hasCSSClass : function(e, n) {
|
||||
return tinymce.DOM.hasClass(e, n);
|
||||
},
|
||||
|
||||
removeCSSClass : function(e, n) {
|
||||
return tinymce.DOM.removeClass(e, n);
|
||||
},
|
||||
|
||||
getCSSClasses : function() {
|
||||
var cl = EditorManager.activeEditor.dom.getClasses(), o = [];
|
||||
|
||||
each(cl, function(c) {
|
||||
o.push(c['class']);
|
||||
});
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
setWindowArg : function(n, v) {
|
||||
EditorManager.activeEditor.windowManager.params[n] = v;
|
||||
},
|
||||
|
||||
getWindowArg : function(n, dv) {
|
||||
var wm = EditorManager.activeEditor.windowManager, v;
|
||||
|
||||
v = wm.getParam(n);
|
||||
if (v === '')
|
||||
return '';
|
||||
|
||||
return v || wm.getFeature(n) || dv;
|
||||
},
|
||||
|
||||
getParentNode : function(n, f) {
|
||||
return this._getDOM().getParent(n, f);
|
||||
},
|
||||
|
||||
selectElements : function(n, na, f) {
|
||||
var i, a = [], nl, x;
|
||||
|
||||
for (x=0, na = na.split(','); x<na.length; x++)
|
||||
for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
|
||||
(!f || f(nl[i])) && a.push(nl[i]);
|
||||
|
||||
return a;
|
||||
},
|
||||
|
||||
getNodeTree : function(n, na, t, nn) {
|
||||
return this.selectNodes(n, function(n) {
|
||||
return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
|
||||
}, na ? na : []);
|
||||
},
|
||||
|
||||
getAttrib : function(e, n, dv) {
|
||||
return this._getDOM().getAttrib(e, n, dv);
|
||||
},
|
||||
|
||||
setAttrib : function(e, n, v) {
|
||||
return this._getDOM().setAttrib(e, n, v);
|
||||
},
|
||||
|
||||
getElementsByAttributeValue : function(n, e, a, v) {
|
||||
var i, nl = n.getElementsByTagName(e), o = [];
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
|
||||
o[o.length] = nl[i];
|
||||
}
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
selectNodes : function(n, f, a) {
|
||||
var i;
|
||||
|
||||
if (!a)
|
||||
a = [];
|
||||
|
||||
if (f(n))
|
||||
a[a.length] = n;
|
||||
|
||||
if (n.hasChildNodes()) {
|
||||
for (i=0; i<n.childNodes.length; i++)
|
||||
tinyMCE.selectNodes(n.childNodes[i], f, a);
|
||||
}
|
||||
|
||||
return a;
|
||||
},
|
||||
|
||||
getContent : function() {
|
||||
return EditorManager.activeEditor.getContent();
|
||||
},
|
||||
|
||||
getParentElement : function(n, na, f) {
|
||||
if (na)
|
||||
na = new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$', 'g');
|
||||
|
||||
return this._getDOM().getParent(n, function(n) {
|
||||
return n.nodeType == 1 && (!na || na.test(n.nodeName)) && (!f || f(n));
|
||||
}, this.activeEditor.getBody());
|
||||
},
|
||||
|
||||
importPluginLanguagePack : function(n) {
|
||||
tinymce.PluginManager.requireLangPack(n);
|
||||
},
|
||||
|
||||
getButtonHTML : function(cn, lang, img, c, u, v) {
|
||||
var ed = EditorManager.activeEditor;
|
||||
|
||||
img = img.replace(/\{\$pluginurl\}/g, tinyMCE.pluginURL);
|
||||
img = img.replace(/\{\$themeurl\}/g, tinyMCE.themeURL);
|
||||
lang = lang.replace(/^lang_/g, '');
|
||||
|
||||
return ed.controlManager.createButton(cn, {
|
||||
title : lang,
|
||||
command : c,
|
||||
ui : u,
|
||||
value : v,
|
||||
scope : this,
|
||||
'class' : 'compat',
|
||||
image : img
|
||||
});
|
||||
},
|
||||
|
||||
addSelectAccessibility : function(e, s, w) {
|
||||
// Add event handlers
|
||||
if (!s._isAccessible) {
|
||||
s.onkeydown = tinyMCE.accessibleEventHandler;
|
||||
s.onblur = tinyMCE.accessibleEventHandler;
|
||||
s._isAccessible = true;
|
||||
s._win = w;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
accessibleEventHandler : function(e) {
|
||||
var elm, win = this._win;
|
||||
|
||||
e = tinymce.isIE ? win.event : e;
|
||||
elm = tinymce.isIE ? e.srcElement : e.target;
|
||||
|
||||
// Unpiggyback onchange on blur
|
||||
if (e.type == "blur") {
|
||||
if (elm.oldonchange) {
|
||||
elm.onchange = elm.oldonchange;
|
||||
elm.oldonchange = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Piggyback onchange
|
||||
if (elm.nodeName == "SELECT" && !elm.oldonchange) {
|
||||
elm.oldonchange = elm.onchange;
|
||||
elm.onchange = null;
|
||||
}
|
||||
|
||||
// Execute onchange and remove piggyback
|
||||
if (e.keyCode == 13 || e.keyCode == 32) {
|
||||
elm.onchange = elm.oldonchange;
|
||||
elm.onchange();
|
||||
elm.oldonchange = null;
|
||||
|
||||
tinyMCE.cancelEvent(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
cancelEvent : function(e) {
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
},
|
||||
|
||||
handleVisualAid : function(e) {
|
||||
EditorManager.activeEditor.addVisual(e);
|
||||
},
|
||||
|
||||
getAbsPosition : function(n, r) {
|
||||
return tinymce.DOM.getPos(n, r);
|
||||
},
|
||||
|
||||
cleanupEventStr : function(s) {
|
||||
s = "" + s;
|
||||
s = s.replace('function anonymous()\n{\n', '');
|
||||
s = s.replace('\n}', '');
|
||||
s = s.replace(/^return true;/gi, ''); // Remove event blocker
|
||||
|
||||
return s;
|
||||
},
|
||||
|
||||
getVisualAidClass : function(s) {
|
||||
// TODO: Implement
|
||||
return s;
|
||||
},
|
||||
|
||||
parseStyle : function(s) {
|
||||
return this._getDOM().parseStyle(s);
|
||||
},
|
||||
|
||||
serializeStyle : function(s) {
|
||||
return this._getDOM().serializeStyle(s);
|
||||
},
|
||||
|
||||
openWindow : function(tpl, args) {
|
||||
var ed = EditorManager.activeEditor, o = {}, n;
|
||||
|
||||
// Convert name/value array to object
|
||||
for (n in tpl)
|
||||
o[n] = tpl[n];
|
||||
|
||||
tpl = o;
|
||||
|
||||
args = args || {};
|
||||
tpl.url = new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file);
|
||||
tpl.inline = tpl.inline || args.inline;
|
||||
|
||||
ed.windowManager.open(tpl, args);
|
||||
},
|
||||
|
||||
closeWindow : function(win) {
|
||||
EditorManager.activeEditor.windowManager.close(win);
|
||||
},
|
||||
|
||||
getOuterHTML : function(e) {
|
||||
return tinymce.DOM.getOuterHTML(e);
|
||||
},
|
||||
|
||||
setOuterHTML : function(e, h, d) {
|
||||
return tinymce.DOM.setOuterHTML(e, h, d);
|
||||
},
|
||||
|
||||
hasPlugin : function(n) {
|
||||
return tinymce.PluginManager.get(n) != null;
|
||||
},
|
||||
|
||||
_setEventsEnabled : function() {
|
||||
// Ignore it!!
|
||||
},
|
||||
|
||||
addPlugin : function(pn, f) {
|
||||
var t = this;
|
||||
|
||||
function PluginWrapper(ed) {
|
||||
tinyMCE.selectedInstance = ed;
|
||||
|
||||
ed.onInit.add(function() {
|
||||
t.settings = ed.settings;
|
||||
t.settings['base_href'] = tinyMCE.documentBasePath;
|
||||
tinyMCE.settings = t.settings;
|
||||
tinyMCE.documentBasePath = ed.documentBasePath;
|
||||
//ed.formElement = DOM.get(ed.id);
|
||||
|
||||
if (f.initInstance)
|
||||
f.initInstance(ed);
|
||||
|
||||
ed.contentDocument = ed.getDoc();
|
||||
ed.contentWindow = ed.getWin();
|
||||
ed.undoRedo = ed.undoManager;
|
||||
ed.startContent = ed.getContent({format : 'raw'});
|
||||
|
||||
tinyMCE.instances[ed.id] = ed;
|
||||
tinyMCE.loadedFiles = [];
|
||||
});
|
||||
|
||||
ed.onActivate.add(function() {
|
||||
tinyMCE.settings = ed.settings;
|
||||
tinyMCE.selectedInstance = ed;
|
||||
});
|
||||
|
||||
/* if (f.removeInstance) {
|
||||
ed.onDestroy.add(function() {
|
||||
return f.removeInstance(ed.id);
|
||||
});
|
||||
}*/
|
||||
|
||||
if (f.handleNodeChange) {
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
f.handleNodeChange(ed.id, n, 0, 0, false, !ed.selection.isCollapsed());
|
||||
});
|
||||
}
|
||||
|
||||
if (f.onChange) {
|
||||
ed.onChange.add(function(ed, n) {
|
||||
return f.onChange(ed);
|
||||
});
|
||||
}
|
||||
|
||||
if (f.cleanup) {
|
||||
ed.onGetContent.add(function() {
|
||||
//f.cleanup(type, content, inst);
|
||||
});
|
||||
}
|
||||
|
||||
this.getInfo = function() {
|
||||
return f.getInfo();
|
||||
};
|
||||
|
||||
this.createControl = function(n) {
|
||||
tinyMCE.pluginURL = tinymce.baseURL + '/plugins/' + pn;
|
||||
tinyMCE.themeURL = tinymce.baseURL + '/themes/' + tinyMCE.activeEditor.settings.theme;
|
||||
|
||||
if (f.getControlHTML)
|
||||
return f.getControlHTML(n);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
this.execCommand = function(cmd, ui, val) {
|
||||
if (f.execCommand)
|
||||
return f.execCommand(ed.id, ed.getBody(), cmd, ui, val);
|
||||
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
tinymce.PluginManager.add(pn, PluginWrapper);
|
||||
},
|
||||
|
||||
_getDOM : function() {
|
||||
return tinyMCE.activeEditor ? tinyMCE.activeEditor.dom : tinymce.DOM;
|
||||
},
|
||||
|
||||
convertRelativeToAbsoluteURL : function(b, u) {
|
||||
return new tinymce.util.URI(b).toAbsolute(u);
|
||||
},
|
||||
|
||||
convertAbsoluteURLToRelativeURL : function(b, u) {
|
||||
return new tinymce.util.URI(b).toRelative(u);
|
||||
}
|
||||
});
|
||||
|
||||
// Extend Editor class
|
||||
tinymce.extend(tinymce.Editor.prototype, {
|
||||
getFocusElement : function() {
|
||||
return this.selection.getNode();
|
||||
},
|
||||
|
||||
getData : function(n) {
|
||||
if (!this.data)
|
||||
this.data = [];
|
||||
|
||||
if (!this.data[n])
|
||||
this.data[n] = [];
|
||||
|
||||
return this.data[n];
|
||||
},
|
||||
|
||||
hasPlugin : function(n) {
|
||||
return this.plugins[n] != null;
|
||||
},
|
||||
|
||||
getContainerWin : function() {
|
||||
return window;
|
||||
},
|
||||
|
||||
getHTML : function(raw) {
|
||||
return this.getContent({ format : raw ? 'raw' : 'html'});
|
||||
},
|
||||
|
||||
setHTML : function(h) {
|
||||
this.setContent(h);
|
||||
},
|
||||
|
||||
getSel : function() {
|
||||
return this.selection.getSel();
|
||||
},
|
||||
|
||||
getRng : function() {
|
||||
return this.selection.getRng();
|
||||
},
|
||||
|
||||
isHidden : function() {
|
||||
var s;
|
||||
|
||||
if (!tinymce.isGecko)
|
||||
return false;
|
||||
|
||||
s = this.getSel();
|
||||
|
||||
// Weird, wheres that cursor selection?
|
||||
return (!s || !s.rangeCount || s.rangeCount == 0);
|
||||
},
|
||||
|
||||
translate : function(s) {
|
||||
var c = this.settings.language, o;
|
||||
|
||||
o = tinymce.EditorManager.i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
|
||||
return tinymce.EditorManager.i18n[c + '.' + b] || '{#' + b + '}';
|
||||
});
|
||||
|
||||
o = o.replace(/{\$lang_([^}]+)\}/g, function(a, b) {
|
||||
return tinymce.EditorManager.i18n[c + '.' + b] || '{$lang_' + b + '}';
|
||||
});
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
repaint : function() {
|
||||
this.execCommand('mceRepaint');
|
||||
}
|
||||
});
|
||||
|
||||
// Extend selection
|
||||
tinymce.extend(tinymce.dom.Selection.prototype, {
|
||||
getSelectedText : function() {
|
||||
return this.getContent({format : 'text'});
|
||||
},
|
||||
|
||||
getSelectedHTML : function() {
|
||||
return this.getContent({format : 'html'});
|
||||
},
|
||||
|
||||
getFocusElement : function() {
|
||||
return this.getNode();
|
||||
},
|
||||
|
||||
selectNode : function(node, collapse, select_text_node, to_start) {
|
||||
var t = this;
|
||||
|
||||
t.select(node, select_text_node || 0);
|
||||
|
||||
if (!is(collapse))
|
||||
collapse = true;
|
||||
|
||||
if (collapse) {
|
||||
if (!is(to_start))
|
||||
to_start = true;
|
||||
|
||||
t.collapse(to_start);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('compat2x', tinymce.plugins.Compat2x);
|
||||
})();
|
||||
|
@ -0,0 +1 @@
|
||||
(function(){var Event=tinymce.dom.Event,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.ContextMenu',{init:function(ed){var t=this;t.editor=ed;t.onContextMenu=new tinymce.util.Dispatcher(this);ed.onContextMenu.add(function(ed,e){if(!e.ctrlKey){t._getMenu(ed).showMenu(e.clientX,e.clientY);Event.add(document,'click',hide);Event.cancel(e);}});function hide(){if(t._menu){t._menu.removeAll();t._menu.destroy();Event.remove(document,'click',hide);}};ed.onMouseDown.add(hide);ed.onKeyDown.add(hide);},getInfo:function(){return{longname:'Contextmenu',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_getMenu:function(ed){var t=this,m=t._menu,se=ed.selection,col=se.isCollapsed(),el=se.getNode()||ed.getBody(),am,p1,p2;if(m){m.removeAll();m.destroy();}p1=DOM.getPos(ed.getContentAreaContainer());p2=DOM.getPos(ed.getContainer());m=ed.controlManager.createDropMenu('contextmenu',{offset_x:p1.x,offset_y:p1.y,constrain:1});t._menu=m;m.add({title:'advanced.cut_desc',icon:'cut',cmd:'Cut'}).setDisabled(col);m.add({title:'advanced.copy_desc',icon:'copy',cmd:'Copy'}).setDisabled(col);m.add({title:'advanced.paste_desc',icon:'paste',cmd:'Paste'});if((el.nodeName=='A'&&!ed.dom.getAttrib(el,'name'))||!col){m.addSeparator();m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});}m.addSeparator();m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();am=m.addMenu({title:'contextmenu.align'});am.add({title:'contextmenu.left',icon:'justifyleft',cmd:'JustifyLeft'});am.add({title:'contextmenu.center',icon:'justifycenter',cmd:'JustifyCenter'});am.add({title:'contextmenu.right',icon:'justifyright',cmd:'JustifyRight'});am.add({title:'contextmenu.full',icon:'justifyfull',cmd:'JustifyFull'});t.onContextMenu.dispatch(t,m,el,col);return m;}});tinymce.PluginManager.add('contextmenu',tinymce.plugins.ContextMenu);})();
|
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 755 2008-03-29 19:14:42Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.ContextMenu', {
|
||||
init : function(ed) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
t.onContextMenu = new tinymce.util.Dispatcher(this);
|
||||
|
||||
ed.onContextMenu.add(function(ed, e) {
|
||||
if (!e.ctrlKey) {
|
||||
t._getMenu(ed).showMenu(e.clientX, e.clientY);
|
||||
Event.add(document, 'click', hide);
|
||||
Event.cancel(e);
|
||||
}
|
||||
});
|
||||
|
||||
function hide() {
|
||||
if (t._menu) {
|
||||
t._menu.removeAll();
|
||||
t._menu.destroy();
|
||||
Event.remove(document, 'click', hide);
|
||||
}
|
||||
};
|
||||
|
||||
ed.onMouseDown.add(hide);
|
||||
ed.onKeyDown.add(hide);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Contextmenu',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_getMenu : function(ed) {
|
||||
var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;
|
||||
|
||||
if (m) {
|
||||
m.removeAll();
|
||||
m.destroy();
|
||||
}
|
||||
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = DOM.getPos(ed.getContainer());
|
||||
|
||||
m = ed.controlManager.createDropMenu('contextmenu', {
|
||||
offset_x : p1.x,
|
||||
offset_y : p1.y,
|
||||
/* vp_offset_x : p2.x,
|
||||
vp_offset_y : p2.y,*/
|
||||
constrain : 1
|
||||
});
|
||||
|
||||
t._menu = m;
|
||||
|
||||
m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);
|
||||
m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);
|
||||
m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});
|
||||
|
||||
if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {
|
||||
m.addSeparator();
|
||||
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
||||
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
||||
}
|
||||
|
||||
m.addSeparator();
|
||||
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
||||
|
||||
m.addSeparator();
|
||||
am = m.addMenu({title : 'contextmenu.align'});
|
||||
am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});
|
||||
am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});
|
||||
am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});
|
||||
am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});
|
||||
|
||||
t.onContextMenu.dispatch(t, m, el, col);
|
||||
|
||||
return m;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
|
||||
})();
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})();
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.Directionality', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
ed.addCommand('mceDirectionLTR', function() {
|
||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
||||
|
||||
if (e) {
|
||||
if (ed.dom.getAttrib(e, "dir") != "ltr")
|
||||
ed.dom.setAttrib(e, "dir", "ltr");
|
||||
else
|
||||
ed.dom.setAttrib(e, "dir", "");
|
||||
}
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
|
||||
ed.addCommand('mceDirectionRTL', function() {
|
||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
||||
|
||||
if (e) {
|
||||
if (ed.dom.getAttrib(e, "dir") != "rtl")
|
||||
ed.dom.setAttrib(e, "dir", "rtl");
|
||||
else
|
||||
ed.dom.setAttrib(e, "dir", "");
|
||||
}
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
|
||||
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
||||
ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
|
||||
|
||||
ed.onNodeChange.add(t._nodeChange, t);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Directionality',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_nodeChange : function(ed, cm, n) {
|
||||
var dom = ed.dom, dir;
|
||||
|
||||
n = dom.getParent(n, dom.isBlock);
|
||||
if (!n) {
|
||||
cm.setDisabled('ltr', 1);
|
||||
cm.setDisabled('rtl', 1);
|
||||
return;
|
||||
}
|
||||
|
||||
dir = dom.getAttrib(n, 'dir');
|
||||
cm.setActive('ltr', dir == "ltr");
|
||||
cm.setDisabled('ltr', 0);
|
||||
cm.setActive('rtl', dir == "rtl");
|
||||
cm.setDisabled('rtl', 0);
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
|
||||
})();
|
@ -1 +1 @@
|
||||
tinyMCE.importPluginLanguagePack('emotions');var TinyMCE_EmotionsPlugin={getInfo:function(){return{longname:'Emotions',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"emotions":return tinyMCE.getButtonHTML(cn,'lang_emotions_desc','{$pluginurl}/images/emotions.gif','mceEmotion')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceEmotion":var template=new Array();template['file']='../../plugins/emotions/emotions.htm';template['width']=250;template['height']=160;template['width']+=tinyMCE.getLang('lang_emotions_delta_width',0);template['height']+=tinyMCE.getLang('lang_emotions_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true}return false}};tinyMCE.addPlugin('emotions',TinyMCE_EmotionsPlugin);
|
||||
(function(){tinymce.create('tinymce.plugins.EmotionsPlugin',{init:function(ed,url){ed.addCommand('mceEmotion',function(){ed.windowManager.open({file:url+'/emotions.htm',width:250+parseInt(ed.getLang('emotions.delta_width',0)),height:160+parseInt(ed.getLang('emotions.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('emotions',{title:'emotions.emotions_desc',cmd:'mceEmotion'});},getInfo:function(){return{longname:'Emotions',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('emotions',tinymce.plugins.EmotionsPlugin);})();
|
@ -1,63 +1,40 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
* $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('emotions');
|
||||
|
||||
// Plucin static class
|
||||
var TinyMCE_EmotionsPlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Emotions',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the HTML contents of the emotions control.
|
||||
*/
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "emotions":
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_emotions_desc', '{$pluginurl}/images/emotions.gif', 'mceEmotion');
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes the mceEmotion command.
|
||||
*/
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mceEmotion":
|
||||
var template = new Array();
|
||||
|
||||
template['file'] = '../../plugins/emotions/emotions.htm'; // Relative to theme
|
||||
template['width'] = 250;
|
||||
template['height'] = 160;
|
||||
|
||||
// Language specific width and height addons
|
||||
template['width'] += tinyMCE.getLang('lang_emotions_delta_width', 0);
|
||||
template['height'] += tinyMCE.getLang('lang_emotions_delta_height', 0);
|
||||
|
||||
tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
|
||||
|
||||
return true;
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.EmotionsPlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceEmotion', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/emotions.htm',
|
||||
width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Emotions',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Register plugin
|
||||
tinyMCE.addPlugin('emotions', TinyMCE_EmotionsPlugin);
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
|
||||
})();
|
Before Width: | Height: | Size: 319 B |
@ -1,2 +0,0 @@
|
||||
These emotions where taken from Mozilla Thunderbird.
|
||||
I hope they don't get angry if I use them here after all this is a open source project aswell.
|
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 337 B |
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
@ -0,0 +1,22 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var EmotionsDialog = {
|
||||
init : function(ed) {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom;
|
||||
|
||||
tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {
|
||||
src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,
|
||||
alt : ed.getLang(title),
|
||||
title : ed.getLang(title),
|
||||
border : 0
|
||||
}));
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);
|
@ -1,21 +0,0 @@
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
}
|
||||
|
||||
function insertEmotion(file_name, title) {
|
||||
title = tinyMCE.getLang(title);
|
||||
|
||||
if (title == null)
|
||||
title = "";
|
||||
|
||||
// XML encode
|
||||
title = title.replace(/&/g, '&');
|
||||
title = title.replace(/\"/g, '"');
|
||||
title = title.replace(/</g, '<');
|
||||
title = title.replace(/>/g, '>');
|
||||
|
||||
var html = '<img src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" mce_src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" border="0" alt="' + title + '" title="' + title + '" />';
|
||||
|
||||
tinyMCE.execCommand('mceInsertContent', false, html);
|
||||
tinyMCEPopup.close();
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('emotions',{
|
||||
title : 'Insert emotion',
|
||||
desc : 'Emotions',
|
||||
cool : 'Cool',
|
||||
cry : 'Cry',
|
||||
embarassed : 'Embarassed',
|
||||
foot_in_mouth : 'Foot in mouth',
|
||||
frown : 'Frown',
|
||||
innocent : 'Innocent',
|
||||
kiss : 'Kiss',
|
||||
laughing : 'Laughing',
|
||||
money_mouth : 'Money mouth',
|
||||
sealed : 'Sealed',
|
||||
smile : 'Smile',
|
||||
surprised : 'Surprised',
|
||||
tongue_out : 'Tongue out',
|
||||
undecided : 'Undecided',
|
||||
wink : 'Wink',
|
||||
yell : 'Yell'
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
tinyMCE.addI18n('en.emotions_dlg',{
|
||||
title:"Insert emotion",
|
||||
desc:"Emotions",
|
||||
cool:"Cool",
|
||||
cry:"Cry",
|
||||
embarassed:"Embarassed",
|
||||
foot_in_mouth:"Foot in mouth",
|
||||
frown:"Frown",
|
||||
innocent:"Innocent",
|
||||
kiss:"Kiss",
|
||||
laughing:"Laughing",
|
||||
money_mouth:"Money mouth",
|
||||
sealed:"Sealed",
|
||||
smile:"Smile",
|
||||
surprised:"Surprised",
|
||||
tongue_out:"Tongue out",
|
||||
undecided:"Undecided",
|
||||
wink:"Wink",
|
||||
yell:"Yell"
|
||||
});
|
@ -1 +0,0 @@
|
||||
Check the TinyMCE documentation for details on this plugin.
|
@ -1,26 +1,6 @@
|
||||
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
|
||||
border: 1px dotted #cc0000;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #ffffcc;
|
||||
}
|
||||
|
||||
.mceItemShockWave {
|
||||
background-image: url('../images/shockwave.gif');
|
||||
}
|
||||
|
||||
.mceItemFlash {
|
||||
background-image: url('../images/flash.gif');
|
||||
}
|
||||
|
||||
.mceItemQuickTime {
|
||||
background-image: url('../images/quicktime.gif');
|
||||
}
|
||||
|
||||
.mceItemWindowsMedia {
|
||||
background-image: url('../images/windowsmedia.gif');
|
||||
}
|
||||
|
||||
.mceItemRealMedia {
|
||||
background-image: url('../images/realmedia.gif');
|
||||
}
|
||||
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;}
|
||||
.mceItemShockWave {background-image: url(../img/shockwave.gif);}
|
||||
.mceItemFlash {background-image:url(../img/flash.gif);}
|
||||
.mceItemQuickTime {background-image:url(../img/quicktime.gif);}
|
||||
.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);}
|
||||
.mceItemRealMedia {background-image:url(../img/realmedia.gif);}
|
||||
|
Before Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 387 B |
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 415 B |
@ -1,94 +0,0 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('media',{
|
||||
title : 'Insert / edit embedded media',
|
||||
desc : 'Insert / edit embedded media',
|
||||
general : 'General',
|
||||
advanced : 'Advanced',
|
||||
file : 'File/URL',
|
||||
list : 'List',
|
||||
size : 'Dimensions',
|
||||
preview : 'Preview',
|
||||
constrain_proportions : 'Constrain proportions',
|
||||
type : 'Type',
|
||||
id : 'Id',
|
||||
name : 'Name',
|
||||
class_name : 'Class',
|
||||
vspace : 'V-Space',
|
||||
hspace : 'H-Space',
|
||||
play : 'Auto play',
|
||||
loop : 'Loop',
|
||||
menu : 'Show menu',
|
||||
quality : 'Quality',
|
||||
scale : 'Scale',
|
||||
align : 'Align',
|
||||
salign : 'SAlign',
|
||||
wmode : 'WMode',
|
||||
bgcolor : 'Background',
|
||||
base : 'Base',
|
||||
flashvars : 'Flashvars',
|
||||
liveconnect : 'SWLiveConnect',
|
||||
autohref : 'AutoHREF',
|
||||
cache : 'Cache',
|
||||
hidden : 'Hidden',
|
||||
controller : 'Controller',
|
||||
kioskmode : 'Kiosk mode',
|
||||
playeveryframe : 'Play every frame',
|
||||
targetcache : 'Target cache',
|
||||
correction : 'No correction',
|
||||
enablejavascript : 'Enable JavaScript',
|
||||
starttime : 'Start time',
|
||||
endtime : 'End time',
|
||||
href : 'Href',
|
||||
qtsrcchokespeed : 'Choke speed',
|
||||
target : 'Target',
|
||||
volume : 'Volume',
|
||||
autostart : 'Auto start',
|
||||
enabled : 'Enabled',
|
||||
fullscreen : 'Fullscreen',
|
||||
invokeurls : 'Invoke URLs',
|
||||
mute : 'Mute',
|
||||
stretchtofit : 'Stretch to fit',
|
||||
windowlessvideo : 'Windowless video',
|
||||
balance : 'Balance',
|
||||
baseurl : 'Base URL',
|
||||
captioningid : 'Captioning id',
|
||||
currentmarker : 'Current marker',
|
||||
currentposition : 'Current position',
|
||||
defaultframe : 'Default frame',
|
||||
playcount : 'Play count',
|
||||
rate : 'Rate',
|
||||
uimode : 'UI Mode',
|
||||
flash_options : 'Flash options',
|
||||
qt_options : 'Quicktime options',
|
||||
wmp_options : 'Windows media player options',
|
||||
rmp_options : 'Real media player options',
|
||||
shockwave_options : 'Shockwave options',
|
||||
autogotourl : 'Auto goto URL',
|
||||
center : 'Center',
|
||||
imagestatus : 'Image status',
|
||||
maintainaspect : 'Maintain aspect',
|
||||
nojava : 'No java',
|
||||
prefetch : 'Prefetch',
|
||||
shuffle : 'Shuffle',
|
||||
console : 'Console',
|
||||
numloop : 'Num loops',
|
||||
controls : 'Controls',
|
||||
scriptcallbacks : 'Script callbacks',
|
||||
swstretchstyle : 'Stretch style',
|
||||
swstretchhalign : 'Stretch H-Align',
|
||||
swstretchvalign : 'Stretch V-Align',
|
||||
sound : 'Sound',
|
||||
progress : 'Progress',
|
||||
qtsrc : 'QT Src',
|
||||
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
|
||||
align_top : 'Top',
|
||||
align_right : 'Right',
|
||||
align_bottom : 'Bottom',
|
||||
align_left : 'Left',
|
||||
align_center : 'Center',
|
||||
align_top_left : 'Top left',
|
||||
align_top_right : 'Top right',
|
||||
align_bottom_left : 'Bottom left',
|
||||
align_bottom_right : 'Bottom right'
|
||||
});
|
@ -0,0 +1,103 @@
|
||||
tinyMCE.addI18n('en.media_dlg',{
|
||||
title:"Insert / edit embedded media",
|
||||
general:"General",
|
||||
advanced:"Advanced",
|
||||
file:"File/URL",
|
||||
list:"List",
|
||||
size:"Dimensions",
|
||||
preview:"Preview",
|
||||
constrain_proportions:"Constrain proportions",
|
||||
type:"Type",
|
||||
id:"Id",
|
||||
name:"Name",
|
||||
class_name:"Class",
|
||||
vspace:"V-Space",
|
||||
hspace:"H-Space",
|
||||
play:"Auto play",
|
||||
loop:"Loop",
|
||||
menu:"Show menu",
|
||||
quality:"Quality",
|
||||
scale:"Scale",
|
||||
align:"Align",
|
||||
salign:"SAlign",
|
||||
wmode:"WMode",
|
||||
bgcolor:"Background",
|
||||
base:"Base",
|
||||
flashvars:"Flashvars",
|
||||
liveconnect:"SWLiveConnect",
|
||||
autohref:"AutoHREF",
|
||||
cache:"Cache",
|
||||
hidden:"Hidden",
|
||||
controller:"Controller",
|
||||
kioskmode:"Kiosk mode",
|
||||
playeveryframe:"Play every frame",
|
||||
targetcache:"Target cache",
|
||||
correction:"No correction",
|
||||
enablejavascript:"Enable JavaScript",
|
||||
starttime:"Start time",
|
||||
endtime:"End time",
|
||||
href:"Href",
|
||||
qtsrcchokespeed:"Choke speed",
|
||||
target:"Target",
|
||||
volume:"Volume",
|
||||
autostart:"Auto start",
|
||||
enabled:"Enabled",
|
||||
fullscreen:"Fullscreen",
|
||||
invokeurls:"Invoke URLs",
|
||||
mute:"Mute",
|
||||
stretchtofit:"Stretch to fit",
|
||||
windowlessvideo:"Windowless video",
|
||||
balance:"Balance",
|
||||
baseurl:"Base URL",
|
||||
captioningid:"Captioning id",
|
||||
currentmarker:"Current marker",
|
||||
currentposition:"Current position",
|
||||
defaultframe:"Default frame",
|
||||
playcount:"Play count",
|
||||
rate:"Rate",
|
||||
uimode:"UI Mode",
|
||||
flash_options:"Flash options",
|
||||
qt_options:"Quicktime options",
|
||||
wmp_options:"Windows media player options",
|
||||
rmp_options:"Real media player options",
|
||||
shockwave_options:"Shockwave options",
|
||||
autogotourl:"Auto goto URL",
|
||||
center:"Center",
|
||||
imagestatus:"Image status",
|
||||
maintainaspect:"Maintain aspect",
|
||||
nojava:"No java",
|
||||
prefetch:"Prefetch",
|
||||
shuffle:"Shuffle",
|
||||
console:"Console",
|
||||
numloop:"Num loops",
|
||||
controls:"Controls",
|
||||
scriptcallbacks:"Script callbacks",
|
||||
swstretchstyle:"Stretch style",
|
||||
swstretchhalign:"Stretch H-Align",
|
||||
swstretchvalign:"Stretch V-Align",
|
||||
sound:"Sound",
|
||||
progress:"Progress",
|
||||
qtsrc:"QT Src",
|
||||
qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..",
|
||||
align_top:"Top",
|
||||
align_right:"Right",
|
||||
align_bottom:"Bottom",
|
||||
align_left:"Left",
|
||||
align_center:"Center",
|
||||
align_top_left:"Top left",
|
||||
align_top_right:"Top right",
|
||||
align_bottom_left:"Bottom left",
|
||||
align_bottom_right:"Bottom right",
|
||||
flv_options:"Flash video options",
|
||||
flv_scalemode:"Scale mode",
|
||||
flv_buffer:"Buffer",
|
||||
flv_startimage:"Start image",
|
||||
flv_starttime:"Start time",
|
||||
flv_defaultvolume:"Default volumne",
|
||||
flv_hiddengui:"Hidden GUI",
|
||||
flv_autostart:"Auto start",
|
||||
flv_loop:"Loop",
|
||||
flv_showscalemodes:"Show scale modes",
|
||||
flv_smoothvideo:"Smooth video",
|
||||
flv_jscallback:"JS Callback"
|
||||
});
|
@ -1 +1 @@
|
||||
tinyMCE.importPluginLanguagePack('nonbreaking');var TinyMCE_NonBreakingPlugin={getInfo:function(){return{longname:'Nonbreaking space',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"nonbreaking":return tinyMCE.getButtonHTML(cn,'lang_nonbreaking_desc','{$pluginurl}/images/nonbreaking.gif','mceNonBreaking',false)}return""},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),h;switch(command){case"mceNonBreaking":h=(inst.visualChars&&inst.visualChars.state)?'<span class="mceItemHiddenVisualChar">·</span>':' ';tinyMCE.execInstanceCommand(editor_id,'mceInsertContent',false,h);return true}return false},handleEvent:function(e){var inst,h;if(!tinyMCE.isOpera&&e.type=='keydown'&&e.keyCode==9&&tinyMCE.getParam('nonbreaking_force_tab',false)){inst=tinyMCE.selectedInstance;h=(inst.visualChars&&inst.visualChars.state)?'<span class="mceItemHiddenVisualChar">···</span>':' ';tinyMCE.execInstanceCommand(inst.editorId,'mceInsertContent',false,h);tinyMCE.cancelEvent(e);return false}return true}};tinyMCE.addPlugin("nonbreaking",TinyMCE_NonBreakingPlugin);
|
||||
(function(){tinymce.create('tinymce.plugins.Nonbreaking',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceNonBreaking',function(){ed.execCommand('mceInsertContent',false,(ed.plugins.visualchars&&ed.plugins.visualchars.state)?'<span class="mceItemHidden mceVisualNbsp">·</span>':' ');});ed.addButton('nonbreaking',{title:'nonbreaking.nonbreaking_desc',cmd:'mceNonBreaking'});if(ed.getParam('nonbreaking_force_tab')){ed.onKeyDown.add(function(ed,e){if(tinymce.isIE&&e.keyCode==9){ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');tinymce.dom.Event.cancel(e);}});}},getInfo:function(){return{longname:'Nonbreaking space',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('nonbreaking',tinymce.plugins.Nonbreaking);})();
|
@ -1,62 +1,50 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('nonbreaking');
|
||||
|
||||
var TinyMCE_NonBreakingPlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Nonbreaking space',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "nonbreaking":
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_nonbreaking_desc', '{$pluginurl}/images/nonbreaking.gif', 'mceNonBreaking', false);
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.Nonbreaking', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceNonBreaking', function() {
|
||||
ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span class="mceItemHidden mceVisualNbsp">·</span>' : ' ');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
|
||||
|
||||
if (ed.getParam('nonbreaking_force_tab')) {
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (tinymce.isIE && e.keyCode == 9) {
|
||||
ed.execCommand('mceNonBreaking');
|
||||
ed.execCommand('mceNonBreaking');
|
||||
ed.execCommand('mceNonBreaking');
|
||||
tinymce.dom.Event.cancel(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Nonbreaking space',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
// Private methods
|
||||
});
|
||||
|
||||
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
var inst = tinyMCE.getInstanceById(editor_id), h;
|
||||
|
||||
switch (command) {
|
||||
case "mceNonBreaking":
|
||||
h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">·</span>' : ' ';
|
||||
tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, h);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
handleEvent : function(e) {
|
||||
var inst, h;
|
||||
|
||||
if (!tinyMCE.isOpera && e.type == 'keydown' && e.keyCode == 9 && tinyMCE.getParam('nonbreaking_force_tab', false)) {
|
||||
inst = tinyMCE.selectedInstance;
|
||||
|
||||
h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">···</span>' : ' ';
|
||||
tinyMCE.execInstanceCommand(inst.editorId, 'mceInsertContent', false, h);
|
||||
|
||||
tinyMCE.cancelEvent(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCE.addPlugin("nonbreaking", TinyMCE_NonBreakingPlugin);
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
|
||||
})();
|
Before Width: | Height: | Size: 619 B |
@ -1,5 +0,0 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('nonbreaking',{
|
||||
desc : 'Insert non-breaking space character'
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>blank_page</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="css/blank.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
<script type="text/javascript">
|
||||
function init() {
|
||||
if (parent.tinymce.isIE)
|
||||
document.body.contentEditable = true;
|
||||
else
|
||||
document.designMode = 'on';
|
||||
|
||||
parent.initIframe(document);
|
||||
window.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,14 @@
|
||||
html, body {height:98%}
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10px;
|
||||
scrollbar-3dlight-color: #F0F0EE;
|
||||
scrollbar-arrow-color: #676662;
|
||||
scrollbar-base-color: #F0F0EE;
|
||||
scrollbar-darkshadow-color: #DDDDDD;
|
||||
scrollbar-face-color: #E0E0DD;
|
||||
scrollbar-highlight-color: #F0F0EE;
|
||||
scrollbar-shadow-color: #F0F0EE;
|
||||
scrollbar-track-color: #F5F5F5;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
.sourceIframe {
|
||||
border: 1px solid #808080;
|
||||
}
|
@ -0,0 +1,387 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 738 2008-03-20 20:00:48Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event;
|
||||
|
||||
tinymce.create('tinymce.plugins.PastePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mcePasteText', function(ui, v) {
|
||||
if (ui) {
|
||||
if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/pastetext.htm',
|
||||
width : 450,
|
||||
height : 400,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
} else
|
||||
t._insertText(clipboardData.getData("Text"), true);
|
||||
} else
|
||||
t._insertText(v.html, v.linebreaks);
|
||||
});
|
||||
|
||||
ed.addCommand('mcePasteWord', function(ui, v) {
|
||||
if (ui) {
|
||||
if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/pasteword.htm',
|
||||
width : 450,
|
||||
height : 400,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
} else
|
||||
t._insertText(t._clipboardHTML());
|
||||
} else
|
||||
t._insertWordContent(v);
|
||||
});
|
||||
|
||||
ed.addCommand('mceSelectAll', function() {
|
||||
ed.execCommand('selectall');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true});
|
||||
ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true});
|
||||
ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'});
|
||||
|
||||
if (ed.getParam("paste_auto_cleanup_on_paste", false)) {
|
||||
ed.onPaste.add(function(ed, e) {
|
||||
return t._handlePasteEvent(e)
|
||||
});
|
||||
}
|
||||
|
||||
if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) {
|
||||
// Force paste dialog if non IE browser
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.ctrlKey && e.keyCode == 86) {
|
||||
window.setTimeout(function() {
|
||||
ed.execCommand("mcePasteText", true);
|
||||
}, 1);
|
||||
|
||||
Event.cancel(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Paste text/word',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_handlePasteEvent : function(e) {
|
||||
var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r;
|
||||
|
||||
// Removes italic, strong etc, the if was needed due to bug #1437114
|
||||
if (ed && (r = sel.getRng()) && r.text.length > 0)
|
||||
ed.execCommand('delete');
|
||||
|
||||
if (html && html.length > 0)
|
||||
ed.execCommand('mcePasteWord', false, html);
|
||||
|
||||
return Event.cancel(e);
|
||||
},
|
||||
|
||||
_insertText : function(content, bLinebreaks) {
|
||||
if (content && content.length > 0) {
|
||||
if (bLinebreaks) {
|
||||
// Special paragraph treatment
|
||||
if (this.editor.getParam("paste_create_paragraphs", true)) {
|
||||
var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||
for (var i=0; i<rl.length; i+=2)
|
||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||
|
||||
content = content.replace(/\r\n\r\n/g, '</p><p>');
|
||||
content = content.replace(/\r\r/g, '</p><p>');
|
||||
content = content.replace(/\n\n/g, '</p><p>');
|
||||
|
||||
// Has paragraphs
|
||||
if ((pos = content.indexOf('</p><p>')) != -1) {
|
||||
this.editor.execCommand("Delete");
|
||||
|
||||
var node = this.editor.selection.getNode();
|
||||
|
||||
// Get list of elements to break
|
||||
var breakElms = [];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.editor.getParam("paste_create_linebreaks", true)) {
|
||||
content = content.replace(/\r\n/g, '<br />');
|
||||
content = content.replace(/\r/g, '<br />');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
}
|
||||
}
|
||||
|
||||
this.editor.execCommand("mceInsertRawHTML", false, content);
|
||||
}
|
||||
},
|
||||
|
||||
_insertWordContent : function(content) {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
if (content && content.length > 0) {
|
||||
// Cleanup Word content
|
||||
var bull = String.fromCharCode(8226);
|
||||
var middot = String.fromCharCode(183);
|
||||
|
||||
if (ed.getParam('paste_insert_word_content_callback'))
|
||||
content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
|
||||
|
||||
var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||
for (var i=0; i<rl.length; i+=2)
|
||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||
|
||||
if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
|
||||
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
|
||||
}
|
||||
|
||||
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
|
||||
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
|
||||
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
|
||||
content = content.replace(/<o:p><\/o:p>/gi, "");
|
||||
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
|
||||
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
|
||||
|
||||
if (this.editor.getParam("paste_remove_spans", true))
|
||||
content = content.replace(/<\/?span[^>]*>/gi, "");
|
||||
|
||||
if (this.editor.getParam("paste_remove_styles", true))
|
||||
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
|
||||
|
||||
content = content.replace(/<\/?font[^>]*>/gi, "");
|
||||
|
||||
// Strips class attributes.
|
||||
switch (this.editor.getParam("paste_strip_class_attributes", "all")) {
|
||||
case "all":
|
||||
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||
break;
|
||||
|
||||
case "mso":
|
||||
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
|
||||
break;
|
||||
}
|
||||
|
||||
content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI());
|
||||
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
|
||||
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
|
||||
content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
|
||||
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
|
||||
|
||||
// content = content.replace(/\/? */gi, "");
|
||||
// content = content.replace(/<p> <\/p>/gi, '');
|
||||
|
||||
if (!this.editor.getParam('force_p_newlines')) {
|
||||
content = content.replace('', '' ,'gi');
|
||||
content = content.replace('</p>', '<br /><br />' ,'gi');
|
||||
}
|
||||
|
||||
if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) {
|
||||
content = content.replace(/<\/?p[^>]*>/gi, "");
|
||||
}
|
||||
|
||||
content = content.replace(/<\/?div[^>]*>/gi, "");
|
||||
|
||||
// Convert all middlot lists to UL lists
|
||||
if (this.editor.getParam("paste_convert_middot_lists", true)) {
|
||||
var div = ed.dom.create("div", null, content);
|
||||
|
||||
// Convert all middot paragraphs to li elements
|
||||
var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList");
|
||||
|
||||
while (this._convertMiddots(div, "--list--")) ; // bull
|
||||
while (this._convertMiddots(div, middot, className)) ; // Middot
|
||||
while (this._convertMiddots(div, bull)) ; // bull
|
||||
|
||||
content = div.innerHTML;
|
||||
}
|
||||
|
||||
// Replace all headers with strong and fix some other issues
|
||||
if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
|
||||
content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
|
||||
content = content.replace(/<h[1-6]>/gi, '<p><b>');
|
||||
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
|
||||
content = content.replace(/<b> <\/b>/gi, '<b> </b>');
|
||||
content = content.replace(/^( )*/gi, '');
|
||||
}
|
||||
|
||||
content = content.replace(/--list--/gi, ""); // Remove --list--
|
||||
|
||||
if (ed.getParam('paste_insert_word_content_callback'))
|
||||
content = ed.execCallback('paste_insert_word_content_callback', 'after', content);
|
||||
|
||||
// Insert cleaned content
|
||||
this.editor.execCommand("mceInsertContent", false, content);
|
||||
|
||||
if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {
|
||||
var ed = this.editor;
|
||||
|
||||
window.setTimeout(function() {
|
||||
ed.execCommand("mceCleanup");
|
||||
}, 1); // Do normal cleanup detached from this thread
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_reEscape : function(s) {
|
||||
var l = "?.\\*[](){}+^$:";
|
||||
var o = "";
|
||||
|
||||
for (var i=0; i<s.length; i++) {
|
||||
var c = s.charAt(i);
|
||||
|
||||
if (l.indexOf(c) != -1)
|
||||
o += '\\' + c;
|
||||
else
|
||||
o += c;
|
||||
}
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
_convertMiddots : function(div, search, class_name) {
|
||||
var ed = this.editor, mdot = String.fromCharCode(183), bull = String.fromCharCode(8226);
|
||||
var nodes, prevul, i, p, ul, li, np, cp, li;
|
||||
|
||||
nodes = div.getElementsByTagName("p");
|
||||
for (i=0; i<nodes.length; i++) {
|
||||
p = nodes[i];
|
||||
|
||||
// Is middot
|
||||
if (p.innerHTML.indexOf(search) == 0) {
|
||||
ul = ed.dom.create("ul");
|
||||
|
||||
if (class_name)
|
||||
ul.className = class_name;
|
||||
|
||||
// Add the first one
|
||||
li = ed.dom.create("li");
|
||||
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||
ul.appendChild(li);
|
||||
|
||||
// Add the rest
|
||||
np = p.nextSibling;
|
||||
while (np) {
|
||||
// If the node is whitespace, then
|
||||
// ignore it and continue on.
|
||||
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
|
||||
np = np.nextSibling;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (search == mdot) {
|
||||
if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) {
|
||||
// Second level of nesting
|
||||
if (!prevul) {
|
||||
prevul = ul;
|
||||
ul = ed.dom.create("ul");
|
||||
prevul.appendChild(ul);
|
||||
}
|
||||
np.innerHTML = np.innerHTML.replace(/^o/, '');
|
||||
} else {
|
||||
// Pop the stack if we're going back up to the first level
|
||||
if (prevul) {
|
||||
ul = prevul;
|
||||
prevul = null;
|
||||
}
|
||||
// Not element or middot paragraph
|
||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Not element or middot paragraph
|
||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
cp = np.nextSibling;
|
||||
li = ed.dom.create("li");
|
||||
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||
np.parentNode.removeChild(np);
|
||||
ul.appendChild(li);
|
||||
np = cp;
|
||||
}
|
||||
|
||||
p.parentNode.replaceChild(ul, p);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_clipboardHTML : function() {
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
|
||||
})();
|
@ -0,0 +1,42 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function saveContent() {
|
||||
if (document.forms[0].htmlSource.value == '') {
|
||||
tinyMCEPopup.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand('mcePasteText', false, {
|
||||
html : document.forms[0].htmlSource.value,
|
||||
linebreaks : document.forms[0].linebreaks.checked
|
||||
});
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function onLoadInit() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// Remove Gecko spellchecking
|
||||
if (tinymce.isGecko)
|
||||
document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
|
||||
|
||||
resizeInputs();
|
||||
}
|
||||
|
||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||
|
||||
function resizeInputs() {
|
||||
if (!tinymce.isIE) {
|
||||
wHeight = self.innerHeight-80;
|
||||
wWidth = self.innerWidth-17;
|
||||
} else {
|
||||
wHeight = document.body.clientHeight-80;
|
||||
wWidth = document.body.clientWidth-17;
|
||||
}
|
||||
|
||||
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
|
||||
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(onLoadInit);
|
@ -0,0 +1,56 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function saveContent() {
|
||||
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
|
||||
|
||||
if (html == ''){
|
||||
tinyMCEPopup.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand('mcePasteWord', false, html);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function onLoadInit() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// Fix for endless reloading in FF
|
||||
window.setTimeout(createIFrame, 10);
|
||||
}
|
||||
|
||||
function createIFrame() {
|
||||
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
|
||||
}
|
||||
|
||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||
|
||||
function initIframe(doc) {
|
||||
var dir = tinyMCEPopup.editor.settings.directionality;
|
||||
|
||||
doc.body.dir = dir;
|
||||
|
||||
// Remove Gecko spellchecking
|
||||
if (tinymce.isGecko)
|
||||
doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
|
||||
|
||||
resizeInputs();
|
||||
}
|
||||
|
||||
function resizeInputs() {
|
||||
if (!tinymce.isIE) {
|
||||
wHeight = self.innerHeight - 80;
|
||||
wWidth = self.innerWidth - 18;
|
||||
} else {
|
||||
wHeight = document.body.clientHeight - 80;
|
||||
wWidth = document.body.clientWidth - 18;
|
||||
}
|
||||
|
||||
var elm = document.getElementById('frmData');
|
||||
if (elm) {
|
||||
elm.style.height = Math.abs(wHeight) + 'px';
|
||||
elm.style.width = Math.abs(wWidth) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(onLoadInit);
|
@ -0,0 +1,5 @@
|
||||
tinyMCE.addI18n('en.paste_dlg',{
|
||||
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
|
||||
text_linebreaks:"Keep linebreaks",
|
||||
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_text_desc}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/pastetext.js"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="saveContent();return false;" action="#">
|
||||
<div style="float: left" class="title">{#paste.paste_text_desc}</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div>{#paste_dlg.text_title}</div>
|
||||
|
||||
<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" class="mceFocus"></textarea>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" name="insert" value="{#insert}" id="insert" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,29 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>{#paste.paste_word_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/pasteword.js"></script>
|
||||
<link href="css/pasteword.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="saveContent();" action="#">
|
||||
<div class="title">{#paste.paste_word_desc}</div>
|
||||
|
||||
<div>{#paste_dlg.word_title}</div>
|
||||
|
||||
<div id="iframecontainer"></div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
This is the location you place TinyMCE plugins.
|
@ -1,20 +1,6 @@
|
||||
/* stylesheet for advsearchreplace plugin*/
|
||||
.panel_wrapper {height:85px;}
|
||||
.panel_wrapper div.current {height:85px;}
|
||||
|
||||
.panel_wrapper { height: 85px; }
|
||||
.panel_wrapper div.current { height: 85px; }
|
||||
|
||||
/* MS IE only styles */
|
||||
* html .panel_wrapper { height: 100px; }
|
||||
* html .panel_wrapper div.current { height: 100px; }
|
||||
|
||||
#replaceBtn, #replaceAllBtn {
|
||||
padding-bottom: 2px;
|
||||
font-weight: bold;
|
||||
width: 90px;
|
||||
height: 21px;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#replaceBtn { background: url(../images/replace_button_bg.gif); }
|
||||
#replaceAllBtn { background: url(../images/replace_all_button_bg.gif); }
|
||||
/* IE */
|
||||
* html .panel_wrapper {height:100px;}
|
||||
* html .panel_wrapper div.current {height:100px;}
|
||||
|
@ -1 +1 @@
|
||||
tinyMCE.importPluginLanguagePack('searchreplace');var TinyMCE_SearchReplacePlugin={getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){inst.addShortcut('ctrl','f','lang_searchreplace_search_desc','mceSearch',true);},getControlHTML:function(cn){switch(cn){case"search":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_search_desc','{$pluginurl}/images/search.gif','mceSearch',true);case"replace":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_replace_desc','{$pluginurl}/images/replace.gif','mceSearchReplace',true)}return""},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),selectedText=inst.selection.getSelectedText(),rng;function defValue(key,default_value){value[key]=typeof(value[key])=="undefined"?default_value:value[key]}function replaceSel(search_str,str,back){if(!inst.selection.isCollapsed()){if(tinyMCE.isRealIE)inst.selection.getRng().duplicate().pasteHTML(str);else inst.execCommand('mceInsertContent',false,str)}}if(!value)value=[];defValue("editor_id",editor_id);defValue("searchstring",selectedText);defValue("replacestring",null);defValue("replacemode","none");defValue("casesensitive",false);defValue("backwards",false);defValue("wrap",false);defValue("wholeword",false);defValue("inline","yes");defValue("resizable","no");switch(command){case"mceSearch":if(user_interface){var template=new Array();template['file']='../../plugins/searchreplace/searchreplace.htm';template['width']=380;template['height']=155+(tinyMCE.isNS7?20:0)+(tinyMCE.isMSIE?15:0);template['width']+=tinyMCE.getLang('lang_searchreplace_delta_width',0);template['height']+=tinyMCE.getLang('lang_searchreplace_delta_height',0);inst.selection.collapse(true);tinyMCE.openWindow(template,value)}else{var win=tinyMCE.getInstanceById(editor_id).contentWindow;var doc=tinyMCE.getInstanceById(editor_id).contentWindow.document;var body=tinyMCE.getInstanceById(editor_id).contentWindow.document.body;var awin=value.win,found;if(body.innerHTML==""){awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(value['replacemode']=="current"){replaceSel(value['string'],value['replacestring'],value['backwards']);value['replacemode']="none";}inst.selection.collapse(value['backwards']);if(tinyMCE.isMSIE){var rng=inst.selection.getRng();var flags=0;if(value['wholeword'])flags=flags|2;if(value['casesensitive'])flags=flags|4;if(!rng.findText){awin.alert('This operation is currently not supported by this browser.');return true}if(value['replacemode']=="all"){found=false;while(rng.findText(value['string'],value['backwards']?-1:1,flags)){found=true;rng.scrollIntoView();rng.select();replaceSel(value['string'],value['replacestring'],value['backwards'])}if(found)awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select()}else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'))}else{if(value['replacemode']=="all"){found=false;while(win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false)){found=true;replaceSel(value['string'],value['replacestring'],value['backwards'])}if(found)awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(!win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'))}}return true;case"mceSearchReplace":value['replacestring']="";tinyMCE.execInstanceCommand(editor_id,'mceSearch',user_interface,value,false);return true}return false}};tinyMCE.addPlugin("searchreplace",TinyMCE_SearchReplacePlugin);
|
||||
(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})();
|
@ -1,173 +1,54 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
* $Id: editor_plugin_src.js 686 2008-03-09 18:13:49Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
tinyMCE.importPluginLanguagePack('searchreplace');
|
||||
|
||||
var TinyMCE_SearchReplacePlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Search/Replace',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
initInstance : function (inst) {
|
||||
inst.addShortcut('ctrl', 'f', 'lang_searchreplace_search_desc', 'mceSearch', true);
|
||||
// No CTRL+R for "replace" because browsers will reload page instead of executing plugin
|
||||
},
|
||||
|
||||
getControlHTML : function (cn) {
|
||||
switch (cn) {
|
||||
case "search" :
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_searchreplace_search_desc', '{$pluginurl}/images/search.gif','mceSearch', true);
|
||||
|
||||
case "replace" :
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_searchreplace_replace_desc', '{$pluginurl}/images/replace.gif', 'mceSearchReplace', true);
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
execCommand : function (editor_id, element, command, user_interface, value) {
|
||||
var inst = tinyMCE.getInstanceById(editor_id), selectedText = inst.selection.getSelectedText(), rng;
|
||||
|
||||
function defValue(key, default_value) {
|
||||
value[key] = typeof(value[key]) == "undefined" ? default_value : value[key];
|
||||
}
|
||||
|
||||
function replaceSel(search_str, str, back) {
|
||||
if (!inst.selection.isCollapsed()) {
|
||||
if (tinyMCE.isRealIE)
|
||||
inst.selection.getRng().duplicate().pasteHTML(str); // Needs to be duplicated due to selection bug in IE
|
||||
else
|
||||
inst.execCommand('mceInsertContent', false, str);
|
||||
}
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.SearchReplacePlugin', {
|
||||
init : function(ed, url) {
|
||||
function open(m) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/searchreplace.htm',
|
||||
width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
|
||||
inline : 1,
|
||||
auto_focus : 0
|
||||
}, {
|
||||
mode : m,
|
||||
search_string : ed.selection.getContent({format : 'text'}),
|
||||
plugin_url : url
|
||||
});
|
||||
};
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceSearch', function() {
|
||||
open('search');
|
||||
});
|
||||
|
||||
ed.addCommand('mceReplace', function() {
|
||||
open('replace');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
|
||||
ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
|
||||
|
||||
ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Search/Replace',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if (!value)
|
||||
value = [];
|
||||
|
||||
defValue("editor_id", editor_id);
|
||||
defValue("searchstring", selectedText);
|
||||
defValue("replacestring", null);
|
||||
defValue("replacemode", "none");
|
||||
defValue("casesensitive", false);
|
||||
defValue("backwards", false);
|
||||
defValue("wrap", false);
|
||||
defValue("wholeword", false);
|
||||
defValue("inline", "yes");
|
||||
defValue("resizable", "no");
|
||||
|
||||
switch (command) {
|
||||
case "mceSearch" :
|
||||
if (user_interface) {
|
||||
var template = new Array();
|
||||
|
||||
template['file'] = '../../plugins/searchreplace/searchreplace.htm';
|
||||
template['width'] = 380;
|
||||
template['height'] = 155 + (tinyMCE.isNS7 ? 20 : 0) + (tinyMCE.isMSIE ? 15 : 0);
|
||||
template['width'] += tinyMCE.getLang('lang_searchreplace_delta_width', 0);
|
||||
template['height'] += tinyMCE.getLang('lang_searchreplace_delta_height', 0);
|
||||
|
||||
inst.selection.collapse(true);
|
||||
|
||||
tinyMCE.openWindow(template, value);
|
||||
} else {
|
||||
var win = tinyMCE.getInstanceById(editor_id).contentWindow;
|
||||
var doc = tinyMCE.getInstanceById(editor_id).contentWindow.document;
|
||||
var body = tinyMCE.getInstanceById(editor_id).contentWindow.document.body;
|
||||
var awin = value.win, found;
|
||||
|
||||
if (body.innerHTML == "") {
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value['replacemode'] == "current") {
|
||||
replaceSel(value['string'], value['replacestring'], value['backwards']);
|
||||
value['replacemode'] = "none";
|
||||
//tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value);
|
||||
//return true;
|
||||
}
|
||||
|
||||
inst.selection.collapse(value['backwards']);
|
||||
|
||||
if (tinyMCE.isMSIE) {
|
||||
var rng = inst.selection.getRng();
|
||||
var flags = 0;
|
||||
if (value['wholeword'])
|
||||
flags = flags | 2;
|
||||
|
||||
if (value['casesensitive'])
|
||||
flags = flags | 4;
|
||||
|
||||
if (!rng.findText) {
|
||||
awin.alert('This operation is currently not supported by this browser.');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value['replacemode'] == "all") {
|
||||
found = false;
|
||||
|
||||
while (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
|
||||
found = true;
|
||||
rng.scrollIntoView();
|
||||
rng.select();
|
||||
replaceSel(value['string'], value['replacestring'], value['backwards']);
|
||||
}
|
||||
|
||||
if (found)
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
|
||||
else
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
|
||||
rng.scrollIntoView();
|
||||
rng.select();
|
||||
} else
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
|
||||
} else {
|
||||
if (value['replacemode'] == "all") {
|
||||
found = false;
|
||||
|
||||
while (win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false)) {
|
||||
found = true;
|
||||
replaceSel(value['string'], value['replacestring'], value['backwards']);
|
||||
}
|
||||
|
||||
if (found)
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
|
||||
else
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false))
|
||||
awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case "mceSearchReplace" :
|
||||
value['replacestring'] = "";
|
||||
tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCE.addPlugin("searchreplace", TinyMCE_SearchReplacePlugin);
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
|
||||
})();
|
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 191 B |
@ -0,0 +1,117 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var SearchReplaceDialog = {
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");
|
||||
|
||||
this.switchMode(m);
|
||||
|
||||
f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");
|
||||
|
||||
// Focus input field
|
||||
f[m + '_panel_searchstring'].focus();
|
||||
},
|
||||
|
||||
switchMode : function(m) {
|
||||
var f, lm = this.lastMode;
|
||||
|
||||
if (lm != m) {
|
||||
f = document.forms[0];
|
||||
|
||||
if (lm) {
|
||||
f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;
|
||||
f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;
|
||||
f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;
|
||||
f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;
|
||||
}
|
||||
|
||||
mcTabs.displayTab(m + '_tab', m + '_panel');
|
||||
document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";
|
||||
document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";
|
||||
this.lastMode = m;
|
||||
}
|
||||
},
|
||||
|
||||
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;
|
||||
|
||||
// Get input
|
||||
f = document.forms[0];
|
||||
s = f[m + '_panel_searchstring'].value;
|
||||
b = f[m + '_panel_backwardsu'].checked;
|
||||
ca = f[m + '_panel_casesensitivebox'].checked;
|
||||
rs = f['replace_panel_replacestring'].value;
|
||||
|
||||
function fix() {
|
||||
// Correct Firefox graphics glitches
|
||||
r = se.getRng().cloneRange();
|
||||
ed.getDoc().execCommand('SelectAll', false, null);
|
||||
se.setRng(r);
|
||||
};
|
||||
|
||||
function replace() {
|
||||
if (tinymce.isIE)
|
||||
ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE
|
||||
else
|
||||
ed.getDoc().execCommand('InsertHTML', false, rs);
|
||||
};
|
||||
|
||||
// IE flags
|
||||
if (ca)
|
||||
fl = fl | 4;
|
||||
|
||||
switch (a) {
|
||||
case 'all':
|
||||
if (tinymce.isIE) {
|
||||
while (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
r.select();
|
||||
replace();
|
||||
fo = 1;
|
||||
}
|
||||
|
||||
tinyMCEPopup.storeSelection();
|
||||
} else {
|
||||
while (w.find(s, ca, b, false, false, false, false)) {
|
||||
replace();
|
||||
fo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (fo)
|
||||
wm.alert(ed.getLang('searchreplace_dlg.allreplaced'));
|
||||
else
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
|
||||
return;
|
||||
|
||||
case 'current':
|
||||
replace();
|
||||
break;
|
||||
}
|
||||
|
||||
se.collapse(b);
|
||||
r = se.getRng();
|
||||
|
||||
// Whats the point
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
if (tinymce.isIE) {
|
||||
if (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
r.select();
|
||||
} else
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
|
||||
tinyMCEPopup.storeSelection();
|
||||
} else {
|
||||
if (!w.find(s, ca, b, false, false, false, false))
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
else
|
||||
fix();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);
|
@ -1,86 +0,0 @@
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// start with appropiate tab
|
||||
var task = (tinyMCE.getWindowArg("replacestring") != null) ? "replace" : "search";
|
||||
mcTabs.displayTab(task + '_tab', task +'_panel');
|
||||
manageReplaceButtons();
|
||||
|
||||
var formObj = document.forms[0];
|
||||
|
||||
formObj[task + "_panel_searchstring"].value = tinyMCE.getWindowArg("searchstring");
|
||||
formObj["replace_panel_replacestring"].value = (tinyMCE.getWindowArg("replacestring") != null) ? tinyMCE.getWindowArg("replacestring") : "";
|
||||
formObj[task + "_panel_casesensitivebox"].checked = tinyMCE.getWindowArg("casesensitive");
|
||||
formObj[task + "_panel_backwardsu"].checked = tinyMCE.getWindowArg("backwards");
|
||||
formObj[task + "_panel_backwardsd"].checked = !tinyMCE.getWindowArg("backwards");
|
||||
}
|
||||
|
||||
function searchNext(replacemode) {
|
||||
// "search" or "replace" mode of operation?
|
||||
var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
|
||||
|
||||
var formObj = document.forms[0];
|
||||
|
||||
if (task == "replace") {
|
||||
// Whats the point?
|
||||
if (formObj[task + "_panel_searchstring"].value == "" || formObj[task + "_panel_searchstring"].value == formObj[task + "_panel_replacestring"].value)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do search
|
||||
tinyMCEPopup.execCommand('mceSearch', false, {
|
||||
string : formObj[task + "_panel_searchstring"].value,
|
||||
replacestring : formObj["replace_panel_replacestring"].value,
|
||||
replacemode : replacemode,
|
||||
casesensitive : formObj[task + "_panel_casesensitivebox"].checked,
|
||||
backwards : formObj[task + "_panel_backwardsu"].checked,
|
||||
win : window
|
||||
}, false);
|
||||
|
||||
window.focus();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function cancelAction() {
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function manageReplaceButtons() {
|
||||
// "search" or "replace" mode of operation?
|
||||
var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
|
||||
document.getElementById("replace_buttons").style.visibility = (task == "replace") ? "visible" : "hidden";
|
||||
}
|
||||
|
||||
function copyValues(link) {
|
||||
// check if tab is already active
|
||||
var tab = link;
|
||||
while (tab.tagName && tab.tagName.toLowerCase() != "li") tab = tab.parentNode;
|
||||
if (tab.className) return false; // tab is already active -> no need to copy any values!
|
||||
|
||||
// copy values from one panel to the other (if they exist there)
|
||||
var from_panel_name = tab.id.match(/^search/i) ? "replace_panel" : "search_panel";
|
||||
var to_panel_name = (from_panel_name == "search_panel") ? "replace_panel" : "search_panel";
|
||||
|
||||
// find all elements with IDs to copy their values
|
||||
var elms = document.getElementById(from_panel_name).getElementsByTagName("*");
|
||||
for (var i = 0; i < elms.length; i++) {
|
||||
if (elms[i].id && elms[i].id != "") {
|
||||
var checked = "undefined";
|
||||
if (elms[i].type.toLowerCase() == "checkbox" || elms[i].type.toLowerCase() == "radio")
|
||||
checked = elms[i].checked;
|
||||
|
||||
// copy values if element exists in other panel
|
||||
var to_elm_name = to_panel_name + elms[i].id.substring(from_panel_name.length, elms[i].id.length);
|
||||
var to_elm = document.getElementById(to_elm_name);
|
||||
if (to_elm) {
|
||||
if (checked != "undefined")
|
||||
to_elm.checked = checked;
|
||||
else
|
||||
to_elm.value = elms[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('',{
|
||||
searchreplace_search_desc : 'Find',
|
||||
searchreplace_searchnext_desc : 'Find again',
|
||||
searchreplace_replace_desc : 'Find/Replace',
|
||||
searchreplace_notfound : 'The search has been completed. The search string could not be found.',
|
||||
searchreplace_search_title : 'Find',
|
||||
searchreplace_replace_title : 'Find/Replace',
|
||||
searchreplace_allreplaced : 'All occurrences of the search string were replaced.',
|
||||
searchreplace_findwhat : 'Find what',
|
||||
searchreplace_replacewith : 'Replace with',
|
||||
searchreplace_direction : 'Direction',
|
||||
searchreplace_up : 'Up',
|
||||
searchreplace_down : 'Down',
|
||||
searchreplace_case : 'Match case',
|
||||
searchreplace_findnext : 'Find next',
|
||||
searchreplace_replace : 'Replace',
|
||||
searchreplace_replaceall : 'Replace all',
|
||||
searchreplace_cancel : 'Cancel'
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
tinyMCE.addI18n('en.searchreplace_dlg',{
|
||||
searchnext_desc:"Find again",
|
||||
notfound:"The search has been completed. The search string could not be found.",
|
||||
search_title:"Find",
|
||||
replace_title:"Find/Replace",
|
||||
allreplaced:"All occurrences of the search string were replaced.",
|
||||
findwhat:"Find what",
|
||||
replacewith:"Replace with",
|
||||
direction:"Direction",
|
||||
up:"Up",
|
||||
down:"Down",
|
||||
mcase:"Match case",
|
||||
findnext:"Find next",
|
||||
replace:"Replace",
|
||||
replaceall:"Replace all"
|
||||
});
|
@ -1 +0,0 @@
|
||||
Check the TinyMCE documentation for details on this plugin.
|
@ -1,11 +0,0 @@
|
||||
Version 1.0.2 (2006-08-02)
|
||||
Added new spellchecker_report_mispellings option, contributed by Jeremy B.
|
||||
Fixed various regexp bugs and issues. Some where contributed by Jeremy B.
|
||||
Fixed the Google speller class so it uses curl, patch contributed by Yuriy Kramar.
|
||||
Fixed encoding issues with language specific characters, patch contributed by codepit.
|
||||
Fixed bug where the spellchecker wasn't working in MSIE if the editor was placed in a P tag.
|
||||
Version 1.0.1 (2006-05-05)
|
||||
Since sourceforge has a serious bug when it comes to replacing files with the same name this release was necessary.
|
||||
Goggle spellchecker class was added.
|
||||
Version 1.0 (2006-05-03)
|
||||
Official first release.
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* *
|
||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||
*
|
||||
* Copyright © 2006 Moxiecode Systems AB
|
||||
*/
|
||||
|
||||
class TinyGoogleSpell {
|
||||
var $lang;
|
||||
var $spellurl;
|
||||
|
||||
function TinyGoogleSpell(& $config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||
$this->lang = $lang;
|
||||
$this->spellurl = $config['googlespell.url'];
|
||||
}
|
||||
|
||||
// Returns array with bad words or false if failed.
|
||||
function checkWords($word_array) {
|
||||
$words = array ();
|
||||
$wordstr = implode(' ', $word_array);
|
||||
|
||||
$matches = $this->_getMatches($wordstr);
|
||||
|
||||
for ($i = 0; $i < count($matches); $i++)
|
||||
$words[] = $this->unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
function unhtmlentities($string) {
|
||||
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
|
||||
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
|
||||
|
||||
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
||||
$trans_tbl = array_flip($trans_tbl);
|
||||
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
|
||||
// Returns array with suggestions or false if failed.
|
||||
function getSuggestion($word) {
|
||||
$sug = array ();
|
||||
|
||||
$matches = $this->_getMatches($word);
|
||||
|
||||
if (count($matches) > 0)
|
||||
$sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4])));
|
||||
|
||||
return $sug;
|
||||
}
|
||||
|
||||
function _xmlChars($string) {
|
||||
$trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
|
||||
|
||||
foreach ($trans as $k => $v)
|
||||
$trans[$k] = "&#" . ord($k) . ";";
|
||||
|
||||
return strtr($string, $trans);
|
||||
}
|
||||
|
||||
function _getMatches($word_list) {
|
||||
$url = $this->spellurl . "&" . $this->lang;
|
||||
|
||||
$path = preg_replace("/^https?:\/\//i", "", $url);
|
||||
|
||||
// Setup XML request
|
||||
$xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $word_list . '</text></spellrequest>';
|
||||
|
||||
$header = "POST " . $path . " HTTP/1.0 \r\n";
|
||||
$header .= "MIME-Version: 1.0 \r\n";
|
||||
$header .= "Content-type: application/PTI26 \r\n";
|
||||
$header .= "Content-length: " . strlen($xml) . " \r\n";
|
||||
$header .= "Content-transfer-encoding: text \r\n";
|
||||
$header .= "Request-number: 1 \r\n";
|
||||
$header .= "Document-type: Request \r\n";
|
||||
$header .= "Interface-Version: Test 1.4 \r\n";
|
||||
$header .= "Connection: close \r\n\r\n";
|
||||
$header .= $xml;
|
||||
//$this->_debugData($xml);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//$this->_debugData($xml);
|
||||
|
||||
// Grab and parse content
|
||||
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function _debugData($data) {
|
||||
$fh = @ fopen("debug.log", 'a+');
|
||||
@ fwrite($fh, $data);
|
||||
@ fclose($fh);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup classname, should be the same as the name of the spellchecker class
|
||||
$spellCheckerConfig['class'] = "TinyGoogleSpell";
|
||||
?>
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/* *
|
||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||
*
|
||||
* Copyright © 2006 Moxiecode Systems AB
|
||||
*
|
||||
*/
|
||||
|
||||
class TinyPSpell {
|
||||
var $lang;
|
||||
var $mode;
|
||||
var $string;
|
||||
var $plink;
|
||||
var $errorMsg;
|
||||
|
||||
var $jargon;
|
||||
var $spelling;
|
||||
var $encoding;
|
||||
|
||||
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||
$this->lang = $lang;
|
||||
$this->mode = $mode;
|
||||
$this->plink = false;
|
||||
$this->errorMsg = array();
|
||||
|
||||
if (!function_exists("pspell_new")) {
|
||||
$this->errorMsg[] = "PSpell not found.";
|
||||
return;
|
||||
}
|
||||
|
||||
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
|
||||
}
|
||||
|
||||
// Returns array with bad words or false if failed.
|
||||
function checkWords($wordArray) {
|
||||
if (!$this->plink) {
|
||||
$this->errorMsg[] = "No PSpell link found for checkWords.";
|
||||
return array();
|
||||
}
|
||||
|
||||
$wordError = array();
|
||||
foreach($wordArray as $word) {
|
||||
if(!pspell_check($this->plink, trim($word)))
|
||||
$wordError[] = $word;
|
||||
}
|
||||
|
||||
return $wordError;
|
||||
}
|
||||
|
||||
// Returns array with suggestions or false if failed.
|
||||
function getSuggestion($word) {
|
||||
if (!$this->plink) {
|
||||
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
|
||||
return array();
|
||||
}
|
||||
|
||||
return pspell_suggest($this->plink, $word);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup classname, should be the same as the name of the spellchecker class
|
||||
$spellCheckerConfig['class'] = "TinyPspell";
|
||||
|
||||
?>
|
@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/* *
|
||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||
*
|
||||
* Copyright © 2006 Moxiecode Systems AB
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class TinyPspellShell {
|
||||
var $lang;
|
||||
var $mode;
|
||||
var $string;
|
||||
var $error;
|
||||
var $errorMsg;
|
||||
|
||||
var $cmd;
|
||||
var $tmpfile;
|
||||
|
||||
var $jargon;
|
||||
var $spelling;
|
||||
var $encoding;
|
||||
|
||||
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||
$this->lang = $lang;
|
||||
$this->mode = $mode;
|
||||
$this->error = false;
|
||||
$this->errorMsg = array();
|
||||
|
||||
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
|
||||
|
||||
if(preg_match("#win#i",php_uname()))
|
||||
$this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1";
|
||||
else
|
||||
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang;
|
||||
}
|
||||
|
||||
// Returns array with bad words or false if failed.
|
||||
function checkWords($wordArray) {
|
||||
if ($fh = fopen($this->tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
foreach($wordArray as $key => $value)
|
||||
fwrite($fh, "^" . $value . "\n");
|
||||
fclose($fh);
|
||||
} else {
|
||||
$this->errorMsg[] = "PSpell not found.";
|
||||
return array();
|
||||
}
|
||||
|
||||
$data = shell_exec($this->cmd);
|
||||
@unlink($this->tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if (strpos($dstr, "@") === 0)
|
||||
continue;
|
||||
|
||||
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1]))
|
||||
$returnData[] = $matches[1];
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
// Returns array with suggestions or false if failed.
|
||||
function getSuggestion($word) {
|
||||
if (function_exists("mb_convert_encoding"))
|
||||
$word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
|
||||
else
|
||||
$word = utf8_encode($word);
|
||||
|
||||
if ($fh = fopen($this->tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
fwrite($fh, "^$word\n");
|
||||
fclose($fh);
|
||||
} else
|
||||
die("Error opening tmp file.");
|
||||
|
||||
$data = shell_exec($this->cmd);
|
||||
|
||||
@unlink($this->tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if (strpos($dstr, "@") === 0)
|
||||
continue;
|
||||
|
||||
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1])) {
|
||||
// For some reason, the exec version seems to add commas?
|
||||
$returnData[] = str_replace(",", "", $matches[1]);
|
||||
}
|
||||
}
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
function _debugData($data) {
|
||||
$fh = @fopen("debug.log", 'a+');
|
||||
@fwrite($fh, $data);
|
||||
@fclose($fh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Setup classname, should be the same as the name of the spellchecker class
|
||||
$spellCheckerConfig['class'] = "TinyPspellShell";
|
||||
|
||||
?>
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
$spellCheckerConfig = array();
|
||||
|
||||
// Spellchecker class use
|
||||
// require_once("classes/TinyPspellShell.class.php"); // Command line pspell
|
||||
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
|
||||
// require_once("classes/TinyPspell.class.php"); // Internal PHP version
|
||||
|
||||
// General settings
|
||||
$spellCheckerConfig['enabled'] = true;
|
||||
|
||||
// Default settings
|
||||
$spellCheckerConfig['default.language'] = 'en';
|
||||
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
|
||||
|
||||
// Normaly not required to configure
|
||||
$spellCheckerConfig['default.spelling'] = "";
|
||||
$spellCheckerConfig['default.jargon'] = "";
|
||||
$spellCheckerConfig['default.encoding'] = "";
|
||||
|
||||
// Pspell shell specific settings
|
||||
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
|
||||
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp';
|
||||
|
||||
$spellCheckerConfig['googlespell.url'] = 'https://www.google.com/tbproxy/spell?hl=en'
|
||||
?>
|
@ -1,5 +1 @@
|
||||
.mceItemHiddenSpellWord {
|
||||
background: url('../images/wline.gif') repeat-x bottom left;
|
||||
bo2rder-bottom: 1px dashed red;
|
||||
cursor: default;
|
||||
}
|
||||
.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
|
||||
|
@ -1,34 +0,0 @@
|
||||
.mceMsgBox {
|
||||
border: 1px solid gray;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.mceMsgBox span {
|
||||
vertical-align: top;
|
||||
color: #555555;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
||||
.mceBlockBox {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60);
|
||||
-moz-opacity:0.6;
|
||||
opacity: 0.6;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.mceMsgBox {
|
||||
display: none;
|
||||
z-index: 101;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
font-family: Arial, Verdana, Tahoma, Helvetica;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
}
|
@ -1,588 +1,338 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 28 2006-08-01 16:02:56Z spocke $
|
||||
* $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
tinyMCE.importPluginLanguagePack('spellchecker', 'en,fr,sv,nn,nb');
|
||||
|
||||
// Plucin static class
|
||||
var TinyMCE_SpellCheckerPlugin = {
|
||||
_contextMenu : new TinyMCE_Menu(),
|
||||
_menu : new TinyMCE_Menu(),
|
||||
_counter : 0,
|
||||
_ajaxPage : '/tinyspell.php',
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Spellchecker',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
handleEvent : function(e) {
|
||||
var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
|
||||
var inst = tinyMCE.selectedInstance, args = '';
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
var cm = self._contextMenu;
|
||||
var p, p2, x, y, sx, sy, h, elm;
|
||||
|
||||
// Handle click on word
|
||||
if ((e.type == "click" || e.type == "contextmenu") && elm) {
|
||||
do {
|
||||
if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") {
|
||||
inst.spellCheckerElm = elm;
|
||||
|
||||
// Setup arguments
|
||||
args += 'id=' + inst.editorId + "|" + (++self._counter);
|
||||
args += '&cmd=suggest&check=' + encodeURIComponent(elm.innerHTML);
|
||||
args += '&lang=' + escape(inst.spellCheckerLang);
|
||||
|
||||
elm = inst.spellCheckerElm;
|
||||
p = tinyMCE.getAbsPosition(inst.iframeElement);
|
||||
p2 = tinyMCE.getAbsPosition(elm);
|
||||
h = parseInt(elm.offsetHeight);
|
||||
sx = inst.getBody().scrollLeft;
|
||||
sy = inst.getBody().scrollTop;
|
||||
x = p.absLeft + p2.absLeft - sx;
|
||||
y = p.absTop + p2.absTop - sy + h;
|
||||
|
||||
cm.clear();
|
||||
cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true));
|
||||
cm.show();
|
||||
cm.moveTo(x, y);
|
||||
|
||||
inst.selection.selectNode(elm, false, false);
|
||||
|
||||
self._sendAjax(self.baseURL + self._ajaxPage, self._ajaxResponse, 'post', args);
|
||||
|
||||
tinyMCE.cancelEvent(e);
|
||||
return false;
|
||||
(function() {
|
||||
var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Spellchecker',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, cm;
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceSpellCheck', function() {
|
||||
if (!t.active) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
|
||||
if (r.length > 0) {
|
||||
t.active = 1;
|
||||
t._markWords(r);
|
||||
ed.setProgressState(0);
|
||||
ed.nodeChanged();
|
||||
} else {
|
||||
ed.setProgressState(0);
|
||||
ed.windowManager.alert('spellchecker.no_mpell');
|
||||
}
|
||||
});
|
||||
} else
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.dom.loadCSS(url + '/css/content.css');
|
||||
});
|
||||
|
||||
ed.onClick.add(t._showMenu, t);
|
||||
ed.onContextMenu.add(t._showMenu, t);
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
if (t.active)
|
||||
t._removeWords();
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm) {
|
||||
cm.setActive('spellchecker', t.active);
|
||||
});
|
||||
|
||||
ed.onSetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd) {
|
||||
if (cmd == 'mceFullScreen')
|
||||
t._done();
|
||||
});
|
||||
|
||||
// Find selected language
|
||||
t.languages = {};
|
||||
each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
|
||||
if (k.indexOf('+') === 0) {
|
||||
k = k.substring(1);
|
||||
t.selectedLang = v;
|
||||
}
|
||||
} while ((elm = elm.parentNode));
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
initInstance : function(inst) {
|
||||
var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e;
|
||||
|
||||
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css");
|
||||
|
||||
if (!tinyMCE.hasMenu('spellcheckercontextmenu')) {
|
||||
tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css");
|
||||
|
||||
cm.init({drop_menu : false});
|
||||
tinyMCE.addMenu('spellcheckercontextmenu', cm);
|
||||
}
|
||||
|
||||
if (!tinyMCE.hasMenu('spellcheckermenu')) {
|
||||
m.init({});
|
||||
tinyMCE.addMenu('spellcheckermenu', m);
|
||||
}
|
||||
|
||||
inst.spellCheckerLang = 'en';
|
||||
self._buildSettingsMenu(inst, null);
|
||||
|
||||
e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent'));
|
||||
self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent'));
|
||||
},
|
||||
|
||||
_getMsgBoxLayer : function(inst) {
|
||||
if (!inst.spellCheckerMsgBoxL)
|
||||
inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false);
|
||||
|
||||
return inst.spellCheckerMsgBoxL;
|
||||
},
|
||||
t.languages[k] = v;
|
||||
});
|
||||
},
|
||||
|
||||
_getBlockBoxLayer : function(inst) {
|
||||
if (!inst.spellCheckerBoxL)
|
||||
inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false);
|
||||
createControl : function(n, cm) {
|
||||
var t = this, c, ed = t.editor;
|
||||
|
||||
return inst.spellCheckerBoxL;
|
||||
},
|
||||
if (n == 'spellchecker') {
|
||||
c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
|
||||
|
||||
_buildSettingsMenu : function(inst, lang) {
|
||||
var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;
|
||||
var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c;
|
||||
c.onRenderMenu.add(function(c, m) {
|
||||
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(t.languages, function(v, k) {
|
||||
var o = {icon : 1}, mi;
|
||||
|
||||
m.clear();
|
||||
m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true));
|
||||
o.onclick = function() {
|
||||
mi.setSelected(1);
|
||||
t.selectedItem.setSelected(0);
|
||||
t.selectedItem = mi;
|
||||
t.selectedLang = v;
|
||||
};
|
||||
|
||||
for (i=0; i<ar.length; i++) {
|
||||
if (ar[i] != '') {
|
||||
p = ar[i].split('=');
|
||||
c = 'mceMenuCheckItem';
|
||||
o.title = k;
|
||||
mi = m.add(o);
|
||||
mi.setSelected(v == t.selectedLang);
|
||||
|
||||
if (p[0].charAt(0) == '+') {
|
||||
p[0] = p[0].substring(1);
|
||||
if (v == t.selectedLang)
|
||||
t.selectedItem = mi;
|
||||
})
|
||||
});
|
||||
|
||||
if (lang == null) {
|
||||
c = 'mceMenuSelectedItem';
|
||||
inst.spellCheckerLang = p[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (lang == p[1])
|
||||
c = 'mceMenuSelectedItem';
|
||||
|
||||
m.add({text : p[0], js : "tinyMCE.execInstanceCommand('" + inst.editorId + "','mceSpellCheckerSetLang',false,'" + p[1] + "');", class_name : c});
|
||||
return c;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setupContent : function(editor_id, body, doc) {
|
||||
TinyMCE_SpellCheckerPlugin._removeWords(doc);
|
||||
},
|
||||
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "spellchecker":
|
||||
return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn, 'lang_spellchecker_desc', '{$pluginurl}/images/spellchecker.gif', 'lang_spellchecker_desc', 'mceSpellCheckerMenu', 'mceSpellCheck');
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the HTML code for a normal button control.
|
||||
*
|
||||
* @param {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
|
||||
* @param {string} lang Language variable key name to insert as the title/alt of the button image.
|
||||
* @param {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
|
||||
* @param {string} mlang Language variable key name to insert as the title/alt of the menu button image.
|
||||
* @param {string} mid Menu by id to display when the menu button is pressed.
|
||||
* @param {string} cmd Command to execute when the user clicks the button.
|
||||
* @param {string} ui Optional user interface boolean for command.
|
||||
* @param {string} val Optional value for command.
|
||||
* @return HTML code for a normal button based in input information.
|
||||
* @type string
|
||||
*/
|
||||
_getMenuButtonHTML : function(id, lang, img, mlang, mid, cmd, ui, val) {
|
||||
var h = '', m, x;
|
||||
|
||||
cmd = 'tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
|
||||
|
||||
if (typeof(ui) != "undefined" && ui != null)
|
||||
cmd += ',' + ui;
|
||||
|
||||
if (typeof(val) != "undefined" && val != null)
|
||||
cmd += ",'" + val + "'";
|
||||
|
||||
cmd += ');';
|
||||
|
||||
// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
|
||||
if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
|
||||
// Tiled button
|
||||
x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
|
||||
h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
|
||||
h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
|
||||
h += '<img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" onclick="' + mcmd + 'return false;" />';
|
||||
h += '</a>';
|
||||
} else {
|
||||
if (tinyMCE.isMSIE && !tinyMCE.isOpera)
|
||||
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';
|
||||
else
|
||||
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
|
||||
|
||||
h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
|
||||
h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
|
||||
h += '<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\'' + mid + '\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
|
||||
h += '</a></span>';
|
||||
}
|
||||
|
||||
return h;
|
||||
},
|
||||
|
||||
_menuButtonEvent : function(e, o) {
|
||||
if (o.className == 'mceMenuButtonFocus')
|
||||
return;
|
||||
|
||||
if (e == 'over')
|
||||
o.className = o.className + ' mceMenuHover';
|
||||
else
|
||||
o.className = o.className.replace(/\s.*$/, '');
|
||||
},
|
||||
},
|
||||
|
||||
_toggleMenu : function(editor_id, id) {
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
var e = document.getElementById(editor_id + '_spellchecker');
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
// Internal functions
|
||||
|
||||
if (self._menu.isVisible()) {
|
||||
tinyMCE.hideMenus();
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, '');
|
||||
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus');
|
||||
|
||||
self._menu.moveRelativeTo(e, 'bl');
|
||||
self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1);
|
||||
|
||||
if (tinyMCE.isOpera)
|
||||
self._menu.moveBy(0, -2);
|
||||
|
||||
self._onMenuEvent(inst, self._menu, 'show');
|
||||
|
||||
self._menu.show();
|
||||
|
||||
tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker';
|
||||
},
|
||||
_walk : function(n, f) {
|
||||
var d = this.editor.getDoc(), w;
|
||||
|
||||
_onMenuEvent : function(inst, m, n) {
|
||||
TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang);
|
||||
},
|
||||
if (d.createTreeWalker) {
|
||||
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
|
||||
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e;
|
||||
while ((n = w.nextNode()) != null)
|
||||
f.call(this, n);
|
||||
} else
|
||||
tinymce.walk(n, f, 'childNodes');
|
||||
},
|
||||
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mceSpellCheck":
|
||||
if (!inst.spellcheckerOn) {
|
||||
inst.spellCheckerBookmark = inst.selection.getBookmark();
|
||||
_getSeparators : function() {
|
||||
var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
|
||||
|
||||
// Setup arguments
|
||||
args += 'id=' + inst.editorId + "|" + (++self._counter);
|
||||
args += '&cmd=spell&check=' + encodeURIComponent(self._getWordList(inst.getBody())).replace( /\'/g, '%27' );
|
||||
args += '&lang=' + escape(inst.spellCheckerLang);
|
||||
// Build word separator regexp
|
||||
for (i=0; i<str.length; i++)
|
||||
re += '\\' + str.charAt(i);
|
||||
|
||||
co = document.getElementById(inst.editorId + '_parent').firstChild;
|
||||
bb = self._getBlockBoxLayer(inst);
|
||||
bb.moveRelativeTo(co, 'tl');
|
||||
bb.resizeTo(co.offsetWidth, co.offsetHeight);
|
||||
bb.show();
|
||||
return re;
|
||||
},
|
||||
|
||||
// Setup message box
|
||||
mb = self._getMsgBoxLayer(inst);
|
||||
e = mb.getElement();
|
||||
e.innerHTML = '<span>' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + '</span>';
|
||||
mb.show();
|
||||
mb.moveRelativeTo(co, 'cc');
|
||||
_getWords : function() {
|
||||
var ed = this.editor, wl = [], tx = '', lo = {};
|
||||
|
||||
if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
|
||||
nl = co.getElementsByTagName('select');
|
||||
for (i=0; i<nl.length; i++)
|
||||
nl[i].disabled = true;
|
||||
}
|
||||
// Get area text
|
||||
this._walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 3)
|
||||
tx += n.nodeValue + ' ';
|
||||
});
|
||||
|
||||
inst.spellcheckerOn = true;
|
||||
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
|
||||
// Split words by separator
|
||||
tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
|
||||
tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
|
||||
|
||||
self._sendAjax(self.baseURL + self._ajaxPage, self._ajaxResponse, 'post', args);
|
||||
} else {
|
||||
self._removeWords(inst.getDoc());
|
||||
inst.spellcheckerOn = false;
|
||||
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
|
||||
// Build word array and remove duplicates
|
||||
each(tx.split(' '), function(v) {
|
||||
if (!lo[v]) {
|
||||
wl.push(v);
|
||||
lo[v] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
case "mceSpellCheckReplace":
|
||||
if (inst.spellCheckerElm)
|
||||
tinyMCE.setOuterHTML(inst.spellCheckerElm, value);
|
||||
|
||||
self._checkDone(inst);
|
||||
self._contextMenu.hide();
|
||||
self._menu.hide();
|
||||
|
||||
return true;
|
||||
|
||||
case "mceSpellCheckIgnore":
|
||||
if (inst.spellCheckerElm)
|
||||
self._removeWord(inst.spellCheckerElm);
|
||||
|
||||
self._checkDone(inst);
|
||||
self._contextMenu.hide();
|
||||
self._menu.hide();
|
||||
return true;
|
||||
|
||||
case "mceSpellCheckIgnoreAll":
|
||||
if (inst.spellCheckerElm)
|
||||
self._removeWords(inst.getDoc(), inst.spellCheckerElm.innerHTML);
|
||||
|
||||
self._checkDone(inst);
|
||||
self._contextMenu.hide();
|
||||
self._menu.hide();
|
||||
return true;
|
||||
|
||||
case "mceSpellCheckerSetLang":
|
||||
tinyMCE.hideMenus();
|
||||
inst.spellCheckerLang = value;
|
||||
self._removeWords(inst.getDoc());
|
||||
inst.spellcheckerOn = false;
|
||||
tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
},
|
||||
|
||||
cleanup : function(type, content, inst) {
|
||||
switch (type) {
|
||||
case "get_from_editor_dom":
|
||||
TinyMCE_SpellCheckerPlugin._removeWords(content);
|
||||
inst.spellcheckerOn = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
// Private plugin specific methods
|
||||
|
||||
_displayUI : function(inst) {
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
var bb = self._getBlockBoxLayer(inst);
|
||||
var mb = self._getMsgBoxLayer(inst);
|
||||
var nl, i;
|
||||
var co = document.getElementById(inst.editorId + '_parent').firstChild;
|
||||
|
||||
if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
|
||||
nl = co.getElementsByTagName('select');
|
||||
for (i=0; i<nl.length; i++)
|
||||
nl[i].disabled = false;
|
||||
}
|
||||
|
||||
bb.hide();
|
||||
mb.hide();
|
||||
},
|
||||
|
||||
_ajaxResponse : function(xml) {
|
||||
var el = xml ? xml.documentElement : null;
|
||||
var inst = tinyMCE.selectedInstance, self = TinyMCE_SpellCheckerPlugin;
|
||||
var cmd = el ? el.getAttribute("cmd") : null, err, id = el ? el.getAttribute("id") : null;
|
||||
return wl;
|
||||
},
|
||||
|
||||
if (id)
|
||||
inst = tinyMCE.getInstanceById(id.substring(0, id.indexOf('|')));
|
||||
_removeWords : function(w) {
|
||||
var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
|
||||
|
||||
self._displayUI(inst);
|
||||
|
||||
// Ignore suggestions for other ajax responses
|
||||
if (cmd == "suggest" && id != inst.editorId + "|" + self._counter)
|
||||
return;
|
||||
|
||||
if (!el) {
|
||||
inst.spellcheckerOn = false;
|
||||
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
|
||||
alert("Could not execute AJAX call, server didn't return valid a XML.");
|
||||
return;
|
||||
}
|
||||
|
||||
err = el.getAttribute("error");
|
||||
|
||||
if (err == "true") {
|
||||
inst.spellcheckerOn = false;
|
||||
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
|
||||
alert(el.getAttribute("msg"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
case "spell":
|
||||
if (xml.documentElement.firstChild) {
|
||||
self._markWords(inst.getDoc(), inst.getBody(), decodeURIComponent(el.firstChild.nodeValue).split('+'));
|
||||
inst.selection.moveToBookmark(inst.spellCheckerBookmark);
|
||||
|
||||
if(tinyMCE.getParam('spellchecker_report_mispellings', false))
|
||||
alert(tinyMCE.getLang('lang_spellchecker_mpell_found', '', true, {words : self._countWords(inst)}));
|
||||
} else
|
||||
alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true));
|
||||
|
||||
self._checkDone(inst);
|
||||
|
||||
break;
|
||||
|
||||
case "suggest":
|
||||
self._buildMenu(el.firstChild ? decodeURIComponent(el.firstChild.nodeValue).split('+') : null, 10);
|
||||
self._contextMenu.show();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_getWordSeparators : function() {
|
||||
var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
|
||||
|
||||
for (i=0; i<ch.length; i++)
|
||||
re += '\\' + ch.charAt(i);
|
||||
|
||||
return re;
|
||||
},
|
||||
|
||||
_getWordList : function(n) {
|
||||
var i, x, s, nv = '', nl = tinyMCE.getNodeTree(n, new Array(), 3), wl = new Array();
|
||||
var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (!new RegExp('/SCRIPT|STYLE/').test(nl[i].parentNode.nodeName))
|
||||
nv += nl[i].nodeValue + " ";
|
||||
}
|
||||
|
||||
nv = nv.replace(new RegExp('([0-9]|[' + re + '])', 'g'), ' ');
|
||||
nv = tinyMCE.trim(nv.replace(/(\s+)/g, ' '));
|
||||
|
||||
nl = nv.split(/\s+/);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
s = false;
|
||||
for (x=0; x<wl.length; x++) {
|
||||
if (wl[x] == nl[i]) {
|
||||
s = true;
|
||||
break;
|
||||
each(dom.select('span').reverse(), function(n) {
|
||||
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
|
||||
if (!w || dom.decode(n.innerHTML) == w)
|
||||
dom.remove(n, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s && nl[i].length > 0)
|
||||
wl[wl.length] = nl[i];
|
||||
}
|
||||
});
|
||||
|
||||
return wl.join(' ');
|
||||
},
|
||||
se.moveToBookmark(b);
|
||||
},
|
||||
|
||||
_removeWords : function(doc, word) {
|
||||
var i, c, nl = doc.getElementsByTagName("span");
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null;
|
||||
_markWords : function(wl) {
|
||||
var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = [];
|
||||
var se = ed.selection, b = se.getBookmark();
|
||||
|
||||
word = typeof(word) == 'undefined' ? null : word;
|
||||
|
||||
for (i=nl.length-1; i>=0; i--) {
|
||||
c = tinyMCE.getAttrib(nl[i], 'class');
|
||||
|
||||
if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word))
|
||||
self._removeWord(nl[i]);
|
||||
}
|
||||
each(wl, function(v) {
|
||||
w += (w ? '|' : '') + v;
|
||||
});
|
||||
|
||||
if (b)
|
||||
inst.selection.moveToBookmark(b);
|
||||
},
|
||||
|
||||
_checkDone : function(inst) {
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
var w = self._countWords(inst);
|
||||
|
||||
if (w == 0) {
|
||||
self._removeWords(inst.getDoc());
|
||||
inst.spellcheckerOn = false;
|
||||
tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
|
||||
}
|
||||
},
|
||||
|
||||
_countWords : function(inst) {
|
||||
var i, w = 0, nl = inst.getDoc().getElementsByTagName("span"), c;
|
||||
var self = TinyMCE_SpellCheckerPlugin;
|
||||
r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
|
||||
r2 = new RegExp('^(' + w + ')', 'g');
|
||||
r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
|
||||
r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
|
||||
r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
|
||||
|
||||
for (i=nl.length-1; i>=0; i--) {
|
||||
c = tinyMCE.getAttrib(nl[i], 'class');
|
||||
// Collect all text nodes
|
||||
this._walk(this.editor.getBody(), function(n) {
|
||||
if (n.nodeType == 3) {
|
||||
nl.push(n);
|
||||
}
|
||||
});
|
||||
|
||||
if (c == 'mceItemHiddenSpellWord')
|
||||
w++;
|
||||
}
|
||||
// Wrap incorrect words in spans
|
||||
each(nl, function(n) {
|
||||
var v;
|
||||
|
||||
return w;
|
||||
},
|
||||
if (n.nodeType == 3) {
|
||||
v = n.nodeValue;
|
||||
|
||||
_removeWord : function(e) {
|
||||
if (e != null)
|
||||
tinyMCE.setOuterHTML(e, e.innerHTML);
|
||||
},
|
||||
if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) {
|
||||
v = dom.encode(v);
|
||||
v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
|
||||
v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
|
||||
|
||||
_markWords : function(doc, n, wl) {
|
||||
var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3);
|
||||
var r1, r2, r3, r4, r5, w = '';
|
||||
var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
|
||||
dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (i=0; i<wl.length; i++) {
|
||||
if (wl[i].length > 0)
|
||||
w += wl[i] + ((i == wl.length-1) ? '' : '|');
|
||||
}
|
||||
se.moveToBookmark(b);
|
||||
},
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
nv = nl[i].nodeValue;
|
||||
r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
|
||||
r2 = new RegExp('^(' + w + ')', 'g');
|
||||
r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
|
||||
r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
|
||||
r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
|
||||
_showMenu : function(ed, e) {
|
||||
var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
|
||||
|
||||
if (r1.test(nv) || r2.test(nv) || r3.test(nv) || r4.test(nv)) {
|
||||
nv = tinyMCE.xmlEncode(nv);
|
||||
nv = nv.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
|
||||
nv = nv.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
|
||||
if (!m) {
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
//p2 = DOM.getPos(ed.getContainer());
|
||||
|
||||
nn = doc.createElement('span');
|
||||
nn.className = "mceItemHidden";
|
||||
nn.innerHTML = nv;
|
||||
m = ed.controlManager.createDropMenu('spellcheckermenu', {
|
||||
offset_x : p1.x,
|
||||
offset_y : p1.y,
|
||||
'class' : 'mceNoIcons'
|
||||
});
|
||||
|
||||
// Remove old text node
|
||||
nl[i].parentNode.replaceChild(nn, nl[i]);
|
||||
t._menu = m;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buildMenu : function(sg, max) {
|
||||
var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu;
|
||||
if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) {
|
||||
m.removeAll();
|
||||
m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) {
|
||||
m.removeAll();
|
||||
|
||||
if (r.length > 0) {
|
||||
m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(r, function(v) {
|
||||
m.add({title : v, onclick : function() {
|
||||
dom.replace(ed.getDoc().createTextNode(v), e.target);
|
||||
t._checkDone();
|
||||
}});
|
||||
});
|
||||
|
||||
m.addSeparator();
|
||||
} else
|
||||
m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_word',
|
||||
onclick : function() {
|
||||
dom.remove(e.target, 1);
|
||||
t._checkDone();
|
||||
}
|
||||
});
|
||||
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_words',
|
||||
onclick : function() {
|
||||
t._removeWords(dom.decode(e.target.innerHTML));
|
||||
t._checkDone();
|
||||
}
|
||||
});
|
||||
|
||||
m.update();
|
||||
});
|
||||
|
||||
ed.selection.select(e.target);
|
||||
p1 = dom.getPos(e.target);
|
||||
m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
} else
|
||||
m.hideMenu();
|
||||
},
|
||||
|
||||
_checkDone : function() {
|
||||
var t = this, ed = t.editor, dom = ed.dom, o;
|
||||
|
||||
each(dom.select('span'), function(n) {
|
||||
if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
|
||||
o = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
cm.clear();
|
||||
if (!o)
|
||||
t._done();
|
||||
},
|
||||
|
||||
if (sg != null) {
|
||||
cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true));
|
||||
_done : function() {
|
||||
var t = this, la = t.active;
|
||||
|
||||
for (i=0; i<sg.length && i<max; i++)
|
||||
cm.addItem(sg[i], 'tinyMCE.execCommand("mceSpellCheckReplace",false,"' + sg[i] + '");');
|
||||
if (t.active) {
|
||||
t.active = 0;
|
||||
t._removeWords();
|
||||
|
||||
cm.addSeparator();
|
||||
} else
|
||||
cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug', '', true));
|
||||
if (t._menu)
|
||||
t._menu.hideMenu();
|
||||
|
||||
cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');
|
||||
cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');
|
||||
if (la)
|
||||
t.editor.nodeChanged();
|
||||
}
|
||||
},
|
||||
|
||||
cm.update();
|
||||
},
|
||||
_sendRPC : function(m, p, cb) {
|
||||
var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}");
|
||||
|
||||
_getAjaxHTTP : function() {
|
||||
try {
|
||||
return new ActiveXObject('Msxml2.XMLHTTP')
|
||||
} catch (e) {
|
||||
try {
|
||||
return new ActiveXObject('Microsoft.XMLHTTP')
|
||||
} catch (e) {
|
||||
return new XMLHttpRequest();
|
||||
if (url == '{backend}') {
|
||||
t.editor.setProgressState(0);
|
||||
alert('Please specify: spellchecker_rpc_url');
|
||||
return;
|
||||
}
|
||||
|
||||
JSONRequest.sendRPC({
|
||||
url : url,
|
||||
method : m,
|
||||
params : p,
|
||||
success : cb,
|
||||
error : function(e, x) {
|
||||
t.editor.setProgressState(0);
|
||||
t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Perform AJAX call.
|
||||
*
|
||||
* @param {string} u URL of AJAX service.
|
||||
* @param {function} f Function to call when response arrives.
|
||||
* @param {string} m Request method post or get.
|
||||
* @param {Array} a Array with arguments to send.
|
||||
*/
|
||||
_sendAjax : function(u, f, m, a) {
|
||||
var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();
|
||||
|
||||
x.open(m, u, true);
|
||||
|
||||
x.onreadystatechange = function() {
|
||||
if (x.readyState == 4)
|
||||
f(x.responseXML);
|
||||
};
|
||||
|
||||
if (m == 'post')
|
||||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
|
||||
x.send(a);
|
||||
}
|
||||
};
|
||||
|
||||
// Register plugin
|
||||
tinyMCE.addPlugin('spellchecker', TinyMCE_SpellCheckerPlugin);
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
|
||||
})();
|
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 46 B After Width: | Height: | Size: 46 B |
@ -1,15 +0,0 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('spellchecker',{
|
||||
desc : 'Toggle spellchecker',
|
||||
menu : 'Spellchecker settings',
|
||||
ignore_word : 'Ignore word',
|
||||
ignore_words : 'Ignore all',
|
||||
langs : 'Languages',
|
||||
wait : 'Please wait...',
|
||||
swait : 'Spellchecking, please wait...',
|
||||
sug : 'Suggestions',
|
||||
no_sug : 'No suggestions',
|
||||
no_mpell : 'No misspellings found.',
|
||||
mpell_found : 'Found {$words} misspellings.'
|
||||
});
|
@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $RCSfile: tinyspell.php,v $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2006/03/14 17:33:47 $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
// Ignore the Notice errors for now.
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
require_once("config.php");
|
||||
|
||||
$id = sanitize($_POST['id'], "loose");
|
||||
|
||||
if (!$spellCheckerConfig['enabled']) {
|
||||
header('Content-type: text/xml; charset=utf-8');
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
|
||||
die;
|
||||
}
|
||||
|
||||
// Basic config
|
||||
$defaultLanguage = $spellCheckerConfig['default.language'];
|
||||
$defaultMode = $spellCheckerConfig['default.mode'];
|
||||
|
||||
// Normaly not required to configure
|
||||
$defaultSpelling = $spellCheckerConfig['default.spelling'];
|
||||
$defaultJargon = $spellCheckerConfig['default.jargon'];
|
||||
$defaultEncoding = $spellCheckerConfig['default.encoding'];
|
||||
$outputType = "xml"; // Do not change
|
||||
|
||||
// Get input parameters.
|
||||
|
||||
$check = urldecode($_REQUEST['check']);
|
||||
$cmd = sanitize($_REQUEST['cmd']);
|
||||
$lang = sanitize($_REQUEST['lang'], "strict");
|
||||
$mode = sanitize($_REQUEST['mode'], "strict");
|
||||
$spelling = sanitize($_REQUEST['spelling'], "strict");
|
||||
$jargon = sanitize($_REQUEST['jargon'], "strict");
|
||||
$encoding = sanitize($_REQUEST['encoding'], "strict");
|
||||
$sg = sanitize($_REQUEST['sg'], "bool");
|
||||
$words = array();
|
||||
|
||||
$validRequest = true;
|
||||
|
||||
if (empty($check))
|
||||
$validRequest = false;
|
||||
|
||||
if (empty($lang))
|
||||
$lang = $defaultLanguage;
|
||||
|
||||
if (empty($mode))
|
||||
$mode = $defaultMode;
|
||||
|
||||
if (empty($spelling))
|
||||
$spelling = $defaultSpelling;
|
||||
|
||||
if (empty($jargon))
|
||||
$jargon = $defaultJargon;
|
||||
|
||||
if (empty($encoding))
|
||||
$encoding = $defaultEncoding;
|
||||
|
||||
function sanitize($str, $type="strict") {
|
||||
switch ($type) {
|
||||
case "strict":
|
||||
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
|
||||
break;
|
||||
case "loose":
|
||||
$str = preg_replace("/</i", ">", $str);
|
||||
$str = preg_replace("/>/i", "<", $str);
|
||||
break;
|
||||
case "bool":
|
||||
if ($str == "true" || $str == true)
|
||||
$str = true;
|
||||
else
|
||||
$str = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
|
||||
|
||||
if (count($tinyspell->errorMsg) == 0) {
|
||||
switch($cmd) {
|
||||
case "spell":
|
||||
// Space for non-exec version and \n for the exec version.
|
||||
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$result = $tinyspell->checkWords($words);
|
||||
break;
|
||||
|
||||
case "suggest":
|
||||
$result = $tinyspell->getSuggestion($check);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Just use this for now.
|
||||
$tinyspell->errorMsg[] = "No command.";
|
||||
$outputType = $outputType . "error";
|
||||
break;
|
||||
}
|
||||
} else
|
||||
$outputType = $outputType . "error";
|
||||
|
||||
if (!$result)
|
||||
$result = array();
|
||||
|
||||
// Output data
|
||||
switch($outputType) {
|
||||
case "xml":
|
||||
header('Content-type: text/xml; charset=utf-8');
|
||||
$body = '<?xml version="1.0" encoding="utf-8" ?>';
|
||||
$body .= "\n";
|
||||
|
||||
if (count($result) == 0)
|
||||
$body .= '<res id="' . $id . '" cmd="'. $cmd .'" />';
|
||||
else
|
||||
$body .= '<res id="' . $id . '" cmd="'. $cmd .'">'. urlencode(implode(" ", $result)) .'</res>';
|
||||
|
||||
echo $body;
|
||||
break;
|
||||
case "xmlerror";
|
||||
header('Content-type: text/xml; charset=utf-8');
|
||||
$body = '<?xml version="1.0" encoding="utf-8" ?>';
|
||||
$body .= "\n";
|
||||
$body .= '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
|
||||
echo $body;
|
||||
break;
|
||||
case "html":
|
||||
var_dump($result);
|
||||
break;
|
||||
case "htmlerror":
|
||||
echo "Error";
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|