]>
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 // dijit/_editor/plugins/NewPage
14 var NewPage
= declare("dijit._editor.plugins.NewPage",_Plugin
,{
16 // This plugin provides a simple 'new page' capability. In other
17 // words, set content to some default user defined string.
19 // content: [public] String
20 // The default content to insert into the editor as the new page.
21 // The default is the `<br>` tag, a single blank line.
24 _initButton: function(){
26 // Over-ride for creation of the Print button.
27 var strings
= i18n
.getLocalization("dijit._editor", "commands"),
29 this.button
= new Button({
30 label
: strings
["newPage"],
31 ownerDocument
: editor
.ownerDocument
,
35 iconClass
: this.iconClassPrefix
+ " " + this.iconClassPrefix
+ "NewPage",
37 onClick
: lang
.hitch(this, "_newPage")
41 setEditor: function(/*dijit/Editor*/ editor){
43 // Tell the plugin which Editor it is associated with.
45 // The editor object to attach the newPage capability to.
50 updateState: function(){
52 // Over-ride for button state control for disabled to work.
53 this.button.set("disabled", this.get("disabled"));
58 // Function to set the content to blank.
61 this.editor.beginEditing();
62 this.editor.set("value", this.content);
63 this.editor.endEditing();
68 // Register this plugin.
69 // For back-compat accept "newpage" (all lowercase) too, remove in 2.0
70 _Plugin.registry["newPage"] = _Plugin.registry["newpage"] = function(args){
72 content: ("content" in args)?args.content:"<br>"