Index: openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js 15 Jul 2007 16:07:45 -0000 1.1
+++ openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js 27 Jul 2007 01:15:20 -0000 1.2
@@ -211,8 +211,8 @@
/********** CONSTANTS **********/
- var $j = jQuery.noConflict();
+
var WYM_INSTANCES = new Array();
var WYM_NAME = "name";
var WYM_INDEX = "{Wym_Index}";
@@ -316,7 +316,7 @@
/**
* Replace an HTML element by WYMeditor
*
- * @example $j(".wymeditor").wymeditor(
+ * @example jQuery(".wymeditor").wymeditor(
* {
*
* }
@@ -333,9 +333,9 @@
* @cat Plugins/WYMeditor
* @author Jean-Francois Hovinne
*/
-$j.fn.wymeditor = function(options) {
+jQuery.fn.wymeditor = function(options) {
- options = $j.extend({
+ options = jQuery.extend({
html: "",
@@ -376,7 +376,7 @@
+ "src='"
+ WYM_IFRAME_BASE_PATH
+ "wymiframe.html' "
- + "onload='window.parent.WYM_INSTANCES["
+ + "onload='this.contentWindow.parent.WYM_INSTANCES["
+ WYM_INDEX + "].initIframe(this)' "
+ ">"
+ "",
@@ -659,14 +659,14 @@
return this.each(function(i) {
- new Wymeditor($j(this),i,options);
+ new Wymeditor(jQuery(this),i,options);
});
};
/* @name extend
* @description Returns the WYMeditor instance based on its index
*/
-$j.extend({
+jQuery.extend({
wymeditors: function(i) {
return (WYM_INSTANCES[i]);
},
@@ -688,7 +688,7 @@
this._element = elem;
this._index = index;
this._options = options;
- this._html = $j(elem).val();
+ this._html = jQuery(elem).val();
if(this._options.html) this._html = this._options.html;
this._options.basePath = this._options.basePath
@@ -711,24 +711,24 @@
//load subclass - browser specific
//unsupported browsers: do nothing
- if ($j.browser.msie) {
+ if (jQuery.browser.msie) {
var WymClass = new WymClassExplorer(this);
}
- else if ($j.browser.mozilla) {
+ else if (jQuery.browser.mozilla) {
var WymClass = new WymClassMozilla(this);
}
- else if ($j.browser.opera) {
+ else if (jQuery.browser.opera) {
var WymClass = new WymClassOpera(this);
}
- else if ($j.browser.safari) {
+ else if (jQuery.browser.safari) {
//commented until supported
//var WymClass = new WymClassSafari(this);
+ var WymClass = new WymClassOpera(this);
}
-
if(WymClass) {
- if($j.isFunction(this._options.preInit)) this._options.preInit(this);
+ if(jQuery.isFunction(this._options.preInit)) this._options.preInit(this);
this.loadXhtmlParser(WymClass);
@@ -739,10 +739,10 @@
this.helper = new XmlHelper();
//extend the Wymeditor object
- $j.extend(this, WymClass);
+ jQuery.extend(this, WymClass);
//load wymbox
- this._box = $j(this._element).hide().after(this._options.boxHtml).next();
+ this._box = jQuery(this._element).hide().after(this._options.boxHtml).next();
//construct the iframe
var iframeHtml = this._options.iframeHtml;
@@ -751,7 +751,7 @@
.replaceAll(WYM_IFRAME_BASE_PATH, this._options.iframeBasePath);
//construct wymbox
- var boxHtml = $j(this._box).html();
+ var boxHtml = jQuery(this._box).html();
boxHtml = boxHtml.replaceAll(WYM_TOOLS, this._options.toolsHtml);
boxHtml = boxHtml.replaceAll(WYM_CONTAINERS,this._options.containersHtml);
@@ -814,10 +814,10 @@
boxHtml = this.replaceStrings(boxHtml);
//load html in wymbox
- $j(this._box).html(boxHtml);
+ jQuery(this._box).html(boxHtml);
//hide the html value
- $j(this._box).find(this._options.htmlSelector).hide();
+ jQuery(this._box).find(this._options.htmlSelector).hide();
//enable the skin
this.skin();
@@ -831,27 +831,27 @@
var wym = this;
//handle click event on tools buttons
- $j(this._box).find(this._options.toolSelector).click(function() {
- wym.exec($j(this).attr(WYM_NAME));
+ jQuery(this._box).find(this._options.toolSelector).click(function() {
+ wym.exec(jQuery(this).attr(WYM_NAME));
return(false);
});
//handle click event on containers buttons
- $j(this._box).find(this._options.containerSelector).click(function() {
- wym.container($j(this).attr(WYM_NAME));
+ jQuery(this._box).find(this._options.containerSelector).click(function() {
+ wym.container(jQuery(this).attr(WYM_NAME));
return(false);
});
//handle keyup event on html value: set the editor value
- $j(this._box).find(this._options.htmlValSelector).keyup(function() {
- $j(wym._doc.body).html($j(this).val());
+ jQuery(this._box).find(this._options.htmlValSelector).keyup(function() {
+ jQuery(wym._doc.body).html(jQuery(this).val());
});
//handle click event on classes buttons
- $j(this._box).find(this._options.classSelector).click(function() {
+ jQuery(this._box).find(this._options.classSelector).click(function() {
var aClasses = eval(wym._options.classesItems);
- var sName = $j(this).attr(WYM_NAME);
+ var sName = jQuery(this).attr(WYM_NAME);
var oClass = aClasses.findByName(sName);
@@ -863,7 +863,7 @@
});
//handle event on update element
- $j(this._options.updateSelector)
+ jQuery(this._options.updateSelector)
.bind(this._options.updateEvent, function() {
wym.update();
});
@@ -888,8 +888,8 @@
*/
Wymeditor.prototype.html = function(html) {
- if(html) $j(this._doc.body).html(html);
- else return($j(this._doc.body).html());
+ if(html) jQuery(this._doc.body).html(html);
+ else return(jQuery(this._doc.body).html());
};
/* @name xhtml
@@ -1024,11 +1024,11 @@
var container = (this._selected_image
? this._selected_image
- : $j(this.selected()));
- container = $j(container).parentsOrSelf(jqexpr);
- $j(container).toggleClass(sClass);
+ : jQuery(this.selected()));
+ container = jQuery(container).parentsOrSelf(jqexpr);
+ jQuery(container).toggleClass(sClass);
- if(!$j(container).attr(WYM_CLASS)) $j(container).removeAttr(this._class);
+ if(!jQuery(container).attr(WYM_CLASS)) jQuery(container).removeAttr(this._class);
};
@@ -1081,9 +1081,9 @@
Wymeditor.prototype.switchTo = function(node,sType) {
var newNode = this._doc.createElement(sType);
- var html = $j(node).html();
+ var html = jQuery(node).html();
node.parentNode.replaceChild(newNode,node);
- $j(newNode).html(html);
+ jQuery(newNode).html(html);
this.setFocusToNode(newNode);
};
@@ -1109,7 +1109,7 @@
Wymeditor.prototype.status = function(sMessage) {
//print status message
- $j(this._box).find(this._options.statusSelector).html(sMessage);
+ jQuery(this._box).find(this._options.statusSelector).html(sMessage);
};
/* @name update
@@ -1118,8 +1118,8 @@
Wymeditor.prototype.update = function() {
var html = this.xhtml();
- $j(this._element).val(html);
- $j(this._box).find(this._options.htmlValSelector).val(html);
+ jQuery(this._element).val(html);
+ jQuery(this._box).find(this._options.htmlValSelector).val(html);
};
/* @name dialog
@@ -1177,7 +1177,7 @@
* @description Shows/Hides the HTML
*/
Wymeditor.prototype.toggleHtml = function() {
- $j(this._box).find(this._options.htmlSelector).toggle();
+ jQuery(this._box).find(this._options.htmlSelector).toggle();
};
Wymeditor.prototype.uniqueStamp = function() {
@@ -1200,14 +1200,14 @@
sTmp = aP[x];
//simple newlines are replaced by a break
sTmp = sTmp.replace(rExp, "
");
- $j(container).after("
" + sTmp + "
");
+ jQuery(container).after("" + sTmp + "
");
}
} else {
for(x = 0; x < aP.length; x++) {
sTmp = aP[x];
//simple newlines are replaced by a break
sTmp = sTmp.replace(rExp, "
");
- $j(this._doc.body).append("" + sTmp + "
");
+ jQuery(this._doc.body).append("" + sTmp + "
");
}
}
@@ -1226,27 +1226,27 @@
/********** CONFIGURATION **********/
Wymeditor.prototype.computeBasePath = function() {
- return $j($j.grep($j('script'), function(s){
+ return jQuery(jQuery.grep(jQuery('script'), function(s){
return (s.src && s.src.match(/jquery\.wymeditor\.js(\?.*)?$/ ))
})).attr('src').replace(/jquery\.wymeditor\.js(\?.*)?$/, '');
};
Wymeditor.prototype.computeJqueryPath = function() {
- return $j($j.grep($j('script'), function(s){
+ return jQuery(jQuery.grep(jQuery('script'), function(s){
return (s.src && s.src.match(/jquery\.js(\?.*)?$/ ))
})).attr('src');
};
Wymeditor.prototype.computeCssPath = function() {
- return $j($j.grep($j('link'), function(s){
+ return jQuery(jQuery.grep(jQuery('link'), function(s){
return (s.href && s.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/ ))
})).attr('href');
};
Wymeditor.prototype.loadXhtmlParser = function(WymClass) {
if(typeof XhtmlSaxListener != 'function'){
// This is the only way to get loaded functions in the global scope until jQuery.globalEval works in safari
- eval($j.ajax({url:this._options.basePath+'xhtml_parser.js',async:false}).responseText);
+ eval(jQuery.ajax({url:this._options.basePath+'xhtml_parser.js',async:false}).responseText);
window.XmlHelper = XmlHelper;
window.XhtmlValidator = XhtmlValidator;
window.ParallelRegex = ParallelRegex;
@@ -1264,16 +1264,16 @@
Wymeditor.prototype.configureEditorUsingRawCss = function() {
if(typeof WymCssParser != 'function'){
- eval($j.ajax({url:this._options.basePath+'wym_css_parser.js',async:false}).responseText);
+ eval(jQuery.ajax({url:this._options.basePath+'wym_css_parser.js',async:false}).responseText);
window.WymCssLexer = WymCssLexer;
window.WymCssParser = WymCssParser;
}
var CssParser = new WymCssParser();
if(this._options.stylesheet){
- CssParser.parse($j.ajax({url: this._options.stylesheet,async:false}).responseText);
+ CssParser.parse(jQuery.ajax({url: this._options.stylesheet,async:false}).responseText);
}else{
CssParser.parse(this._options.styles, false);
- }
+ }
if(this._options.classesItems.length == 0) {
this._options.classesItems = CssParser.css_settings.classesItems;
@@ -1292,12 +1292,12 @@
//don't use jQuery.find() on the iframe body
//because of MSIE + jQuery + expando issue (#JQ1143)
- //$j(this._doc.body).find("*").bind("mouseup", this.mouseup);
+ //jQuery(this._doc.body).find("*").bind("mouseup", this.mouseup);
- $j(this._doc.body).bind("mouseup", this.mouseup);
+ jQuery(this._doc.body).bind("mouseup", this.mouseup);
var images = this._doc.body.getElementsByTagName("img");
for(var i=0; i < images.length; i++) {
- $j(images[i]).bind("mouseup", this.mouseup);
+ jQuery(images[i]).bind("mouseup", this.mouseup);
}
};
@@ -1318,41 +1318,41 @@
case WYM_DEFAULT_SKIN:
- $j(this._box).addClass("wym_skin_default");
+ jQuery(this._box).addClass("wym_skin_default");
//render following sections as panels
- $j(this._box).find(this._options.classesSelector)
+ jQuery(this._box).find(this._options.classesSelector)
.addClass("wym_panel");
//render following sections as buttons
- $j(this._box).find(this._options.toolsSelector)
+ jQuery(this._box).find(this._options.toolsSelector)
.addClass("wym_buttons");
//render following sections as dropdown menus
- $j(this._box).find(this._options.containersSelector)
+ jQuery(this._box).find(this._options.containersSelector)
.addClass("wym_dropdown")
.find(WYM_H2)
.append(" >");
// auto add some margin to the main area sides if left area
// or right area are not empty (if they contain sections)
- $j(this._box).find("div.wym_area_right ul")
+ jQuery(this._box).find("div.wym_area_right ul")
.parents("div.wym_area_right").show()
.parents(this._options.boxSelector)
.find("div.wym_area_main")
.css({"margin-right": "155px"});
- $j(this._box).find("div.wym_area_left ul")
+ jQuery(this._box).find("div.wym_area_left ul")
.parents("div.wym_area_left").show()
.parents(this._options.boxSelector)
.find("div.wym_area_main")
.css({"margin-left": "155px"});
//make hover work under IE < 7
- $j(this._box).find(".wym_section").hover(function(){
- $j(this).addClass("hover");
+ jQuery(this._box).find(".wym_section").hover(function(){
+ jQuery(this).addClass("hover");
},function(){
- $j(this).removeClass("hover");
+ jQuery(this).removeClass("hover");
});
break;
@@ -1372,11 +1372,11 @@
//fix MSIE selection if link image has been clicked
if(!selected && wym._selected_image) {
- selected = $j(wym._selected_image).parentsOrSelf(WYM_A);
+ selected = jQuery(wym._selected_image).parentsOrSelf(WYM_A);
}
//pre-init functions
- if($j.isFunction(wym._options.preInitDialog))
+ if(jQuery.isFunction(wym._options.preInitDialog))
wym._options.preInitDialog(wym,window);
//add css rules from options
@@ -1387,84 +1387,84 @@
//auto populate fields if selected container (e.g. A)
if(selected) {
- $j(wym._options.hrefSelector).val($j(selected).attr(WYM_HREF));
- $j(wym._options.srcSelector).val($j(selected).attr(WYM_SRC));
- $j(wym._options.titleSelector).val($j(selected).attr(WYM_TITLE));
- $j(wym._options.altSelector).val($j(selected).attr(WYM_ALT));
+ jQuery(wym._options.hrefSelector).val(jQuery(selected).attr(WYM_HREF));
+ jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYM_SRC));
+ jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYM_TITLE));
+ jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYM_ALT));
}
//auto populate image fields if selected image
if(wym._selected_image) {
- $j(wym._options.dialogImageSelector + " " + wym._options.srcSelector)
- .val($j(wym._selected_image).attr(WYM_SRC));
- $j(wym._options.dialogImageSelector + " " + wym._options.titleSelector)
- .val($j(wym._selected_image).attr(WYM_TITLE));
- $j(wym._options.dialogImageSelector + " " + wym._options.altSelector)
- .val($j(wym._selected_image).attr(WYM_ALT));
+ jQuery(wym._options.dialogImageSelector + " " + wym._options.srcSelector)
+ .val(jQuery(wym._selected_image).attr(WYM_SRC));
+ jQuery(wym._options.dialogImageSelector + " " + wym._options.titleSelector)
+ .val(jQuery(wym._selected_image).attr(WYM_TITLE));
+ jQuery(wym._options.dialogImageSelector + " " + wym._options.altSelector)
+ .val(jQuery(wym._selected_image).attr(WYM_ALT));
}
- $j(wym._options.dialogLinkSelector + " "
+ jQuery(wym._options.dialogLinkSelector + " "
+ wym._options.submitSelector).click(function() {
- var sUrl = $j(wym._options.hrefSelector).val();
+ var sUrl = jQuery(wym._options.hrefSelector).val();
if(sUrl.length > 0) {
wym._exec(WYM_CREATE_LINK, sStamp);
//don't use jQuery.find() see #JQ1143
- //var link = $j(wym._doc.body).find("a[@href=" + sStamp + "]");
+ //var link = jQuery(wym._doc.body).find("a[@href=" + sStamp + "]");
var link = null;
var nodes = wym._doc.body.getElementsByTagName(WYM_A);
for(var i=0; i < nodes.length; i++) {
- if($j(nodes[i]).attr(WYM_HREF) == sStamp) {
- link = $j(nodes[i]);
+ if(jQuery(nodes[i]).attr(WYM_HREF) == sStamp) {
+ link = jQuery(nodes[i]);
break;
}
}
if(link) {
link.attr(WYM_HREF, sUrl);
- link.attr(WYM_TITLE, $j(wym._options.titleSelector).val());
+ link.attr(WYM_TITLE, jQuery(wym._options.titleSelector).val());
}
}
window.close();
});
- $j(wym._options.dialogImageSelector + " "
+ jQuery(wym._options.dialogImageSelector + " "
+ wym._options.submitSelector).click(function() {
- var sUrl = $j(wym._options.srcSelector).val();
+ var sUrl = jQuery(wym._options.srcSelector).val();
if(sUrl.length > 0) {
wym._exec(WYM_INSERT_IMAGE, sStamp);
//don't use jQuery.find() see #JQ1143
- //var image = $j(wym._doc.body).find("img[@src=" + sStamp + "]");
+ //var image = jQuery(wym._doc.body).find("img[@src=" + sStamp + "]");
var image = null;
var nodes = wym._doc.body.getElementsByTagName(WYM_IMG);
for(var i=0; i < nodes.length; i++) {
- if($j(nodes[i]).attr(WYM_SRC) == sStamp) {
- image = $j(nodes[i]);
+ if(jQuery(nodes[i]).attr(WYM_SRC) == sStamp) {
+ image = jQuery(nodes[i]);
break;
}
}
if(image) {
image.attr(WYM_SRC, sUrl);
- image.attr(WYM_TITLE, $j(wym._options.titleSelector).val());
- image.attr(WYM_ALT, $j(wym._options.altSelector).val());
+ image.attr(WYM_TITLE, jQuery(wym._options.titleSelector).val());
+ image.attr(WYM_ALT, jQuery(wym._options.altSelector).val());
}
}
window.close();
});
- $j(wym._options.dialogTableSelector + " "
+ jQuery(wym._options.dialogTableSelector + " "
+ wym._options.submitSelector).click(function() {
- var iRows = $j(wym._options.rowsSelector).val();
- var iCols = $j(wym._options.colsSelector).val();
+ var iRows = jQuery(wym._options.rowsSelector).val();
+ var iCols = jQuery(wym._options.colsSelector).val();
if(iRows > 0 && iCols > 0) {
var table = wym._doc.createElement(WYM_TABLE);
var newRow = null;
var newCol = null;
- var sCaption = $j(wym._options.captionSelector).val();
+ var sCaption = jQuery(wym._options.captionSelector).val();
//we create the caption
var newCaption = table.createCaption();
@@ -1477,40 +1477,40 @@
}
//append the table after the selected container
- var node = $j(wym.findUp(wym.container(),WYM_MAIN_CONTAINERS)).get(0);
- if(!node || !node.parentNode) $j(wym._doc.body).append(table);
- else $j(node).after(table);
+ var node = jQuery(wym.findUp(wym.container(),WYM_MAIN_CONTAINERS)).get(0);
+ if(!node || !node.parentNode) jQuery(wym._doc.body).append(table);
+ else jQuery(node).after(table);
}
window.close();
});
- $j(wym._options.dialogPasteSelector + " "
+ jQuery(wym._options.dialogPasteSelector + " "
+ wym._options.submitSelector).click(function() {
- var sText = $j(wym._options.textSelector).val();
+ var sText = jQuery(wym._options.textSelector).val();
wym.paste(sText);
window.close();
});
- $j(wym._options.dialogPreviewSelector + " "
+ jQuery(wym._options.dialogPreviewSelector + " "
+ wym._options.previewSelector)
.html(wym.xhtml());
//cancel button
- $j(wym._options.cancelSelector).mousedown(function() {
+ jQuery(wym._options.cancelSelector).mousedown(function() {
window.close();
});
//pre-init functions
- if($j.isFunction(wym._options.postInitDialog))
+ if(jQuery.isFunction(wym._options.postInitDialog))
wym._options.postInitDialog(wym,window);
};
/********** HELPERS **********/
// Returns true if it is a text node with whitespaces only
-$j.fn.isPhantomNode = function() {
+jQuery.fn.isPhantomNode = function() {
if (this[0].nodeType == 3)
return !(/[^\t\n\r ]/.test(this[0].data));
@@ -1526,7 +1526,7 @@
// Returns the Parents or the node itself
// jqexpr = a jQuery expression
-$j.fn.parentsOrSelf = function(jqexpr) {
+jQuery.fn.parentsOrSelf = function(jqexpr) {
var n = this;
if (n[0].nodeType == 3)
@@ -1628,7 +1628,7 @@
this._doc.title = this._wym._index;
//init html value
- $j(this._doc.body).html(this._wym._html);
+ jQuery(this._doc.body).html(this._wym._html);
//handle events
var wym = this;
@@ -1655,13 +1655,13 @@
if(this._initialized) {
//pre-bind functions
- if($j.isFunction(this._options.preBind)) this._options.preBind(this);
+ if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
//bind external events
this._wym.bindEvents();
//post-init functions
- if($j.isFunction(this._options.postInit)) this._options.postInit(this);
+ if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
//add event listeners to doc elements, e.g. images
this.listen();
@@ -1775,22 +1775,22 @@
this.enableDesignMode();
//pre-bind functions
- if($j.isFunction(this._options.preBind)) this._options.preBind(this);
+ if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
//bind external events
this._wym.bindEvents();
//bind editor keydown events
- $j(this._doc).bind("keydown", this.keydown);
+ jQuery(this._doc).bind("keydown", this.keydown);
//bind editor keyup events
- $j(this._doc).bind("keyup", this.keyup);
+ jQuery(this._doc).bind("keyup", this.keyup);
//bind editor focus events (used to reset designmode - Gecko bug)
- $j(this._doc).bind("focus", this.enableDesignMode);
+ jQuery(this._doc).bind("focus", this.enableDesignMode);
//post-init functions
- if($j.isFunction(this._options.postInit)) this._options.postInit(this);
+ if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
//add event listeners to doc elements, e.g. images
this.listen();
@@ -1814,16 +1814,18 @@
.replace(/<\/strong>/gi, "");
//update the html body
- $j(this._doc.body).html(html);
+ jQuery(this._doc.body).html(html);
//re-init designMode
this.enableDesignMode();
}
- else return($j(this._doc.body).html());
+ else return(jQuery(this._doc.body).html());
};
WymClassMozilla.prototype._exec = function(cmd,param) {
+ if(!this.selected()) return(false);
+
switch(cmd) {
case WYM_INDENT: case WYM_OUTDENT:
@@ -1917,7 +1919,7 @@
//RETURN key
//cleanup
between paragraphs
- $j(wym._doc.body).children(WYM_BR).remove();
+ jQuery(wym._doc.body).children(WYM_BR).remove();
}
else if(evt.keyCode != 8
@@ -1991,12 +1993,12 @@
this.output += this.helper.tag(tag, attributes, true);
};
-
-WymClassMozilla.prototype.closeBlockTag = function(tag)
-{
- this.output = this.output.replace(/
$/, '')+this._getClosingTagContent('before', tag)+""+tag+">"+this._getClosingTagContent('after', tag);
-};
+WymClassMozilla.prototype.closeBlockTag = function(tag)
+{
+ this.output = this.output.replace(/
$/, '')+this._getClosingTagContent('before', tag)+""+tag+">"+this._getClosingTagContent('after', tag);
+};
+
WymClassMozilla.prototype.getTagForStyle = function(style) {
if(/bold/.test(style)) return 'strong';
@@ -2050,22 +2052,22 @@
this.html(this._wym._html);
//pre-bind functions
- if($j.isFunction(this._options.preBind)) this._options.preBind(this);
+ if(jQuery.isFunction(this._options.preBind)) this._options.preBind(this);
//hide indent and outdent until supported
- $j(this._box).find(this._options.toolSelector
+ jQuery(this._box).find(this._options.toolSelector
+ '[@name=' + WYM_INDENT +']').hide();
- $j(this._box).find(this._options.toolSelector
+ jQuery(this._box).find(this._options.toolSelector
+ '[@name=' + WYM_OUTDENT +']').hide();
//bind external events
this._wym.bindEvents();
//bind editor events
- $j(this._doc).bind("keyup", this.keyup);
+ jQuery(this._doc).bind("keyup", this.keyup);
//post-init functions
- if($j.isFunction(this._options.postInit)) this._options.postInit(this);
+ if(jQuery.isFunction(this._options.postInit)) this._options.postInit(this);
//add event listeners to doc elements, e.g. images
this.listen();
Index: openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js 15 Jul 2007 16:07:45 -0000 1.1
+++ openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js 27 Jul 2007 01:15:20 -0000 1.2
@@ -1 +1 @@
-if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_EN={Strong:'Strong',Emphasis:'Emphasis',Superscript:'Superscript',Subscript:'Subscript',Ordered_List:'Ordered List',Unordered_List:'Unordered List',Indent:'Indent',Outdent:'Outdent',Undo:'Undo',Redo:'Redo',Link:'Link',Unlink:'Unlink',Image:'Image',Table:'Table',HTML:'HTML',Paragraph:'Paragraph',Heading_1:'Heading 1',Heading_2:'Heading 2',Heading_3:'Heading 3',Heading_4:'Heading 4',Heading_5:'Heading 5',Heading_6:'Heading 6',Preformatted:'Preformatted',Blockquote:'Blockquote',Table_Header:'Table Header',URL:'URL',Title:'Title',Alternative_Text:'Alternative text',Caption:'Caption',Number_Of_Rows:'Number of rows',Number_Of_Cols:'Number of cols',Submit:'Submit',Cancel:'Cancel',Choose:'Choose',Preview:'Preview',Paste_From_Word:'Paste from Word',Tools:'Tools',Containers:'Containers',Classes:'Classes',Status:'Status',Source_Code:'Source code'};WYM_STRINGS['en']=WYM_STRINGS_EN;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_DE={Strong:'Fett',Emphasis:'Kursiv',Superscript:'Text hochstellen',Subscript:'Text tiefstellen',Ordered_List:'Geordnete Liste einfügen',Unordered_List:'Ungeordnete Liste einfügen',Indent:'Einzug erhöhen',Outdent:'Einzug vermindern',Undo:'Befehle rückgängig machen',Redo:'Befehle wiederherstellen',Link:'Hyperlink einfügen',Unlink:'Hyperlink entfernen',Image:'Bild einfügen',Table:'Tabelle einfügen',HTML:'HTML anzeigen/verstecken',Paragraph:'Absatz',Heading_1:'Überschrift 1',Heading_2:'Überschrift 2',Heading_3:'Überschrift 3',Heading_4:'Überschrift 4',Heading_5:'Überschrift 5',Heading_6:'Überschrift 6',Preformatted:'Vorformatiert',Blockquote:'Zitat',Table_Header:'Tabellenüberschrift',URL:'URL',Title:'Titel',Alternative_Text:'Alternativer Text',Caption:'Tabellenüberschrift',Number_Of_Rows:'Anzahl Zeilen',Number_Of_Cols:'Anzahl Spalten',Submit:'Absenden',Cancel:'Abbrechen',Choose:'Auswählen',Preview:'Vorschau',Paste_From_Word:'Aus Word einfügen',Tools:'Werkzeuge',Containers:'Inhaltstyp',Classes:'Klassen',Status:'Status',Source_Code:'Quellcode'};WYM_STRINGS['de']=WYM_STRINGS_DE;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_ES={Strong:'Resaltar',Emphasis:'Enfatizar',Superscript:'Superindice',Subscript:'Subindice',Ordered_List:'Lista ordenada',Unordered_List:'Lista sin ordenar',Indent:'Indentado',Outdent:'Sin indentar',Undo:'Deshacer',Redo:'Rehacer',Link:'Enlazar',Unlink:'Eliminar enlace',Image:'Imagen',Table:'Tabla',HTML:'HTML',Paragraph:'Párrafo',Heading_1:'Cabecera 1',Heading_2:'Cabecera 2',Heading_3:'Cabecera 3',Heading_4:'Cabecera 4',Heading_5:'Cabecera 5',Heading_6:'Cabecera 6',Preformatted:'Preformateado',Blockquote:'Cita',Table_Header:'Cabecera de la tabla',URL:'URL',Title:'Título',Alternative_Text:'Texto alternativo',Caption:'Leyenda',Number_Of_Rows:'Número de filas',Number_Of_Cols:'Número de columnas',Submit:'Enviar',Cancel:'Cancelar',Choose:'Seleccionar',Preview:'Vista previa',Paste_From_Word:'Pegar desde Word',Tools:'Herramientas',Containers:'Contenedores',Classes:'Clases',Status:'Estado',Source_Code:'Código fuente'};WYM_STRINGS['es']=WYM_STRINGS_ES;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_FR={Strong:'Mise en évidence',Emphasis:'Emphase',Superscript:'Exposant',Subscript:'Indice',Ordered_List:'Liste Ordonnée',Unordered_List:'Liste Non-Ordonnée',Indent:'Imbriqué',Outdent:'Non-imbriqué',Undo:'Annuler',Redo:'Rétablir',Link:'Lien',Unlink:'Supprimer le Lien',Image:'Image',Table:'Tableau',HTML:'HTML',Paragraph:'Paragraphe',Heading_1:'Titre 1',Heading_2:'Titre 2',Heading_3:'Titre 3',Heading_4:'Titre 4',Heading_5:'Titre 5',Heading_6:'Titre 6',Preformatted:'Pré-formatté',Blockquote:'Citation',Table_Header:'Cellule de titre',URL:'URL',Title:'Titre',Alternative_Text:'Texte alternatif',Caption:'Légende',Number_Of_Rows:'Nombre de lignes',Number_Of_Cols:'Nombre de colonnes',Submit:'Envoyer',Cancel:'Annuler',Choose:'Choisir',Preview:'Prévisualisation',Paste_From_Word:'Copier depuis Word',Tools:'Outils',Containers:'Type de texte',Classes:'Type de contenu',Status:'Infos',Source_Code:'Code source'};WYM_STRINGS['fr']=WYM_STRINGS_FR;var $j=jQuery.noConflict();var WYM_INSTANCES=new Array();var WYM_NAME="name";var WYM_INDEX="{Wym_Index}";var WYM_BASE_PATH="{Wym_Base_Path}";var WYM_CSS_PATH="{Wym_Css_Path}";var WYM_IFRAME_BASE_PATH="{Wym_Iframe_Base_Path}";var WYM_IFRAME_DEFAULT="iframe/default/";var WYM_JQUERY_PATH="{Wym_Jquery_Path}";var WYM_TOOLS="{Wym_Tools}";var WYM_TOOLS_ITEMS="{Wym_Tools_Items}";var WYM_TOOL_NAME="{Wym_Tool_Name}";var WYM_TOOL_TITLE="{Wym_Tool_Title}";var WYM_TOOL_CLASS="{Wym_Tool_Class}";var WYM_CLASSES="{Wym_Classes}";var WYM_CLASSES_ITEMS="{Wym_Classes_Items}";var WYM_CLASS_NAME="{Wym_Class_Name}";var WYM_CLASS_TITLE="{Wym_Class_Title}";var WYM_CONTAINERS="{Wym_Containers}";var WYM_CONTAINERS_ITEMS="{Wym_Containers_Items}";var WYM_CONTAINER_NAME="{Wym_Container_Name}";var WYM_CONTAINER_TITLE="{Wym_Containers_Title}";var WYM_CONTAINER_CLASS="{Wym_Container_Class}";var WYM_HTML="{Wym_Html}";var WYM_IFRAME="{Wym_Iframe}";var WYM_STATUS="{Wym_Status}";var WYM_DIALOG_TITLE="{Wym_Dialog_Title}";var WYM_DIALOG_BODY="{Wym_Dialog_Body}";var WYM_BODY="body";var WYM_STRING="string";var WYM_P="p";var WYM_H1="h1";var WYM_H2="h2";var WYM_H3="h3";var WYM_H4="h4";var WYM_H5="h5";var WYM_H6="h6";var WYM_PRE="pre";var WYM_BLOCKQUOTE="blockquote";var WYM_TD="td";var WYM_TH="th";var WYM_A="a";var WYM_BR="br";var WYM_IMG="img";var WYM_TABLE="table";var WYM_UL="ul";var WYM_OL="ol";var WYM_LI="li";var WYM_CLASS="class";var WYM_HREF="href";var WYM_SRC="src";var WYM_TITLE="title";var WYM_ALT="alt";var WYM_DIALOG_LINK="Link";var WYM_DIALOG_IMAGE="Image";var WYM_DIALOG_TABLE="Table";var WYM_DIALOG_PASTE="Paste_From_Word";var WYM_BOLD="Bold";var WYM_ITALIC="Italic";var WYM_CREATE_LINK="CreateLink";var WYM_INSERT_IMAGE="InsertImage";var WYM_INSERT_TABLE="InsertTable";var WYM_PASTE="Paste";var WYM_INDENT="Indent";var WYM_OUTDENT="Outdent";var WYM_TOGGLE_HTML="ToggleHtml";var WYM_FORMAT_BLOCK="FormatBlock";var WYM_PREVIEW="Preview";var WYM_DEFAULT_SKIN="default";var WYM_MAIN_CONTAINERS=new Array(WYM_P,WYM_H1,WYM_H2,WYM_H3,WYM_H4,WYM_H5,WYM_H6,WYM_PRE,WYM_BLOCKQUOTE);var WYM_BLOCKS=new Array("address","blockquote","div","dl","fieldset","form","h1","h2","h3","h4","h5","h6","hr","noscript","ol","p","pre","table","ul","dd","dt","li","tbody","td","tfoot","th","thead","tr");var WYM_KEY={BACKSPACE:8,ENTER:13,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,CURSOR:new Array(37,38,39,40),DELETE:46};var WYM_NODE={ELEMENT:1,ATTRIBUTE:2,TEXT:3};$j.fn.wymeditor=function(options){options=$j.extend({html:"",basePath:false,cssPath:false,iframeBasePath:false,jQueryPath:false,styles:false,stylesheet:false,lang:"en",boxHtml:""+"
"+WYM_TOOLS+"
"+"
"+"
"+WYM_CONTAINERS+WYM_CLASSES+"
"+"
"+WYM_HTML+WYM_IFRAME+WYM_STATUS+"
"+"
"+"
"+"
",iframeHtml:""+""+"
",editorStyles:[],toolsHtml:"",toolsItemHtml:""+WYM_TOOL_TITLE+"",toolsItems:[{'name':'Bold','title':'Strong','css':'wym_tools_strong'},{'name':'Italic','title':'Emphasis','css':'wym_tools_emphasis'},{'name':'Superscript','title':'Superscript','css':'wym_tools_superscript'},{'name':'Subscript','title':'Subscript','css':'wym_tools_subscript'},{'name':'InsertOrderedList','title':'Ordered_List','css':'wym_tools_ordered_list'},{'name':'InsertUnorderedList','title':'Unordered_List','css':'wym_tools_unordered_list'},{'name':'Indent','title':'Indent','css':'wym_tools_indent'},{'name':'Outdent','title':'Outdent','css':'wym_tools_outdent'},{'name':'Undo','title':'Undo','css':'wym_tools_undo'},{'name':'Redo','title':'Redo','css':'wym_tools_redo'},{'name':'CreateLink','title':'Link','css':'wym_tools_link'},{'name':'Unlink','title':'Unlink','css':'wym_tools_unlink'},{'name':'InsertImage','title':'Image','css':'wym_tools_image'},{'name':'InsertTable','title':'Table','css':'wym_tools_table'},{'name':'Paste','title':'Paste_From_Word','css':'wym_tools_paste'},{'name':'ToggleHtml','title':'HTML','css':'wym_tools_html'},{'name':'Preview','title':'Preview','css':'wym_tools_preview'}],containersHtml:"",containersItemHtml:""+""+WYM_CONTAINER_TITLE+"",containersItems:[{'name':'P','title':'Paragraph','css':'wym_containers_p'},{'name':'H1','title':'Heading_1','css':'wym_containers_h1'},{'name':'H2','title':'Heading_2','css':'wym_containers_h2'},{'name':'H3','title':'Heading_3','css':'wym_containers_h3'},{'name':'H4','title':'Heading_4','css':'wym_containers_h4'},{'name':'H5','title':'Heading_5','css':'wym_containers_h5'},{'name':'H6','title':'Heading_6','css':'wym_containers_h6'},{'name':'PRE','title':'Preformatted','css':'wym_containers_pre'},{'name':'BLOCKQUOTE','title':'Blockquote','css':'wym_containers_blockquote'},{'name':'TH','title':'Table_Header','css':'wym_containers_th'}],classesHtml:"",classesItemHtml:""+WYM_CLASS_TITLE+"",classesItems:[],statusHtml:""+"
{Status}
"+"",htmlHtml:""+"
{Source_Code}
"+""+"",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no"+",width=560,height=300,top=0,left=0",dialogHtml:""+""+""+""+WYM_DIALOG_TITLE+""+""+""+""+WYM_DIALOG_BODY+"",dialogLinkHtml:""+""+"",dialogImageHtml:""+""+"",dialogTableHtml:""+""+"",dialogPasteHtml:""+""+"",dialogPreviewHtml:"",dialogStyles:[],skin:WYM_DEFAULT_SKIN,stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},options);return this.each(function(i){new Wymeditor($j(this),i,options)})};$j.extend({wymeditors:function(i){return(WYM_INSTANCES[i])},wymstrings:function(lang,sKey){return(WYM_STRINGS[lang][sKey])}});function Wymeditor(elem,index,options){WYM_INSTANCES[index]=this;this._element=elem;this._index=index;this._options=options;this._html=$j(elem).val();if(this._options.html)this._html=this._options.html;this._options.basePath=this._options.basePath||this.computeBasePath();this._options.cssPath=this._options.cssPath||this.computeCssPath();this._options.iframeBasePath=this._options.iframeBasePath||this._options.basePath+WYM_IFRAME_DEFAULT;this._options.jQueryPath=this._options.jQueryPath||this.computeJqueryPath();this.init()};Wymeditor.prototype.init=function(){if($j.browser.msie){var WymClass=new WymClassExplorer(this)}else if($j.browser.mozilla){var WymClass=new WymClassMozilla(this)}else if($j.browser.opera){var WymClass=new WymClassOpera(this)}else if($j.browser.safari){}if(WymClass){if($j.isFunction(this._options.preInit))this._options.preInit(this);this.loadXhtmlParser(WymClass);if(this._options.styles||this._options.stylesheet){this.configureEditorUsingRawCss()}this.helper=new XmlHelper();$j.extend(this,WymClass);this._box=$j(this._element).hide().after(this._options.boxHtml).next();var iframeHtml=this._options.iframeHtml;iframeHtml=iframeHtml.replaceAll(WYM_INDEX,this._index).replaceAll(WYM_IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=$j(this._box).html();boxHtml=boxHtml.replaceAll(WYM_TOOLS,this._options.toolsHtml);boxHtml=boxHtml.replaceAll(WYM_CONTAINERS,this._options.containersHtml);boxHtml=boxHtml.replaceAll(WYM_CLASSES,this._options.classesHtml);boxHtml=boxHtml.replaceAll(WYM_HTML,this._options.htmlHtml);boxHtml=boxHtml.replaceAll(WYM_IFRAME,iframeHtml);boxHtml=boxHtml.replaceAll(WYM_STATUS,this._options.statusHtml);var aTools=eval(this._options.toolsItems);var sTools="";for(var i=0;i0)firstNode=nodes.item(0);for(var x=0;x=0;x--){sTmp=aP[x];sTmp=sTmp.replace(rExp,"
");$j(container).after(""+sTmp+"
")}}else{for(x=0;x");$j(this._doc.body).append(""+sTmp+"
")}}};Wymeditor.prototype.addCssRules=function(doc,aCss){var styles=doc.styleSheets[0];if(styles){for(var i=0;i >");$j(this._box).find("div.wym_area_right ul").parents("div.wym_area_right").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-right":"155px"});$j(this._box).find("div.wym_area_left ul").parents("div.wym_area_left").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-left":"155px"});$j(this._box).find(".wym_section").hover(function(){$j(this).addClass("hover")},function(){$j(this).removeClass("hover")});break}};function WYM_INIT_DIALOG(index){var wym=window.opener.WYM_INSTANCES[index];var doc=window.document;var selected=wym.selected();var sStamp=wym.uniqueStamp();if(!selected&&wym._selected_image){selected=$j(wym._selected_image).parentsOrSelf(WYM_A)}if($j.isFunction(wym._options.preInitDialog))wym._options.preInitDialog(wym,window);var styles=doc.styleSheets[0];var aCss=eval(wym._options.dialogStyles);wym.addCssRules(doc,aCss);if(selected){$j(wym._options.hrefSelector).val($j(selected).attr(WYM_HREF));$j(wym._options.srcSelector).val($j(selected).attr(WYM_SRC));$j(wym._options.titleSelector).val($j(selected).attr(WYM_TITLE));$j(wym._options.altSelector).val($j(selected).attr(WYM_ALT))}if(wym._selected_image){$j(wym._options.dialogImageSelector+" "+wym._options.srcSelector).val($j(wym._selected_image).attr(WYM_SRC));$j(wym._options.dialogImageSelector+" "+wym._options.titleSelector).val($j(wym._selected_image).attr(WYM_TITLE));$j(wym._options.dialogImageSelector+" "+wym._options.altSelector).val($j(wym._selected_image).attr(WYM_ALT))}$j(wym._options.dialogLinkSelector+" "+wym._options.submitSelector).click(function(){var sUrl=$j(wym._options.hrefSelector).val();if(sUrl.length>0){wym._exec(WYM_CREATE_LINK,sStamp);var link=null;var nodes=wym._doc.body.getElementsByTagName(WYM_A);for(var i=0;i0){wym._exec(WYM_INSERT_IMAGE,sStamp);var image=null;var nodes=wym._doc.body.getElementsByTagName(WYM_IMG);for(var i=0;i0&&iCols>0){var table=wym._doc.createElement(WYM_TABLE);var newRow=null;var newCol=null;var sCaption=$j(wym._options.captionSelector).val();var newCaption=table.createCaption();newCaption.innerHTML=sCaption;for(x=0;x]*)>/gi,"").replace(/<\/em>/gi,"").replace(/]*)>/gi,"").replace(/<\/strong>/gi,"");$j(this._doc.body).html(html);this.enableDesignMode()}else return($j(this._doc.body).html())};WymClassMozilla.prototype._exec=function(cmd,param){switch(cmd){case WYM_INDENT:case WYM_OUTDENT:var focusNode=this.selected();var sel=this._iframe.contentWindow.getSelection();var anchorNode=sel.anchorNode;if(anchorNode.nodeName=="#text")anchorNode=anchorNode.parentNode;focusNode=this.findUp(focusNode,WYM_BLOCKS);anchorNode=this.findUp(anchorNode,WYM_BLOCKS);if(focusNode&&focusNode==anchorNode&&focusNode.tagName.toLowerCase()==WYM_LI){var ancestor=focusNode.parentNode.parentNode;if(focusNode.parentNode.childNodes.length>1||ancestor.tagName.toLowerCase()==WYM_OL||ancestor.tagName.toLowerCase()==WYM_UL)this._doc.execCommand(cmd,'',null)}break;default:if(param)this._doc.execCommand(cmd,'',param);else this._doc.execCommand(cmd,'',null)}var container=this.selected();if(container.tagName.toLowerCase()==WYM_BODY)this._exec(WYM_FORMAT_BLOCK,WYM_P);this.listen()};WymClassMozilla.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassMozilla.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassMozilla.prototype.keydown=function(evt){var wym=WYM_INSTANCES[this.title];if(evt.ctrlKey){if(evt.keyCode==66){wym._exec(WYM_BOLD);return false}if(evt.keyCode==73){wym._exec(WYM_ITALIC);return false}}};WymClassMozilla.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null;if(evt.keyCode==13&&!evt.shiftKey){$j(wym._doc.body).children(WYM_BR).remove()}else if(evt.keyCode!=8&&evt.keyCode!=17&&evt.keyCode!=46&&evt.keyCode!=224&&!evt.metaKey&&!evt.ctrlKey){var container=wym.selected();var name=container.tagName.toLowerCase();if(name=="strong"||name=="b"||name=="em"||name=="i"||name=="sub"||name=="sup"||name=="a")name=container.parentNode.tagName.toLowerCase();if(name==WYM_BODY)wym._exec(WYM_FORMAT_BLOCK,WYM_P)}};WymClassMozilla.prototype.enableDesignMode=function(){if(this.designMode=="off"){try{this.designMode="on";this.execCommand("styleWithCSS",'',false)}catch(e){}}};WymClassMozilla.prototype.setFocusToNode=function(node){var range=document.createRange();range.selectNode(node);var selected=this._iframe.contentWindow.getSelection();selected.addRange(range);selected.collapse(node,node.childNodes.length);this._iframe.contentWindow.focus()};WymClassMozilla.prototype.openBlockTag=function(tag,attributes){var attributes=this.validator.getValidTagAttributes(tag,attributes);if(tag=='span'&&attributes.style){var new_tag=this.getTagForStyle(attributes.style);if(new_tag){this._tag_stack.pop();var tag=new_tag;this._tag_stack.push(new_tag);attributes.style=''}else{return}}if(tag!='li'&&(tag=='ul'||tag=='ol')&&this.last_tag&&!this.last_tag_opened&&this.last_tag=='li'){this.output=this.output.replace(/<\/li>$/,'');this.insertContentAfterClosingTag(tag,'')}this.output+=this.helper.tag(tag,attributes,true)};WymClassMozilla.prototype.closeBlockTag=function(tag){this.output=this.output.replace(/
$/,'')+this._getClosingTagContent('before',tag)+""+tag+">"+this._getClosingTagContent('after',tag)};WymClassMozilla.prototype.getTagForStyle=function(style){if(/bold/.test(style))return'strong';if(/italic/.test(style))return'em';if(/sub/.test(style))return'sub';if(/sub/.test(style))return'super';return false};function WymClassOpera(wym){this._wym=wym;this._class="class";this._newLine="\r\n"};WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe;this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0];var aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss);this._doc.title=this._wym._index;this._doc.designMode="on";this.html(this._wym._html);if($j.isFunction(this._options.preBind))this._options.preBind(this);$j(this._box).find(this._options.toolSelector+'[@name='+WYM_INDENT+']').hide();$j(this._box).find(this._options.toolSelector+'[@name='+WYM_OUTDENT+']').hide();this._wym.bindEvents();$j(this._doc).bind("keyup",this.keyup);if($j.isFunction(this._options.postInit))this._options.postInit(this);this.listen()};WymClassOpera.prototype._exec=function(cmd,param){switch(cmd){case WYM_INDENT:case WYM_OUTDENT:this.status("Unsupported feature.");break;default:if(param)this._doc.execCommand(cmd,false,param);else this._doc.execCommand(cmd);break}this.listen()};WymClassOpera.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassOpera.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassOpera.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null};WymClassOpera.prototype.setFocusToNode=function(node){};
\ No newline at end of file
+if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_EN={Strong:'Strong',Emphasis:'Emphasis',Superscript:'Superscript',Subscript:'Subscript',Ordered_List:'Ordered List',Unordered_List:'Unordered List',Indent:'Indent',Outdent:'Outdent',Undo:'Undo',Redo:'Redo',Link:'Link',Unlink:'Unlink',Image:'Image',Table:'Table',HTML:'HTML',Paragraph:'Paragraph',Heading_1:'Heading 1',Heading_2:'Heading 2',Heading_3:'Heading 3',Heading_4:'Heading 4',Heading_5:'Heading 5',Heading_6:'Heading 6',Preformatted:'Preformatted',Blockquote:'Blockquote',Table_Header:'Table Header',URL:'URL',Title:'Title',Alternative_Text:'Alternative text',Caption:'Caption',Number_Of_Rows:'Number of rows',Number_Of_Cols:'Number of cols',Submit:'Submit',Cancel:'Cancel',Choose:'Choose',Preview:'Preview',Paste_From_Word:'Paste from Word',Tools:'Tools',Containers:'Containers',Classes:'Classes',Status:'Status',Source_Code:'Source code'};WYM_STRINGS['en']=WYM_STRINGS_EN;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_DE={Strong:'Fett',Emphasis:'Kursiv',Superscript:'Text hochstellen',Subscript:'Text tiefstellen',Ordered_List:'Geordnete Liste einfügen',Unordered_List:'Ungeordnete Liste einfügen',Indent:'Einzug erhöhen',Outdent:'Einzug vermindern',Undo:'Befehle rückgängig machen',Redo:'Befehle wiederherstellen',Link:'Hyperlink einfügen',Unlink:'Hyperlink entfernen',Image:'Bild einfügen',Table:'Tabelle einfügen',HTML:'HTML anzeigen/verstecken',Paragraph:'Absatz',Heading_1:'Überschrift 1',Heading_2:'Überschrift 2',Heading_3:'Überschrift 3',Heading_4:'Überschrift 4',Heading_5:'Überschrift 5',Heading_6:'Überschrift 6',Preformatted:'Vorformatiert',Blockquote:'Zitat',Table_Header:'Tabellenüberschrift',URL:'URL',Title:'Titel',Alternative_Text:'Alternativer Text',Caption:'Tabellenüberschrift',Number_Of_Rows:'Anzahl Zeilen',Number_Of_Cols:'Anzahl Spalten',Submit:'Absenden',Cancel:'Abbrechen',Choose:'Auswählen',Preview:'Vorschau',Paste_From_Word:'Aus Word einfügen',Tools:'Werkzeuge',Containers:'Inhaltstyp',Classes:'Klassen',Status:'Status',Source_Code:'Quellcode'};WYM_STRINGS['de']=WYM_STRINGS_DE;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_ES={Strong:'Resaltar',Emphasis:'Enfatizar',Superscript:'Superindice',Subscript:'Subindice',Ordered_List:'Lista ordenada',Unordered_List:'Lista sin ordenar',Indent:'Indentado',Outdent:'Sin indentar',Undo:'Deshacer',Redo:'Rehacer',Link:'Enlazar',Unlink:'Eliminar enlace',Image:'Imagen',Table:'Tabla',HTML:'HTML',Paragraph:'Párrafo',Heading_1:'Cabecera 1',Heading_2:'Cabecera 2',Heading_3:'Cabecera 3',Heading_4:'Cabecera 4',Heading_5:'Cabecera 5',Heading_6:'Cabecera 6',Preformatted:'Preformateado',Blockquote:'Cita',Table_Header:'Cabecera de la tabla',URL:'URL',Title:'Título',Alternative_Text:'Texto alternativo',Caption:'Leyenda',Number_Of_Rows:'Número de filas',Number_Of_Cols:'Número de columnas',Submit:'Enviar',Cancel:'Cancelar',Choose:'Seleccionar',Preview:'Vista previa',Paste_From_Word:'Pegar desde Word',Tools:'Herramientas',Containers:'Contenedores',Classes:'Clases',Status:'Estado',Source_Code:'Código fuente'};WYM_STRINGS['es']=WYM_STRINGS_ES;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_FR={Strong:'Mise en évidence',Emphasis:'Emphase',Superscript:'Exposant',Subscript:'Indice',Ordered_List:'Liste Ordonnée',Unordered_List:'Liste Non-Ordonnée',Indent:'Imbriqué',Outdent:'Non-imbriqué',Undo:'Annuler',Redo:'Rétablir',Link:'Lien',Unlink:'Supprimer le Lien',Image:'Image',Table:'Tableau',HTML:'HTML',Paragraph:'Paragraphe',Heading_1:'Titre 1',Heading_2:'Titre 2',Heading_3:'Titre 3',Heading_4:'Titre 4',Heading_5:'Titre 5',Heading_6:'Titre 6',Preformatted:'Pré-formatté',Blockquote:'Citation',Table_Header:'Cellule de titre',URL:'URL',Title:'Titre',Alternative_Text:'Texte alternatif',Caption:'Légende',Number_Of_Rows:'Nombre de lignes',Number_Of_Cols:'Nombre de colonnes',Submit:'Envoyer',Cancel:'Annuler',Choose:'Choisir',Preview:'Prévisualisation',Paste_From_Word:'Copier depuis Word',Tools:'Outils',Containers:'Type de texte',Classes:'Type de contenu',Status:'Infos',Source_Code:'Code source'};WYM_STRINGS['fr']=WYM_STRINGS_FR;var WYM_INSTANCES=new Array();var WYM_NAME="name";var WYM_INDEX="{Wym_Index}";var WYM_BASE_PATH="{Wym_Base_Path}";var WYM_CSS_PATH="{Wym_Css_Path}";var WYM_IFRAME_BASE_PATH="{Wym_Iframe_Base_Path}";var WYM_IFRAME_DEFAULT="iframe/default/";var WYM_JQUERY_PATH="{Wym_Jquery_Path}";var WYM_TOOLS="{Wym_Tools}";var WYM_TOOLS_ITEMS="{Wym_Tools_Items}";var WYM_TOOL_NAME="{Wym_Tool_Name}";var WYM_TOOL_TITLE="{Wym_Tool_Title}";var WYM_TOOL_CLASS="{Wym_Tool_Class}";var WYM_CLASSES="{Wym_Classes}";var WYM_CLASSES_ITEMS="{Wym_Classes_Items}";var WYM_CLASS_NAME="{Wym_Class_Name}";var WYM_CLASS_TITLE="{Wym_Class_Title}";var WYM_CONTAINERS="{Wym_Containers}";var WYM_CONTAINERS_ITEMS="{Wym_Containers_Items}";var WYM_CONTAINER_NAME="{Wym_Container_Name}";var WYM_CONTAINER_TITLE="{Wym_Containers_Title}";var WYM_CONTAINER_CLASS="{Wym_Container_Class}";var WYM_HTML="{Wym_Html}";var WYM_IFRAME="{Wym_Iframe}";var WYM_STATUS="{Wym_Status}";var WYM_DIALOG_TITLE="{Wym_Dialog_Title}";var WYM_DIALOG_BODY="{Wym_Dialog_Body}";var WYM_BODY="body";var WYM_STRING="string";var WYM_P="p";var WYM_H1="h1";var WYM_H2="h2";var WYM_H3="h3";var WYM_H4="h4";var WYM_H5="h5";var WYM_H6="h6";var WYM_PRE="pre";var WYM_BLOCKQUOTE="blockquote";var WYM_TD="td";var WYM_TH="th";var WYM_A="a";var WYM_BR="br";var WYM_IMG="img";var WYM_TABLE="table";var WYM_UL="ul";var WYM_OL="ol";var WYM_LI="li";var WYM_CLASS="class";var WYM_HREF="href";var WYM_SRC="src";var WYM_TITLE="title";var WYM_ALT="alt";var WYM_DIALOG_LINK="Link";var WYM_DIALOG_IMAGE="Image";var WYM_DIALOG_TABLE="Table";var WYM_DIALOG_PASTE="Paste_From_Word";var WYM_BOLD="Bold";var WYM_ITALIC="Italic";var WYM_CREATE_LINK="CreateLink";var WYM_INSERT_IMAGE="InsertImage";var WYM_INSERT_TABLE="InsertTable";var WYM_PASTE="Paste";var WYM_INDENT="Indent";var WYM_OUTDENT="Outdent";var WYM_TOGGLE_HTML="ToggleHtml";var WYM_FORMAT_BLOCK="FormatBlock";var WYM_PREVIEW="Preview";var WYM_DEFAULT_SKIN="default";var WYM_MAIN_CONTAINERS=new Array(WYM_P,WYM_H1,WYM_H2,WYM_H3,WYM_H4,WYM_H5,WYM_H6,WYM_PRE,WYM_BLOCKQUOTE);var WYM_BLOCKS=new Array("address","blockquote","div","dl","fieldset","form","h1","h2","h3","h4","h5","h6","hr","noscript","ol","p","pre","table","ul","dd","dt","li","tbody","td","tfoot","th","thead","tr");var WYM_KEY={BACKSPACE:8,ENTER:13,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,CURSOR:new Array(37,38,39,40),DELETE:46};var WYM_NODE={ELEMENT:1,ATTRIBUTE:2,TEXT:3};jQuery.fn.wymeditor=function(options){options=jQuery.extend({html:"",basePath:false,cssPath:false,iframeBasePath:false,jQueryPath:false,styles:false,stylesheet:false,lang:"en",boxHtml:""+"
"+WYM_TOOLS+"
"+"
"+"
"+WYM_CONTAINERS+WYM_CLASSES+"
"+"
"+WYM_HTML+WYM_IFRAME+WYM_STATUS+"
"+"
"+"
"+"
",iframeHtml:""+""+"
",editorStyles:[],toolsHtml:"",toolsItemHtml:""+WYM_TOOL_TITLE+"",toolsItems:[{'name':'Bold','title':'Strong','css':'wym_tools_strong'},{'name':'Italic','title':'Emphasis','css':'wym_tools_emphasis'},{'name':'Superscript','title':'Superscript','css':'wym_tools_superscript'},{'name':'Subscript','title':'Subscript','css':'wym_tools_subscript'},{'name':'InsertOrderedList','title':'Ordered_List','css':'wym_tools_ordered_list'},{'name':'InsertUnorderedList','title':'Unordered_List','css':'wym_tools_unordered_list'},{'name':'Indent','title':'Indent','css':'wym_tools_indent'},{'name':'Outdent','title':'Outdent','css':'wym_tools_outdent'},{'name':'Undo','title':'Undo','css':'wym_tools_undo'},{'name':'Redo','title':'Redo','css':'wym_tools_redo'},{'name':'CreateLink','title':'Link','css':'wym_tools_link'},{'name':'Unlink','title':'Unlink','css':'wym_tools_unlink'},{'name':'InsertImage','title':'Image','css':'wym_tools_image'},{'name':'InsertTable','title':'Table','css':'wym_tools_table'},{'name':'Paste','title':'Paste_From_Word','css':'wym_tools_paste'},{'name':'ToggleHtml','title':'HTML','css':'wym_tools_html'},{'name':'Preview','title':'Preview','css':'wym_tools_preview'}],containersHtml:"",containersItemHtml:""+""+WYM_CONTAINER_TITLE+"",containersItems:[{'name':'P','title':'Paragraph','css':'wym_containers_p'},{'name':'H1','title':'Heading_1','css':'wym_containers_h1'},{'name':'H2','title':'Heading_2','css':'wym_containers_h2'},{'name':'H3','title':'Heading_3','css':'wym_containers_h3'},{'name':'H4','title':'Heading_4','css':'wym_containers_h4'},{'name':'H5','title':'Heading_5','css':'wym_containers_h5'},{'name':'H6','title':'Heading_6','css':'wym_containers_h6'},{'name':'PRE','title':'Preformatted','css':'wym_containers_pre'},{'name':'BLOCKQUOTE','title':'Blockquote','css':'wym_containers_blockquote'},{'name':'TH','title':'Table_Header','css':'wym_containers_th'}],classesHtml:"",classesItemHtml:""+WYM_CLASS_TITLE+"",classesItems:[],statusHtml:""+"
{Status}
"+"",htmlHtml:""+"
{Source_Code}
"+""+"",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no"+",width=560,height=300,top=0,left=0",dialogHtml:""+""+""+""+WYM_DIALOG_TITLE+""+""+""+""+WYM_DIALOG_BODY+"",dialogLinkHtml:""+""+"",dialogImageHtml:""+""+"",dialogTableHtml:""+""+"",dialogPasteHtml:""+""+"",dialogPreviewHtml:"",dialogStyles:[],skin:WYM_DEFAULT_SKIN,stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},options);return this.each(function(i){new Wymeditor(jQuery(this),i,options)})};jQuery.extend({wymeditors:function(i){return(WYM_INSTANCES[i])},wymstrings:function(lang,sKey){return(WYM_STRINGS[lang][sKey])}});function Wymeditor(elem,index,options){WYM_INSTANCES[index]=this;this._element=elem;this._index=index;this._options=options;this._html=jQuery(elem).val();if(this._options.html)this._html=this._options.html;this._options.basePath=this._options.basePath||this.computeBasePath();this._options.cssPath=this._options.cssPath||this.computeCssPath();this._options.iframeBasePath=this._options.iframeBasePath||this._options.basePath+WYM_IFRAME_DEFAULT;this._options.jQueryPath=this._options.jQueryPath||this.computeJqueryPath();this.init()};Wymeditor.prototype.init=function(){if(jQuery.browser.msie){var WymClass=new WymClassExplorer(this)}else if(jQuery.browser.mozilla){var WymClass=new WymClassMozilla(this)}else if(jQuery.browser.opera){var WymClass=new WymClassOpera(this)}else if(jQuery.browser.safari){var WymClass=new WymClassOpera(this)}if(WymClass){if(jQuery.isFunction(this._options.preInit))this._options.preInit(this);this.loadXhtmlParser(WymClass);if(this._options.styles||this._options.stylesheet){this.configureEditorUsingRawCss()}this.helper=new XmlHelper();jQuery.extend(this,WymClass);this._box=jQuery(this._element).hide().after(this._options.boxHtml).next();var iframeHtml=this._options.iframeHtml;iframeHtml=iframeHtml.replaceAll(WYM_INDEX,this._index).replaceAll(WYM_IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=jQuery(this._box).html();boxHtml=boxHtml.replaceAll(WYM_TOOLS,this._options.toolsHtml);boxHtml=boxHtml.replaceAll(WYM_CONTAINERS,this._options.containersHtml);boxHtml=boxHtml.replaceAll(WYM_CLASSES,this._options.classesHtml);boxHtml=boxHtml.replaceAll(WYM_HTML,this._options.htmlHtml);boxHtml=boxHtml.replaceAll(WYM_IFRAME,iframeHtml);boxHtml=boxHtml.replaceAll(WYM_STATUS,this._options.statusHtml);var aTools=eval(this._options.toolsItems);var sTools="";for(var i=0;i0)firstNode=nodes.item(0);for(var x=0;x=0;x--){sTmp=aP[x];sTmp=sTmp.replace(rExp,"
");jQuery(container).after(""+sTmp+"
")}}else{for(x=0;x");jQuery(this._doc.body).append(""+sTmp+"
")}}};Wymeditor.prototype.addCssRules=function(doc,aCss){var styles=doc.styleSheets[0];if(styles){for(var i=0;i >");jQuery(this._box).find("div.wym_area_right ul").parents("div.wym_area_right").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-right":"155px"});jQuery(this._box).find("div.wym_area_left ul").parents("div.wym_area_left").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-left":"155px"});jQuery(this._box).find(".wym_section").hover(function(){jQuery(this).addClass("hover")},function(){jQuery(this).removeClass("hover")});break}};function WYM_INIT_DIALOG(index){var wym=window.opener.WYM_INSTANCES[index];var doc=window.document;var selected=wym.selected();var sStamp=wym.uniqueStamp();if(!selected&&wym._selected_image){selected=jQuery(wym._selected_image).parentsOrSelf(WYM_A)}if(jQuery.isFunction(wym._options.preInitDialog))wym._options.preInitDialog(wym,window);var styles=doc.styleSheets[0];var aCss=eval(wym._options.dialogStyles);wym.addCssRules(doc,aCss);if(selected){jQuery(wym._options.hrefSelector).val(jQuery(selected).attr(WYM_HREF));jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYM_SRC));jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYM_TITLE));jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYM_ALT))}if(wym._selected_image){jQuery(wym._options.dialogImageSelector+" "+wym._options.srcSelector).val(jQuery(wym._selected_image).attr(WYM_SRC));jQuery(wym._options.dialogImageSelector+" "+wym._options.titleSelector).val(jQuery(wym._selected_image).attr(WYM_TITLE));jQuery(wym._options.dialogImageSelector+" "+wym._options.altSelector).val(jQuery(wym._selected_image).attr(WYM_ALT))}jQuery(wym._options.dialogLinkSelector+" "+wym._options.submitSelector).click(function(){var sUrl=jQuery(wym._options.hrefSelector).val();if(sUrl.length>0){wym._exec(WYM_CREATE_LINK,sStamp);var link=null;var nodes=wym._doc.body.getElementsByTagName(WYM_A);for(var i=0;i0){wym._exec(WYM_INSERT_IMAGE,sStamp);var image=null;var nodes=wym._doc.body.getElementsByTagName(WYM_IMG);for(var i=0;i0&&iCols>0){var table=wym._doc.createElement(WYM_TABLE);var newRow=null;var newCol=null;var sCaption=jQuery(wym._options.captionSelector).val();var newCaption=table.createCaption();newCaption.innerHTML=sCaption;for(x=0;x]*)>/gi,"").replace(/<\/em>/gi,"").replace(/]*)>/gi,"").replace(/<\/strong>/gi,"");jQuery(this._doc.body).html(html);this.enableDesignMode()}else return(jQuery(this._doc.body).html())};WymClassMozilla.prototype._exec=function(cmd,param){if(!this.selected())return(false);switch(cmd){case WYM_INDENT:case WYM_OUTDENT:var focusNode=this.selected();var sel=this._iframe.contentWindow.getSelection();var anchorNode=sel.anchorNode;if(anchorNode.nodeName=="#text")anchorNode=anchorNode.parentNode;focusNode=this.findUp(focusNode,WYM_BLOCKS);anchorNode=this.findUp(anchorNode,WYM_BLOCKS);if(focusNode&&focusNode==anchorNode&&focusNode.tagName.toLowerCase()==WYM_LI){var ancestor=focusNode.parentNode.parentNode;if(focusNode.parentNode.childNodes.length>1||ancestor.tagName.toLowerCase()==WYM_OL||ancestor.tagName.toLowerCase()==WYM_UL)this._doc.execCommand(cmd,'',null)}break;default:if(param)this._doc.execCommand(cmd,'',param);else this._doc.execCommand(cmd,'',null)}var container=this.selected();if(container.tagName.toLowerCase()==WYM_BODY)this._exec(WYM_FORMAT_BLOCK,WYM_P);this.listen()};WymClassMozilla.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassMozilla.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassMozilla.prototype.keydown=function(evt){var wym=WYM_INSTANCES[this.title];if(evt.ctrlKey){if(evt.keyCode==66){wym._exec(WYM_BOLD);return false}if(evt.keyCode==73){wym._exec(WYM_ITALIC);return false}}};WymClassMozilla.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null;if(evt.keyCode==13&&!evt.shiftKey){jQuery(wym._doc.body).children(WYM_BR).remove()}else if(evt.keyCode!=8&&evt.keyCode!=17&&evt.keyCode!=46&&evt.keyCode!=224&&!evt.metaKey&&!evt.ctrlKey){var container=wym.selected();var name=container.tagName.toLowerCase();if(name=="strong"||name=="b"||name=="em"||name=="i"||name=="sub"||name=="sup"||name=="a")name=container.parentNode.tagName.toLowerCase();if(name==WYM_BODY)wym._exec(WYM_FORMAT_BLOCK,WYM_P)}};WymClassMozilla.prototype.enableDesignMode=function(){if(this.designMode=="off"){try{this.designMode="on";this.execCommand("styleWithCSS",'',false)}catch(e){}}};WymClassMozilla.prototype.setFocusToNode=function(node){var range=document.createRange();range.selectNode(node);var selected=this._iframe.contentWindow.getSelection();selected.addRange(range);selected.collapse(node,node.childNodes.length);this._iframe.contentWindow.focus()};WymClassMozilla.prototype.openBlockTag=function(tag,attributes){var attributes=this.validator.getValidTagAttributes(tag,attributes);if(tag=='span'&&attributes.style){var new_tag=this.getTagForStyle(attributes.style);if(new_tag){this._tag_stack.pop();var tag=new_tag;this._tag_stack.push(new_tag);attributes.style=''}else{return}}if(tag!='li'&&(tag=='ul'||tag=='ol')&&this.last_tag&&!this.last_tag_opened&&this.last_tag=='li'){this.output=this.output.replace(/<\/li>$/,'');this.insertContentAfterClosingTag(tag,'')}this.output+=this.helper.tag(tag,attributes,true)};WymClassMozilla.prototype.closeBlockTag=function(tag){this.output=this.output.replace(/
$/,'')+this._getClosingTagContent('before',tag)+""+tag+">"+this._getClosingTagContent('after',tag)};WymClassMozilla.prototype.getTagForStyle=function(style){if(/bold/.test(style))return'strong';if(/italic/.test(style))return'em';if(/sub/.test(style))return'sub';if(/sub/.test(style))return'super';return false};function WymClassOpera(wym){this._wym=wym;this._class="class";this._newLine="\r\n"};WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe;this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0];var aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss);this._doc.title=this._wym._index;this._doc.designMode="on";this.html(this._wym._html);if(jQuery.isFunction(this._options.preBind))this._options.preBind(this);jQuery(this._box).find(this._options.toolSelector+'[@name='+WYM_INDENT+']').hide();jQuery(this._box).find(this._options.toolSelector+'[@name='+WYM_OUTDENT+']').hide();this._wym.bindEvents();jQuery(this._doc).bind("keyup",this.keyup);if(jQuery.isFunction(this._options.postInit))this._options.postInit(this);this.listen()};WymClassOpera.prototype._exec=function(cmd,param){switch(cmd){case WYM_INDENT:case WYM_OUTDENT:this.status("Unsupported feature.");break;default:if(param)this._doc.execCommand(cmd,false,param);else this._doc.execCommand(cmd);break}this.listen()};WymClassOpera.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassOpera.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassOpera.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null};WymClassOpera.prototype.setFocusToNode=function(node){};
\ No newline at end of file
Index: openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js 15 Jul 2007 16:07:45 -0000 1.1
+++ openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js 27 Jul 2007 01:15:20 -0000 1.2
@@ -47,7 +47,7 @@
* # =>
* this.tag ('br', false, true)
* # =>
-* this.tag ('input', $j({type:'text',disabled:true }) )
+* this.tag ('input', jQuery({type:'text',disabled:true }) )
* # =>
*/
XmlHelper.prototype.tag = function(name, options, open)
@@ -67,9 +67,9 @@
*
* this.contentTag ('p', 'Hello world!' )
* # => Hello world!
-* this.contentTag('div', this.contentTag('p', "Hello world!"), $j({class : "strong"}))
+* this.contentTag('div', this.contentTag('p', "Hello world!"), jQuery({class : "strong"}))
* # =>
-* this.contentTag("select", options, $j({multiple : true}))
+* this.contentTag("select", options, jQuery({multiple : true}))
* # =>
*/
XmlHelper.prototype.contentTag = function(name, content, options)
@@ -113,7 +113,7 @@
*/
XmlHelper.prototype._fixDoubleEscape = function(escaped)
{
- return escaped.replace(/&([a-z]+|(#\d+));/i, "&$1;");
+ return escaped.replace(/&([a-z]+|(#\d+));/ig, "&$1;");
}
/*
@@ -1399,22 +1399,26 @@
this.mapHandler('Text', 'Text');
- this.addCommentTokens('Text');
- this.addScriptTokens('Text');
- this.addCssTokens('Text');
- this.addTagTokens('Text');
-
+ this.addTokens();
+
this.init();
return this;
}
-
XhtmlLexer.prototype.init = function()
{
}
+XhtmlLexer.prototype.addTokens = function()
+{
+ this.addCommentTokens('Text');
+ this.addScriptTokens('Text');
+ this.addCssTokens('Text');
+ this.addTagTokens('Text');
+}
+
XhtmlLexer.prototype.addCommentTokens = function(scope)
{
this.addEntryPattern("