Coder Social home page Coder Social logo

Comments (5)

jasonm23 avatar jasonm23 commented on June 7, 2024

This will replace the join / wrapping strings items in preferences.

I will need to define:

  • How to adding user-defined functions to CutBox. _MVP: add functions via ~/.cutbox.js

from cutbox.

jasonm23 avatar jasonm23 commented on June 7, 2024

Initial push of this feature will be released in 1.1.0 today.

Documentation is still TODO, basic usage as below:

  1. Items you've selected will be in the Javascript environment as items (if you only select one item will still be in items)
  2. Cutbox will evaluate the Javascript and fetch the value of paste

Anything you do in between is up to you.

To trigger a paste which uses your javascript use: Cmd + Enter

For now, everything needs to be available in ~/.cutbox.js I've considered adding useful libs (i.e. LoDash), but I think it's better if you just build a single file for the moment, and JS has a lot built in for filtering arrays etc. So maybe, maybe not.

More important will be allowing you to do things that give you a way of selecting one of many actions that you've scripted. The keyboard interaction part is the way I'd use it, but giving people a programmable GUI menu / HUD etc. would be a nice way to make it user friendly.

I'm rambling.

from cutbox.

jasonm23 avatar jasonm23 commented on June 7, 2024

Quick examples

Pressing Cmd + Enter to process with JS and paste:

Assuming: items
Lorem ipsum
Dolor sit amet
Bob the goat
var mapped = items.map((e) => `<p>${e}</p>`)
var paste = `<div>${mapped.join("\n")}</div>`
<div><p>Lorem ipsum</p>
<p>Dolor sit amet</p>
<p>Bob the goat</p></div>

More examples:

Transform text pasted to uppercase

var paste = this.items.map((e) => e.toUpperCase() ).join("\n");
LOREM IPSUM
DOLOR SIT AMET
BOB THE GOAT

Transform text pasted to lowercase

var paste = this.items.map((e) => e.toLowerCase() ).join("\n");
lorem ipsum
dolor sit amet
bob the goat

from cutbox.

jasonm23 avatar jasonm23 commented on June 7, 2024

At this point, I don't think this is a particularly useful feature, but I wanted to open it up as soon as possible for people to use, so I can get feedback if any is coming, and to get an idea of the way people want to use this.

For myself, it would be useful to be able to define a number of different transformers that I can choose from when I do Cmd + Enter

Showing a secondary popup with a list of actions available, would be relatively easy to deliver and I can iterate on that based on how I use it, or other user feedback.

from cutbox.

jasonm23 avatar jasonm23 commented on June 7, 2024

1.1.0 is released.

from cutbox.

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.