Joplin: Toggling formatting elements from Toolbar doesn't work.

Created on 23 Feb 2020  路  14Comments  路  Source: laurent22/joplin

Styling the notes using the toolbar is buggy. When clicked elements on the toolbar, it attempts to insert new elements rather than toggle the current one.

Problems & Expected Behaviour

Bold and Italics

Problem

  • Highlight a text
  • Click on Italics. * gets added before and after the selected
  • Click on Italics again. * gets added again. But two * equals and bold text.

Bold and Italics Error

Expected Behaviour

The italic property from the highlighted text should be removed.
Alternatively, I think it would be a good idea to change italic from * to _ (Same as the markdown in Github)

Inserting lists

Problem

  • Highlight a text
  • Click on either Numbered, Bullet or Checkbox list.
  • Click multiple times.

List Error](https://gifyu.com/image/7Fs0)

Expected Behaviour

The newly created list item should be empty, or the addition and removal of the list item should be toggled.

Environment

Joplin version: 1.0.185 (dev, darwin)
Platform: macOS Desktop (Electron)
OS specifcs: macOS Catalina 10.15.2

enhancement good first issue

All 14 comments

@laurent22 I would like to work on this if this is a bug.

I would say yes, but let us ask @tessus as well as GH is more up to @tessus and @laurent22

This was never a bug. It worked like this since the beginning.

However, I do understand that a function to toggle the action would be nice. Altho8ugh it's not only Bold and Iralics, but also the code button. Although the code button is more complicated, because it creates a code block, if the selection contains at least one newline.

I would like to see this implemented, because it has a more natural feeling than the current behaviour. But these decisions lie with Laurent. Let's see what he thinks.

@rabeehrz so you know what to do, looking forward to your PR

Well, I'd wait for @laurent22's ok first. I don't want anyone to code something that is then not merged.

@tessus What do you think about replacing * with _ for italics? I've tested it out and it works fine in the editor.

Unfortunately these kind of decisions are not mine to make. It's Laurent's project. I cannot make any architectural descisions or anything that impacts everyone.
I myself use the underscore for italics, but maybe there's a reason why Laurent uses *. He also uses * * * for a hline, while I use ---.

Theoreticlly the change should be ok, because it won't break anything, but as I said, this is not my decision. Laurent will have to decide.

That would be a big change (we'd also need to update the turndown package) and not really necessary. I guess I've used stars because that's what they use in their editors on GitHub and SO.

@laurent22 So how do you want me to proceed with this?

Why the turndown package? Underscores are currently supported. But this is not really neceesary anyway.

image

The main reason for this discussion was about the toggling.

You have a text bla, select it and click Bold. Then you get **bla**, you select **bla**, click Bold and get bla.

Why the turndown package?

The turndown package generates Markdown from HTML and currently uses "*" for bold/italic if I'm not mistaken.

You have a text bla, select it and click Bold. Then you get **bla**, you select **bla**, click Bold and get bla.

I will implement this and open a PR.

@laurent22 Can i also contribute to this issue?

The person who created the PR will be the one in the commit log, since we squash the commits at merge.
But you can always help, this is up to you. If somebody gets stuck or asks for help, you decide if you want to pitch in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v-marinkov picture v-marinkov  路  3Comments

Dharmesh-Poddar picture Dharmesh-Poddar  路  3Comments

smhearty picture smhearty  路  3Comments

christianlupus picture christianlupus  路  3Comments

GingerPapa picture GingerPapa  路  3Comments