Giter Club home page Giter Club logo

Comments (10)

majkinetor avatar majkinetor commented on July 20, 2024

How would I export to html ?

from copyq.

hluk avatar hluk commented on July 20, 2024

@majkinetor What do you mean by "export to HTML"? Be more specific please.

from copyq.

majkinetor avatar majkinetor commented on July 20, 2024

Tab to html page ?

from copyq.

hluk avatar hluk commented on July 20, 2024

This task is about making backups or moving tabs and items to different installation.

Creating HTML page from tab would be possible using a custom command (importing the page back to the app could be possible but a bit more complicated).

You can do something like following (saves selected HTML and plain text items).

[Command]
Name=Save As HTML...
Command="
    copyq:
    currentpath(Dir().homePath())
    var defaultFileName = 'untitled.html'

    var fileName = dialog(
      '.title', 'Save Items As HTML...',
      '.width', 250,
      'File', File(defaultFileName)
    ) || abort()

    if (!fileName)
      abort()

    var f = File(fileName)
    if (!f.open()) {
      popup('Failed to open \"' + f.fileName() + '\"', f.errorString())
      abort()
    }

    var html = \"<html><body>\"

    var selected = selectedItems()
    for (var i in selected) {
      var item = getitem(selected[i])
      html += \"<p>\"
      if ('text/html' in item) {
        html += str(item['text/html'])
      } else if ('text/plain' in item) {
        html += escapeHtml(str(item['text/plain']))
      }
      html += \"</p>\"
    }

    html += \"</body></html>\"

    f.write(html)
    popup(\"Items Saved\", 'Items saved as \"' + f.fileName() + '\".')"
InMenu=true
Icon=\xf0c7
Shortcut=ctrl+s

from copyq.

majkinetor avatar majkinetor commented on July 20, 2024

What about images ?

from copyq.

hluk avatar hluk commented on July 20, 2024

Sure, images can be saved separately and referenced in HTML or serialized with base64 encoding, e.g.:

if ('text/png' in item) {
  html += '<img src="data:image/png;base64,'
  html += str(toBase64(item['image/png']))
  html += '" />'
}

from copyq.

majkinetor avatar majkinetor commented on July 20, 2024

Totally epic. Thanks.

NOTE: text/png should be image/png.

from copyq.

paul1149 avatar paul1149 commented on July 20, 2024

I just upgraded my main machine to Linux Lite 3.0, which required a fresh install. I thought I would simply copy the old database files at /.config/copyq over to the new install but it's not happening. Is there something I'm missing about bringing in the old data? Thanks.

from copyq.

paul1149 avatar paul1149 commented on July 20, 2024

Cancel that. Copying the entire folder over does work. Thanks.

from copyq.

hluk avatar hluk commented on July 20, 2024

Implementation is in import-export branch.

What is not imported:

  • position and size for windows/dialogs
  • filter history
  • command history (from Action dialog)
  • underlying files for Synchronize plugins
  • encrypted tabs are imported decrypted (!)
  • public and secret keys from Encryption plugin (needs to be generated again)

For backup it's still better to back up the whole configuration folder manually since everything is not exported and import doesn't replace existing tabs and commands.

from copyq.

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.