Git Product home page Git Product logo

Comments (5)

piroor avatar piroor commented on June 13, 2024 1

OK I got it why the difference between my result and your result happens. On my case I select multiple tabs including both Google Docs and other services, and the first tab of them is not Google Docs. On the other hand your case looks to have Google Docs as the first tab.

Due to some technical reasons, this addon executes document.execCommand() and handles it with its own custom event listener, in the first tab of the selection. If you have something another webpage as the first selected tab, the operation succeeds. On the other hand, if the first tab shows Google Docs, document.execCommand() is executed but the event never been handled by the custom event listener. It possibly that such events have been handled and canceled by scripts of the Google Docs service itself.

There is only one workaround: enabling the native clipboard write API of Firefox itself. Go to about:config and turn dom.events.asyncClipboard.dataTransfer to true, then the API becomes available and this addon will use it to copy rich text data without script execution in webpages. (But I've found that there is a mistake and you need to wait a next release including the commit fc80555.)

from copy-selected-tabs-to-clipboard.

piroor avatar piroor commented on June 13, 2024 1

I've released the version 1.3.0 with the fix.

from copy-selected-tabs-to-clipboard.

piroor avatar piroor commented on June 13, 2024

I've tried this with the latest development build but couldn't reproduce it. Could you try it via about:debugging?:
https://piro.sakura.ne.jp/xul/xpi/nightly/copy-selected-tabs-to-clipboard.xpi

Steps I did:

  1. Start Nightly 79.0a1 on Windows 10.
  2. Load the latest development version of this addon via about:debugging.
  3. Prepare two formats and grant the required permission:
    • HTML Link: %RT%<a title="%TITLE_HTML%" href="%URL_HTML%">%TITLE_HTML%</a>
    • Rich text link: %RT%
  4. Go to Google Docs.
  5. Create a blank new document.
  6. Select all tabs and copy as "HTML Link".
  7. Paste the clipboard contents to the document created at 5.
  8. Select all tabs and copy as "Rich text link".
  9. Paste the clipboard contents to the document created at 5.

On both steps 7 and 9 I successfully got inserted links. If you still fail, I think it may be a problem of Firefox or the platform itself...

from copy-selected-tabs-to-clipboard.

gwicke avatar gwicke commented on June 13, 2024

Retried on Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0.

Neither the nightly, nor the released version of the extension are copying the %RT% format for Google docs tabs, while other tabs (and other link formats on Google Docs) are working fine.

I stepped through the copy process in the debugger, and the richText HTML string looks correct to me. The execution hits the browser.tabs.executeScript(permittedTabs[0].id path, and tries to inject the event based copy code into the gdocs page, but the clipboard is not updated.

from copy-selected-tabs-to-clipboard.

gwicke avatar gwicke commented on June 13, 2024

Confirmed that rich text copying is now working for gdocs tabs as well with the preference set. Thank you!

One small nit: When the preference is missing, I am getting the HTML string in the clipboard (with <a> tags), rather than the plain text format. Might be nicer to fall back to the user configured plain text format instead.

from copy-selected-tabs-to-clipboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.