JAVASCRIPT 8
Editorcontrols.js Guest on 21st November 2020 10:01:32 AM
  1. /*
  2.         LicencovĂĄno pod MIT LicencĂ­, jejĂ­ celĂ˝ text je uveden v souboru licence.txt
  3.         Licenced under the MIT Licence, complete text is available in licence.txt file
  4. */
  5.  
  6. /**
  7.  * @namespace
  8.  * @group jak-widgets
  9.  */
  10. JAK.EditorControls = JAK.ClassMaker.makeStatic({
  11.         NAME: "JAK.EditorControls",
  12.         VERSION: "1.0"
  13. });
  14.  
  15. /* basic control: enable/disable, hover */
  16. /**
  17.  * @class
  18.  * @group jak-widgets
  19.  * @augments JAK.ISignals
  20.  */
  21. JAK.EditorControl = JAK.ClassMaker.makeClass({
  22.         NAME: "JAK.EditorControl",
  23.         VERSION: "2.0",
  24.         IMPLEMENT: JAK.ISignals
  25. });
  26.  
  27. JAK.EditorControl.prototype.$constructor = function(owner, options) {
  28.         this.options = {};
  29.         this._defaultOptions();
  30.         for (var p in options) { this.options[p] = options[p]; }
  31.         if ("text" in this.options && typeof(this.options.text) == "string") { this.options.text = [this.options.text]; }
  32.        
  33.         this.enabled = true;
  34.         this.owner = owner;
  35.         this.dom = {};
  36.         this.ec = [];
  37.        
  38.         this._build(); /* create DOM */
  39.         this._init(); /* control-specific init */
  40. }
  41.  
  42. JAK.EditorControl.prototype.$destructor = function() {
  43.         for (var i=0;i<this.ec.length;i++) {
  44.                 JAK.Events.removeListener(this.ec[i]);
  45.         }
  46.         this.dom.container.parentNode.removeChild(this.dom.container);
  47.         for (var p in this) { this[p] = null; }
  48. }
  49.  
  50. JAK.EditorControl.prototype.refresh = function() {}
  51.  
  52. JAK.EditorControl.prototype.submit = function() {}
  53.  
  54. JAK.EditorControl.prototype.enable = function() {
  55.         this.enabled = true;
  56.         JAK.DOM.removeClass(this.dom.container,"disabled");
  57. }
  58.  
  59. JAK.EditorControl.prototype.disable = function() {
  60.         this.enabled = false;
  61.         JAK.DOM.addClass(this.dom.container,"disabled");
  62.         JAK.DOM.removeClass(this.dom.container,"mouseover");
  63. }
  64.  
  65. JAK.EditorControl.prototype._build = function() {
  66.         this.dom.container = JAK.cel("div");
  67. }
  68.  
  69. JAK.EditorControl.prototype._init = function() {}
  70.  
  71. JAK.EditorControl.prototype._defaultOptions = function() {}
  72.  
  73. JAK.EditorControl.prototype._addMouseEvents = function(elm) {
  74.         this.ec.push(JAK.Events.addListener(elm,"mouseover",this,"_mouseover",false,true));
  75.         this.ec.push(JAK.Events.addListener(elm,"mouseout",this,"_mouseout",false,true));
  76. }
  77.  
  78. JAK.EditorControl.prototype._mouseover = function(e, elm) {
  79.         if (this.enabled) {     JAK.DOM.addClass(elm,"mouseover"); }
  80. }
  81.  
  82. JAK.EditorControl.prototype._mouseout = function(e, elm) {
  83.         if (this.enabled) { JAK.DOM.removeClass(elm,"mouseover"); }
  84. }
  85.  
  86. /* --- */
  87.  
  88. /**
  89.  * @class
  90.  * @augments JAK.EditorControl
  91.  */
  92. JAK.EditorControl.Dummy = JAK.ClassMaker.makeClass({
  93.         NAME: "JAK.EditorControl.Dummy",
  94.         VERSION: "2.0",
  95.         EXTEND: JAK.EditorControl
  96. });
  97.  
  98. JAK.EditorControl.Dummy.prototype._build = function() {
  99.         this.dom.container = JAK.cel("img");
  100.         this.dom.container.src = this.owner.options.imagePath + this.options.image;
  101.         if (this.options.className) { JAK.DOM.addClass(this.dom.container,this.options.className); }
  102. }
  103.  
  104. JAK.EditorControl.Dummy.prototype.disable = function(){}
  105. /* --- */
  106.  
  107. /* click action */
  108. /**
  109.  * @class
  110.  * @augments JAK.EditorControl
  111.  */
  112. JAK.EditorControl.Interactive = JAK.ClassMaker.makeClass({
  113.         NAME: "JAK.EditorControl.Interactive",
  114.         VERSION: "2.0",
  115.         EXTEND: JAK.EditorControl
  116. });
  117.  
  118. JAK.EditorControl.Interactive.prototype._defaultOptions = function() {
  119.         this.options = {
  120.                 image:"none.gif",
  121.                 text:""
  122.         }
  123. }
  124.  
  125. JAK.EditorControl.Interactive.prototype._build = function() {
  126.         this.dom.container = JAK.cel("img", "button");
  127.         this.dom.container.src = this.owner.options.imagePath + this.options.image;
  128.         this.ec.push(JAK.Events.addListener(this.dom.container,"click",this,"_click",false,true));
  129.         if (this.options.text[0]) { this.dom.container.title = this.options.text[0]; }
  130. }
  131.  
  132. JAK.EditorControl.Interactive.prototype._click = function(e, elm) {
  133.         JAK.Events.cancelDef(e);
  134.         if (this.enabled) { this._clickAction(e); }
  135. }
  136.  
  137. JAK.EditorControl.Interactive.prototype._init = function() {
  138.         this._addMouseEvents(this.dom.container);
  139. }
  140.  
  141. JAK.EditorControl.Interactive.prototype._clickAction = function(e) {}
  142.  
  143. /* --- */
  144.  
  145. /* exec command on action */
  146. /**
  147.  * @class
  148.  * @augments JAK.EditorControl.Interactive
  149.  */
  150. JAK.EditorControl.OneStateButton = JAK.ClassMaker.makeClass({
  151.         NAME: "JAK.EditorControl.OneStateButton",
  152.         VERSION: "2.0",
  153.         EXTEND: JAK.EditorControl.Interactive
  154. });
  155.  
  156. JAK.EditorControl.OneStateButton.prototype._clickAction = function() {
  157.         if (!this.options.command) { return; }
  158.         this.owner.commandExec(this.options.command);
  159. }
  160.  
  161. JAK.EditorControl.OneStateButton.prototype._refresh = function() {
  162.         if (!this.options.command) { return; }
  163.         var state = this.owner.commandQuerySupported(this.options.command);
  164.         if (state == this.enabled) { return; }
  165.         if (state) { this.enable(); } else { this.disable(); }
  166. }
  167.  
  168. /* --- */
  169.  
  170. /* change state on refresh */
  171. /**
  172.  * @class
  173.  * @augments JAK.EditorControl.Interactive
  174.  */
  175. JAK.EditorControl.TwoStateButton = JAK.ClassMaker.makeClass({
  176.         NAME: "JAK.EditorControl.TwoStateButton",
  177.         VERSION: "2.0",
  178.         EXTEND: JAK.EditorControl.Interactive
  179. });
  180.  
  181. JAK.EditorControl.TwoStateButton.prototype._clickAction = function() {
  182.         if (!this.options.command) { return; }
  183.         this.owner.commandExec(this.options.command);
  184. }
  185.  
  186. JAK.EditorControl.TwoStateButton.prototype._init = function() {
  187.         this._addMouseEvents(this.dom.container);
  188.         this.state = 0;
  189. }
  190.  
  191. JAK.EditorControl.TwoStateButton.prototype._toggleState = function(state) {
  192.         this.state = state;
  193.         if (this.state) {
  194.                 JAK.DOM.addClass(this.dom.container,"pressed");
  195.         } else {
  196.                 JAK.DOM.removeClass(this.dom.container,"pressed");
  197.         }
  198. }
  199.  
  200. JAK.EditorControl.TwoStateButton.prototype.refresh = function() {
  201.         if (!this.options.command) { return; }
  202.  
  203.         var state = this.owner.commandQuerySupported(this.options.command);
  204.         if (state != this.enabled) {
  205.                 if (state) { this.enable(); } else { this.disable(); }
  206.         }
  207.        
  208.         var s = this.owner.commandQueryState(this.options.command);
  209.         s = (s ? 1 : 0);
  210.         if (s != this.state) { this._toggleState(s); }
  211. }
  212.  
  213. /* --- */
  214.  
  215. /* ask, then insert/edit image */
  216. /**
  217.  * @class
  218.  * @augments JAK.EditorControl.TwoStateButton
  219.  */
  220. JAK.EditorControl.InsertImage = JAK.ClassMaker.makeClass({
  221.         NAME: "JAK.EditorControl.InsertImage",
  222.         VERSION: "2.0",
  223.         EXTEND: JAK.EditorControl.TwoStateButton
  224. });
  225.  
  226. JAK.EditorControl.InsertImage.prototype.refresh = function() {
  227.         var elm = this.owner.getSelectedNode();
  228.         var state = (elm.tagName && elm.tagName.toLowerCase() == "img" ? 1 : 0);
  229.         this._toggleState(state);
  230. }
  231.  
  232. JAK.EditorControl.InsertImage.prototype._clickAction = function() {
  233.         if (this.state) { /* at image - change url */
  234.                 var elm = this.owner.getSelectedNode();
  235.                 var url = prompt(this.options.text[1],elm.src);
  236.                 if (url) { elm.src = url; }
  237.         } else { /* insert image */
  238.                 var url = prompt(this.options.text[1],"http://");
  239.                 if (url) { this.owner.commandExec("insertimage",url); }
  240.         }
  241. }
  242.  
  243. /* --- */
  244.  
  245. /* select from some options */
  246. /**
  247.  * @class
  248.  * @augments JAK.EditorControl.Interactive
  249.  */
  250. JAK.EditorControl.Select = JAK.ClassMaker.makeClass({
  251.         NAME: "JAK.EditorControl.Select",
  252.         VERSION: "2.0",
  253.         EXTEND: JAK.EditorControl.Interactive
  254. });
  255.  
  256. JAK.EditorControl.Select.prototype._defaultOptions = function() {
  257.         this.options = {
  258.                 text:"",
  259.                 command:"",
  260.                 options:[]
  261.         }
  262. }
  263.  
  264. JAK.EditorControl.Select.prototype._build = function() {
  265.         this.dom.container = JAK.cel("span", "select");
  266.         this.dom.content = JAK.mel("div", {className:"options"}, {position:"absolute",zIndex:10});
  267.         this.dom.opts = [];
  268.        
  269.         this.dom.container.innerHTML = this.options.text[0];
  270.  
  271.         for (var i=0;i<this.options.options.length;i++) {
  272.                 var o = this.options.options[i];
  273.                 var div = JAK.cel("div", "option");
  274.                 this.dom.opts.push(div);
  275.                 this.ec.push(JAK.Events.addListener(div,"click",this,"_optionClick",false,true));
  276.                 div.innerHTML = o.innerHTML;
  277.                 this.dom.content.appendChild(div);
  278.                 this._addMouseEvents(div);
  279.         }
  280.        
  281.         this.owner._lock(this.dom.content);
  282.         this._addMouseEvents(this.dom.container);
  283.         this.ec.push(JAK.Events.addListener(this.dom.container,"click",this,"_click",false,true));
  284.         this.ec.push(JAK.Events.addListener(this.dom.content,"mousedown",JAK.Events,"cancelDef",false,true));
  285. }
  286.  
  287. JAK.EditorControl.Select.prototype._init = function() {
  288.         this.state = 0;
  289.         this.widthCounted = false;
  290. }
  291.  
  292. JAK.EditorControl.Select.prototype.show = function() {
  293.         JAK.EditorControl.Select.active = this;
  294.         this.state = 1;
  295.         this.owner.dom.controlBox.appendChild(this.dom.content);
  296.         /* position */
  297.         var pos = JAK.DOM.getPortBoxPosition(this.dom.container);
  298.         var pos2 = JAK.DOM.getPortBoxPosition(this.owner.dom.controlBox);
  299.         pos.left -= pos2.left;
  300.         pos.top -= pos2.top + 1;
  301.        
  302.         this.dom.content.style.left = pos.left+"px";
  303.         this.dom.content.style.top = (pos.top + this.dom.container.offsetHeight) + "px";
  304.        
  305.         if (!this.widthCounted) {
  306.                 var w = this.dom.content.offsetWidth;
  307.                 for (var i=0;i<this.dom.opts.length;i++) {
  308.                         this.dom.opts[i].style.width = w+"px";
  309.                 }
  310.                 this.widthCounted = true;
  311.         }
  312. }
  313.  
  314. JAK.EditorControl.Select.prototype.hide = function() {
  315.         JAK.EditorControl.Select.active = false;
  316.         this.state = 0;
  317.         for (var i=0;i<this.dom.opts.length;i++) {
  318.                 JAK.DOM.removeClass(this.dom.opts[i],"mouseover");
  319.         }
  320.         this.dom.content.parentNode.removeChild(this.dom.content);
  321. }
  322.  
  323. JAK.EditorControl.Select.prototype._click = function(e, elm) {
  324.         if (!this.enabled) { return; }
  325.         JAK.Events.stopEvent(e);
  326.         if (JAK.EditorControl.Select.active == this) {
  327.                 JAK.EditorControl.Select.active = false;
  328.         }
  329.         JAK.EditorControl.Select.checkHide(e, elm);
  330.         if (this.state) {
  331.                 this.hide();
  332.         } else {
  333.                 this.show();
  334.         }
  335. }
  336.  
  337. JAK.EditorControl.Select.active = false;
  338. JAK.EditorControl.Select.checkHide = function(e, elm) {
  339.         if (JAK.EditorControl.Select.active) { JAK.EditorControl.Select.active.hide(); }
  340. }
  341.  
  342. JAK.Events.addListener(document,"click",window,JAK.EditorControl.Select.checkHide);
  343.        
  344. JAK.EditorControl.Select.prototype._optionClick = function(e, elm) {
  345.         var index = -1;
  346.         for (var i=0;i<this.dom.opts.length;i++) {
  347.                 if (this.dom.opts[i] == elm) { index = i; }
  348.         }
  349.        
  350.         this.hide();
  351.         var val = this.options.options[index].value;
  352.         //@note aichi: v IE je nutne pridat <> pouze k formatovacimu prikazu (h1-6,p,div) a ne velikosti a typu pisma
  353.         if (JAK.Browser.client == "ie" && !(val.match(/</)) && this.options.command == 'formatblock') {
  354.                 val = "<"+val+">";
  355.         }
  356.         this.owner.commandExec(this.options.command, val);
  357. }
  358.  
  359. /* --- */
  360.  
  361. /* ask, then insert/edit link */
  362. /**
  363.  * @class
  364.  * @augments JAK.EditorControl.TwoStateButton
  365.  */
  366. JAK.EditorControl.InsertLink = JAK.ClassMaker.makeClass({
  367.         NAME: "JAK.EditorControl.InsertLink",
  368.         VERSION: "2.0",
  369.         EXTEND: JAK.EditorControl.TwoStateButton
  370. });
  371.  
  372. JAK.EditorControl.InsertLink.prototype._findLink = function() {
  373.         var elm = this.owner.getSelectedNode();
  374.         do {
  375.                 if (elm.tagName && elm.tagName.toLowerCase() == "a") { return elm; }
  376.                 elm = elm.parentNode;
  377.         } while (elm);
  378.         return false;
  379. }
  380.  
  381. JAK.EditorControl.InsertLink.prototype.refresh = function() {
  382.         var a = this._findLink();
  383.         var state = (a ? 1 : 0);
  384.         this._toggleState(state);
  385. }
  386.  
  387. JAK.EditorControl.InsertLink.prototype._clickAction = function() {
  388.         if (this.state) { /* at link - change href */
  389.                 var a = this._findLink();
  390.                 var url = prompt(this.options.text[1],a.href);
  391.                 if (url) { a.href = url; }
  392.         } else { /* insert link */
  393.                 var url = prompt(this.options.text[1],"http://");
  394.                 if (url) { this.owner.commandExec("createlink",url); }
  395.         }
  396. }
  397.  
  398. /* --- */
  399.  
  400. /* remove link */
  401. /**
  402.  * @class
  403.  * @augments JAK.EditorControl.OneStateButton
  404.  */
  405. JAK.EditorControl.Unlink = JAK.ClassMaker.makeClass({
  406.         NAME: "JAK.EditorControl.Unlink",
  407.         VERSION: "2.0",
  408.         EXTEND: JAK.EditorControl.OneStateButton
  409. });
  410.  
  411. JAK.EditorControl.Unlink.prototype._findLink = function() {
  412.         var elm = this.owner.getSelectedNode();
  413.         do {
  414.                 if (elm.tagName && elm.tagName.toLowerCase() == "a") { return elm; }
  415.                 elm = elm.parentNode;
  416.         } while (elm);
  417.         return false;
  418. }
  419.  
  420. JAK.EditorControl.Unlink.prototype.refresh = function() {
  421.         var a = this._findLink();
  422.         if (a != this.enabled) {
  423.                 if (a) { this.enable(); } else { this.disable(); }
  424.         }
  425. }
  426.  
  427. JAK.EditorControl.Unlink.prototype._clickAction = function() {
  428.         var a = this._findLink();
  429.         if (!a) { return; }
  430.         this.owner.instance.saveRange();
  431.         this.owner.selectNode(a);
  432.         this.owner.commandExec("unlink");
  433.         this.owner.instance.loadRange();
  434. }
  435.  
  436. /* --- */
  437.  
  438. /**
  439.  * @class
  440.  * @augments JAK.EditorControl.OneStateButton
  441.  */
  442. JAK.EditorControl.Color = JAK.ClassMaker.makeClass({
  443.         NAME: "JAK.EditorControl.Color",
  444.         VERSION: "2.0",
  445.         EXTEND: JAK.EditorControl.OneStateButton
  446. });
  447.  
  448. JAK.EditorControl.Color.prototype._init = function() {
  449.         this._addMouseEvents(this.dom.container);
  450.         this.picker = (JAK.ColorPicker ? new JAK.ColorPicker(this.options.colorPickerOptions) : false);
  451.         if (this.picker) {
  452.                 this.owner._lock(this.picker.dom.container); /* tezkej hack pro IE */
  453.                 this.addListener("colorselect","_selectColor",this.picker);
  454.         }
  455.         this._selectColor = this._selectColor.bind(this);
  456. }
  457.  
  458. JAK.EditorControl.Color.prototype._clickAction = function(e,elm) {
  459.         this.owner.getInstance().saveRange();
  460.         if (this.picker) {
  461.                 var scroll = JAK.DOM.getScrollPos();
  462.                 this.picker.pick(scroll.x+e.clientX-20,scroll.y+e.clientY-20,false,false);
  463.         } else {
  464.                 var color = prompt(this.options.text[1]);
  465.                 if (color) { this._selectColor(color); }
  466.         }
  467. }
  468.  
  469. JAK.EditorControl.Color.prototype._selectColor = function(color) {
  470.         var c = (this.picker ? this.picker.getColor() : color);
  471.         this.owner.getInstance().loadRange();
  472.         if (this.options.command.toLowerCase() == "backcolor" && JAK.Browser.client != "ie") {
  473.                 this.owner.commandExec("hilitecolor", c);
  474.         } else {
  475.                 this.owner.commandExec(this.options.command, c);
  476.         }
  477. }
  478.  
  479. /* --- */
  480.  
  481. /* edit html in textarea */
  482. /**
  483.  * @class
  484.  * @augments JAK.EditorControl.TwoStateButton
  485.  */
  486. JAK.EditorControl.HTML = JAK.ClassMaker.makeClass({
  487.         NAME: "JAK.EditorControl.HTML",
  488.         VERSION: "2.0",
  489.         EXTEND: JAK.EditorControl.TwoStateButton
  490. });
  491.  
  492. JAK.EditorControl.HTML.prototype._init = function() {
  493.         this._addMouseEvents(this.dom.container);
  494.         this.state = 0;
  495. }
  496.  
  497. JAK.EditorControl.HTML.prototype.show = function() {
  498.         this._toggleState(1);
  499.         var w = this.owner.width-4;
  500.         var h = this.owner.height-4;
  501.         this.ta = JAK.mel("textarea", null, {width:w+"px",height:h+"px"});
  502.         this.ta.value = this.owner.getContent();
  503.         this.elm = this.owner.dom.container.insertBefore(this.ta,this.owner.dom.content);
  504.         this.owner.dom.content.style.display = "none";
  505.        
  506.         for (var i=0;i<this.owner.controls.length;i++) {
  507.                 var c = this.owner.controls[i];
  508.                 if (c != this) { c.disable(); }
  509.         }
  510. }
  511.  
  512. JAK.EditorControl.HTML.prototype.hide = function() {
  513.         this._toggleState(0);
  514.         this.owner.setContent(this.ta.value);
  515.         this.ta.parentNode.removeChild(this.ta);
  516.         this.owner.dom.content.style.display = "block";
  517.        
  518.         for (var i=0;i<this.owner.controls.length;i++) {
  519.                 var c = this.owner.controls[i];
  520.                 c.enable();
  521.         }
  522.        
  523.         this.owner.refresh();
  524.        
  525. }
  526.  
  527. JAK.EditorControl.HTML.prototype.submit = function() {
  528.         if (this.state) {
  529.                 this.owner.setContent(this.ta.value);
  530.                 this.hide();
  531.         }
  532. }
  533.  
  534. JAK.EditorControl.HTML.prototype._clickAction = function() {
  535.         if (this.state) {
  536.                 this.hide();
  537.         } else {
  538.                 this.show();
  539.         }
  540. }
  541.  
  542. /* --- */
  543.  
  544. /**
  545.  * @class
  546.  * @group jak-widgets
  547.  */
  548. JAK.EditorControl.Window = JAK.ClassMaker.makeClass({
  549.         NAME: "JAK.EditorControl.Window",
  550.         VERSION: "2.0"
  551. });
  552.  
  553. JAK.EditorControl.Window.prototype.openWindow = function(url, optObj) {
  554.         var options = {
  555.                 left:null,
  556.                 top:null,
  557.                 toolbar:"no",
  558.                 status:"yes",
  559.                 location:"no",
  560.                 scrollbars:"no",
  561.                 width:null,
  562.                 height:null,
  563.                 resizable:"yes"
  564.         }
  565.         for (var p in optObj) { options[p] = optObj[p]; }
  566.        
  567.         var arr = [];
  568.         for (var p in options) {
  569.                 var val = options[p];
  570.                 if (val !== null) { arr.push(p+"="+val); }
  571.         }
  572.         var w = window.open(url,"_blank",arr.join(","));
  573.         return w;
  574. }
  575.  
  576. /* ---------------------------------------------------------------- */
  577.  
  578. JAK.EditorControls["separator"] = {object:JAK.EditorControl.Dummy, image:"separator.gif", className:"separator"};
  579. JAK.EditorControls["br"] = {object:JAK.EditorControl.Dummy, image:"blank.gif", className:"br"};
  580.  
  581. JAK.EditorControls["line"] = {object:JAK.EditorControl.OneStateButton, command:"inserthorizontalrule", image:"line.gif"};
  582. JAK.EditorControls["indent"] = {object:JAK.EditorControl.OneStateButton, command:"indent", image:"indent.gif"};
  583. JAK.EditorControls["outdent"] = {object:JAK.EditorControl.OneStateButton, command:"outdent", image:"outdent.gif"};
  584.  
  585. JAK.EditorControls["bold"] = {object:JAK.EditorControl.TwoStateButton, command:"bold", image:"bold.gif"};
  586. JAK.EditorControls["italic"] = {object:JAK.EditorControl.TwoStateButton, command:"italic", image:"italic.gif"};
  587. JAK.EditorControls["underline"] = {object:JAK.EditorControl.TwoStateButton, command:"underline", image:"underline.gif"};
  588. JAK.EditorControls["justifycenter"] = {object:JAK.EditorControl.TwoStateButton, command:"justifycenter", image:"justifycenter.gif"};
  589. JAK.EditorControls["justifyleft"] = {object:JAK.EditorControl.TwoStateButton, command:"justifyleft", image:"justifyleft.gif"};
  590. JAK.EditorControls["justifyright"] = {object:JAK.EditorControl.TwoStateButton, command:"justifyright", image:"justifyright.gif"};
  591. JAK.EditorControls["justifyfull"] = {object:JAK.EditorControl.TwoStateButton, command:"justifyfull", image:"justifyfull.gif"};
  592. JAK.EditorControls["strikethrough"] = {object:JAK.EditorControl.TwoStateButton, command:"strikethrough", image:"strikethrough.gif"};
  593. JAK.EditorControls["superscript"] = {object:JAK.EditorControl.TwoStateButton, command:"superscript", image:"superscript.gif"};
  594. JAK.EditorControls["subscript"] = {object:JAK.EditorControl.TwoStateButton, command:"subscript", image:"subscript.gif"};
  595. JAK.EditorControls["orderedlist"] = {object:JAK.EditorControl.TwoStateButton, command:"insertorderedlist", image:"orderedlist.gif"};
  596. JAK.EditorControls["unorderedlist"] = {object:JAK.EditorControl.TwoStateButton, command:"insertunorderedlist", image:"unorderedlist.gif"};
  597.  
  598. JAK.EditorControls["image"] = {object:JAK.EditorControl.InsertImage, image:"image.gif"};
  599. JAK.EditorControls["link"] = {object:JAK.EditorControl.InsertLink, image:"link.gif"};
  600. JAK.EditorControls["unlink"] = {object:JAK.EditorControl.Unlink, image:"unlink.gif"};
  601. JAK.EditorControls["forecolor"] = {object:JAK.EditorControl.Color, command:"forecolor", image:"forecolor.gif", colorPickerOptions:{}};
  602. JAK.EditorControls["backcolor"] = {object:JAK.EditorControl.Color, command:"backcolor", image:"backcolor.gif", colorPickerOptions:{}};
  603. JAK.EditorControls["html"] = {object:JAK.EditorControl.HTML, image:"html.gif"};
  604.  
  605. var obj = [
  606.         {innerHTML:"<font size='1'>1&nbsp;(8pt)</font>", value:"1"},
  607.         {innerHTML:"<font size='2'>2&nbsp;(10pt)</font>", value:"2"},
  608.         {innerHTML:"<font size='3'>3&nbsp;(12pt)</font>", value:"3"},
  609.         {innerHTML:"<font size='4'>4&nbsp;(14pt)</font>", value:"4"},
  610.         {innerHTML:"<font size='5'>5&nbsp;(18pt)</font>", value:"5"},
  611.         {innerHTML:"<font size='6'>6&nbsp;(24pt)</font>", value:"6"},
  612.         {innerHTML:"<font size='7'>7&nbsp;(36pt)</font>", value:"7"}
  613. ]
  614. JAK.EditorControls["fontsize"] = {object:JAK.EditorControl.Select, command:"fontsize", options:obj};
  615.  
  616. var obj = [
  617.         {innerHTML:"<font face='arial'>Arial</font>", value:"arial"},
  618.         {innerHTML:"<font face='comic sans ms'>Comic Sans</font>", value:"comic sans ms"},
  619.         {innerHTML:"<font face='courier new'>Courier New</font>", value:"courier new"},
  620.         {innerHTML:"<font face='georgia'>Georgia</font>", value:"georgia"},
  621.         {innerHTML:"<font face='helvetica'>Helvetica</font>", value:"helvetica"},
  622.         {innerHTML:"<font face='impact'>Impact</font>", value:"impact"},
  623.         {innerHTML:"<font face='times new roman'>Times New</font>", value:"times new roman"},
  624.         {innerHTML:"<font face='trebuchet'>Trebuchet</font>", value:"trebuchet"},
  625.         {innerHTML:"<font face='verdana'>Verdana</font>", value:"verdana"}
  626. ]
  627. JAK.EditorControls["fontname"] = {object:JAK.EditorControl.Select, command:"fontname", options:obj};
  628.  
  629. var obj = [
  630.         {innerHTML:"<h1 style='margin:0px;padding:0px;'>Heading 1</h1>", value:"h1"},
  631.         {innerHTML:"<h2 style='margin:0px;padding:0px;'>Heading 2</h2>", value:"h2"},
  632.         {innerHTML:"<h3 style='margin:0px;padding:0px;'>Heading 3</h3>", value:"h3"},
  633.         {innerHTML:"<h4 style='margin:0px;padding:0px;'>Heading 4</h4>", value:"h4"},
  634.         {innerHTML:"<h5 style='margin:0px;padding:0px;'>Heading 5</h5>", value:"h5"},
  635.         {innerHTML:"<h6 style='margin:0px;padding:0px;'>Heading 6</h6>", value:"h6"},
  636.         {innerHTML:"<p style='margin:0px;padding:0px;'>Paragraph</p>", value:"p"},
  637.         {innerHTML:"<pre style='margin:0px;padding:0px;'>Pre</pre>", value:"pre"}
  638. ]
  639. JAK.EditorControls["format"] = {object:JAK.EditorControl.Select, command:"formatblock", options:obj};

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Recent Pastes

Raw Paste

Login or Register to edit or fork this paste. It's free.