Create note from highlighted text

This simple plugin turns text or block of text into new note under active folder.

When a block of text is selected, first line is taken as a title of new note and the whole block goes as body.
This can be customized with option to ask for new title (see Settings in plugin's menu).

Latest version is available in Joplin Plugins search or via download as .jpl:

Works on 1.4.19 and up

Source code available:

changelog:

02/04/2021
v.1.4.8

  • Popup dialog autofocuses

01/31/2021
v1.4.6

  • Icon change

01/24/2021
v1.4.5

  • Added option to not include title at the top of text (as suggest by @jb261 )

01/22/2021
v1.4.4

  • Asking for new title is based now on settable number of words in first line. If its exact or more than set number, popup will appear.
  • Type of new note can be now "todo" as default.
  • Option to choose a text before backlink
    01/21/2021
    v1.4.3
  • Ask for title via dialog box (default is off) @uxamanda
  • Auto switch to newly created note (default is on)

12/11/2020
v1.2.0

  • Automatically copies tags from active note to new note (suggested by @blank)
  • Backlinking and/or copying of tags can now be turned off via plugin settings - Tools>Options>Convert To New Note

12/05/2020

  • Github page and release file

11/22/2020

  • Added right click menu entry version (for Joplin 1.4.11)
    11/16/2020
  • added backlink from new note to origin note (suggested by @roman_r_m )
  • bug fix: escaped [ and ], to not break title (suggested by @laurent)
15 Likes

Nice!
Here's an idea for improvement: in addition to clipped text also create a link to the original note

3 Likes

And how can this be enabled?

That's great, and very nice touch to convert the copied text to a link to the new note.

Just so you know, this will not work if the title contains a ]

await joplin.commands.execute('replaceSelection', `[${title}](:/${newnote.id})`);

But you could escape the title like it's done in the app:

escapeTitleText(text: string) {
	return text.replace(/(\[|\])/g, '\\$1');
}
2 Likes
  1. Read and apply section " Setting up your environment" from https://joplinapp.org/api/get_started/plugins/

  2. Copy plugin code from first post to file index.ts under src folder (src/index.ts).

  3. Run npm run dist

  4. Copy path to your plugin folder and paste it at Joplin settings Tools->Options->Plugins (Beta)

  5. Restart Joplin.

1 Like

Our first plugin! Congratulation and thanks for sharing!

3 Likes

Unfortunately not available in the portable version...
Why that complicated? A plug-in function, plug-ins per download as a file, place it in a specific folder, enable e.g. by a config file.

Much way easier

In an upcoming release managing plugins will be a lot easier.

1 Like

that would be great... To make Joplin more know a usuable by people it needs out of the box features or functionality which can be enabled as described above. Many, including me do not have the time to proceed complex procedures...

It's more important to get the foundation of the plugin system right. If this is done, we can worry about the UI. It was always planned to create a nice UI. And the people who are currently writing plugins don't care about that. They want to be able to use the API properly to fit their needs.

The above steps only look complicated, but they aren't. Also, if one distributes a plugin, it could already be compiled, so you only have to copy it in a dir and add the dir to the preferences.

Suffice it to say, there will be an ecosystem for plugins and there will be improvements to the UI.

2 Likes

@ambrt Do you have the source hosted on github maybe?

A lot of people might not have a dev env available, so it would be great, if you had a .jpl file as well.

2 Likes

Ok i will make it available in a moment

1 Like

Done:)

3 Likes

Quite useful plugin.
Instead of multiple laborious cut & paste, I've been able to split easily and rapidly some very (very !) long notes.

Thanks !

Feature request : if the original note has some tags, would it be possible to transmit them automatically to the new notes during the process ?

1 Like

Awesome, thank you!

Glad that you find it useful!

Also, interesting suggestion (and yes its possible).

I think of doing plugin settings section to turn options on and off -backlink references and for tags suggested by you and ship them in one go.
So next release will copy the tags to new note.

Done in newest release (see first post).

Thank you !
Works perfectly well.

Thanks for sharing! This is really useful. Few ideas if you are interested in iterating on it:

  • allow user to change the text that appears with the backlink (i.e. instead of "from" i could choose to say "backlink: ")
  • allow the user to choose whether to default as a note or a todo (i use todo's 99% of the time)
  • allow the user to choose to have the newly created note opened automatically
  • allow the user to define a new title (especially useful when I copy a large amount of text)
  • allow the user to assign a keyboard shortcut to the action

Also, FYI, for me I don't see this when I right click the text, I can only get it to work by clicking the star. (EDIT: I see this same issue in other plugins, so might be my problem :slight_smile: opened this to ask: Right Click on Mac)

3 Likes

All are valid ideas and thanks for taking the time to write them.

Give me some time, i will implement them.

allow the user to define a new title (especially useful when I copy a large amount of text)

How would you like it to be implemented? It can be to pop up input box to ask for new title.

2 Likes