Index: typo3/sysext/t3editor/jslib/t3editor.js =================================================================== --- typo3/sysext/t3editor/jslib/t3editor.js (revision 6273) +++ typo3/sysext/t3editor/jslib/t3editor.js (working copy) @@ -70,14 +70,6 @@ }); this.outerdiv.appendChild(this.modalOverlay); -/* - // wrapping the Toolbar - this.toolbar_wrap = new Element("DIV", { - "class": "t3e_toolbar_wrap" - }); - this.outerdiv.appendChild(this.toolbar_wrap); -*/ - // wrapping the linenumbers this.linenum_wrap = new Element("DIV", { "class": "t3e_linenum_wrap" @@ -153,7 +145,9 @@ // hide the textarea this.textarea.hide(); - this.saveButtons = $(this.textarea.form).getInputs('image', 'submit'); + // get the form object (needed for Ajax saving) + var form = $(this.textarea.form); + this.saveButtons = form.getInputs('image', 'submit'); // initialize ajax saving events this.saveFunctionEvent = this.saveFunction.bind(this); Index: typo3/sysext/t3editor/jslib/ts_codecompletion/tscodecompletion.js =================================================================== --- typo3/sysext/t3editor/jslib/ts_codecompletion/tscodecompletion.js (revision 6273) +++ typo3/sysext/t3editor/jslib/ts_codecompletion/tscodecompletion.js (working copy) @@ -39,7 +39,7 @@ * @param outerdiv div that contains the editor, for DOM manipulation * @return A new TsCodeCompletion instance */ -var TsCodeCompletion = function(codeMirror,outerdiv) { +var TsCodeCompletion = function(codeMirror, outerdiv) { // private Vars var tsRef = new TsRef(); var mirror = codeMirror; @@ -57,23 +57,22 @@ var linefeedsPrepared = false; var currentCursorPosition = null; - Event.observe(document,'mousemove',saveMousePos, false); + Event.observe(document, 'mousemove', saveMousePos, false); // load the external templates ts-setup into extTsObjTree var extTsObjTree = new Object(); - var parser = new TsParser(tsRef,extTsObjTree); + var parser = new TsParser(tsRef, extTsObjTree); loadExtTemplatesAsync(); - //Event.observe(document, 'mousemove', setMousePos); - // TODO port pugin to t3editor.js + // TODO port plugin to t3editor.js // plugin-array will be retrieved through AJAX from the conf array // plugins can be attached by regular TYPO3-extensions var plugins = []; -// we add the description plugin here because its packed with the codecompletion currently -// maybe we will swap it to an external plugin in future + // we add the description plugin here because its packed with the codecompletion currently + // maybe we will swap it to an external plugin in future var plugin = new Object(); plugin.extpath = PATH_t3e; plugin.classpath = 'jslib/ts_codecompletion/descriptionPlugin.js'; @@ -82,28 +81,23 @@ plugins.push(plugin); -// TODO cleanup -// to roll back linebreaks inserted by hitting enter, the current node has to be stored before the codecompletion outside of the eventlistener -// var nodeBeforeInsert; - - var codeCompleteBox = new Element("DIV", { "class": "t3e_codeCompleteBox" }); codeCompleteBox.hide(); outerdiv.appendChild(codeCompleteBox); -// TODO do we need this toolbar? + // TODO do we need this toolbar? var toolbardiv = new Element("DIV", { "class": "t3e_toolbar" }); toolbardiv.show(); outerdiv.appendChild(toolbardiv); -// load the external xml-reference + // load the external xml-reference tsRef.loadTsrefAsync(); -// plugins will be provided with the pluginContext + // plugins will be provided with the pluginContext var pluginContext = new Object(); pluginContext.outerdiv = outerdiv; pluginContext.codeCompleteBox = codeCompleteBox; @@ -111,9 +105,10 @@ pluginContext.tsRef = tsRef; pluginContext.parser = parser; pluginContext.plugins = plugins; + pluginContext.codeMirror = codeMirror; -// should we use a pluginmanager so no for loops are required on each hook? -// e.g. pluginmanager.call('afterKeyUp',....); + // should we use a pluginmanager so no for loops are required on each hook? + // e.g. pluginmanager.call('afterKeyUp',....); loadPluginArray(); @@ -144,7 +139,7 @@ } /** - * Instantiates all plugins and adds the instances to the plugin array + * instantiates all plugins and adds the instances to the plugin array */ function loadPlugins() { for (var i = 0; i < plugins.length ; i++) { @@ -157,15 +152,15 @@ } /** - * Makes a single plugin instance + * makes a single plugin instance */ function makeInstance(plugin, i) { try { var localname = "plugins[" + i + "].obj"; - eval(localname+' = new '+plugin.classname+'();'); + eval(localname+' = new ' + plugin.classname + '();'); var obj = eval(localname); } catch(e) { - throw("error occured while trying to make new instance of \""+plugin.classname+"\"! maybe syntax error or wrong filepath?"); + throw("error occured while trying to make new instance of \"" + plugin.classname + "\"! maybe syntax error or wrong filepath?"); return; } obj.init(pluginContext,plugin); @@ -199,7 +194,8 @@ var childNode; // if the childnode has a value and there is a parto of a reference operator ('<') // and it does not look like a html tag ('>') - if (childNodes[key].v && childNodes[key].v[0] == '<' && childNodes[key].v.indexOf('>') == -1 ){ + if (childNodes[key].v && childNodes[key].v[0] == '<' + && childNodes[key].v.indexOf('>') == -1 ) { var path = childNodes[key].v.replace(/ mouseover was triggered by scrolling of the result list -> don't highlight another word (return) - if(mousePos.x == event.clientX && mousePos.y == event.clientY) + if(mousePos.x == event.clientX && mousePos.y == event.clientY) { return; + } mousePos.x = event.clientX; mousePos.y = event.clientY; } @@ -567,9 +577,13 @@ this.insertCurrWordAtCursor = function(){ insertCurrWordAtCursor(); } - // insert selected word into text from codecompletebox + + /** + * insert selected word into text from codecompletebox + */ function insertCurrWordAtCursor() { var word = proposals[currWord].word; + // tokenize current line mirror.editor.highlightAtCursor(); var cursorNode = getCursorNode(); if (cursorNode.currentText @@ -583,49 +597,14 @@ var select = mirror.editor.win.select; var start = select.cursorPos(mirror.editor.container, true), end = select.cursorPos(mirror.editor.container, false); - if (!start || !end) return; + if (!start || !end) { + return; + } select.setCursorPos(mirror.editor.container, end, end); } -// TODO remove if unneeded /** - * determines what kind of completion is possible and return a array of proposals - * if we have no suggestions, the list will be empty - */ - /* -function getCompletionResult(startNode, cursor) { -var compResult; -buildTsObjTree(startNode, cursor); - -// is there an operator left of the current curser Position (= in the currentLine) -var op = getOperator(currentLine); -if (op != -1) { - // is it a reference/copy operator? - if (op.indexOf("<") != -1) { - // show path completion - compResult = getPathCompletion(currentTsTreeNode); - } else { - // show what ????? - // biggest mystery!! - // think about! - } - // no operator in the line -} else { - - // whitespace after last characters? -> show operators - if(currentLine.substr(-1,1) == " ") { - compResult = getOperatorCompletion(); - // no whitespace? we're in a path! - } else { - compResult = getPathCompletion(currentTsTreeNode); - } -} - -return compResult; -}*/ - - /** * retrieves the get-variable with the specified name */ function getGetVar(name){ @@ -651,7 +630,7 @@ } } while(name_index != -1); -// Restores all the blank spaces. + // Restores all the blank spaces. var space = return_value.indexOf('+'); while(space != -1) { return_value = return_value.substr(0, space) + ' ' + Index: typo3/sysext/t3editor/lib/ts_codecompletion/class.tx_t3editor_codecompletion.php =================================================================== --- typo3/sysext/t3editor/lib/ts_codecompletion/class.tx_t3editor_codecompletion.php (revision 6273) +++ typo3/sysext/t3editor/lib/ts_codecompletion/class.tx_t3editor_codecompletion.php (working copy) @@ -25,6 +25,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +require_once(PATH_t3lib.'class.t3lib_page.php'); $GLOBALS['LANG']->includeLLFile('EXT:t3editor/locallang.xml'); class tx_t3editor_codecompletion { Index: typo3/sysext/t3editor/class.tx_t3editor.php =================================================================== --- typo3/sysext/t3editor/class.tx_t3editor.php (revision 6273) +++ typo3/sysext/t3editor/class.tx_t3editor.php (working copy) @@ -394,6 +394,8 @@ $POST = t3lib_div::_POST(); if ($POST['submit']) { + require_once(PATH_t3lib . 'class.t3lib_tcemain.php'); + // Set the data to be saved $recData = array(); Index: typo3/sysext/t3editor/jslib/ts_codecompletion/descriptionPlugin.js =================================================================== --- typo3/sysext/t3editor/jslib/ts_codecompletion/descriptionPlugin.js (revision 6273) +++ typo3/sysext/t3editor/jslib/ts_codecompletion/descriptionPlugin.js (working copy) @@ -87,10 +87,9 @@ descriptionBox.hide(); } - descriptionBox.scrollTop = 0; descriptionBox.style.overflowY = 'scroll'; - descriptionBox.style.class = 'descriptionBox'; + descriptionBox.addClassName('descriptionBox'); var leftOffset = parseInt(completionBox.getStyle('left').gsub('px','')) + parseInt(completionBox.getStyle('width').gsub('px','')) + 5; leftOffset += 'px'; descriptionBox.setStyle({ Index: typo3/sysext/t3editor/jslib/ts_codecompletion/tsparser.js =================================================================== --- typo3/sysext/t3editor/jslib/ts_codecompletion/tsparser.js (revision 6273) +++ typo3/sysext/t3editor/jslib/ts_codecompletion/tsparser.js (working copy) @@ -84,13 +84,14 @@ return node.v; } else { var type = this.getNodeTypeFromTsref(); - if(type) + if(type) { return type; - else + } else { return ''; } } } + } /** * This method will try to resolve the properties recursively from right @@ -125,7 +126,9 @@ var extTree = extTsObjTree; var path = this.extPath.split('.'); var pathSeg; - if (path == "") return extTree; + if (path == "") { + return extTree; + } var i; for(i=0;i0) { node = currentNode.currentText; - if (node[0] == '#')stack.push('#'); - if (node == '(')stack.push('('); - if (node[0] == '/' && node[1]=='*')stack.push('/*'); + if (node[0] == '#') { + stack.push('#'); + } + if (node == '(') { + stack.push('('); + } + if (node[0] == '/' && node[1]=='*') { + stack.push('/*'); + } if (node == '{') { // TODO: ignore whole block if wrong whitespaces in this line stack.push('{'); @@ -230,8 +239,6 @@ ignoreLine = true; } - - if (node == ')') { stack.popIfLastElementEquals('('); } @@ -393,12 +400,12 @@ // step through the path from left to right for(i=0;i