laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.11k stars 4.91k forks source link

Change how paragraphs are handled in Rich Text editor #8600

Open laurent22 opened 1 year ago

laurent22 commented 1 year ago

The current rich text editor supports both paragraphs (P tag) and lines separated by newlines (BR tags). The distinction between both can be confusing and makes it hard to edit the text.

It is also not how other WYSIWYG editors, in particular Word, work. Paragraphs are simply blocks of texts separated by two newlines.

We should aim for something similar. It means that when rendering the Markdown, to the Rich Text editor in particular, we should use two BRs to separate paragraphs instead of a P tag. When pasting text we should do something similar.

Pressing Enter, should create a BR tag (not a P, as now).

When implementing this, we should however make sure it's not going to break:

ssotoen commented 1 year ago

It is also not how other WYSIWYG editors, in particular Word, work.

That’s exactly how Word works though. In Word you start a new paragraph with Enter and a new line with Shift + Enter, same as in Joplin.

laurent22 commented 1 year ago

I've just tried from a blank document the other day and that's not how it was working

tomasz1986 commented 1 year ago

I've just done a test in Word 2021 and this is how it looks:

image

The "new line" was created using Shift+Enter, and the "new paragraph" using just Enter.

laurent22 commented 1 year ago

I've just tried again on Word 2019 (macOS) and it's as I mentioned in the initial post. There's no "Shift+Enter", just Enter creates a new line, and Enter twice would be the equivalent of a new paragraph.

So now I'm confused, not sure what's best here.

image
tomasz1986 commented 1 year ago

I think there may be differences in how this works in Word on macOS and Word on Windows. The two aren't exactly the same, and especially the older versions (as from what I know, the newest ones have become closer in terms of functionality). My testing was done on Windows 10.

Daeraxa commented 1 year ago

This is dependent on what style you use. By default I think the Normal style is chosen which is the way that @tomasz1986 is describing but whenever I make a document I always swap to the No Spacing style to revert back to the more "traditional" mode.

Interestingly Wordpad also defaults to this same style with the different return and shift + return behaviour.

Compare that to LibreOffice Writer or Google Docs which both use the same for both.

ssotoen commented 1 year ago

Word, Google Docs, and Libreoffice Writer all work the same way. Enter for a paragraph break, Shift + Enter for a line break. Google Docs and Writer’s default styles don’t include extra spacing so paragraph breaks look like line breaks, but the formatting marks show what’s actually going on. ¶ marks a paragraph break. ↵ marks a line break.

@laurent22 What does your document look like with formatting marks enabled?

Screenshot-word2

Screenshot-google

Screenshot-libreoffice

laurent22 commented 1 year ago

With formatting enabled I have this:

image

It doesn't matter if I press Shift+Enter or not, everything is just a basic newline.

With Google Docs I get the same behaviour:

image

It might indeed depends on the settings, but I rarely use Word (or Google Docs) so it's default settings everywhere.

ssotoen commented 1 year ago

Interesting. These are all paragraph breaks. Seems like Shift + Enter is broken on MacOS.

laurent22 commented 1 year ago

Let's leave it as it is, since the current behaviour seems to be ok

laurent22 commented 11 months ago

This issue comes up often enough that I'm wondering if we should have a poll about it.

ghost commented 8 months ago

Please add an option to change this. I don't want to press Shift + Enter every time to make a new line, I just want it to be Enter. I didn't see it in Keyboard Shortcuts.

I'm probably dumb but I don't understand what the point is with Viewer (I can't edit anything), and Markdown editor isn't pleasing either because I don't want to see the technical stuff when bolding or whatever, like - **Note Editor** instead of it just being bold and with a bullet point. Joplin with Rich Text Editor seems like just what I want, if only Enter would make a "normal" new line.

Sorry if it's just me that's being dumb and not understanding.

I want it like this: cet

Not like this: cyt

laurent22 commented 8 months ago

For that particular example, I guess you could use a list? That would be more semantically correct or would format in a better way.

But yes I agree that ideally pressing Enter should just be one new line, not a new paragraph. However I checked and the editor we use, TinyMCE, doesn't really support it. Well it does, but when it's enabled many things are broken because it needs the concept of paragraphs to apply formatting correctly.

So I can't think of a solution at this point. It seems like a Typora-like editor would solve this by treating the text as it is, instead of having hidden paragraphs or newline elements.

personalizedrefrigerator commented 7 months ago

One option would be to add a "add space between paragraphs" or similar appearance setting.

This could be applied with CSS similar to the following:

#rendered-md.-reduce-paragraph-spacing p {
        margin-top: 0;
        margin-bottom: 0;
}
artemgur commented 6 months ago

