root / trunk / web / dojo / dijit / _editor / plugins / NewPage.js
History | View | Annotate | Download (1.44 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["dijit._editor.plugins.NewPage"]){ |
||
9 | dojo._hasResource["dijit._editor.plugins.NewPage"]=true; |
||
10 | dojo.provide("dijit._editor.plugins.NewPage");
|
||
11 | dojo.require("dijit._editor._Plugin");
|
||
12 | dojo.require("dijit.form.Button");
|
||
13 | dojo.require("dojo.i18n");
|
||
14 | dojo.requireLocalization("dijit._editor","commands",null,"ROOT,ar,ca,cs,da,de,el,es,fi,fr,he,hu,it,ja,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw"); |
||
15 | dojo.declare("dijit._editor.plugins.NewPage",dijit._editor._Plugin,{content:"<br>",_initButton:function(){ |
||
16 | var _1=dojo.i18n.getLocalization("dijit._editor","commands"),_2=this.editor; |
||
17 | this.button=new dijit.form.Button({label:_1["newPage"],dir:_2.dir,lang:_2.lang,showLabel:false,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"NewPage",tabIndex:"-1",onClick:dojo.hitch(this,"_newPage")}); |
||
18 | },setEditor:function(_3){ |
||
19 | this.editor=_3;
|
||
20 | this._initButton();
|
||
21 | },_newPage:function(){ |
||
22 | this.editor.beginEditing();
|
||
23 | this.editor.set("value",this.content); |
||
24 | this.editor.endEditing();
|
||
25 | this.editor.focus();
|
||
26 | }}); |
||
27 | dojo.subscribe(dijit._scopeName+".Editor.getPlugin",null,function(o){ |
||
28 | if(o.plugin){
|
||
29 | return;
|
||
30 | } |
||
31 | var _4=o.args.name.toLowerCase();
|
||
32 | if(_4==="newpage"){ |
||
33 | o.plugin=new dijit._editor.plugins.NewPage({content:("content" in o.args)?o.args.content:"<br>"}); |
||
34 | } |
||
35 | }); |
||
36 | } |