Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / editor / plugins / InsertEntity.js

History | View | Annotate | Download (2.18 KB)

1 9 andrej.cim
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6
7
8
if(!dojo._hasResource["dojox.editor.plugins.InsertEntity"]){
9
dojo._hasResource["dojox.editor.plugins.InsertEntity"]=true;
10
dojo.provide("dojox.editor.plugins.InsertEntity");
11
dojo.require("dijit._editor._Plugin");
12
dojo.require("dijit.form.Button");
13
dojo.require("dijit.TooltipDialog");
14
dojo.require("dojox.editor.plugins.EntityPalette");
15
dojo.require("dojox.html.entities");
16
dojo.require("dojo.i18n");
17
dojo.requireLocalization("dojox.editor.plugins","InsertEntity",null,"ROOT,cs,de,es,fr,hu,it,ja,ko,pl,pt,ro,ru,zh,zh-tw");
18
dojo.declare("dojox.editor.plugins.InsertEntity",dijit._editor._Plugin,{iconClassPrefix:"dijitAdditionalEditorIcon",_initButton:function(){
19
this.dropDown=new dojox.editor.plugins.EntityPalette({showCode:this.showCode,showEntityName:this.showEntityName});
20
this.connect(this.dropDown,"onChange",function(_1){
21
this.button.closeDropDown();
22
this.editor.focus();
23
this.editor.execCommand("inserthtml",_1);
24
});
25
var _2=dojo.i18n.getLocalization("dojox.editor.plugins","InsertEntity");
26
this.button=new dijit.form.DropDownButton({label:_2["insertEntity"],showLabel:false,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"InsertEntity",tabIndex:"-1",dropDown:this.dropDown});
27
},setEditor:function(_3){
28
this.editor=_3;
29
this._initButton();
30
this.editor.addKeyHandler("s",true,true,dojo.hitch(this,function(){
31
this.button.openDropDown();
32
this.dropDown.focus();
33
}));
34
_3.contentPreFilters.push(this._preFilterEntities);
35
_3.contentPostFilters.push(this._postFilterEntities);
36
},_preFilterEntities:function(s){
37
return dojox.html.entities.decode(s,dojox.html.entities.latin);
38
},_postFilterEntities:function(s){
39
return dojox.html.entities.encode(s,dojox.html.entities.latin);
40
}});
41
dojo.subscribe(dijit._scopeName+".Editor.getPlugin",null,function(o){
42
if(o.plugin){
43
return;
44
}
45
var _4=o.args.name?o.args.name.toLowerCase():"";
46
if(_4==="insertentity"){
47
o.plugin=new dojox.editor.plugins.InsertEntity({showCode:("showCode" in o.args)?o.args.showCode:false,showEntityName:("showEntityName" in o.args)?o.args.showEntityName:false});
48
}
49
});
50
}