EnsPortal.Util.CodeEditorBase
abstract class EnsPortal.Util.CodeEditorBase
Base class to implement common code editor code to allow for code indentation and similar functionality.Method Inventory
Methods
clientmethod codeKeyPress(zenControl, evt, language="") [ Language = javascript ]
Keypress handler for Zen textarea controls which automatically inserts the indentation
used on the previous line of the control when the user hits the Enter key.
Note that the actual whitespace determination is performed in getPrevWhitespace()().
clientmethod getPrevWhitespace(previousData, codelanguage="") [ Language = javascript ]
Helper method to supply anticipated indentiation required based on preceeding code input lines (previousData)
Where indent of increment was automatically provided for new line starting "context.TheList ..."
Where indent was automatically decremented on new line after "pass" keyword
At end of line with "context ... " line, enter key was pressed three times.
The increment is automatically decremented so that the "if" command starts in a lower code block scope
In this example no indent was needed.
Object Script and Basic
Continue previous indent or default to indent of two whitespace charactersPython code entry conveniences
Feature Colon ":"
When the user types colon ":" ( ignoring trailing white space) + Enter key. This will automatically increment indent for new or nested blockfor item in range(0,int(request.StringVaue)): context.TheList.Insert(item+1)
Feature "pass" keyword
When a line only contains pass keyword anticipate placeholder for code block and decrement indent on the following lineif (x==1): pass else: pass
Feature Empty lines
Second empty line indicates end of block scope When two sequential empty lines ( ignoring whitespace ) are typed, the following new line will decrement the indentfor item in range(0,int(request.StringValue)): context.TheList.Insert(item+1) if (x==1): pass