| 1 | | // htmlArea v3.0 - Copyright (c) 2003-2004 dynarch.com |
| 2 | | // 2002-2003 interactivetools.com, inc. |
| 3 | | // This copyright notice MUST stay intact for use (see license.txt). |
| 4 | | // |
| 5 | | // A free WYSIWYG editor replacement for <textarea> fields. |
| 6 | | // For full source code and docs, visit http://www.interactivetools.com/ |
| 7 | | // |
| 8 | | // Version 3.0 developed by Mihai Bazon. |
| 9 | | // http://dynarch.com/mishoo/ |
| 10 | | // |
| 11 | | // $Id: htmlarea.js,v 1.95 2004/09/17 11:54:24 mishoo Exp $ |
| | 1 | |
| | 2 | /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- |
| | 3 | -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ |
| | 4 | -- |
| | 5 | -- Use of Xinha is granted by the terms of the htmlArea License (based on |
| | 6 | -- BSD license) please read license.txt in this package for details. |
| | 7 | -- |
| | 8 | -- Xinha was originally based on work by Mihai Bazon which is: |
| | 9 | -- Copyright (c) 2003-2004 dynarch.com. |
| | 10 | -- Copyright (c) 2002-2003 interactivetools.com, inc. |
| | 11 | -- This copyright notice MUST stay intact for use. |
| | 12 | -- |
| | 13 | -- Developers - Coding Style: |
| | 14 | -- For the sake of not committing needlessly conflicting changes, |
| | 15 | -- |
| | 16 | -- * New code to be indented with 2 spaces ("soft tab"). |
| | 17 | -- * New code preferably uses BSD-Style Bracing |
| | 18 | -- if(foo) |
| | 19 | -- { |
| | 20 | -- bar(); |
| | 21 | -- } |
| | 22 | -- * Don't change brace styles unless you're working on the non BSD-Style |
| | 23 | -- area (so we don't get spurious changes in line numbering). |
| | 24 | -- * Don't change indentation unless you're working on the badly indented |
| | 25 | -- area (so we don't get spurious changes of large blocks of code). |
| | 26 | -- * Jedit is the recommended editor, a comment of this format should be |
| | 27 | -- included in the top 10 lines of the file (see the embedded edit mode) |
| | 28 | -- |
| | 29 | -- $HeadURL$ |
| | 30 | -- $LastChangedDate$ |
| | 31 | -- $LastChangedRevision$ |
| | 32 | -- $LastChangedBy$ |
| | 33 | --------------------------------------------------------------------------*/ |
| 260 | | /* |
| 261 | | this.toolbar = [ |
| 262 | | [ "fontname", "space", |
| 263 | | "fontsize", "space", |
| 264 | | "formatblock", "space", |
| 265 | | "bold", "italic", "underline", "strikethrough", "separator", |
| 266 | | "subscript", "superscript", "separator", |
| 267 | | "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ], |
| 268 | | |
| 269 | | [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", |
| 270 | | "lefttoright", "righttoleft", "separator", |
| 271 | | "orderedlist", "unorderedlist", "outdent", "indent", "separator", |
| 272 | | "forecolor", "hilitecolor", "separator", |
| 273 | | "inserthorizontalrule", "createlink", "insertimage", "inserttable", "toggleborders", "htmlmode", "separator", |
| 274 | | "popupeditor", "separator", "showhelp", "about" ] |
| 275 | | ]; |
| 276 | | */ |
| 277 | | |
| 342 | | /* |
| 343 | | bold: [ "Bold", "ed_format_bold.gif", false, function(e) {e.execCommand("bold");} ], |
| 344 | | italic: [ "Italic", "ed_format_italic.gif", false, function(e) {e.execCommand("italic");} ], |
| 345 | | underline: [ "Underline", "ed_format_underline.gif", false, function(e) {e.execCommand("underline");} ], |
| 346 | | strikethrough: [ "Strikethrough", "ed_format_strike.gif", false, function(e) {e.execCommand("strikethrough");} ], |
| 347 | | subscript: [ "Subscript", "ed_format_sub.gif", false, function(e) {e.execCommand("subscript");} ], |
| 348 | | superscript: [ "Superscript", "ed_format_sup.gif", false, function(e) {e.execCommand("superscript");} ], |
| 349 | | justifyleft: [ "Justify Left", "ed_align_left.gif", false, function(e) {e.execCommand("justifyleft");} ], |
| 350 | | justifycenter: [ "Justify Center", "ed_align_center.gif", false, function(e){e.execCommand("justifycenter");}], |
| 351 | | justifyright: [ "Justify Right", "ed_align_right.gif", false, function(e) {e.execCommand("justifyright");} ], |
| 352 | | justifyfull: [ "Justify Full", "ed_align_justify.gif", false, function(e) {e.execCommand("justifyfull");} ], |
| 353 | | |
| 354 | | orderedlist: [ "Ordered List", "ed_list_num.gif", false, function(e) {e.execCommand("insertorderedlist");} ], |
| 355 | | unorderedlist: [ "Bulleted List", "ed_list_bullet.gif", false, function(e) {e.execCommand("insertunorderedlist");} ], |
| 356 | | insertorderedlist: [ "Ordered List", "ed_list_num.gif", false, function(e) {e.execCommand("insertorderedlist");} ], |
| 357 | | insertunorderedlist: [ "Bulleted List", "ed_list_bullet.gif", false, function(e) {e.execCommand("insertunorderedlist");} ], |
| 358 | | |
| 359 | | outdent: [ "Decrease Indent", "ed_indent_less.gif", false, function(e) {e.execCommand("outdent");} ], |
| 360 | | indent: [ "Increase Indent", "ed_indent_more.gif", false, function(e) {e.execCommand("indent");} ], |
| 361 | | forecolor: [ "Font Color", "ed_color_fg.gif", false, function(e) {e.execCommand("forecolor");} ], |
| 362 | | hilitecolor: [ "Background Color", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ], |
| 363 | | |
| 364 | | undo: [ "Undoes your last action", "ed_undo.gif", false, function(e) {e.execCommand("undo");} ], |
| 365 | | redo: [ "Redoes your last action", "ed_redo.gif", false, function(e) {e.execCommand("redo");} ], |
| 366 | | cut: [ "Cut selection", "ed_cut.gif", false, cut_copy_paste ], |
| 367 | | copy: [ "Copy selection", "ed_copy.gif", false, cut_copy_paste ], |
| 368 | | paste: [ "Paste from clipboard", "ed_paste.gif", false, cut_copy_paste ], |
| 369 | | |
| 370 | | */ |
| 1644 | | document.write("<script type='text/javascript' src='" + plugin_file + "'></script>"); |
| 1645 | | document.write("<script type='text/javascript' src='" + plugin_lang + "'></script>"); |
| 1646 | | //this.loadScript(plugin_file); |
| 1647 | | //this.loadScript(plugin_lang); |
| 1648 | | }; |
| | 1626 | |
| | 1627 | if(callback) |
| | 1628 | { |
| | 1629 | HTMLArea._loadback(plugin_file, function() { HTMLArea._loadback(plugin_lang, callback); }); |
| | 1630 | } |
| | 1631 | else |
| | 1632 | { |
| | 1633 | document.write("<script type='text/javascript' src='" + plugin_file + "'></script>"); |
| | 1634 | document.write("<script type='text/javascript' src='" + plugin_lang + "'></script>"); |
| | 1635 | } |
| | 1636 | }; |
| | 1637 | |
| | 1638 | HTMLArea.loadPlugins = function(plugins, callbackIfNotReady) |
| | 1639 | { |
| | 1640 | var nuPlugins = HTMLArea.cloneObject(plugins); |
| | 1641 | |
| | 1642 | while(nuPlugins.length) |
| | 1643 | { |
| | 1644 | // Might already be loaded |
| | 1645 | if(eval('typeof ' + nuPlugins[nuPlugins.length-1]) != 'undefined') |
| | 1646 | { |
| | 1647 | nuPlugins.pop(); |
| | 1648 | } |
| | 1649 | else |
| | 1650 | { |
| | 1651 | break; |
| | 1652 | } |
| | 1653 | } |
| | 1654 | |
| | 1655 | if(!nuPlugins.length) |
| | 1656 | { |
| | 1657 | return true; |
| | 1658 | } |
| | 1659 | |
| | 1660 | HTMLArea.loadPlugin |
| | 1661 | (nuPlugins.pop(), |
| | 1662 | function() |
| | 1663 | { |
| | 1664 | if(HTMLArea.loadPlugins(nuPlugins, callbackIfNotReady)) |
| | 1665 | { |
| | 1666 | if(typeof callbackIfNotReady == 'function') |
| | 1667 | { |
| | 1668 | callbackIfNotReady(); |
| | 1669 | } |
| | 1670 | } |
| | 1671 | } |
| | 1672 | ); |
| | 1673 | return false; |
| | 1674 | } |
| | 1675 | |