I think that the best solution to paragraph vs new line on Enter debate is to make it a setting, so every user can choose an option that is more convenient to them.

For me, personally, paragraph on Enter is vastly preferred behavior (in fact, I never had the need to insert a "line but not paragraph" in the first place). And it's a de-facto standard in editors like Word. So the hypothetical change of that behavior would be workflow-breaking for me (and likely many others), and I would likely migrate to another notes app (because it would be extremely unconvenient to press Enter twice or Shift+Enter every time I want to start a new paragraph).

In my opinion, "just new line" is a rarer use case than "paragraph", so Shift+Enter is better for "just new line" and Enter for "paragraph". But I understand that others can have other opinion, so it would be best to let the user choose via settings.

This comment is only about the usability side of the issue, not about <p> vs <br>.

captain118 commented 4 months ago

I too would like to have this as an option. If you are wanting consistancy. OneNote doesnt do it. EverNote doesnt do it. Obsidian doesnt do it. Notepad++ doesnt do it. It seems like word processors normally do this but Note taking apps dont normally do it. I can appreciate people needing the option. For me its more I would rather be able to see more of my notes on one screen than I would have the text be spaced out.

captain118 commented 4 months ago

Word, Google Docs, and Libreoffice Writer all work the same way. Enter for a paragraph break, Shift + Enter for a line break. Google Docs and Writer’s default styles don’t include extra spacing so paragraph breaks look like line breaks, but the formatting marks show what’s actually going on. ¶ marks a paragraph break. ↵ marks a line break.

@laurent22 What does your document look like with formatting marks enabled?

Screenshot-word2

Screenshot-google

Screenshot-libreoffice

These are word processors not note taking apps. They are a different catagory of application.

steveb166 commented 3 months ago

I think I have to agree with adding it as a setting at least. My opinion is that its a note taking app not a word processor, I'm not sure I even see the point of a new "paragraph" when two new lines basically does the same thing when required, whilst avoiding the annoyance of pressing shift all the time.

Australian-Infomaniac commented 3 months ago

Yes please please please please please provide an option to change it. It causes me problems every single day. It's so disruptive, I've literally created a to do list item about it. I've also searched for solutions about five times. All the solutions create problems, like making all your previously-created docs lose their spacing.


Every other program I've ever used just takes you to a new line when you hit enter, rather than adding a line/space/paragraph (whatever you may call it). Various abstract arguments otherwise don't contradict this.


Furthermore, since this is a note-taking program, I use new-paragraphs for specific purposes. To create a whole new section.


Learning to hit shift-enter will just create a habit that confuses my use of other apps.


How about THIS as an option: Some of us can choose a preference that creates a simple new line when you hit enter, and if you hit SHIFT enter, you can create a line-space. Basically the reverse of now.


My number 1 wish with Joplin! :)

viuxa commented 1 week ago

Similar problems have been discussed by many people every year, I don't quite understand why developers are not willing to make changes.

Joplin also has a lot of popular users, no matter non-technical or technical people, just a simple line break must Shift+Enter is still very annoying, and this problem used to unanimously bother me, then I used a simpler solution to solve the problem, shortcut mapping, on windows I use autohotkey to map shortcuts Enter -> Shift+Enter, Shift+Enter -> Enter.

I think if it's difficult to implement at least add the shortcuts to the settings, I subjectively think it's less disruptive and gives the user more choices.

laurent22 commented 1 week ago

I'm copying my answer from the forum here and locking the thread so that this answer remains visible. We understand this is important to a lot of users (and, actually, to me too), but unfortunately there is no easy fix:


The problem is that if we change this behaviour to enter a newline instead of a paragraph, the editor will see the document as one giant continuous line with no paragraphs (even two lines separated by two newlines will not be considered as two paragraphs). So a lot of functionalities that rely on paragraphs will be broken, in particular when creating lists.

The conversion to Markdown also won't be good, which means when you view the note on mobile you'll have a very long line with litteral <br> tags to represent new lines.

So it's not really a matter of adding an option or not. Even if we add the option, it's still broken and unfortunately that can't currently be fixed with the editor we're using.

My preferred solution at the moment would be to move to a different Rich Text Editor, one like Typora, which is a bit closer to Markdown while keeping most of the advantages of a proper RTE.