New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot edit Ace in a taskpane of an add-in in Excel for Windows #3375
Comments
I have not heard about excel addins running webviews before. Does it work if you click add textarea to the page, and click on it before clicking on the ace? |
Yes, JavaScript API for Office is available to build Office add-ins with web languages, the add-ins are just like web pages... Ace and CodeMirror of the web page of my testing add-in work fine in Chrome, IE, Safari, Excel Online (in Chrome, IE and Safari), and Excel for Mac. They just don't work in Excel for Windows. "Does it work if you click add textarea to the page, and click on it before clicking on the ace?" ==> I don't know what you mean by "click add textarea to the page". But I just realised that, if we click on Excel, then click on a useless area (somewhere without element) in the taskpane before clicking in the Ace textarea, we could then edit its content. Is this information useful for you? Can we make some workaround? |
try adding window.addEventListener("mousedown", function(e) {
if (!document.hasFocus()) e.stopPropagation()
}, true) browsers sometimes do not focus the window, when mousedown even is cancelled. Normally ace does https://github.com/ajaxorg/ace/blob/v1.2.8/lib/ace/mouse/mouse_handler.js#L55, but maybe it doesn't work on the browser that excel uses |
With the
So do you have a solution? I think we are in the right direction... Thank you |
try adding |
I have done
Now, each time I click back to anything in the taskpane, the focus is systematically set to the Ace textarea, I think we need to bind Actually, I will finally use Thank you very much |
add document.querySelector(".editor").addEventListener("mousedown", function(e) {
if (!document.hasFocus()) {
e.stopPropagation();
e.currentTarget.env.editor.focus()
}
}, true) |
@SoftTimur Did the above solve your issue? |
I just realised that we cannot modify well texts of Ace in a taskpane of an add-in in Excel for Windows. Although Office may not be a supported platform of Ace, this problem seems to apply to other source editors like CodeMirror as well. I would like to know if you have a solution or workaround, because one important of mine is disabled by this.
Here is the details.
Thank you in advance
The text was updated successfully, but these errors were encountered: