mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00:08 +00:00
34 lines
894 B
JavaScript
Executable File
34 lines
894 B
JavaScript
Executable File
/**********************************************************************
|
|
*
|
|
*
|
|
*
|
|
**********************************************************************/
|
|
|
|
HTMLTextAreaElement.prototype.updateSize = function(){
|
|
this.style.height = ''
|
|
this.style.height = this.scrollHeight + 'px'
|
|
return this }
|
|
HTMLTextAreaElement.prototype.autoUpdateSize = function(){
|
|
var that = this
|
|
this.addEventListener('input',
|
|
function(evt){
|
|
that.updateSize() })
|
|
return this }
|
|
|
|
Object.defineProperty(HTMLTextAreaElement.prototype, 'caretLine', {
|
|
enumerable: false,
|
|
get: function(){
|
|
var offset = this.selectionStart
|
|
return offset != null ?
|
|
this.value
|
|
.slice(0, offset)
|
|
.split(/\n/g)
|
|
.length
|
|
: undefined },
|
|
})
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
* vim:set ts=4 sw=4 : */
|