Skip to content
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

Copy/Paste doesn't work on Bootstrap dialog on IE #2521

Closed
Gabriel-Lahyani opened this issue Jun 2, 2015 · 2 comments
Closed

Copy/Paste doesn't work on Bootstrap dialog on IE #2521

Gabriel-Lahyani opened this issue Jun 2, 2015 · 2 comments

Comments

@Gabriel-Lahyani
Copy link

Description

The feature Copy/Paste works well on Bootstrap dialog both on Chrome and Firefox.
But fails on IE. (checked on IE9, IE10, IE11on Windows 7).
Handsontable 0.14.1

How to fix

Copy the CopyPasteDiv tag within the bootstrap modal dialog.

   <div style="left: -10000px; top: -10000px; position: fixed;" id="CopyPasteDiv"><textarea    style="width: 10000px; height: 10000px; overflow: hidden; opacity: 0;" class="copyPaste"></textarea>
   </div> 

And, when you copy the CopyPasteTag, pay attention to not return to the line before the tag 'textarea'.
For instance, copying the CopyPasteDiv tag like this will fail for all browsers:

   <div style="left: -10000px; top: -10000px; position: fixed;" id="CopyPasteDiv">
          <textarea    style="width: 10000px; height: 10000px; overflow: hidden; opacity: 0;" class="copyPaste"></textarea>
   </div> 

Reason:
handsontable.full.js, Line 9678:

     if (document.getElementById('CopyPasteDiv')) {
        this.elDiv = document.getElementById('CopyPasteDiv');
        this.elTextarea = this.elDiv.firstChild;
    }

If there is space or line return between 'div id="CopyPasteDiv"' and 'textarea', this space or line return will be interpreted as the firstChild and will fail for all Browsers.

Note: easy to check this, regarding the IE debug mode:
Text - Empty Text Node

Proposed Solution

     if (document.getElementById('CopyPasteDiv')) {
          this.elDiv = document.getElementById('CopyPasteDiv');
          // this.elTextarea = this.elDiv.firstChild;
          var textareas = this.elDiv.getElementsByTagName('textarea');
          this.elTextarea = textareas.length ? textareas[0] : null;
     }
@AMBudnik
Copy link
Contributor

AMBudnik commented Mar 7, 2016

I'm transferring all the improvement suggestion to our Wiki section at: improvement suggestions

Please feel free to add any additional suggestions/tips or investigation results.

Issue is closed. It will be reopened with a developing update.

@AMBudnik AMBudnik closed this as completed Mar 7, 2016
@burnash
Copy link

burnash commented May 11, 2016

Had similar issue in Chrome 50.0.2661.94, Handsontable 0.15.1, and Bootstrap 3.3.5. @Gabriel-Lahyani solution fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants