<commit_before>jsio('from shared.javascript import Singleton')
jsio('import ui.Component')

exports = Singleton(ui.Component, function(supr) {
	
	this._className = 'TextViewEdit'
	this._padding = 4
	this._border = 2
	
	this._createContent = function() {
		this.hide()
		this._input = fin.getView('Input')
		this._input.appendTo(this._element)
		this._input.subscribe('Blur', bind(this, 'hide'))
		this._input.subscribe('NewValue', bind(this, '_onInputNewValue'))
		
		this._input.getElement().style.position = 'absolute'
		this._input.getElement().style.overflow = 'hidden'
		this._input.getElement().style.padding = this._padding + 'px'
		this._input.getElement().style.paddingRight = 0 // so that the text inside the input box doesn't wrap around by hitting the end of the input box
	}
	
	this.showAt = function(view, item, property) {
		if (this._view) { logger.warn('TODO: release current view') }
		this.appendTo(gBody)
		this._view = view
		this._item = item
		var el = this._input.getElement()
		
		el.style.fontSize = this._view.getStyle('font-size');
		el.style.fontFamily = this._view.getStyle('font-family');
		el.style.fontWeight = this._view.getStyle('font-weight');
		el.style.lineHeight = this._view.getStyle('line-height');
		
		this._input.setDependant(item, property)
		this._input.setValue(item.getProperty(property) || '')
		
		this._resizeSub = this._view.subscribe('Resize', bind(this, '_onViewResize'))
		this._onViewResize()
		
		this.show()
		this._input.focus()
	}
	
	this.hide = function() {
		if (this._view) { 
			this._view.unsubscribe('Resize', this._resizeSub)
			this._item.releaseFocus()
			delete this._view
			delete this._item<commit_msg>Don't delete the view and item on hiding the text view edit. They may still be used for keystroke events that have not yet percolated the system<commit_after>jsio('from shared.javascript import Singleton')
jsio('import ui.Component')

exports = Singleton(ui.Component, function(supr) {
	
	this._className = 'TextViewEdit'
	this._padding = 4
	this._border = 2
	
	this._createContent = function() {
		this.hide()
		this._input = fin.getView('Input')
		this._input.appendTo(this._element)
		this._input.subscribe('Blur', bind(this, 'hide'))
		this._input.subscribe('NewValue', bind(this, '_onInputNewValue'))
		
		this._input.getElement().style.position = 'absolute'
		this._input.getElement().style.overflow = 'hidden'
		this._input.getElement().style.padding = this._padding + 'px'
		this._input.getElement().style.paddingRight = 0 // so that the text inside the input box doesn't wrap around by hitting the end of the input box
	}
	
	this.showAt = function(view, item, property) {
		if (this._view) { logger.warn('TODO: release current view') }
		this.appendTo(gBody)
		this._view = view
		this._item = item
		var el = this._input.getElement()
		
		el.style.fontSize = this._view.getStyle('font-size');
		el.style.fontFamily = this._view.getStyle('font-family');
		el.style.fontWeight = this._view.getStyle('font-weight');
		el.style.lineHeight = this._view.getStyle('line-height');
		
		this._input.setDependant(item, property)
		this._input.setValue(item.getProperty(property) || '')
		
		this._resizeSub = this._view.subscribe('Resize', bind(this, '_onViewResize'))
		this._onViewResize()
		
		this.show()
		this._input.focus()
	}
	
	this.hide = function() {
		if (this._view) { 
			this._view.unsubscribe('Resize', this._resizeSub)
			this._item.releaseFocus()
{'fraction_non_alphanumeric': 0.14539110206455366, 'fraction_numerical': 0.0017446932247746438, 'mean_word_length': 4.341614906832298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4472980', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1078, 'n_words': 225}