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

Safari 6.0.2 support #5

Open
mplorentz opened this issue Nov 29, 2012 · 19 comments
Open

Safari 6.0.2 support #5

mplorentz opened this issue Nov 29, 2012 · 19 comments

Comments

@mplorentz
Copy link
Collaborator

It appears that the excel copy and paste does not work in Safari 6.0.2.

@Celebio
Copy link
Owner

Celebio commented Nov 29, 2012

Yes it should work with command + C/V. My code captures the native clipboard events and then does a few hacks in order to send them to slickgrid.
Verify you don't capture these events anywhere else in your program.

Could you tell me if this online demo works for you http://labs.nereo.fr/SlickGrid/examples/example-excel-compatible-spreadsheet.html ?

@gibito
Copy link

gibito commented Nov 29, 2012

ommand +C/V in the demo works for me on a MacBook Air

@mplorentz
Copy link
Collaborator Author

Hmm, its the demo that's not working for me. I tried it in Safari, Chrome, and Firefox. I've got a Macbook running Mountain Lion (10.8.2).

I've tried to copy and paste to and from TextEdit, within one of the grids on the demo page, and between the grids on the demo page. The cells turn blue when I copy them, and when I paste the Edit menu item on the menubar flashes blue like it pasted, but the grid does not change. If I paste into TextEdit I just get what was previously on my clipboard.

@mplorentz
Copy link
Collaborator Author

Ok, now it works for me in Chrome and Firefox, so... Safari issue? I'm running 6.0.2. What are you running @gibito?
(I updated the issue title to reflect)

@gibito
Copy link

gibito commented Dec 12, 2012

I checked (I use chrome on air) and there is a problem with Safari on my machine too.

@Celebio
Copy link
Owner

Celebio commented Dec 12, 2012

I confirm the safari bug, I will have a look when possible.

@dmccraw
Copy link

dmccraw commented Oct 31, 2013

Looks like this isn't working on Safari 7.0.
http://labs.nereo.com/SlickGrid/examples/example-excel-compatible-spreadsheet.html isn't working either.

@Celebio
Copy link
Owner

Celebio commented Oct 31, 2013

Yes. I investigated it a litte bit earlier. The hack seems not working with safari because the textarea selection is not "seen" by the native clipboard copy handler. We can use the official onPaste handler but an editable (ie editMode on) element has to have focus and I didn't manage to get that because the "canvas" div from slickgrid core needs to be changed.

If someone finds another way to do it, that would be great, otherwise we need to modify slickgrid core code.

@mplorentz
Copy link
Collaborator Author

Yeah I've spent a few hours on it myself without making any progress.

@forbearer
Copy link

Gents,

Just to 'poke' at this issue..it'd be nice to get this working in Safari. I'm more interested in the copy feature.

I've confirmed that 'copy' from Safari 6.1.4 (8537.76.4) to an external target does not work.

A couple interesting notes:

  1. If Safari handles the Command-C, the "Edit" menu blinks; otherwise, Safari induces a system beep. Command-C on a grid selection issues this beep.
  2. If I hold on to Command-C for a second or so, the contents eventually gets copied, so the text area focus does seem working..there appears to be a timing issue unique to Safari?

@Celebio If I were to try to get this working, what changes need I make to the slickgrid core? Could you give some pointers?

Thanks!
Owen

@mplorentz
Copy link
Collaborator Author

That's really interesting that holding command-C eventually executes the copy, you might try pursuing that. I have sunk quite a few hours into trying to fix this issue with no progress. The fact is that it's a security vulnerability to be able to change what the user thinks they are copying to the clipboard, and Safari does a good job of making sure that doesn't happen. I wish I could give you some more pointers of things to try, but I've tried all the hacks I can think of.

On Aug 28, 2014, at 8:26 AM, Owen Cheng notifications@github.com wrote:

Gents,

Just to 'poke' at this issue..it'd be nice to get this working in Safari. I'm more interested in the copy feature.

I've confirmed that 'copy' from Safari 6.1.4 (8537.76.4) to an external target does not work.

A couple interesting notes:

  1. If Safari handles the Command-C, the "Edit" menu blinks; otherwise, Safari induces a system beep. Command-C on a grid selection issues this beep.
  2. If I hold on to Command-C for a second or so, the contents eventually gets copied, so the text area focus does seem working..there appears to be a timing issue unique to Safari?

@Celebio If I were to try to get this working, what changes need I make to the slickgrid core? Could you give some pointers?

Thanks!
Owen


Reply to this email directly or view it on GitHub.

@Celebio
Copy link
Owner

Celebio commented Sep 2, 2014

As far as I remember the only way to make it work with Safari was a hack with contenteditable = true for the top level item. That's what I saw here.

However, @rb-cohen seems to have a solution that would not affect any core item of the grid. I let you see with him if you can go further.

Another possibility is to reverse engineer that awesome grid which seems to work with Safari.

@rb-cohen
Copy link

rb-cohen commented Sep 3, 2014

I didn't have much luck with setting contenteditable=true on the $focusSink div in Safari 5/6, but as soon as it was a textarea, the beeps stopped and I could copy/paste using the alt menus and keyboard shortcuts.

The only trouble is I couldn't find a way to get/change this $focusSink element without a change to core.

@6pac
Copy link

6pac commented Sep 3, 2014

mleibman#1000
$focusSink as textarea (has a nice commit/pull request)

@Celebio
Copy link
Owner

Celebio commented Sep 3, 2014

@rb-cohen, can I see your modifications? By changing $focusSink to a textarea, safari is happy for pasting but not for copying. What other modifications did you to make copy work?

@rb-cohen
Copy link

rb-cohen commented Sep 3, 2014

Sorry, I got a bit ahead of myself.. copy is not working at the moment, only paste.

I'll have another play, in Google Drive it works so it must be possible natively.

@rb-cohen
Copy link

rb-cohen commented Sep 4, 2014

I'm getting closer, with some tweaks I can copy in Safari with Ctrl/Cmd+C and from the context menus, but Firefox will only copy grid content using Ctrl+C. Edit>Copy in FF returns the value of $focusSink..

I bound a focus handler to $focusSink, which always populated the textarea with some dummy content and selected it. That way Safari will accept attempts to copy, and you can listen for "oncopy".

The bind ( in slick.grid.js, although this could happen in the plugin if we implement grid.getFocusSinks() ):

$focusSink.bind('focus', function() {
  var $this = $(this);
  $this.val('Please use Ctrl+C to copy content from the grid');
  $this.get(0).select();
 });

Clone the events for the second sink (still in slick.grid.js at the moment):

 $focusSink2 = $focusSink.clone(true).appendTo($container);

Oncopy event (witin the copy/paste plugin), where doCopy is the same code executed on Ctrl+C:

$focusSink.bind('copy', function() {
  return doCopy();
});

I'll try to consolidate this all in to a pull request, at the moment my working Slick Grid/CopyPaste files are a little outdated and contain a few patches.

@Celebio
Copy link
Owner

Celebio commented Sep 4, 2014

good news !

@6pac
Copy link

6pac commented Jun 4, 2015

i'd like to integrate this into my fork. Is there any progress on this one? Can you perhaps just point me to a bunch of commits on your own fork ?

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

No branches or pull requests

7 participants