Using `whitespace: pre-wrap` to format plain text email sometimes
causes additional width to be allocated by the plain text blocks that
then does not get used due to the constraints on the HTML element.
The allocated space remains however and hence an un-needed horizontal
scrollbar appears.
Using `break-spaces` instead seems to help since it allows breaks after
a space character, leading to the additional space not otherwise being
allocated.
Now that the `:focus-within` pseudoclass is supported, use this rather
than some custom JS to update custom HTML classes. This also prevents
spurious mutation events from firing.
The ComposerPageState JS object assumed that if no signature was present
when first loaded, that none ever would be. This broke changing the
signature when the composer was opened for an account without one, and
the from account was changed to an account with a sig.
Instead of including the signature as part of the loaded body, always
include just a skeleton signature DIV and ensure the signature is loaded
dynamically after the body has been loaded. Update code and tests to
match this assumption, and add a unit test for updating the sig.
Fixes#309
This lets us implement changing signatures and deleting bottom-quoted
messages without having to reload the whole view, and makes it possible
to target only the user's content when modifying for send, etc.
* src/client/composer/composer-web-view.vala (ComposerWebView): Move
composer CSS into composer-web-view.css resource file, load it when
loading JS resource and add it to the view's user content manager.
(ComposerWebView::load_html): Split up body, signature and quote into a
DIV container for each.
(ComposerWebView::linkify_content): Replaced with ::clean_content,
which will also tidy up internal markup before sending. Update call
site and unit test.
* src/engine/rfc822/rfc822-utils.vala (Geary.RFC822.Utils): Remove some
more obtrusive white space when sending replies/forwards.
* test/client/composer/composer-web-view-test.vala,
test/js/composer-page-state-test.vala: Update tests to expect new HTML
and text output from ComposerWebView and use of individual parts for
composer markup.
* ui/composer-web-view.js (ComposerPageState): Replace messageBody
property and uses with bodyPart, signaturePart and quotePart. Set these
content-editable on load. Move listeners from messageBody back to the
document.body so they also listen for events on the additional
parts. Keep track of text cursor location within the parts and set a
class if so, to work around the lack of :focus-inside support.
(ComposerPageState::updateSignature): Implement by updating the inner
content of the signature part.
(ComposerPageState::deleteQuotedMessage): Implement by removing the
quote part from the DOM tree.
(ComposerPageState::containsAttachmentKeyword): Consider only the
bodyPart when scanning for attachments, remove hacks for ignoring the
signature any any quoted message.
(ComposerPageState::linkifyContent): Mirror ClientWebView change and
replace with ::cleanContent. Ensure existing parts have contenteditable
and focus class removed, remove signature and quote parts if empty.
(ComposerPageState::getHtml): Generate HTML using clones of the three
parts, so we can rmeove contenteditable and focus classes without
modifying the actual DOM.
(ComposerPageState::selectionChanged): Update focus class on parts as
needed.