Create note from highlighted text

Few ideas for how to implement:

  1. Leave it as is, but if/when you are able to get to "open new note automatically" have the cursor in the title box, then it is fast to leave or edit. The biggest issue with this is that the link to the note would have different text.
  2. Have a popup box, as you said. Ideally, this would be pre-populated with the selected text, so I could quickly hit enter if I am ok with it.
  3. Same as #2, but with a setting that says "choose custom title if text is above words". This would give the user some control. This lets me have the functionality to really quickly create "wiki" style links (where I highlight a word or two, click a keyboard command, and a new entry with that name is created). But it also works in the case when I am actually trying to move part of a long note into a separate note. In that case, I'd almost always want to have a different title.
3 Likes

All of a sudden, Convert Text To New Note doesn't work anymore.
I didn't use it since maybe 2 weeks, today I wanted to split a few notes and nothing happens when I select some text => right-click => Convert Text to notes (same things from the icon).

Looking at the console log, this is what I have : -1610265787472.log (1.2 KB)

Log
index.html:1 Uncaught (in promise) Error: Cannot execute a command without a runtime: selectedText
    at CommandService.<anonymous> (C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\CommandService.js:144)
    at Generator.next (<anonymous>)
    at C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\CommandService.js:8
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\CommandService.js:4)
    at CommandService.execute (C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\CommandService.js:136)
    at JoplinCommands.<anonymous> (C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\plugins\api\JoplinCommands.js:56)
    at Generator.next (<anonymous>)
    at C:\Users\admin\AppData\Local\Temp\1mpmxbqw6gSvGilmcLUZ6c7NPdS\resources\app.asar\node_modules\@joplin\lib\services\plugins\api\JoplinCommands.js:8
    at new Promise (<anonymous>)

Any idea what's going on ?
Thanks !

Windows 10 / Joplin 1.6.6 (prod, win32)
Client ID: 817c6c01ce9649c797b83efe3df5f1fe
Sync Version: 2
Profile Version: 34
Keychain Supported: No
Revision: f58b7563e (master)

2 Likes

I see it on my end too.
It happens on Joplin 1.6.6. I'm looking for fix, atm.

1 Like

I think this is the way.

If i understand it correctly, it would work like this:
If text is just one line - (few words), create new note with those words as title.
If text is 2 or more lines, ask for title in popup (pre-populated with first line to be edited or accepted).

Is that the case?

2 Likes

There are few problems with 1.6.6.
So if ,that's possible, downgrade.

Few other features were also affected by 1.6.6 :frowning:

Working in Joplin 1.6.7 which was released a few hours ago. Your backlinks plugin works in this release as well.

2 Likes

New version is out with these features added:

  • 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

Keyboard setting for creating note is "Ctrl+Alt+N" but it should be possible to change in Keyboard Shortcuts to any combination.

These are still pending:

  • 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)
2 Likes

Thank you, this is great!

It looks like the trigger for asking for the title is >1 paragraph. This threw me off when I tried on a paragraph with many lines of text. Maybe a future change could trigger it based on having lots of words? Not sure if that's possible.

3 Likes

I'm finding this plugin very useful in conjunction with my daily "todo note" that I work out of as my anchor or reference point for the day. Anytime an item starts getting a little long, this plugin streamlines the process of creating a new note out of that text and creating the backlink. This keeps my daily todo note neat and easy to scan.

Agreed. Anytime you have more than a few words that you are going to convert to a note, you'll likely want to change the note title since most of us don't use sentence-long note titles.

3 Likes

Good points.
I will make it trigger on amount of words in first line (8? 10?).

Technically its not dependent on paragraph but on new line made with Return (or Enter) key.
So if one will write long text without breaking it with Enter its treated as one line,while it looks in editor as having multiple lines.

2 Likes

IMHO, even 8-10 words is too high a threshold. Check the titles of your 10 most recently updated notes - what's the average # of words in note title? I'm guessing it's less than 8. Just ran this test on my notes - avg for 10 most recently updated notes is 4 words (and I counted words like "and", "for", and still only 4 word avg for titles).

Is is possible to create exclusive options in a plugin's settings (meaning user can only specify one option)?
If so, maybe something like:

  • Always ask for title
  • Ask for title if 8 or more words are selected

OR how about this instead, if technically feasible:

  • Ask for title if more than [ ] words are selected
    User supplies # of words to trigger title pop-up. 0 = always ask.
2 Likes

This is good solution. I set default to 5 so if 5 or more words are chosen then popup will ask for title.
(Its still counting words on first line)

Also default type ("note" or "todo") and text before backlink is now possible to choose in options.

Newest version is 1.4.4 (.jpl in OP) and will be soon available in Joplin plugins search

1 Like

Just tried new version. Looks good, but I noticed one issue, when I select text and run plugin, the newly created note duplicates the selected text. So for example, I selected "test converter" in a note, ran plugin and new note body shows:

test converter
test converter

Joplin 1.7.3 (prod, win32)

2 Likes

Yes! Works really well thank you!

FWIW, I am not seeing this behavior.
Joplin 1.7.4 (prod, darwin)

2 Likes

Did you use 0 or so as number of words to trigger popup?

If so the dialog popup asks for a title and adds it to the beginning of new note.
The highlighted text becomes new title (first line in editor) and ,additionally, a new body (everything below).

Yes, 0 words in settings (behavior described below is identical for 0 or 1 word).

Part of the design makes sense to me - user edits title, and this becomes title of new note and the text for the link placed in the referring note. But this edited title also becomes the first line of the note body, followed by the originally selected text - this bolded bit seems undesirable.

For example, I select the words "test converter" in a note, then edit title to "plugin check". Results:
image

If I give a note title, it should be the title of the new note and the text for the link, but why should it also be the first line of the new note's body?

1 Like

It is created to follow Joplin default behavior when creating new notes (if you create new note - first line of "body" is used as title)
Basically all my notes look also like this:
snip create

But it doesn't have to be this way.
There can be option to not insert title into first line of body if popup is used and still preserve title in note as whole.

Yes, but that's only if you start a new note without a title. Since every note must be titled, Joplin uses the first line as title. So the original text is in note body and the duplication is in the title. Evernote does this as well; probably most other note apps as well.

BUT, if you enter a title first, then you start typing in note body, there is no duplication of that title text - as there is no need for it, because user has specified title, so no need for app to assume a title. I would think this situation is more analogous to what your plugin is doing when user triggers title popup - i.e., user is specifying a title, so no need for duplication of title text.

An option would be fine, but I think unnecessary. If you follow my logic above (hopefully I was clear), the only reason there is duplication in Joplin (or Evernote, etc.) is because user does not specify note title, so app must assume one. That duplication is a one-way street - it's only duplicating note body text into an empty title field. It's not duplication of title into note body, which is what your plugin does now, which is undesireable, at least in my humble opinion.

1 Like

What you say , JB , make sense.
I would make it an option though.

Reason is that using it the old way is consistent
with other ways of creating notes.
(At least, i don't know whats most common
way of creating note's title)

So i wouldn't push it as default way.
Give me a bit of time and i will add it.

1 Like

Ok, option is out.

BTW. @jb261 did you used Evernote a lot? I'm not familiar with it much.

1 Like