Giter Site home page Giter Site logo

Comments (8)

seshrs avatar seshrs commented on May 16, 2024 2

That makes sense, I hadn't realized that there's value in copying all the commands alone. How about this: Only for console code blocks, we display two buttons. One is the regular "copy entire block" button, but the other copies just the commands.

I'll prototype it tomorrow/over the weekend, and put up a PR + demo :)

from primer-spec.

sugihjamin avatar sugihjamin commented on May 16, 2024 1

I did consider suggesting it only for one-liner, but found that to be too limiting. If you have a multi-line console block, copy-and-pasting all the multiple lines of commands to the console actually does run them serially, so it could work as intended.

If one assumes a console prompt in front of each command, maybe copy only the commands so recognized, skipping potential console outputs or comments?

from primer-spec.

eecs441staff avatar eecs441staff commented on May 16, 2024 1

It would be interesting to see what icons you come up with to distinguish the two cases.

Assuming you have control over mouse functions on the browser, an alternative could be that drag-to-select on console select only the commands, leaving out the prompts, outputs, and comments. The clipboard-copy button can be left as is, to copy everything, and you don't need to add another button.

from primer-spec.

eecs441staff avatar eecs441staff commented on May 16, 2024 1

The 'copy all commands' button video demo looks good! Thanks!

from primer-spec.

seshrs avatar seshrs commented on May 16, 2024

This is a nice idea! One question in my mind: This makes sense for code blocks with a single line, but how do we deal with multi-line console blocks (which might also contain console output)?

Alternatively, maybe the global β€œcopy” button should exclude the prompts when the console block has only one line. What do you think?

from primer-spec.

seshrs avatar seshrs commented on May 16, 2024

It would be interesting to see what icons you come up with to distinguish the two cases.

I just realized I don't have a good icon for this yet πŸ˜…

Another alternative: Is there ever a use-case for copying an entire console block along with its outputs? What if we changed the "copy" button only for console blocks into a "Copy all commands" button?

An alternative could be that drag-to-select on console select only the commands, leaving out the prompts, outputs, and comments.

^ This is a nice idea too!

from primer-spec.

seshrs avatar seshrs commented on May 16, 2024

An alternative could be that drag-to-select on console select only the commands, leaving out the prompts, outputs, and comments.

^ This is a nice idea too!

Actually, this isn't possible in any browser except Firefox β€”Β only Firefox support selecting multiple disjoint text ranges. From (MDN)

image

There are ways to work around the browser limitations, but would likely involve a lot more work (which I think may be overkill for Primer Spec 😞 )

from primer-spec.

seshrs avatar seshrs commented on May 16, 2024

This feature will be released with v.1.7.0 later this month. Closing this issue for now, let me know if you have questions :)

from primer-spec.

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.