📄 textareaitem.js
字号:
/*
* Isomorphic SmartClient
* Version 6.5 (2008-04-30)
* Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
* "SmartClient" is a trademark of Isomorphic Software, Inc.
*
* licensing@smartclient.com
*
* http://smartclient.com/license
*/
//> @class TextAreaItem//// Class for editable multi-line text areas (uses HTML <code><TEXTAREA></code> object)// @visibility external// @example textAreaItem//<isc.ClassFactory.defineClass("TextAreaItem", "FormItem");isc.TextAreaItem.addClassProperties({ //> @type TEXTAREA_WRAP // @value isc.TextAreaItem.OFF don't allow wrapping at all OFF : "OFF", // @value isc.TextAreaItem.SOFT when the entered text reaches the edge of the text area, // wrap visibly but don't include line breaks in the textarea // value SOFT : "SOFT", VIRTUAL : "SOFT", // @value isc.TextAreaItem.HARD when the entered text reaches the edge of the text area, // insert a line break ON : "HARD", HARD : "HARD", PHYSICAL : "HARD" // // @visibility external //<});isc.TextAreaItem.addProperties({ //> @attr textAreaItem.wrap (TEXTAREA_WRAP : isc.TextAreaItem.VIRTUAL : IRW) // Text wrapping style. // @group appearance // @visibility external //< wrap:isc.TextAreaItem.VIRTUAL, //> @attr textAreaItem.width (number : 150 : IRW) // default width of this item // @group appearance // @visibility external //< width:150, //> @attr textAreaItem.height (number : 100 : IRW) // default height of this item // @group appearance // @visibility external //< height:100, //> @attr textAreaItem.textBoxStyle (FormItemBaseStyle : "textItem" : IRW) // Base CSS class to apply to this item's input element. // NOTE: See the +link{group:CompoundFormItem_skinning} discussion for special skinning considerations. // // @group appearance // @visibility external //< textBoxStyle:"textItem", //> @attr textAreaItem.length (number : null : IRW) // if set, maximum number of characters for this field // @group validation //< // FIXME: not currently implemented // length:null, //> @attr textAreaItem._getSizesDynamically (boolean : true : RA) // Dynamically figure out field sizes for this element // in Navigator so we know how to approximate its size. //< _getSizesDynamically:true, // Override redrawOnShowFormIcon - we can handle dynamically updating the item's HTML to // show / hide textArea item icons redrawOnShowIcon:false, //> @attr textAreaItem._hasDataElement (boolean : true : IRW) // Text areas have a data element. // @group formValues // @visibility internal // @see method:FormItem.hasDataElement // @see method:FormItem.getDataElement //< _hasDataElement:true, // This flag means updateState will apply the result of this.getTextBoxStyle() to this item's // data element - appropriate for native text boxes, text areas and selects. _dataElementIsTextBox:true, //> @attr textAreaItem._emptyStringValue (any : null : IRW) // Should the empty string be mapped to null, or stored as an empty string. // Updated on 'setValue(null)' or 'setValue("")' // @group formValues // @visibility internal //< _emptyStringValue:null, //> @attr textAreaItem.lineBreakValue (string : "\n" : IRW) // What character string should be used to represent line breaks?<br> // Multi-line values edited in TextAreaItems will use this string // as a line separator. // @group formValues // @visibility psft //< lineBreakValue:"\n", //> @attr textAreaItem.iconVAlign (VerticalAlignment : isc.Canvas.TOP : IR) // Align icons with the top edge of text area icons by default. // @group formIcons // @visibility external //< iconVAlign:isc.Canvas.TOP, // _nativeEventHandlers is a place to specify native event handlers to be applied to the // form item element once it has been written into the DOM (without having to override // '_applyHandlersToElement()' _nativeEventHandlers : { onmousedown : ( isc.Browser.isIE ? function () { var element = this, itemInfo = isc.DynamicForm._getItemInfoFromElement(element), item = itemInfo.item; if (item) item._setupFocusCheck(); } : null ) } //>@attr TextAreaItem.browserSpellCheck (boolean : null : IRWA) // @include FormItem.browserSpellCheck // @visibility internal //< //>@attr TextAreaItem.selectOnFocus (boolean : null : IRW) // @include FormItem.selectOnFocus // @visibility external //< //>@attr TextAreaItem.readOnly (boolean : null : IRWA) // Setter for the standard HTML readonly property of the textArea element. // If set to true, text will be non editable (though it can still be selected and copied etc) // @visibility internal //<});isc.TextAreaItem.addMethods({ // Don't allow any valueIcon to appear on a different line from the text area getTextBoxCellCSS : function () { return this._$nowrapCSS; }, _sizeTextBoxAsContentBox : function () { return isc.Browser.isStrict; }, // NOTE: this is here for doc generation //> @method textAreaItem.keyPress (A) // @group event handling // event handler for keys pressed in this item //< // _willHandleInput() // Can we use the "input" event in this browser / form item? // True for Moz and Safari, but not IE. See comments near FormItem._handleInput() _willHandleInput : function () { return !isc.Browser.isIE; }, //> @method textAreaItem.getElementHTML() (A) // @group drawing // output the HTML for a text field element // // @param value (string) Value of the element [Unused because it is more reliably set by setValue]. // @return (HTML) HTML output for this element //< getElementHTML : function (value) { // remember which element number we wrote this out as var form = this.form, formID = form.getID(), itemID = this.getItemID(), output = isc.StringBuffer.create(), valueIconHTML = this._getValueIconHTML(this._value); if (valueIconHTML != null) output.append(valueIconHTML); if (!this.showValueIconOnly) { output.append( "<TEXTAREA NAME=" , this.getElementName(), " ID=", this.getDataElementId(), // hang a flag on the element marking it as the data element for the // appropriate form item. this._getItemElementAttributeHTML(), this.getElementStyleHTML(), (this.isDisabled() ? " DISABLED " : ""),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -