问题
I just realized that we cannot modify texts in CodeMirror or Ace in a taskpane of an add-in in Excel for Windows.
I have made a test html page with this code, and link it to a manifest file of an Excel add-in. It works well in Excel Online (in Chrome and IE), Excel for Mac. However, in Excel for Windows, 1) textarea
works well; 2) We could put the focus on CodeMirror, whereas we can NOT type anything; 3) When we put the focus on Excel then back on Ace, we can NOT type anything.
I have not tested other JavaScript-based source editor, because my webpage is actually built with angularjs and I need ui-codemirror
or ui-ace
. I have tested them, they have the same bug, though i will not list the testing code here because I don't think it is the ui-
that causes the problem.
Is anyone aware of this odd behavior? How could we fix this? Is there any workaround or alternative?
PS: I have found a comment from the author of the CodeMirror, but I don't know if (and how) it can help fix add-ins in Excel for Windows.
PS2: 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. Does anyone know how to use this to make a workaround for the Ace textarea? This method does not work with CodeMirror textarea...
回答1:
I think yo can follow this steps mentioned here. I hope it will solve your issue as it solve the issue for that user:
https://github.com/ajaxorg/ace/issues/3375
来源:https://stackoverflow.com/questions/45531106/cannot-edit-codemirror-or-ace-in-a-taskpane-of-an-add-in-in-excel-for-windows