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

One click copy to clipboard for code block. #973

Closed
projectrk opened this issue Apr 19, 2020 · 10 comments
Closed

One click copy to clipboard for code block. #973

projectrk opened this issue Apr 19, 2020 · 10 comments

Comments

@projectrk
Copy link

projectrk commented Apr 19, 2020

Feature Request:

  • One click copy to clipboard for code block.
  • Link code notes to text note instead of code block.

Trilium Linux v 0.40.7

@projectrk projectrk changed the title Feature Request: Once click copy for code block. Feature Request: Once click copy to clipboard for code block. Apr 19, 2020
@projectrk projectrk changed the title Feature Request: Once click copy to clipboard for code block. Feature Request: One click copy to clipboard for code block. Apr 19, 2020
@zadam
Copy link
Owner

zadam commented Apr 20, 2020

Hello, could you explain "Link code notes to text note instead of code block." - I don't understand what you mean ...

@projectrk
Copy link
Author

It's like framing it to the page at the same time there is also a click button for copy the whole code to the clipboard.

  1. I will create a "code/python" page I will put my code there name it as cisco.py.
  2. On my "text" page, I will just insert like <iframe>cisco.py</iframe> then it will display as part of that "text" page.

Whatever changes I made in my cisco.py code page, it will reflect also to my "text" page.

@zadam
Copy link
Owner

zadam commented Apr 30, 2020

Yes, this is already possible with "include note". There won't be syntax highlighting though.

image

@popey456963 popey456963 changed the title Feature Request: One click copy to clipboard for code block. One click copy to clipboard for code block. May 7, 2020
@projectrk
Copy link
Author

Here is the image of what I am talking about. when you click the clipboard icon on the far right of it. it will copy the content inside the box to the clipboard automatically.
oneclick01

The syntax on how you create content into it. formatting is plain-text
oneclick02

This can also be use for code formatting. for python
oneclick03

@zhdenny
Copy link

zhdenny commented Jul 8, 2020

I would also like for an easy way to copy the contents of a code block OUT of Trilium....exactly how @projectrk shows in his latest screenshots

@liukun
Copy link

liukun commented Nov 26, 2020

This script add a button on the toolbar to copy the content of an active note to the clipboard.

api.addButtonToToolbar({
    title: "Copy Content",
    icon: "copy",
    shortcut: "ctrl+alt+c",
    action: async () => {
        let note = api.getActiveTabNote()
        let content = await note.getContent()
        navigator.clipboard.writeText(content)
        api.showMessage("Copied `"+note.title+"`")
    }
})

Not too good as a button on a code block, but may be convenient under some circumstances.

@liukun
Copy link

liukun commented Nov 27, 2020

Just for reference, a plugin for Obsidian with the same functionality https://github.com/jdbrice/obsidian-code-block-copy .

@TuffG
Copy link

TuffG commented Apr 17, 2021

+1 for this feature

@Nriver
Copy link
Contributor

Nriver commented May 9, 2024

Refer to https://github.com/Nriver/copy-code-block-widget

@meichthys
Copy link
Collaborator

Trilium has entered maintenance mode. Future enhancements will be addressed in TrilumNext: TriliumNext#124

@meichthys meichthys closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants