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

Soft Break not Working => Line Break and Soft Break are interchanged in the code #267

Closed
d-e-v-esh opened this issue Feb 25, 2021 · 10 comments

Comments

@d-e-v-esh
Copy link
Contributor

Bug Report 🐛

The soft brake was confused with the line break (i.e. hard break) in the code
This was also causing issue #263
There was no actual functional linebrake, just a headingbrake with a restriction on the paragraph so it doesn't mess up anything when called from a paragraph. For this reason, the soft break was not working.

You can see this when you open up the demo and it appears like this:

chrome_RQFT8jGi0h

Every single break we created came under type headingbreak even if it was created in a paragraph.

As we can see the soft break is not working in its place and has instead taken up the place of the hard break.

Expected Behavior

It should appear like this:

chrome_EX6SKZBtq3

Current Behavior

chrome_RQFT8jGi0h

Possible Solution

I have fixed up the code and will create a pull request soon explaining the solution in detail

Steps to Reproduce

  1. Go to the demo page and the problem will appear under the break section

Context (Environment)

Desktop

  • OS: Windows 10
  • Browser: Chrome
  • Version 88.0.4324.182 (Official Build) (64-bit)

Possible Implementation

  1. My solution is to rename the headingbreak to linebreak and linebreak to softbreak so that it automatically matches the template of the frontpage. This shows that this is how it was intended to be written.
  2. Create a new insertHeadingBreak function and implemented it in a way that it will only get called when we press Enter from a heading block.
  3. By doing this, every single normal break will have a type of linebreak.
@dselman
Copy link
Contributor

dselman commented Feb 25, 2021

I think the terminology here may be causing confusion.

Softbreaks in the markdown specification are typically rendered as spaces in HTML:
6.10 Soft line breaks https://spec.commonmark.org/0.29/

Pressing ENTER in the editor should create a new paragraph.

Pressing SHIFT-ENTER (sometimes called a soft break in editors!) should create a newline. The markdown specification calls this a hard line break (section 6.9).

@d-e-v-esh
Copy link
Contributor Author

@dselman That is true, the terminology is definitely a little confusing.

@Pratik1234agarwal
Copy link

I am new here. Wanted to work on this issue. Can I get started ?

@jolanglinais
Copy link
Member

@Pratik1234agarwal feel free to share here what you'd like to do in regards to this issue that is not captured in #270.

d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Mar 17, 2021
d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Apr 2, 2021
d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Apr 3, 2021
@jolanglinais
Copy link
Member

I believe, based on the tech working group call tonight, this is not actually an Issue. Rather, just a confusion on terminology. Correct @jeromesimeon and @d-e-v-esh?

@jeromesimeon
Copy link
Member

I believe, based on the tech working group call tonight, this is not actually an Issue. Rather, just a confusion on terminology. Correct @jeromesimeon and @d-e-v-esh?

That's what I understood for the demo and discussion as well.

We should certainly clarify the terminology and how WYSIWYG editing relates to the underlying commonmark. Maybe staying away from "soft break" and "hard break" altogether when we talk about the editing experience would actually improve things.

e.g., linebreak (represented as a commonmark hard break) and paragraph break

@d-e-v-esh
Copy link
Contributor Author

d-e-v-esh commented Apr 7, 2021

@irmerk @jeromesimeon That is true. This is very confusing. I didn't think of it then but now it makes more sense. We should only have one break (linebreak). right? We can discuss a little bit more on how we want to trigger the line break.
The line break could be added with a shift + enter and the normal break would be plain enter. That is right?
But then we need to remove that (soft break) sample text from the markdown editor. I think that was the one that caused the problem

@jeromesimeon
Copy link
Member

jeromesimeon commented Apr 7, 2021

@irmerk @jeromesimeon That is true. This is very confusing. I didn't think of it then but now it makes more sense. We should only have one break (linebreak). right? We can discuss a little bit more on how we want to trigger the line break.
The line break could be added with a shift + enter and the normal break would be plain enter. That is right?
But then we need to remove that (soft break) sample text from the markdown editor. I think that was the one that caused the problem

I think this makes a lot of sense. I'm unclear that the distinction between commonmark softbreak and hardbreaks makes much sense from a user of the rich text editor perspective. And if someone really needs that distinction we can revisit that decision at a later date.

I think that also means simply: remove those examples from the demo!

@d-e-v-esh
Copy link
Contributor Author

d-e-v-esh commented Apr 7, 2021

@jeromesimeon @irmerk Yes, so I thought about this for a few minutes now. The thing that I wasn't able to convey in the call was that I didn't actually change the functionality of any breaks. This is how it was actually supposed to be after removing the restriction on the enter key. I just tried to match the function name in code from what was written in the examples from the demo text so that the hard and soft would make sense. We can put appropriate naming on them now and not care about the soft and hard breaks. This confusion was caused by the text in the demo. That needs to be changed.

@jolanglinais
Copy link
Member

Yes agreed.

I think in ui-markdown-editor, we should have:

Support for CommonMark inline soft line break is supported, but we don't emphasize it in the editor (or the demo text in the Storybook).

d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Apr 13, 2021
d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Oct 31, 2021
d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Oct 31, 2021
d-e-v-esh added a commit to d-e-v-esh/web-components that referenced this issue Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants