diff --git a/docs/upgrades/upgrade_6.2.8-6.3.0.sql b/docs/upgrades/upgrade_6.2.8-6.3.0.sql index a5d7d78d5..87d46eb39 100644 --- a/docs/upgrades/upgrade_6.2.8-6.3.0.sql +++ b/docs/upgrades/upgrade_6.2.8-6.3.0.sql @@ -1,12 +1,12 @@ insert into webguiVersion values ('6.3.0','upgrade',unix_timestamp()); delete from template where templateId='tinymce' and namespace='richEditor'; -INSERT INTO template VALUES ('tinymce','TinyMCE','^JavaScript(\"/tinymce/jscripts/tiny_mce/tiny_mce.js\");\r\n\r\n\r\n','richEditor',1,1); +INSERT INTO template VALUES ('tinymce','TinyMCE','^JavaScript(\"/tinymce/jscripts/tiny_mce/tiny_mce.js\");\r\n\r\n\r\n','richEditor',1,1); delete from template where templateId='1' and namespace='richEditor/pagetree'; -INSERT INTO template VALUES ('1','Rich Editor Page Tree','\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\nInsert/Edit Link\r\n\r\n
\r\n Link Settings\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Link URL:
Link Target:\r\n
 
\r\n
\r\n \r\n\r\n
\r\n
\r\n\r\n\r\n
\r\n Available Page Tree\r\n\r\n\r\n \')\">
\r\n
\r\n\r\n
\r\n \r\n
\r\n\r\n','richEditor/pagetree',1,1); -UPDATE template set template = '\r\n \r\n \r\n <tmpl_var session.page.title> - <tmpl_var session.setting.companyName>\r\n \r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n\r\n \r\n ' where templateId = '10' and namespace='style'; - +INSERT INTO template VALUES ('1','Rich Editor Page Tree','\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\nInsert/Edit Link\r\n\r\n
\r\n Link Settings\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Link URL:
Link Target:\r\n
 
\r\n
\r\n \r\n\r\n
\r\n
\r\n\r\n\r\n
\r\n Available Page Tree\r\n\r\n\r\n \')\">
\r\n
\r\n\r\n
\r\n \r\n
\r\n\r\n','richEditor/pagetree',1,1); +UPDATE template set template = '\r\n \r\n \r\n <tmpl_var session.page.title> - <tmpl_var session.setting.companyName>\r\n \r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n\r\n \r\n ' where templateId = '10' and namespace='style'; delete from userProfileField where fieldName='richEditor'; INSERT INTO userProfileField VALUES ('richEditor','WebGUI::International::get(496)',1,0,'selectList','{5=>WebGUI::International::get(880),\r\nnone=>WebGUI::International::get(881),\r\n\'tinymce\'=>WebGUI::International::get(\"tinymce\")\n}','[\'tinymce\']',11,'4',0,1); update userProfileData set fieldData='tinyMCE' where fieldName='richEditor'; +UPDATE template set template = '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\nInsert/Edit Link\r\n\r\n
\r\n Link Settings\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Link URL:
Link Target:\r\n
 
\r\n
\r\n \r\n\r\n
\r\n
\r\n\r\n\r\n
\r\n Available Page Tree\r\n
\r\n\r\n \')\">
\r\n
\r\n
\r\n
\r\n \r\n
\r\n\r\n' where namespace='richEditor/pagetree' && templateId = '1'; diff --git a/www/extras/htmlArea/editor.html b/www/extras/htmlArea/editor.html deleted file mode 100644 index 715f4eca7..000000000 --- a/www/extras/htmlArea/editor.html +++ /dev/null @@ -1,64 +0,0 @@ -Rich Edit - - - - - - - - - - - -
- - - - - - - -
- -setHTML - - - - -
- diff --git a/www/extras/htmlArea/editor.js b/www/extras/htmlArea/editor.js deleted file mode 100644 index 1f3b70707..000000000 --- a/www/extras/htmlArea/editor.js +++ /dev/null @@ -1,1914 +0,0 @@ -// -// htmlArea v2.02 - Copyright (c) 2002 interactivetools.com, inc. -// This copyright notice MUST stay intact for use (see license.txt). -// -// A free WYSIWYG editor replacement for '; - - // add context menu - editor += ''; - - // hide original textarea and insert htmlarea after it - if (!config.debug) { document.all[objname].style.display = "none"; } - - if (config.plaintextInput) { // replace nextlines with breaks - var contents = document.all[objname].value; - contents = contents.replace(/\r\n/g, '
'); - contents = contents.replace(/\n/g, '
'); - contents = contents.replace(/\r/g, '
'); - document.all[objname].value = contents; - } - - // insert wysiwyg - document.all[objname].insertAdjacentHTML('afterEnd', editor) - - // convert htmlarea from textarea to wysiwyg editor - editor_setmode(objname, 'init'); - - // call filterOutput when user submits form - for (var idx=0; idx < document.forms.length; idx++) { - var r = document.forms[idx].attachEvent('onsubmit', function() { editor_filterOutput(objname); }); - if (!r) { alert("Error attaching event to form!"); } - } - -return true; - -} - -/* ---------------------------------------------------------------------- *\ - Function : editor_action - Description : perform an editor command on selected editor content - Usage : - Arguments : button_id - button id string with editor and action name -\* ---------------------------------------------------------------------- */ - -function editor_action(button_id) { - - // split up button name into "editorID" and "cmdID" - var BtnParts = Array(); - BtnParts = button_id.split("_"); - var objname = button_id.replace(/^_(.*)_[^_]*$/, '$1'); - var cmdID = BtnParts[ BtnParts.length-1 ]; - var button_obj = document.all[button_id]; - var editor_obj = document.all["_" +objname + "_editor"]; - var config = document.all[objname].config; - - // help popup - if (cmdID == 'showhelp') { - window.open(_editor_url + "popups/editor_help.html", 'EditorHelp'); - return; - } - - // popup editor - if (cmdID == 'popupeditor') { - window.open(_editor_url + "popups/fullscreen.html?"+objname, - 'FullScreen', - 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480'); - return; - } - - // inserted by lvn : showborders - - if (cmdID == 'ShowBorder'){ - var btnObj = document.all["_" +objname+ "_ShowBorder"]; - if (config.showborders){ // toggle is on : put borders off - nullBorders(editor_obj.contentWindow.document,'hide'); - btnObj.className = 'btn'; - config.showborders = false; - } else { - nullBorders(editor_obj.contentWindow.document,'show'); - btnObj.className = 'btnDown'; - config.showborders = true; - } - return; - } -// end insert by lvn - - // check editor mode (don't perform actions in textedit mode) - if (editor_obj.tagName.toLowerCase() == 'textarea') { return; } - - var editdoc = editor_obj.contentWindow.document; - editor_focus(editor_obj); - - // get index and value for pulldowns - var idx = button_obj.selectedIndex; - var val = (idx != null) ? button_obj[ idx ].value : null; - - if (0) {} // use else if for easy cutting and pasting - - // - // CUSTOM BUTTONS START HERE - // - // special characters - else if (cmdID == 'SpecChar') { - var newchar = showModalDialog(_editor_url + "popups/insert_char.html", '', "dialogWidth:493px; dialogHeight: 140px; resizable: no; help: no; status: no; scroll: no;"); - if (newchar == '') {return;} - else {editor_insertHTML(objname,newchar);} - } - - // Insert a smiley - else if (cmdID == 'Smileys') { // insert some text from a popup window - var myTitle = "Insert a Smiley"; - var myText = showModalDialog(_editor_url + "popups/insert_smiley.html", - myTitle, // str or obj specified here can be read from dialog as "window.dialogArguments" - "resizable: yes; help: no; status: no; scroll: yes; "); - if (myText) { editor_insertHTML(objname, myText); } - } - - // Find function - if (cmdID == 'Find') { - setGlobalVar ("_editor_field",objname); - var findRange = editor_obj.contentWindow.document.body.createTextRange(); - showModelessDialog(_editor_url + "popups/find.html",window, "resizable: no; help: no; status: no; scroll: no; "); - return; - } - - // Custom1 - else if (cmdID == 'custom1') { - alert("Hello, I am custom button 1!"); - } - - // Custom2 - else if (cmdID == 'Macros') { // insert some text from a popup window - var myTitle = "Insert WebGUI Macro"; - var myText = showModalDialog(_editor_url + "popups/macros.html", - myTitle, // str or obj specified here can be read from dialog as "window.dialogArguments" - "resizable: yes; help: no; status: no; scroll: no; "); - if (myText) { editor_insertHTML(objname, myText); } - } - - // inserted by lvn : table operations - else if ( cmdID == 'TableProperties' || - cmdID == 'RowProperties' || - cmdID == 'InsertRowBefore' || - cmdID == 'InsertRowAfter' || - cmdID == 'DeleteRow' || - cmdID == 'InsertColumnBefore' || - cmdID == 'InsertColumnAfter' || - cmdID == 'DeleteColumn' || - cmdID == 'CellProperties' || - cmdID == 'InsertCellBefore' || - cmdID == 'InsertCellAfter' || - cmdID == 'SplitCell' || - cmdID == 'MergeRows' || - cmdID == 'SplitRow' || - cmdID == 'MergeCells' || - cmdID == 'DeleteCell' ) { - // table operations - var table_src_element = editdoc.selection.createRange().parentElement(); - while (table_src_element != null && table_src_element.tagName != 'TD' && table_src_element.tagName != 'TH'){ - table_src_element = table_src_element.parentElement; - } - if (table_src_element == null) { - alert('Table operations not allowed here'); - } else { - tables_action(button_id,table_src_element); - } - } -// end insert by lvn - - // Custom3 - else if (cmdID == 'custom3') { // insert some text - editor_insertHTML(objname, "It's easy to add buttons that insert text!"); - } - else if (cmdID == 'spell') { - if(! spellEnabled()) alert('Unable to start MS Word for spell checking.\nActive X is not enabled for this site or MS Word is not available.'); - else { - editdoc.execCommand('copy'); - if (editdoc.selection.createRange().text != "") {CheckDocument(); return true;} - else {alert('Nothing to spellcheck. Please select the text you want HTMLArea to check.\nTo avoid unexpected results, we recommend you to select complete paragraphs.');} - } - } - - else if (cmdID == 'word') { - var oTags = editdoc.all.tags("SPAN"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - oTags[i].outerHTML = oTags[i].innerHTML; - } -} - -oTags = editdoc.all.tags("FONT"); -if (oTags != null) { -for (var i = oTags.length - 1; i >= 0; i--) { -oTags[i].outerHTML = oTags[i].innerHTML; -} -} - - oTags = editdoc.all.tags("P"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); - } -} - oTags = editdoc.all.tags("H1"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); -} -} - oTags = editdoc.all.tags("H2"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); -} -} - oTags = editdoc.all.tags("H3"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); -} -} - oTags = editdoc.all.tags("H4"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); -} -} - oTags = editdoc.all.tags("OL"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); -} -} - oTags = editdoc.all.tags("UL"); - if (oTags != null) { - for (var i = oTags.length - 1; i >= 0; i--) { - cleanEmptyTag(oTags[i]); } -} -} - - - // - // END OF CUSTOM BUTTONS - // - - // FontName - else if (cmdID == 'FontName' && val) { - editdoc.execCommand(cmdID,0,val); - } - - // FontSize - else if (cmdID == 'FontSize' && val) { - editdoc.execCommand(cmdID,0,val); - } - - // FontStyle (change CSS className) - else if (cmdID == 'FontStyle' && val) { - editdoc.execCommand('RemoveFormat'); - editdoc.execCommand('FontName',0,'636c6173734e616d6520706c616365686f6c646572'); - var fontArray = editdoc.all.tags("FONT"); - for (i=0; i tag. Now let's extract... - // 1. the href attribute - var href_value = fullElement.split(/href=/); - href_value2 = href_value[1].split(/\s|>/); - href_attribute = href_value2[0]; - - // 2. the target attribute - if (fullElement.search(/target=/) != -1) { - var tar = fullElement.split(/target=/); - tar2 = tar[1].split(/\s|>/); - tar_attribute = tar2[0]; - } - else { tar_attribute = ''; } - - // 3. the link text - var linkText2 = fullElement.split(/>/); - var lt = linkText2[1].split(/ tr.childNodes.length){ - if (where > tr.cells.length){ - tr.insertCell(); - } else { - tr.insertCell(where); - } - } - } - function deleteColumn(tbody,where) { - //for (var i=0;i < tbody.childNodes.length;i++) { - for (var i=0;i < tbody.rows.length;i++) { - //var tr = tbody.childNodes(i); - var tr = tbody.rows(i); - //if (tr.childNodes.length - 1 < where){ - if (tr.cells.length - 1 < where){ - //tr.deleteCell(tr.childNodes.length - 1); - tr.deleteCell(tr.cells.length - 1); - } else { - tr.deleteCell(where); - } - //tr = tbody.childNodes(i); - tr = tbody.rows(i); - //if (tr.childNodes.length == 0){ - if (tr.cells.length == 0){ - tbody.deleteRow(i); - } - } - } - function splitCell(tbody,currTr,currTd){ - if (currTd.colSpan > 1) { - // rowspan > 1 just insert cell and decrease colspan - currTd.colSpan = currTd.colSpan - 1; - currTr.insertCell(currTd.cellIndex + 1); - } else { - // rowspan = 1 increase colspan for all other rows and insert cell in current row - for (var i=0;i < tbody.rows.length;i++) { - var tr = tbody.rows(i); - var td = tr.cells(currTd.cellIndex); - if (i == currTr.rowIndex) { - tr.insertCell(currTd.cellIndex + 1); - } else { - td.colSpan = td.colSpan + 1; - } - } - } - } - // commented out! - /* function mergeCells(tbody,currTr,currTd){ - // check if leftmost of cells to merge - var left = false; - for (var i=0;i < tbody.rows.length;i++) { - var tr = tbody.rows(i); - var allTd = tr.cells; - if (currTd.cellIndex + 2 > allTd.length) { - left = false; - break; - } else { - var td = tr.cells(currTd.cellIndex); - if (i != currTr.rowIndex) { - if (td.colSpan > 1) { - left = true; - } else { - left = false; - break; - } - } - } - } - if (left){ - for (var i=0;i < tbody.rows.length;i++){ - var tr = tbody.rows(i); - var td = tr.cells(currTd.cellIndex); - if (currTd.cellIndex + 2 > tr.length) { - alert("You can't merge cells here."); - return; - } else { - var mergeCell = tr.cells(currTd.cellIndex + 1); - if (i == currTr.rowIndex) { - // merge the contents of the current cell with the one on the right - currTd.innerHTML = currTd.innerHTML + mergeCell.innerHTML; - currTr.deleteCell(currTd.cellIndex + 1); - } else { - // decrease colspan for non current rows - td.colSpan = td.colSpan - 1; - } - } - } - } else { - alert('Select the leftmost cell of the split to merge.'); - } - } */ - function mergeCells(tbody,currTr,currTd){ - //first check if there are cells to the right - if (currTd.cellIndex < currTr.cells.length-1) { - //get current colspan and cell to be merged's colspan - //add the two together to get the new one, - //move the conetent and delete the right one - var currColSpan = currTd.colSpan ; - var mergeCellColSpan = currTr.cells(currTd.cellIndex+1).colSpan; - var mergeCell = currTr.cells(currTd.cellIndex+1); - currTd.innerHTML = currTd.innerHTML + mergeCell.innerHTML; - currTr.deleteCell(currTd.cellIndex + 1); - currTd.colSpan = currColSpan+mergeCellColSpan ; - } else { - alert('Select the leftmost cell of the split to merge.'); - } - } - function splitRow(tbody,currTr,currTd){ - // check rowspan on other cells - if (currTd.rowSpan > 1){ - currTd.rowSpan = currTd.rowSpan - 1; - var tr = tbody.rows(currTr.rowIndex + 1); - var where = 0; - for (var i=0;i < currTr.cells.length;i++) { - if (i < currTd.cellIndex){ - if (currTr.cells(i).rowSpan < 2){where++;} - } - } - tr.insertCell(where); - } else { - for (var i=0;i < currTr.cells.length;i++) { - var td = currTr.cells(i); - if (i == currTd.cellIndex) { - tr = tbody.insertRow(currTr.rowIndex + 1); - tr.insertCell(0); - } else { - td.rowSpan = td.rowSpan + 1; - } - } - } - } - function mergeRows(tbody,currTr,currTd){ - // check if topmost of cells to merge - var top = false; - if (currTd.rowSpan < 2){ - for (var i=0;i < currTr.cells.length;i++) { - if (i !== currTd.cellIndex) { - if (currTr.cells(i).rowSpan > 1){ - top = true; - break; - } - } - } - } - if (top){ - return; - } else { - alert('Select the topmost row of the split to merge.'); - } - } - // execute the operation depending on the given command - switch(cmdID) { - case 'CreateCaption' : table.createCaption();break; - case 'DeleteCaption' : table.deleteCaption();break; - case 'CreateTHead' : table.createTHead();break; - case 'DeleteTHead' : table.deleteTHead();break; - case 'CreateTFoot' : table.createTFoot();break; - case 'DeleteTFoot' : table.deleteTFoot();break; - case 'InsertRowTop' : newtr = tbody.insertRow(0);insertRowDetails(tr,newtr);break; - case 'InsertRowBottom' : newtr = tbody.insertRow(-1);insertRowDetails(tr,newtr);break; - case 'InsertRowBefore' : newtr = tbody.insertRow(tr.rowIndex);insertRowDetails(tr,newtr);break; - case 'InsertRowAfter' : newtr = tbody.insertRow(tr.rowIndex+1);insertRowDetails(tr,newtr);break; - case 'InsertRowStart' : newtr = tbody.insertRow(0);insertRowDetails(tr,newtr);break; - case 'DeleteRow' : tbody.deleteRow(tr.rowIndex);break; - case 'InsertColumnLeft' : insertColumn(tbody,0);break; - case 'InsertColumnRight' : insertColumn(tbody,-1);break; - case 'InsertColumnBefore' : insertColumn(tbody,td.cellIndex);break; - case 'InsertColumnAfter' : insertColumn(tbody,td.cellIndex+1);break; - case 'DeleteColumn' : deleteColumn(tbody,td.cellIndex);break; - case 'InsertCellLeft' : tr.insertCell(0);break; - case 'InsertCellRight' : tr.insertCell(-1);break; - case 'InsertCellBefore' : tr.insertCell(td.cellIndex);break; - case 'InsertCellAfter' : tr.insertCell(td.cellIndex+1);break; - case 'InsertCellStart' : tr.insertCell(0);break; - case 'DeleteCell' : tr.deleteCell(td.cellIndex);break; - case 'SplitCell' : splitCell(tbody,tr,td);break; - case 'MergeCells' : mergeCells(tbody,tr,td);break; - case 'SplitRow' : splitRow(tbody,tr,td);break; - case 'MergeRows' : mergeRows(tbody,tr,td);break; -// inserted by lvn : property pallettes - case 'TableProperties' : nullBorders(editor_obj.contentWindow.document,'hide'); - setGlobalVar('_editor_field',objname); - setGlobalVar('_editor_table',table); - showModalDialog(_editor_url + "popups/tableprop.html?"+objname, - window, - "resizable: yes; help: no; status: no; scroll: no; "); - td.focus(); - break; - case 'RowProperties' : setGlobalVar('_editor_field',objname); - setGlobalVar('_editor_row',tr); - showModalDialog(_editor_url + "popups/rowprop.html?"+objname, - window, - "resizable: yes; help: no; status: no; scroll: no; "); - td.focus(); - break; - case 'CellProperties' : setGlobalVar('_editor_field',objname); - setGlobalVar('_editor_cell',td); - showModalDialog(_editor_url + "popups/cellprop.html?"+objname, - window, - "resizable: yes; help: no; status: no; scroll: no; "); - td.focus(); - break; -// end insert lvn property pallettes - default : break; - } - // if 0 table borders and the switch to show them is on: show them - if (config.showborders){ // toggle is on : show null borders - nullBorders(editor_obj.contentWindow.document,'show'); - } - } - } - return; -} -// end insert by lvn - -/* ---------------------------------------------------------------------- *\ - Function : MS-Word clean-up - Description : replace textarea with wysiwyg editor - Usage : editor_generate("textarea_id",[height],[width]); - Arguments : objname - ID of textarea to replace - w - width of wysiwyg editor - h - height of wysiwyg editor -\* ---------------------------------------------------------------------- */ -function cleanEmptyTag(oElem) { -if (oElem.hasChildNodes) { -var tmp = oElem -for (var k = tmp.children.length; k >= 0; k--) { -if (tmp.children[k] != null) { -cleanEmptyTag(tmp.children[k]); -} -} - -} - -var oAttribs = oElem.attributes; -if (oAttribs != null) { -for (var j = oAttribs.length - 1; j >=0; j--) { -var oAttrib = oAttribs[j]; -if (oAttrib.nodeValue != null) { -oAttribs.removeNamedItem('class') -} - } - } - oElem.style.cssText = ''; -if (oElem.innerHTML == '' || oElem.innerHTML == ' ') { -oElem.outerHTML = ''; } -} - -function cleanTable(oElem) { - oElem.style.cssText = ''; - var oAttribs = oElem.attributes; - if (oAttribs != null) { - for (var j = oAttribs.length - 1; j >=0; j--) { - var oAttrib = oAttribs[j]; - if (oAttrib.nodeValue != null) { - oAttribs.removeNamedItem('class') - } - } - } - var oTR = oElem.rows; - if (oTR != null) { - for (var r = oTR.length - 1; r >= 0; r--) { - oTR[r].style.cssText = ''; - } - } - var oTD = oElem.cells; - if (oTD != null) { - for (var t = oTD.length - 1; t >= 0; t--) { - oTD[t].style.cssText = ''; - } - } -} -/* ---------------------------------------------------------------------- *\ - Function : editor_event - Description : called everytime an editor event occurs - Usage : editor_event(objname, runDelay, eventName) - Arguments : objname - ID of textarea to replace - runDelay: -1 = run now, no matter what - 0 = run now, if allowed - 1000 = run in 1 sec, if allowed at that point -\* ---------------------------------------------------------------------- */ - -function editor_event(objname,runDelay) { - var config = document.all[objname].config; - var editor_obj = document.all["_" +objname+ "_editor"]; // html editor object - if (runDelay == null) { runDelay = 0; } - var editdoc; - var editEvent = editor_obj.contentWindow ? editor_obj.contentWindow.event : event; - - // catch keypress events - if (editEvent && editEvent.keyCode) { - var ord = editEvent.keyCode; // ascii order of key pressed - var ctrlKey = editEvent.ctrlKey; - var altKey = editEvent.altKey; - var shiftKey = editEvent.shiftKey; - - if (ord == 16) { return; } // ignore shift key by itself - if (ord == 17) { return; } // ignore ctrl key by itself - if (ord == 18) { return; } // ignore alt key by itself - - - // cancel ENTER key and insert
instead -// if (ord == 13 && editEvent.type == 'keypress') { -// editEvent.returnValue = false; -// editor_insertHTML(objname, "
"); -// return; -// } - - if (ctrlKey && (ord == 122 || ord == 90)) { // catch ctrl-z (UNDO) -// TODO: Add our own undo/redo functionality -// editEvent.cancelBubble = true; - return; - } - if ((ctrlKey && (ord == 121 || ord == 89)) || - ctrlKey && shiftKey && (ord == 122 || ord == 90)) { // catch ctrl-y, ctrl-shift-z (REDO) -// TODO: Add our own undo/redo functionality - return; - } - } - - // setup timer for delayed updates (some events take time to complete) - if (runDelay > 0) { return setTimeout(function(){ editor_event(objname); }, runDelay); } - - // don't execute more than 3 times a second (eg: too soon after last execution) - if (this.tooSoon == 1 && runDelay >= 0) { this.queue = 1; return; } // queue all but urgent events - this.tooSoon = 1; - setTimeout(function(){ - this.tooSoon = 0; - if (this.queue) { editor_event(objname,-1); }; - this.queue = 0; - }, 333); // 1/3 second - - -// editor_updateOutput(objname); - editor_updateToolbar(objname); - -} - -/* ---------------------------------------------------------------------- *\ - Function : editor_updateToolbar - Description : update toolbar state - Usage : - Arguments : objname - ID of textarea to replace - action - enable, disable, or update (default action) -\* ---------------------------------------------------------------------- */ - -function editor_updateToolbar(objname,action) { - var config = document.all[objname].config; - var editor_obj = document.all["_" +objname+ "_editor"]; - - // disable or enable toolbar - - if (action == "enable" || action == "disable") { - var tbItems = new Array('FontName','FontSize','FontStyle'); // add pulldowns - for (var btnName in config.btnList) { tbItems.push(config.btnList[btnName][0]); } // add buttons - - for (var idxN in tbItems) { - var cmdID = tbItems[idxN].toLowerCase(); - var tbObj = document.all["_" +objname+ "_" +tbItems[idxN]]; - if (cmdID == "htmlmode" || cmdID == "about" || cmdID == "showhelp" || cmdID == "popupeditor") { continue; } // don't change these buttons - if (tbObj == null) { continue; } - var isBtn = (tbObj.tagName.toLowerCase() == "button") ? true : false; - - if (action == "enable") { tbObj.disabled = false; if (isBtn) { tbObj.className = 'btn' }} - if (action == "disable") { tbObj.disabled = true; if (isBtn) { tbObj.className = 'btnNA' }} - } - return; - } - - // update toolbar state - - if (editor_obj.tagName.toLowerCase() == 'textarea') { return; } // don't update state in textedit mode - var editdoc = editor_obj.contentWindow.document; - - // Set FontName pulldown - var fontname_obj = document.all["_" +objname+ "_FontName"]; - if (fontname_obj) { - var fontname = editdoc.queryCommandValue('FontName'); - if (fontname == null) { fontname_obj.value = null; } - else { - var found = 0; - for (i=0; i