Sigil-Ebook / PageEdit

ePub XHTML Visual Editor
GNU General Public License v3.0
248 stars 28 forks source link

pageedit changing style when deleting end of paragraph to merge two paragraphs #28

Closed jwes44 closed 1 year ago

jwes44 commented 1 year ago

Unzip the attached file and open NONE_BUT_LUCIFER.html in pageedit. Put the cursor at the end of a paragraph and press delete. span xmlns="http://www.w3.org/1999/xhtml" style="font-size: 0.88889em; text-indent: 0.25in;" is added to the html. This occurs on windows 11 and windows 7 with 1.9.20. It does not occur if stylesheet.css is not in the directory. petest.zip

kevinhendricks commented 1 year ago

Was that the style of the paragraph you merged into or the style of the next paragraph?

Merging paragraphs will typically pick up the style of the paragraph that is being merged into. This is how live edit works in Chromium based engines.

jwes44 commented 1 year ago

No. Generally, both paragraphs have the same style. The inserted style appears nowhere in my document.

kevinhendricks commented 1 year ago

Okay, I'll take a look to see if I can recreate it.

kevinhendricks commented 1 year ago

They add a span to replace the p tag you removed and inherit its style from before the merger.

Look at the code in PageEdit's Inspector at the line that was added and use the inspector tools to see where the style is coming from:

It shows it is from the the .bodystyle class and from the .calibre class both of which are in your stylesheet.

.bodytext { display: block; font-family: "Times New Roman2"; font-size: 0.88889em; text-align: justify; text-indent: 0.25in; margin: 0; } .calibre { display: block; font-size: 1.125em; line-height: 1.2; padding-left: 0; padding-right: 0; margin: 0 5pt; }

The font changes on my system because the listed font "Times New Roman2" does not exist.

As I said, this is just how merging styled paragraphs works under a Chromium live edit engine which is what QtWebEngine really is.

That is why we recommend you make serious edits with Sigil and for proofing and simple edits you can launch PageEdit from within Sigil via the Preferred XEditor icon. That way you can see and correct undesirable but legal under html changes like that using Sigil's CodeView editor.

Sorry, this is expected behaviour and not something under PageEdit's (our) control.

Closing this.

kevinhendricks commented 1 year ago

FWIW, I recommend that you think about greatly cleaning up and simplifying that stylesheet.css Add a p selector and remove all the bodytext classes since they would fall to the default p selector. Replace all bodysection classes with real header tags with their own styles followed by first p of section class definition. Split the chapters into multiple files, remove references to specific font names unless they exist or every os or are embedded , etc.

Live editing xhtml filled with classes on every paragraph and trying to merge adjacent paragraphs each with their own class definitions will be fraught with difficulties.