Editor2Toolbar.js
上传用户:kimgenplus
上传日期:2016-06-05
资源大小:20877k
文件大小:29k
源码类别:

OA系统

开发平台:

Java

  1. /*
  2. Copyright (c) 2004-2006, The Dojo Foundation
  3. All Rights Reserved.
  4. Licensed under the Academic Free License version 2.1 or above OR the
  5. modified BSD license. For more information on Dojo licensing, see:
  6. http://dojotoolkit.org/community/licensing.shtml
  7. */
  8. dojo.provide("dojo.widget.Editor2Toolbar");
  9. dojo.require("dojo.lang.*");
  10. dojo.require("dojo.widget.*");
  11. dojo.require("dojo.event.*");
  12. dojo.require("dojo.html.layout");
  13. dojo.require("dojo.html.display");
  14. dojo.require("dojo.widget.RichText");
  15. dojo.require("dojo.widget.PopupContainer");
  16. dojo.require("dojo.widget.ColorPalette");
  17. dojo.lang.declare("dojo.widget.HandlerManager", null, function () {
  18. this._registeredHandlers = [];
  19. }, {registerHandler:function (obj, func) {
  20. if (arguments.length == 2) {
  21. this._registeredHandlers.push(function () {
  22. return obj[func].apply(obj, arguments);
  23. });
  24. } else {
  25. this._registeredHandlers.push(obj);
  26. }
  27. }, removeHandler:function (func) {
  28. for (var i = 0; i < this._registeredHandlers.length; i++) {
  29. if (func === this._registeredHandlers[i]) {
  30. delete this._registeredHandlers[i];
  31. return;
  32. }
  33. }
  34. dojo.debug("HandlerManager handler " + func + " is not registered, can not remove.");
  35. }, destroy:function () {
  36. for (var i = 0; i < this._registeredHandlers.length; i++) {
  37. delete this._registeredHandlers[i];
  38. }
  39. }});
  40. dojo.widget.Editor2ToolbarItemManager = new dojo.widget.HandlerManager;
  41. dojo.lang.mixin(dojo.widget.Editor2ToolbarItemManager, {getToolbarItem:function (name) {
  42. var item;
  43. name = name.toLowerCase();
  44. for (var i = 0; i < this._registeredHandlers.length; i++) {
  45. item = this._registeredHandlers[i](name);
  46. if (item) {
  47. return item;
  48. }
  49. }
  50. switch (name) {
  51.   case "bold":
  52.   case "copy":
  53.   case "cut":
  54.   case "delete":
  55.   case "indent":
  56.   case "inserthorizontalrule":
  57.   case "insertorderedlist":
  58.   case "insertunorderedlist":
  59.   case "italic":
  60.   case "justifycenter":
  61.   case "justifyfull":
  62.   case "justifyleft":
  63.   case "justifyright":
  64.   case "outdent":
  65.   case "paste":
  66.   case "redo":
  67.   case "removeformat":
  68.   case "selectall":
  69.   case "strikethrough":
  70.   case "subscript":
  71.   case "superscript":
  72.   case "underline":
  73.   case "undo":
  74.   case "unlink":
  75.   case "createlink":
  76.   case "insertimage":
  77.   case "htmltoggle":
  78. item = new dojo.widget.Editor2ToolbarButton(name);
  79. break;
  80.   case "forecolor":
  81.   case "hilitecolor":
  82. item = new dojo.widget.Editor2ToolbarColorPaletteButton(name);
  83. break;
  84.   case "plainformatblock":
  85. item = new dojo.widget.Editor2ToolbarFormatBlockPlainSelect("formatblock");
  86. break;
  87.   case "formatblock":
  88. item = new dojo.widget.Editor2ToolbarFormatBlockSelect("formatblock");
  89. break;
  90.   case "fontsize":
  91. item = new dojo.widget.Editor2ToolbarFontSizeSelect("fontsize");
  92. break;
  93.   case "fontname":
  94. item = new dojo.widget.Editor2ToolbarFontNameSelect("fontname");
  95. break;
  96.   case "inserttable":
  97.   case "insertcell":
  98.   case "insertcol":
  99.   case "insertrow":
  100.   case "deletecells":
  101.   case "deletecols":
  102.   case "deleterows":
  103.   case "mergecells":
  104.   case "splitcell":
  105. dojo.debug(name + " is implemented in dojo.widget.Editor2Plugin.TableOperation, please require it first.");
  106. break;
  107.   case "inserthtml":
  108.   case "blockdirltr":
  109.   case "blockdirrtl":
  110.   case "dirltr":
  111.   case "dirrtl":
  112.   case "inlinedirltr":
  113.   case "inlinedirrtl":
  114. dojo.debug("Not yet implemented toolbar item: " + name);
  115. break;
  116.   default:
  117. dojo.debug("dojo.widget.Editor2ToolbarItemManager.getToolbarItem: Unknown toolbar item: " + name);
  118. }
  119. return item;
  120. }});
  121. dojo.addOnUnload(dojo.widget.Editor2ToolbarItemManager, "destroy");
  122. dojo.declare("dojo.widget.Editor2ToolbarButton", null, function (name) {
  123. this._name = name;
  124. }, {create:function (node, toolbar, nohover) {
  125. this._domNode = node;
  126. var cmd = toolbar.parent.getCommand(this._name);
  127. if (cmd) {
  128. this._domNode.title = cmd.getText();
  129. }
  130. this.disableSelection(this._domNode);
  131. this._parentToolbar = toolbar;
  132. dojo.event.connect(this._domNode, "onclick", this, "onClick");
  133. if (!nohover) {
  134. dojo.event.connect(this._domNode, "onmouseover", this, "onMouseOver");
  135. dojo.event.connect(this._domNode, "onmouseout", this, "onMouseOut");
  136. }
  137. }, disableSelection:function (rootnode) {
  138. dojo.html.disableSelection(rootnode);
  139. var nodes = rootnode.all || rootnode.getElementsByTagName("*");
  140. for (var x = 0; x < nodes.length; x++) {
  141. dojo.html.disableSelection(nodes[x]);
  142. }
  143. }, onMouseOver:function () {
  144. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  145. if (curInst) {
  146. var _command = curInst.getCommand(this._name);
  147. if (_command && _command.getState() != dojo.widget.Editor2Manager.commandState.Disabled) {
  148. this.highlightToolbarItem();
  149. }
  150. }
  151. }, onMouseOut:function () {
  152. this.unhighlightToolbarItem();
  153. }, destroy:function () {
  154. this._domNode = null;
  155. this._parentToolbar = null;
  156. }, onClick:function (e) {
  157. if (this._domNode && !this._domNode.disabled && this._parentToolbar.checkAvailability()) {
  158. e.preventDefault();
  159. e.stopPropagation();
  160. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  161. if (curInst) {
  162. var _command = curInst.getCommand(this._name);
  163. if (_command) {
  164. _command.execute();
  165. }
  166. }
  167. }
  168. }, refreshState:function () {
  169. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  170. var em = dojo.widget.Editor2Manager;
  171. if (curInst) {
  172. var _command = curInst.getCommand(this._name);
  173. if (_command) {
  174. var state = _command.getState();
  175. if (state != this._lastState) {
  176. switch (state) {
  177.   case em.commandState.Latched:
  178. this.latchToolbarItem();
  179. break;
  180.   case em.commandState.Enabled:
  181. this.enableToolbarItem();
  182. break;
  183.   case em.commandState.Disabled:
  184.   default:
  185. this.disableToolbarItem();
  186. }
  187. this._lastState = state;
  188. }
  189. }
  190. }
  191. return em.commandState.Enabled;
  192. }, latchToolbarItem:function () {
  193. this._domNode.disabled = false;
  194. this.removeToolbarItemStyle(this._domNode);
  195. dojo.html.addClass(this._domNode, this._parentToolbar.ToolbarLatchedItemStyle);
  196. }, enableToolbarItem:function () {
  197. this._domNode.disabled = false;
  198. this.removeToolbarItemStyle(this._domNode);
  199. dojo.html.addClass(this._domNode, this._parentToolbar.ToolbarEnabledItemStyle);
  200. }, disableToolbarItem:function () {
  201. this._domNode.disabled = true;
  202. this.removeToolbarItemStyle(this._domNode);
  203. dojo.html.addClass(this._domNode, this._parentToolbar.ToolbarDisabledItemStyle);
  204. }, highlightToolbarItem:function () {
  205. dojo.html.addClass(this._domNode, this._parentToolbar.ToolbarHighlightedItemStyle);
  206. }, unhighlightToolbarItem:function () {
  207. dojo.html.removeClass(this._domNode, this._parentToolbar.ToolbarHighlightedItemStyle);
  208. }, removeToolbarItemStyle:function () {
  209. dojo.html.removeClass(this._domNode, this._parentToolbar.ToolbarEnabledItemStyle);
  210. dojo.html.removeClass(this._domNode, this._parentToolbar.ToolbarLatchedItemStyle);
  211. dojo.html.removeClass(this._domNode, this._parentToolbar.ToolbarDisabledItemStyle);
  212. this.unhighlightToolbarItem();
  213. }});
  214. dojo.declare("dojo.widget.Editor2ToolbarDropDownButton", dojo.widget.Editor2ToolbarButton, {onClick:function () {
  215. if (this._domNode && !this._domNode.disabled && this._parentToolbar.checkAvailability()) {
  216. if (!this._dropdown) {
  217. this._dropdown = dojo.widget.createWidget("PopupContainer", {});
  218. this._domNode.appendChild(this._dropdown.domNode);
  219. }
  220. if (this._dropdown.isShowingNow) {
  221. this._dropdown.close();
  222. } else {
  223. this.onDropDownShown();
  224. this._dropdown.open(this._domNode, null, this._domNode);
  225. }
  226. }
  227. }, destroy:function () {
  228. this.onDropDownDestroy();
  229. if (this._dropdown) {
  230. this._dropdown.destroy();
  231. }
  232. dojo.widget.Editor2ToolbarDropDownButton.superclass.destroy.call(this);
  233. }, onDropDownShown:function () {
  234. }, onDropDownDestroy:function () {
  235. }});
  236. dojo.declare("dojo.widget.Editor2ToolbarColorPaletteButton", dojo.widget.Editor2ToolbarDropDownButton, {onDropDownShown:function () {
  237. if (!this._colorpalette) {
  238. this._colorpalette = dojo.widget.createWidget("ColorPalette", {});
  239. this._dropdown.addChild(this._colorpalette);
  240. this.disableSelection(this._dropdown.domNode);
  241. this.disableSelection(this._colorpalette.domNode);
  242. dojo.event.connect(this._colorpalette, "onColorSelect", this, "setColor");
  243. dojo.event.connect(this._dropdown, "open", this, "latchToolbarItem");
  244. dojo.event.connect(this._dropdown, "close", this, "enableToolbarItem");
  245. }
  246. }, setColor:function (color) {
  247. this._dropdown.close();
  248. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  249. if (curInst) {
  250. var _command = curInst.getCommand(this._name);
  251. if (_command) {
  252. _command.execute(color);
  253. }
  254. }
  255. }});
  256. dojo.declare("dojo.widget.Editor2ToolbarFormatBlockPlainSelect", dojo.widget.Editor2ToolbarButton, {create:function (node, toolbar) {
  257. this._domNode = node;
  258. this._parentToolbar = toolbar;
  259. this._domNode = node;
  260. this.disableSelection(this._domNode);
  261. dojo.event.connect(this._domNode, "onchange", this, "onChange");
  262. }, destroy:function () {
  263. this._domNode = null;
  264. }, onChange:function () {
  265. if (this._parentToolbar.checkAvailability()) {
  266. var sv = this._domNode.value.toLowerCase();
  267. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  268. if (curInst) {
  269. var _command = curInst.getCommand(this._name);
  270. if (_command) {
  271. _command.execute(sv);
  272. }
  273. }
  274. }
  275. }, refreshState:function () {
  276. if (this._domNode) {
  277. dojo.widget.Editor2ToolbarFormatBlockPlainSelect.superclass.refreshState.call(this);
  278. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  279. if (curInst) {
  280. var _command = curInst.getCommand(this._name);
  281. if (_command) {
  282. var format = _command.getValue();
  283. if (!format) {
  284. format = "";
  285. }
  286. dojo.lang.forEach(this._domNode.options, function (item) {
  287. if (item.value.toLowerCase() == format.toLowerCase()) {
  288. item.selected = true;
  289. }
  290. });
  291. }
  292. }
  293. }
  294. }});
  295. dojo.declare("dojo.widget.Editor2ToolbarComboItem", dojo.widget.Editor2ToolbarDropDownButton, {href:null, create:function (node, toolbar) {
  296. dojo.widget.Editor2ToolbarComboItem.superclass.create.apply(this, arguments);
  297. if (!this._contentPane) {
  298. dojo.require("dojo.widget.ContentPane");
  299. this._contentPane = dojo.widget.createWidget("ContentPane", {preload:"true"});
  300. this._contentPane.addOnLoad(this, "setup");
  301. this._contentPane.setUrl(this.href);
  302. }
  303. }, onMouseOver:function (e) {
  304. if (this._lastState != dojo.widget.Editor2Manager.commandState.Disabled) {
  305. dojo.html.addClass(e.currentTarget, this._parentToolbar.ToolbarHighlightedSelectStyle);
  306. }
  307. }, onMouseOut:function (e) {
  308. dojo.html.removeClass(e.currentTarget, this._parentToolbar.ToolbarHighlightedSelectStyle);
  309. }, onDropDownShown:function () {
  310. if (!this._dropdown.__addedContentPage) {
  311. this._dropdown.addChild(this._contentPane);
  312. this._dropdown.__addedContentPage = true;
  313. }
  314. }, setup:function () {
  315. }, onChange:function (e) {
  316. if (this._parentToolbar.checkAvailability()) {
  317. var name = e.currentTarget.getAttribute("dropDownItemName");
  318. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  319. if (curInst) {
  320. var _command = curInst.getCommand(this._name);
  321. if (_command) {
  322. _command.execute(name);
  323. }
  324. }
  325. }
  326. this._dropdown.close();
  327. }, onMouseOverItem:function (e) {
  328. dojo.html.addClass(e.currentTarget, this._parentToolbar.ToolbarHighlightedSelectItemStyle);
  329. }, onMouseOutItem:function (e) {
  330. dojo.html.removeClass(e.currentTarget, this._parentToolbar.ToolbarHighlightedSelectItemStyle);
  331. }});
  332. dojo.declare("dojo.widget.Editor2ToolbarFormatBlockSelect", dojo.widget.Editor2ToolbarComboItem, {href:dojo.uri.moduleUri("dojo.widget", "templates/Editor2/EditorToolbar_FormatBlock.html"), setup:function () {
  333. dojo.widget.Editor2ToolbarFormatBlockSelect.superclass.setup.call(this);
  334. var nodes = this._contentPane.domNode.all || this._contentPane.domNode.getElementsByTagName("*");
  335. this._blockNames = {};
  336. this._blockDisplayNames = {};
  337. for (var x = 0; x < nodes.length; x++) {
  338. var node = nodes[x];
  339. dojo.html.disableSelection(node);
  340. var name = node.getAttribute("dropDownItemName");
  341. if (name) {
  342. this._blockNames[name] = node;
  343. var childrennodes = node.getElementsByTagName(name);
  344. this._blockDisplayNames[name] = childrennodes[childrennodes.length - 1].innerHTML;
  345. }
  346. }
  347. for (var name in this._blockNames) {
  348. dojo.event.connect(this._blockNames[name], "onclick", this, "onChange");
  349. dojo.event.connect(this._blockNames[name], "onmouseover", this, "onMouseOverItem");
  350. dojo.event.connect(this._blockNames[name], "onmouseout", this, "onMouseOutItem");
  351. }
  352. }, onDropDownDestroy:function () {
  353. if (this._blockNames) {
  354. for (var name in this._blockNames) {
  355. delete this._blockNames[name];
  356. delete this._blockDisplayNames[name];
  357. }
  358. }
  359. }, refreshState:function () {
  360. dojo.widget.Editor2ToolbarFormatBlockSelect.superclass.refreshState.call(this);
  361. if (this._lastState != dojo.widget.Editor2Manager.commandState.Disabled) {
  362. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  363. if (curInst) {
  364. var _command = curInst.getCommand(this._name);
  365. if (_command) {
  366. var format = _command.getValue();
  367. if (format == this._lastSelectedFormat && this._blockDisplayNames) {
  368. return this._lastState;
  369. }
  370. this._lastSelectedFormat = format;
  371. var label = this._domNode.getElementsByTagName("label")[0];
  372. var isSet = false;
  373. if (this._blockDisplayNames) {
  374. for (var name in this._blockDisplayNames) {
  375. if (name == format) {
  376. label.innerHTML = this._blockDisplayNames[name];
  377. isSet = true;
  378. break;
  379. }
  380. }
  381. if (!isSet) {
  382. label.innerHTML = "&nbsp;";
  383. }
  384. }
  385. }
  386. }
  387. }
  388. return this._lastState;
  389. }});
  390. dojo.declare("dojo.widget.Editor2ToolbarFontSizeSelect", dojo.widget.Editor2ToolbarComboItem, {href:dojo.uri.moduleUri("dojo.widget", "templates/Editor2/EditorToolbar_FontSize.html"), setup:function () {
  391. dojo.widget.Editor2ToolbarFormatBlockSelect.superclass.setup.call(this);
  392. var nodes = this._contentPane.domNode.all || this._contentPane.domNode.getElementsByTagName("*");
  393. this._fontsizes = {};
  394. this._fontSizeDisplayNames = {};
  395. for (var x = 0; x < nodes.length; x++) {
  396. var node = nodes[x];
  397. dojo.html.disableSelection(node);
  398. var name = node.getAttribute("dropDownItemName");
  399. if (name) {
  400. this._fontsizes[name] = node;
  401. this._fontSizeDisplayNames[name] = node.getElementsByTagName("font")[0].innerHTML;
  402. }
  403. }
  404. for (var name in this._fontsizes) {
  405. dojo.event.connect(this._fontsizes[name], "onclick", this, "onChange");
  406. dojo.event.connect(this._fontsizes[name], "onmouseover", this, "onMouseOverItem");
  407. dojo.event.connect(this._fontsizes[name], "onmouseout", this, "onMouseOutItem");
  408. }
  409. }, onDropDownDestroy:function () {
  410. if (this._fontsizes) {
  411. for (var name in this._fontsizes) {
  412. delete this._fontsizes[name];
  413. delete this._fontSizeDisplayNames[name];
  414. }
  415. }
  416. }, refreshState:function () {
  417. dojo.widget.Editor2ToolbarFormatBlockSelect.superclass.refreshState.call(this);
  418. if (this._lastState != dojo.widget.Editor2Manager.commandState.Disabled) {
  419. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  420. if (curInst) {
  421. var _command = curInst.getCommand(this._name);
  422. if (_command) {
  423. var size = _command.getValue();
  424. if (size == this._lastSelectedSize && this._fontSizeDisplayNames) {
  425. return this._lastState;
  426. }
  427. this._lastSelectedSize = size;
  428. var label = this._domNode.getElementsByTagName("label")[0];
  429. var isSet = false;
  430. if (this._fontSizeDisplayNames) {
  431. for (var name in this._fontSizeDisplayNames) {
  432. if (name == size) {
  433. label.innerHTML = this._fontSizeDisplayNames[name];
  434. isSet = true;
  435. break;
  436. }
  437. }
  438. if (!isSet) {
  439. label.innerHTML = "&nbsp;";
  440. }
  441. }
  442. }
  443. }
  444. }
  445. return this._lastState;
  446. }});
  447. dojo.declare("dojo.widget.Editor2ToolbarFontNameSelect", dojo.widget.Editor2ToolbarFontSizeSelect, {href:dojo.uri.moduleUri("dojo.widget", "templates/Editor2/EditorToolbar_FontName.html")});
  448. dojo.widget.defineWidget("dojo.widget.Editor2Toolbar", dojo.widget.HtmlWidget, function () {
  449. dojo.event.connect(this, "fillInTemplate", dojo.lang.hitch(this, function () {
  450. if (dojo.render.html.ie) {
  451. this.domNode.style.zoom = 1;
  452. }
  453. }));
  454. }, {templateString:"<div dojoAttachPoint="domNode" class="EditorToolbarDomNode" unselectable="on">nt<table cellpadding="3" cellspacing="0" border="0">ntt<!--ntttour toolbar should look something like:nnttt+=======+=======+=======+=============================================+nttt| w   w | style | copy  | bo | it | un | le | ce | ri |nttt| w w w | style |=======|==============|==============|nttt|  w w  | style | paste |  undo | redo | change style |nttt+=======+=======+=======+=============================================+ntt-->ntt<tbody>nttt<tr valign="top">ntttt<td rowspan="2">nttttt<div class="bigIcon" dojoAttachPoint="wikiWordButton"nttttttdojoOnClick="wikiWordClick; buttonClick;">ntttttt<span style="font-size: 30px; margin-left: 5px;">ntttttttWntttttt</span>nttttt</div>ntttt</td>ntttt<td rowspan="2">nttttt<div class="bigIcon" dojoAttachPoint="styleDropdownButton"nttttttdojoOnClick="styleDropdownClick; buttonClick;">ntttttt<span unselectable="on"ntttttttstyle="font-size: 30px; margin-left: 5px;">ntttttttSntttttt</span>nttttt</div>nttttt<div class="StyleDropdownContainer" style="display: none;"nttttttdojoAttachPoint="styleDropdownContainer">ntttttt<table cellpadding="0" cellspacing="0" border="0"ntttttttheight="100%" width="100%">nttttttt<tr valign="top">ntttttttt<td rowspan="2">nttttttttt<div style="height: 245px; overflow: auto;">ntttttttttt<div class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="normalTextClick">normal</div>ntttttttttt<h1 class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="h1TextClick">Heading 1</h1>ntttttttttt<h2 class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="h2TextClick">Heading 2</h2>ntttttttttt<h3 class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="h3TextClick">Heading 3</h3>ntttttttttt<h4 class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="h4TextClick">Heading 4</h4>ntttttttttt<div class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="blahTextClick">blah</div>ntttttttttt<div class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="blahTextClick">blah</div>ntttttttttt<div class="headingContainer"ntttttttttttunselectable="on"ntttttttttttdojoOnClick="blahTextClick">blah</div>ntttttttttt<div class="headingContainer">blah</div>ntttttttttt<div class="headingContainer">blah</div>ntttttttttt<div class="headingContainer">blah</div>ntttttttttt<div class="headingContainer">blah</div>nttttttttt</div>ntttttttt</td>ntttttttt<!--ntttttttt<td>nttttttttt<span class="iconContainer" dojoOnClick="buttonClick;">ntttttttttt<span class="icon justifyleft" ntttttttttttstyle="float: left;">&nbsp;</span>nttttttttt</span>nttttttttt<span class="iconContainer" dojoOnClick="buttonClick;">ntttttttttt<span class="icon justifycenter" ntttttttttttstyle="float: left;">&nbsp;</span>nttttttttt</span>nttttttttt<span class="iconContainer" dojoOnClick="buttonClick;">ntttttttttt<span class="icon justifyright" ntttttttttttstyle="float: left;">&nbsp;</span>nttttttttt</span>nttttttttt<span class="iconContainer" dojoOnClick="buttonClick;">ntttttttttt<span class="icon justifyfull" ntttttttttttstyle="float: left;">&nbsp;</span>nttttttttt</span>ntttttttt</td>ntttttttt-->nttttttt</tr>nttttttt<tr valign="top">ntttttttt<td>ntttttttttthudntttttttt</td>nttttttt</tr>ntttttt</table>nttttt</div>ntttt</td>ntttt<td>nttttt<!-- copy -->nttttt<span class="iconContainer" dojoAttachPoint="copyButton"nttttttunselectable="on"nttttttdojoOnClick="copyClick; buttonClick;">ntttttt<span class="icon copy" ntttttttunselectable="on"ntttttttstyle="float: left;">&nbsp;</span> copynttttt</span>nttttt<!-- "droppable" options -->nttttt<span class="iconContainer" dojoAttachPoint="boldButton"nttttttunselectable="on"nttttttdojoOnClick="boldClick; buttonClick;">ntttttt<span class="icon bold" unselectable="on">&nbsp;</span>nttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="italicButton"nttttttdojoOnClick="italicClick; buttonClick;">ntttttt<span class="icon italic" unselectable="on">&nbsp;</span>nttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="underlineButton"nttttttdojoOnClick="underlineClick; buttonClick;">ntttttt<span class="icon underline" unselectable="on">&nbsp;</span>nttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="leftButton"nttttttdojoOnClick="leftClick; buttonClick;">ntttttt<span class="icon justifyleft" unselectable="on">&nbsp;</span>nttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="fullButton"nttttttdojoOnClick="fullClick; buttonClick;">ntttttt<span class="icon justifyfull" unselectable="on">&nbsp;</span>nttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="rightButton"nttttttdojoOnClick="rightClick; buttonClick;">ntttttt<span class="icon justifyright" unselectable="on">&nbsp;</span>nttttt</span>ntttt</td>nttt</tr>nttt<tr>ntttt<td>nttttt<!-- paste -->nttttt<span class="iconContainer" dojoAttachPoint="pasteButton"nttttttdojoOnClick="pasteClick; buttonClick;" unselectable="on">ntttttt<span class="icon paste" style="float: left;" unselectable="on">&nbsp;</span> pastenttttt</span>nttttt<!-- "droppable" options -->nttttt<span class="iconContainer" dojoAttachPoint="undoButton"nttttttdojoOnClick="undoClick; buttonClick;" unselectable="on">ntttttt<span class="icon undo" style="float: left;" unselectable="on">&nbsp;</span> undonttttt</span>nttttt<span class="iconContainer" dojoAttachPoint="redoButton"nttttttdojoOnClick="redoClick; buttonClick;" unselectable="on">ntttttt<span class="icon redo" style="float: left;" unselectable="on">&nbsp;</span> redonttttt</span>ntttt</td>tnttt</tr>ntt</tbody>nt</table>n</div>n", templateCssString:".StyleDropdownContainer {ntposition: absolute;ntz-index: 1000;ntoverflow: auto;ntcursor: default;ntwidth: 250px;ntheight: 250px;ntbackground-color: white;ntborder: 1px solid black;n}nn.ColorDropdownContainer {ntposition: absolute;ntz-index: 1000;ntoverflow: auto;ntcursor: default;ntwidth: 250px;ntheight: 150px;ntbackground-color: white;ntborder: 1px solid black;n}nn.EditorToolbarDomNode {ntbackground-image: url(buttons/bg-fade.png);ntbackground-repeat: repeat-x;ntbackground-position: 0px -50px;n}nn.EditorToolbarSmallBg {ntbackground-image: url(images/toolbar-bg.gif);ntbackground-repeat: repeat-x;ntbackground-position: 0px 0px;n}nn/*nbody {ntbackground:url(images/blank.gif) fixed;n}*/nn.IEFixedToolbar {ntposition:absolute;nt/* top:0; */nttop: expression(eval((document.documentElement||document.body).scrollTop));n}nndiv.bigIcon {ntwidth: 40px;ntheight: 40px; nt/* background-color: white; */nt/* border: 1px solid #a6a7a3; */ntfont-family: Verdana, Trebuchet, Tahoma, Arial;n}nn.iconContainer {ntfont-family: Verdana, Trebuchet, Tahoma, Arial;ntfont-size: 13px;ntfloat: left;ntheight: 18px;ntdisplay: block;nt/* background-color: white; */ntcursor: pointer;ntpadding: 1px 4px 1px 1px; /* almost the same as a transparent border */ntborder: 0px;n}nn.dojoE2TBIcon {ntdisplay: block;nttext-align: center;ntmin-width: 18px;ntwidth: 18px;ntheight: 18px;nt/* background-color: #a6a7a3; */ntbackground-repeat: no-repeat;ntbackground-image: url(buttons/aggregate.gif);n}nnn.dojoE2TBIcon[class~=dojoE2TBIcon] {n}nn.ToolbarButtonLatched {n border: #316ac5 1px solid; !important;n padding: 0px 3px 0px 0px; !important; /* make room for border */n background-color: #c1d2ee;n}nn.ToolbarButtonHighlighted {n border: #316ac5 1px solid; !important;n padding: 0px 3px 0px 0px; !important; /* make room for border */n background-color: #dff1ff;n}nn.ToolbarButtonDisabled{n filter: gray() alpha(opacity=30); /* IE */n opacity: 0.30; /* Safari, Opera and Mozilla */n}nn.headingContainer {ntwidth: 150px;ntheight: 30px;ntmargin: 0px;nt/* padding-left: 5px; */ntoverflow: hidden;ntline-height: 25px;ntborder-bottom: 1px solid black;ntborder-top: 1px solid white;n}nn.EditorToolbarDomNode select {ntfont-size: 14px;n}n n.dojoE2TBIcon_Sep { width: 5px; min-width: 5px; max-width: 5px; background-position: 0px 0px}n.dojoE2TBIcon_Backcolor { background-position: -18px 0px}n.dojoE2TBIcon_Bold { background-position: -36px 0px}n.dojoE2TBIcon_Cancel { background-position: -54px 0px}n.dojoE2TBIcon_Copy { background-position: -72px 0px}n.dojoE2TBIcon_Link { background-position: -90px 0px}n.dojoE2TBIcon_Cut { background-position: -108px 0px}n.dojoE2TBIcon_Delete { background-position: -126px 0px}n.dojoE2TBIcon_TextColor { background-position: -144px 0px}n.dojoE2TBIcon_BackgroundColor { background-position: -162px 0px}n.dojoE2TBIcon_Indent { background-position: -180px 0px}n.dojoE2TBIcon_HorizontalLine { background-position: -198px 0px}n.dojoE2TBIcon_Image { background-position: -216px 0px}n.dojoE2TBIcon_NumberedList { background-position: -234px 0px}n.dojoE2TBIcon_Table { background-position: -252px 0px}n.dojoE2TBIcon_BulletedList { background-position: -270px 0px}n.dojoE2TBIcon_Italic { background-position: -288px 0px}n.dojoE2TBIcon_CenterJustify { background-position: -306px 0px}n.dojoE2TBIcon_BlockJustify { background-position: -324px 0px}n.dojoE2TBIcon_LeftJustify { background-position: -342px 0px}n.dojoE2TBIcon_RightJustify { background-position: -360px 0px}n.dojoE2TBIcon_left_to_right { background-position: -378px 0px}n.dojoE2TBIcon_list_bullet_indent { background-position: -396px 0px}n.dojoE2TBIcon_list_bullet_outdent { background-position: -414px 0px}n.dojoE2TBIcon_list_num_indent { background-position: -432px 0px}n.dojoE2TBIcon_list_num_outdent { background-position: -450px 0px}n.dojoE2TBIcon_Outdent { background-position: -468px 0px}n.dojoE2TBIcon_Paste { background-position: -486px 0px}n.dojoE2TBIcon_Redo { background-position: -504px 0px}ndojoE2TBIcon_RemoveFormat { background-position: -522px 0px}n.dojoE2TBIcon_right_to_left { background-position: -540px 0px}n.dojoE2TBIcon_Save { background-position: -558px 0px}n.dojoE2TBIcon_Space { background-position: -576px 0px}n.dojoE2TBIcon_StrikeThrough { background-position: -594px 0px}n.dojoE2TBIcon_Subscript { background-position: -612px 0px}n.dojoE2TBIcon_Superscript { background-position: -630px 0px}n.dojoE2TBIcon_Underline { background-position: -648px 0px}n.dojoE2TBIcon_Undo { background-position: -666px 0px}n.dojoE2TBIcon_WikiWord { background-position: -684px 0px}nn", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/EditorToolbar.css"), ToolbarLatchedItemStyle:"ToolbarButtonLatched", ToolbarEnabledItemStyle:"ToolbarButtonEnabled", ToolbarDisabledItemStyle:"ToolbarButtonDisabled", ToolbarHighlightedItemStyle:"ToolbarButtonHighlighted", ToolbarHighlightedSelectStyle:"ToolbarSelectHighlighted", ToolbarHighlightedSelectItemStyle:"ToolbarSelectHighlightedItem", postCreate:function () {
  455. var nodes = dojo.html.getElementsByClass("dojoEditorToolbarItem", this.domNode);
  456. this.items = {};
  457. for (var x = 0; x < nodes.length; x++) {
  458. var node = nodes[x];
  459. var itemname = node.getAttribute("dojoETItemName");
  460. if (itemname) {
  461. var item = dojo.widget.Editor2ToolbarItemManager.getToolbarItem(itemname);
  462. if (item) {
  463. item.create(node, this);
  464. this.items[itemname.toLowerCase()] = item;
  465. } else {
  466. node.style.display = "none";
  467. }
  468. }
  469. }
  470. }, update:function () {
  471. for (var cmd in this.items) {
  472. this.items[cmd].refreshState();
  473. }
  474. }, shareGroup:"", checkAvailability:function () {
  475. if (!this.shareGroup) {
  476. this.parent.focus();
  477. return true;
  478. }
  479. var curInst = dojo.widget.Editor2Manager.getCurrentInstance();
  480. if (this.shareGroup == curInst.toolbarGroup) {
  481. return true;
  482. }
  483. return false;
  484. }, destroy:function () {
  485. for (var it in this.items) {
  486. this.items[it].destroy();
  487. delete this.items[it];
  488. }
  489. dojo.widget.Editor2Toolbar.superclass.destroy.call(this);
  490. }});