📄 textareaitem.js
字号:
// disable native autoComplete (this._getAutoCompleteSetting() != "native" ? " AUTOCOMPLETE=OFF " : ""), // enable / disable native spellcheck in Moz // Same setting in Safari - see comments in TextItem.js ((isc.Browser.isMoz || isc.Browser.isSafari) ? (this.getBrowserSpellCheck() ? " spellcheck=true" : " spellcheck=false") : null), " WRAP=", this.wrap, " TABINDEX=", this._getElementTabIndex(), (this.showTitle == false && this.accessKey != null ? " ACCESSKEY=" + this.accessKey : ""), // If this browser supports the "input" event write out a handler for it. (this._willHandleInput ? " ONINPUT='" + this.getID() + "._handleInput()'" : null), // If the readonly property is set, set it on the handle too (this.readOnly ? " READONLY=TRUE" : null), // Ensure we pass events through the ISC event handling system. " handleNativeEvents=false></TEXTAREA>" ); } //this.logWarn("textArea HTML:"+ output); return output.release(); }, // Override _nativeElementBlur to fire 'change' explicitly in response to blur rather than // relying on the native 'ONCHANGE' handler method // (as with textItem) _nativeElementBlur : function (element, itemID) { var returnVal = this.Super("_nativeElementBlur", arguments); if (this.changeOnBlur) this.form.elementChanged(this); else { var elementValue = this.getElementValue(); // unmap the value if necessary if (this.mapDisplayToValue) { elementValue = this.mapDisplayToValue(elementValue); } if (this._value != elementValue) this.form.elementChanged(this); } return returnVal; }, //> @method textAreaItem.getElementStyleHTML() (I) // Get the HTML string used to set the visual characteristics for a textArea item. // This includes the STYLE=... & CLASS=... properties to be written into this // form item's element. // This varies by platform, as we attempt to make Netscape think in pixels rather than // characters and rows // // @group appearance // @return (string) String of HTML containing STYLE=... & CLASS=... properties for // this items element. // //< getElementStyleHTML : function () { var width = this.getTextBoxWidth(), height = this.getTextBoxHeight(); return isc.StringBuffer.concat( " CLASS='" + this.getTextBoxStyle(), (isc.Browser.isMoz && this.wrap.toLowerCase() != "off" ? "' ROWS=10 COLS=10" : "'"), " STYLE='", // Ensure there's no margin(helps with sizing and v-alignment with icons) (isc.Browser.isIE ? "margin-top:-1px;margin-bottom:-1px;margin-left:0px;margin-right:0px;" : "margin:0px;"), (isc.isA.Number(width) ? "WIDTH:" + width + "px;" : ""), (isc.isA.Number(height) ? "HEIGHT:" + height + "px;" : ""), // text align property, known to be supported in IE6 and Moz/Firefox on // Windows, not supported on Safari 1.2 (this.textAlign ? "text-align:" + this.textAlign + ";" : ""), // In Mozilla we must use the 'moz-user-focus' css property to govern // whether this element can recieve focus or not. (isc.Browser.isMoz ? "-moz-user-focus:" + (this._getElementTabIndex() > 0 ? "normal;" : "ignore;") : ""), "' "); }, //> @method textAreaItem.mapValueToDisplay() (A) // Map from the internal value for this item to the display value. // @group drawing // @param internalValue (string) Internal value for this item. // @return (string) Displayed value corresponding to internal value. //< mapValueToDisplay : function (internalValue, a,b,c,d) { var value = this.invokeSuper(isc.TextAreaItem, "mapValueToDisplay", internalValue, a,b,c,d); // always display the empty string for null values, rather than "null" or "undefined" if (value == null) value = isc.emptyString; return value; }, //> @method textAreaItem.mapDisplayToValue() (A) // Map from a the display value for this item to the internal value. // @group drawing // // @param displayValue (string) Value displayed to the user. // @return (string) Internal value corresponding to that display value. //< mapDisplayToValue : function (displayValue) { var value = this._unmapKey(displayValue); // if the value to be saved is an empty string, map it to 'null' if necessary if (isc.is.emptyString(value)) value = this._emptyStringValue; return value; }, // override 'setValue' to update the data value to store when the element value is set to // the empty string. // See Text item setValue override for full description setValue : function (value) { var undef; if (value !== undef && (value == null || isc.is.emptyString(value))) this._emptyStringValue = value; // Also clear out the '_hasEditedValue' flag, used to handle line break conversions // (See comments by the 'lineBreakValue' property) delete this._hasEditedValue; return this.Super("setValue", arguments); }, // Override 'updateValue()' to set a flag on this item marking it as having been edited. // This is used by 'getValue()' to determine whether we should convert line breaks to // the lineBreakValue for this item. updateValue : function () { this._hasEditedValue = true; return this.Super("updateValue", arguments); }, // Override getValue() to convert any line break characters to this.lineBreakValue. // See comments by this.lineBreakValue definition for why we do this. getValue : function () { var value = this.Super("getValue", arguments); if (this._hasEditedValue && isc.isA.String(value)) { // replace every line break with our line break char string if (!this._lineBreakValueRegex) this._lineBreakValueRegex = new RegExp("(\\r\\n|[\\r\\n])", "g"); value = "" + value; value = value.replace(this._lineBreakValueRegex, this.lineBreakValue); } return value; }, // SCROLLING // Add support for programmatic scrolling of TextAreas getScrollHeight : function () { var element = this._getTextBoxElement(); if (element == null) return this.getHeight(); return element.scrollHeight; }, getScrollWidth : function () { var element = this._getTextBoxElement(); if (element == null) return this.getWidth(); return element.scrollWidth; }, _hscrollOn : function () { var element = this._getTextBoxElement(); return element && element.scrollWidth > element.clientWidth; }, _vscrollOn : function () { var element = this._getTextBoxElement(); return element && element.scrollHeight > element.clientHeight; }, getScrollTop : function () { var element = this._getTextBoxElement(); if (element == null) return 0; return element.scrollTop; }, getScrollLeft : function () { var element = this._getTextBoxElement(); if (element == null) return 0; return element.scrollLeft; }, scrollTo : function (left, top) { var element = this._getTextBoxElement(); if (element == null) return; if (left != null) element.scrollLeft = left; if (top != null) element.scrollTop = top; }, scrollToTop : function () { this.scrollTo(null, 0); }, scrollToBottom : function () { var maxScroll = this.getScrollHeight() - this.getInnerHeight(); if (maxScroll >= 0) { if (this._hscrollOn()) maxScroll += this.form.getScrollbarSize(); this.scrollTo(null, maxScroll); } }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -