Alex A. Naanou 45d8ef11d3 refactoring mostly done...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2023-09-28 20:49:06 +03:00

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 : */