Upgrade to Xinha 0.931. Xinha has been optimized for size and dozens of issues have been closed

out since the last upgrade . Add Firefox and Xinha buttons to main page to show our support.
This commit is contained in:
Chris Morgan
2007-05-31 22:43:05 +00:00
committed by WineHQ
parent ff46a4485d
commit 2d4b27530d
354 changed files with 19793 additions and 21419 deletions

View File

@@ -1,149 +1,74 @@
// Simple CSS (className) plugin for the editor
// Sponsored by http://www.miro.com.au
// Implementation by Mihai Bazon, http://dynarch.com/mishoo.
//
// (c) dynarch.com 2003
// Distributed under the same terms as HTMLArea itself.
// This notice MUST stay intact for use (see license.txt).
//
// $Id$
// @TODO This is the default and won't be very useful to others.
// We should make this better.
HTMLArea.Config.prototype.cssPluginConfig =
{
combos : [
{ label: "Syntax",
// menu text // CSS class
options: { "None" : "",
"Code" : "code",
"String" : "string",
"Comment" : "comment",
"Variable name" : "variable-name",
"Type" : "type",
"Reference" : "reference",
"Preprocessor" : "preprocessor",
"Keyword" : "keyword",
"Function name" : "function-name",
"Html tag" : "html-tag",
"Html italic" : "html-helper-italic",
"Warning" : "warning",
"Html bold" : "html-helper-bold"
},
context: "pre"
},
{ label: "Info",
options: { "None" : "",
"Quote" : "quote",
"Highlight" : "highlight",
"Deprecated" : "deprecated"
}
}
]
};
function CSS(editor, params) {
this.editor = editor;
var cfg = editor.config;
var self = this;
var plugin_config;
if(params && params.length)
{
plugin_config = params[0];
}
else
{
plugin_config = editor.config.cssPluginConfig;
}
var combos = plugin_config.combos;
for (var i = 0; i < combos.length; i++) {
var combo = combos[i];
var id = "CSS-class" + i;
var css_class = {
id : id,
options : combo.options,
action : function(editor) { self.onSelect(editor, this, combo.context, combo.updatecontextclass); },
refresh : function(editor) { self.updateValue(editor, this); },
context : combo.context
};
cfg.registerDropdown(css_class);
cfg.addToolbarElement(["T[" + combo.label + "]", id, "separator"] , "formatblock", -1);
}
HTMLArea.Config.prototype.cssPluginConfig={combos:[{label:"Syntax",options:{"None":"","Code":"code","String":"string","Comment":"comment","Variable name":"variable-name","Type":"type","Reference":"reference","Preprocessor":"preprocessor","Keyword":"keyword","Function name":"function-name","Html tag":"html-tag","Html italic":"html-helper-italic","Warning":"warning","Html bold":"html-helper-bold"},context:"pre"},{label:"Info",options:{"None":"","Quote":"quote","Highlight":"highlight","Deprecated":"deprecated"}}]};
function CSS(_1,_2){
this.editor=_1;
var _3=_1.config;
var _4=this;
var _5;
if(_2&&_2.length){
_5=_2[0];
}else{
_5=_1.config.cssPluginConfig;
}
var _6=_5.combos;
for(var i=0;i<_6.length;i++){
var _8=_6[i];
var id="CSS-class"+i;
var _a={id:id,options:_8.options,action:function(_b){
_4.onSelect(_b,this,_8.context,_8.updatecontextclass);
},refresh:function(_c){
_4.updateValue(_c,this);
},context:_8.context};
_3.registerDropdown(_a);
_3.addToolbarElement(["T["+_8.label+"]",id,"separator"],"formatblock",-1);
}
}
CSS._pluginInfo={name:"CSS",version:"1.0",developer:"Mihai Bazon",developer_url:"http://dynarch.com/mishoo/",c_owner:"Mihai Bazon",sponsor:"Miro International",sponsor_url:"http://www.miro.com.au",license:"htmlArea"};
CSS.prototype.onSelect=function(_d,_e,_f,_10){
var _11=_d._toolbarObjects[_e.id];
var _12=_11.element.selectedIndex;
var _13=_11.element.value;
var _14=_d.getParentElement();
var _15=true;
var _16=(_14&&_14.tagName.toLowerCase()=="span");
var _17=(_f&&_10&&_14&&_14.tagName.toLowerCase()==_f);
if(_17){
_14.className=_13;
_d.updateToolbar();
return;
}
if(_16&&_12==0&&!/\S/.test(_14.style.cssText)){
while(_14.firstChild){
_14.parentNode.insertBefore(_14.firstChild,_14);
}
_14.parentNode.removeChild(_14);
_d.updateToolbar();
return;
}
if(_16){
if(_14.childNodes.length==1){
_14.className=_13;
_15=false;
_d.updateToolbar();
}
}
if(_15){
_d.surroundHTML("<span class='"+_13+"'>","</span>");
}
CSS._pluginInfo = {
name : "CSS",
version : "1.0",
developer : "Mihai Bazon",
developer_url : "http://dynarch.com/mishoo/",
c_owner : "Mihai Bazon",
sponsor : "Miro International",
sponsor_url : "http://www.miro.com.au",
license : "htmlArea"
};
CSS.prototype.onSelect = function(editor, obj, context, updatecontextclass) {
var tbobj = editor._toolbarObjects[obj.id];
var index = tbobj.element.selectedIndex;
var className = tbobj.element.value;
// retrieve parent element of the selection
var parent = editor.getParentElement();
var surround = true;
var is_span = (parent && parent.tagName.toLowerCase() == "span");
var update_parent = (context && updatecontextclass && parent && parent.tagName.toLowerCase() == context);
if (update_parent) {
parent.className = className;
editor.updateToolbar();
return;
}
if (is_span && index == 0 && !/\S/.test(parent.style.cssText)) {
while (parent.firstChild) {
parent.parentNode.insertBefore(parent.firstChild, parent);
}
parent.parentNode.removeChild(parent);
editor.updateToolbar();
return;
}
if (is_span) {
// maybe we could simply change the class of the parent node?
if (parent.childNodes.length == 1) {
parent.className = className;
surround = false;
// in this case we should handle the toolbar updation
// ourselves.
editor.updateToolbar();
}
}
// Other possibilities could be checked but require a lot of code. We
// can't afford to do that now.
if (surround) {
// shit happens ;-) most of the time. this method works, but
// it's dangerous when selection spans multiple block-level
// elements.
editor.surroundHTML("<span class='" + className + "'>", "</span>");
}
CSS.prototype.updateValue=function(_18,obj){
var _1a=_18._toolbarObjects[obj.id].element;
var _1b=_18.getParentElement();
if(typeof _1b.className!="undefined"&&/\S/.test(_1b.className)){
var _1c=_1a.options;
var _1d=_1b.className;
for(var i=_1c.length;--i>=0;){
var _1f=_1c[i];
if(_1d==_1f.value){
_1a.selectedIndex=i;
return;
}
}
}
_1a.selectedIndex=0;
};
CSS.prototype.updateValue = function(editor, obj) {
var select = editor._toolbarObjects[obj.id].element;
var parent = editor.getParentElement();
if (typeof parent.className != "undefined" && /\S/.test(parent.className)) {
var options = select.options;
var value = parent.className;
for (var i = options.length; --i >= 0;) {
var option = options[i];
if (value == option.value) {
select.selectedIndex = i;
return;
}
}
}
select.selectedIndex = 0;
};