Trumbowyg: Unwraping paragraph problem

Created on 11 Apr 2016  路  4Comments  路  Source: Alex-D/Trumbowyg

Informations

Unwrapping empty paragraph cause optically change height of empty line.
Also it sometimes may add additional line (ie 10)
Browser + version: ie10/chrome
OS: win
Resolution: 2.0.0-beta.7+

How to reproduce the bug?

additional styles:

p {
line-height: 16px;
border: solid 1px red; // for problem observation only
}
  1. type BBB anything (line 1)
  2. 3x hit enter
  3. type AAA anything (should be in line 5)
  4. move to line 3
  5. hit enter (this may add additional line, AAA should be at line 6)

    Possible work around:

this fixing problem with changing line height and preventing of insertion additional lines but leaving thrash inside paragraphs with is also no good

1 Remove unvraping block:

  // Unwrap paragraphs content, containing nothing usefull
   t.$ed.find('p').filter(function () {
   ....
   }).contents().unwrap();

2 Replace enpty <p> with <p/> instead of <br/>

t.$ed.find('p:empty').replaceWith('<p/>');
question

Most helpful comment

@Alex-D but users don't understand HTML and CSS semantics, they don't care about it. If user need 2 lines break he'll hit enter two times. Or just accidentally... it still will be broken.
So it isn't about semantics but about usability.

All 4 comments

Thanks for report.

Your bug is due to a non-semantic usage of the editor. You should not have multiple blank lines. It's a WYSIWYG, so if you need a margin, maybe you need to change your CSS to get a clean code and a clean result :)

So, I'm sorry but your work around break a lot of other cases and remove a part of clean up process to get semantic code.

My work around is indeed broken, to make it work I had to remove whole paragraph unwrapping logic.

You should not have multiple blank lines.

I don't think its correct assumption.
Because it will be hard to explain it to end-user who is used to MS Word, and getting more space after hitting Enter.

I would be great if you could find better solution for this problem, because I don't see any other possibility then blocking ability to add multiple lines (with is also not so great)

it will be hard to explain it to end-user who is used to MS Word

If you need to handle this case, don't use Trumbowyg. This WYSIWYG is for semantic and clean result, really based on CSS of the website. If you need some MS Word-like features/behavior, go to another WYSIWYG which have not this philosophy :/

@Alex-D but users don't understand HTML and CSS semantics, they don't care about it. If user need 2 lines break he'll hit enter two times. Or just accidentally... it still will be broken.
So it isn't about semantics but about usability.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmorrison-olive picture dmorrison-olive  路  3Comments

Tiogshi picture Tiogshi  路  5Comments

lstrzebinczyk picture lstrzebinczyk  路  4Comments

DirkOlten picture DirkOlten  路  3Comments

tonvanalebeek picture tonvanalebeek  路  6Comments