]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/_editor/plugins/NewPage.js.uncompressed.js
1 define("dijit/_editor/plugins/NewPage", [
2 "dojo/_base/declare", // declare
3 "dojo/i18n", // i18n.getLocalization
4 "dojo/_base/lang", // lang.hitch
7 "dojo/i18n!../nls/commands"
8 ], function(declare
, i18n
, lang
, _Plugin
, Button
){
11 var _Plugin = dijit._editor._Plugin;
15 // dijit/_editor/plugins/NewPage
17 // This plugin provides a simple 'new page' capability. In other
18 // words, set content to some default user defined string.
21 var NewPage
= declare("dijit._editor.plugins.NewPage",_Plugin
,{
23 // This plugin provides a simple 'new page' capability. In other
24 // words, set content to some default user defined string.
26 // content: [public] String
27 // The default content to insert into the editor as the new page.
28 // The default is the <br> tag, a single blank line.
31 _initButton: function(){
33 // Over-ride for creation of the Print button.
34 var strings
= i18n
.getLocalization("dijit._editor", "commands"),
36 this.button
= new Button({
37 label
: strings
["newPage"],
41 iconClass
: this.iconClassPrefix
+ " " + this.iconClassPrefix
+ "NewPage",
43 onClick
: lang
.hitch(this, "_newPage")
47 setEditor: function(/*dijit.Editor*/ editor
){
49 // Tell the plugin which Editor it is associated with.
51 // The editor object to attach the newPage capability to.
56 updateState: function(){
58 // Over-ride for button state control for disabled to work.
59 this.button
.set("disabled", this.get("disabled"));
64 // Function to set the content to blank.
67 this.editor
.beginEditing();
68 this.editor
.set("value", this.content
);
69 this.editor
.endEditing();
74 // Register this plugin.
75 // For back-compat accept "newpage" (all lowercase) too, remove in 2.0
76 _Plugin
.registry
["newPage"] = _Plugin
.registry
["newpage"] = function(args
){
78 content
: ("content" in args
)?args
.content
:"<br>"