Skip to content

Instantly share code, notes, and snippets.

@furusystems
Created October 27, 2009 02:34
Show Gist options
  • Save furusystems/219248 to your computer and use it in GitHub Desktop.
Save furusystems/219248 to your computer and use it in GitHub Desktop.
// #if PLATFORM(DOM)
var CPTextViewDOMInputElement = nil;
// #endif
@implementation CPTextView : CPTextField
{
}
/* @ignore */
#if PLATFORM(DOM)
- (DOMElement)_inputElement
{
if(!CPTextViewDOMInputElement){
[super _inputElement]; // make the parent create it's input element an attach all the listeners.
CPTextViewDOMInputElement = document.createElement("textarea");
CPTextViewDOMInputElement.style.resize = "none";
CPTextViewDOMInputElement.style.overflow = "hidden";
CPTextViewDOMInputElement.style.position = "absolute";
CPTextViewDOMInputElement.style.border = "0px";
CPTextViewDOMInputElement.style.padding = "0px";
CPTextViewDOMInputElement.style.margin = "0px";
CPTextViewDOMInputElement.style.whiteSpace = "pre";
CPTextViewDOMInputElement.style.background = "transparent";
CPTextViewDOMInputElement.style.outline = "none";
}
return CPTextViewDOMInputElement;
}
#endif
// @override stringValue
- (CPString) stringValue
{
if(CPTextViewDOMInputElement){
return CPTextViewDOMInputElement.value; // override return value.
}
return [super stringValue];
}
@end
// #if PLATFORM(DOM)
var CPTextViewDOMInputElement = nil;
// #endif
@implementation CPTextView : CPTextField
{
}
/* @ignore */
#if PLATFORM(DOM)
- (DOMElement)_inputElement
{
if(!CPTextViewDOMInputElement){
[super _inputElement]; // make the parent create it's input element an attach all the listeners.
CPTextViewDOMInputElement = document.createElement("textarea");
CPTextViewDOMInputElement.style.resize = "none";
CPTextViewDOMInputElement.style.overflow = "hidden";
CPTextViewDOMInputElement.style.position = "absolute";
CPTextViewDOMInputElement.style.border = "0px";
CPTextViewDOMInputElement.style.padding = "0px";
CPTextViewDOMInputElement.style.margin = "0px";
CPTextViewDOMInputElement.style.whiteSpace = "pre";
CPTextViewDOMInputElement.style.background = "transparent";
CPTextViewDOMInputElement.style.outline = "none";
}
return CPTextViewDOMInputElement;
}
#endif
// @override setObjectValue
- (void)setObjectValue:(id)aValue
{
if(CPTextViewDOMInputElement){
aValue = CPTextViewDOMInputElement.value;
}
[super setObjectValue:aValue]; // bubble up.
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment