handsontable-chosen-editor
handsontable-chosen-editor copied to clipboard
focus problems
value: function focus() { // Add an empty space to texarea. It is necessary for safari to enable "copy" command from menu bar. this.mainElement.value = ' '; this.mainElement.select(); }
In version 4.0.0 they updated this function and it causes this TypeError: this.mainElement.select is not a function when you focus cell which is using this editor.
Any idea how to fix it please?
I am currently not really working on this, but I do accept PRs if you find time to figure this out!
SOLVED! Here is new solution.
ChosenEditor.prototype.createElements = function () { this.$body = $(document.body);
this.TEXTAREA = document.createElement('textarea');
let select = document.createElement('select');
this.TEXTAREA.appendChild(select);
//this.TEXTAREA.setAttribute('type', 'text');
this.$textarea = $(this.TEXTAREA.children[0]);
Handsontable.dom.addClass(this.TEXTAREA.children[0], 'handsontableInput');
this.textareaStyle = this.TEXTAREA.children[0].style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
this.TEXTAREA_PARENT = document.createElement('DIV');
Handsontable.dom.addClass(this.TEXTAREA_PARENT, 'handsontableInputHolder');
this.textareaParentStyle = this.TEXTAREA_PARENT.style;
this.textareaParentStyle.top = 0;
this.textareaParentStyle.left = 0;
this.textareaParentStyle.display = 'none';
this.textareaParentStyle.width = "200px";
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA.children[0]);
this.instance.rootElement.appendChild(this.TEXTAREA_PARENT);
var that = this;
this.instance._registerTimeout(setTimeout(function () {
that.refreshDimensions();
}, 0));
};
@element150 Thanks a lot! You made my day. Could you please add answer to handsontable issue too? I almost miss this solution if i don't open this repo issues =(