* src/client/composer/composer-web-view.vala
(ComposerWebView::load_html): Remove spacers around cursor, just add
them after body and inline quote if present. Update unit tests.
In some cases, it may happen that a mail is being sent multiple times simultaneously
to the same recipient.
The only modified field being the Message-ID, we have to check it as well as
message's size before merging 2 mails together.
Otherwise, at each start-up Geary will try to fetch "missing mails" but will never
succeed to do so.
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.
* ui/conversation-web-view.js
(ConversationPageState::createControllableQuotes): Only add control
buttons if the quote is controllable. Calculat the height difference up
front, not in the control button's click handler, so the value is
correct.
* test/client/components/client-web-view-test.vala: New explicit tests
for init'ing the WebContext and loading default resources.
* test/client/components/client-web-view-test-case.vala:
Init the WebContext and load resources in the constructor rather than
fixture setup, so it only happens once per suite, not once per
test. Update subclasses to do same.
* test/client/composer/composer-web-view-test.vala: Add an explicit test
for loading ComposerWebView resources.
* src/client/composer/composer-link-popover.vala:
Gtk.Popover::set_default_widget is only available in GTK+ 3.18,
Gtk.Widget::set_tooltop_text param can't be null in earlier GTK vala
bindings.
* src/client/composer/composer-link-popover.vala (ComposerLinkPopover):
Replace calls to GTK 3.22-specific ::popdown() with ::hide().
* src/engine/util/util-js.vala (Geary.JS): Replace '\v' literal,
unsupported on at least valac 0.30.1 and gcc 5.4, with ordinal equiv.
* ui/conversation-web-view.js (ConversationPageState::createControllableQuotes):
Since WK does not want to seem to reduce the value of offsetHeight for
the HTML element when a quote is collapsed, calculate the difference
and manually update the preferred height.
* ui/client-web-view.js (PageState::updatePreferredHeight): Allow the new
preferred height to be passed in as a param.
* src/client/composer/composer-link-popover.vala
(ComposerLinkPopover::show): Focus URL entry on being shown.
* ui/composer-link-popover.ui: Replace URL entry text label with an
accessibility name. Refine the tooltip for the insert button, add notes
to translators about it.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add
::save_selection and ::free_selection to allow the selection to be
saved when inserting a link. Thunk calls to JS.
(ComposerWebView::insert_link): Add selection id param, pass through to
JS.
* src/client/composer/composer-widget.vala
(ComposerWidget::new_link_popover): Manage saving the editor's
selection, passing its id when inserting a link, freeing it
again. Convert into an async method so we can wait for the selection id
to get back from the WebProcess, update call sites.
(ComposerWidget::on_insert_link): Disconnect and reconnect selection
changed signal so the popover isn't dismissed when the selection does
change/
* ui/composer-web-view.js (ComposerPageState): Implement new
::saveSelection, ::freeSelection and selectionId param on ::insertLink.
* src/client/application/geary-controller.vala
(GearyController::open_async): Pass new cache dir through to
ClientWebView::init_web_context. Update avatar cache dir name to remove
redundancy.
* src/client/components/client-web-view.vala
(ClientWebView::init_web_context): Add additional cache dir para and
update call sites. Use to construct a WebsiteDataManager
instance. Construct a new WebContext using the data manager, and use
that instead of the default one when creating new ClientWebView
instances.
* src/client/composer/composer-embed.vala: Use scroll events captured on
the composer to manage the height of the composer, and forward through
to the conversation viewer's scrolled window and the editor as
needed. Remove code dependent on the editor having a scrolled
window (it doesn't) or access to the DOM (we don't).
* ui/client-web-view.js (PageState::getPreferredHeight): Compute and use
top and bottom when determining the height value.
* ui/conversation-web-view.css: Remove onerous style defaults now we
can deal with HTML elements with margins.
We can't easily wrap ComposerWebView in a GtkScrolledWindow, since we
don't any notifications that the cursor has moved offscreen and hence the
view needs to be scrolled, so let the view do its own scrolling.
* ui/composer-widget.ui: Replace editor_scrolled with editor_container,
update uses.
* src/client/components/client-web-view.vala
(ClientWebView::preferred_height): Make preferred_height a public
property so it can be accessed outside the class. Move
::get_preferred_height and ::get_preferred_width to
ConversationWebView. Tidy up ::on_preferred_height_changed a bit.
* ui/composer-web-view.js (ComposerPageState): Break any blockquote
elements under the cursor when Enter is pressed, unless Shift is also
down.
* src/client/web-process/util-composer.vala: Removed, no longer used.
* src/client/composer/composer-web-view.vala (ComposerWebView): Rename
::linkify_document since it really only applies to editor content. Make
an asyc method so we can wait until its finished. Update call
sites. Thunk call to JS.
* src/client/web-process/util-composer.vala,
src/client/web-process/util-webkit.vala: Remove unused code.
* ui/composer-web-view.js (ComposerPageState): Add ::linkifyContent
method and ::linkify static method. Add unit tests.
* src/client/composer/composer-web-view.vala (ClientWebView): Replace
::undo_blockquote_style with ::indent_line.
* src/client/composer/composer-widget.vala (ComposerWidget::on_indent):
Call new ::indent_line method, rather than doing a execCommand and a
second JS thunking call to fix the markup.
* ui/composer-web-view.js: Also replace ::undoBlockquoteStyle with new
::indentLine method. Add unit test.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add
::contains_attachment_keywords that thunks to JS, remove uneeded
::get_block_quote_representation method.
* src/client/composer/composer-widget.vala (ComposerWidget): Remove
attachment keywork checking related code, just call new method on
editor to do the check.
* src/client/web-process/util-composer.vala,
src/client/web-process/util-webkit.vala: Remove uneeded code.
* ui/composer-web-view.js (ComposerPageState): Implement new
::containsAttachmentKeyword method based on previous code. Add unit
tests.
The main gist of this is to ensure that the composer's widgets are
constructed seperately to loading its content, and that we only ever call
ComposerWebView::load_html precisely once per composer instance.
* src/client/composer/composer-widget.vala: Remove referred message,
quote text and draft flag param from constructor signature, move any
calls that loaded data from them to new load method. Don't load
anything into the editor here. Make loading the signature file async,
and call new ComposerWebView::updateSignature method on the editor to
update it.
(ComposerWidget::load): New async message for loading content into the
composer. Move related code from the constructor and GearyController
here, make methods that were previously public for that private
again. Tidy up calls a bit now that we have a single place from which
to do it all, and can understand the process a bit better.
(ComposerWidget::on_editor_key_press_event): Don't reload the editor to
remove the quoted text, call new ComposerWebView::delete_quoted_message
method on it instead.
* src/client/composer/composer-web-view.vala
(ComposerWebView): Add ::delete_quoted_message ::update_signature
methods, thunk to JS.
(ComposerWebView::load_html): Add quote and is_draft parameters,
construct HTML for the composer using apporporate spacing here, instead
of relying on all the disparate parts from doing the right thing.
* src/client/application/geary-controller.vala
(GearyController::create_compose_widget_async): Load composer content
after adding it to the widget hierarchy, set focus only after
everything is set up.
* src/engine/rfc822/rfc822-utils.vala (quote_email_for_reply,
quote_email_for_forward): Don't add extra padding around quoted parts -
let callers manage their own whitespace.
* test/client/components/client-web-view-test-case.vala
(TestCase:load_body_fixture): Make HTML param non-nullable, update
subclasses.
* ui/composer-web-view.js (ComposerPageState): Add ::updateSignature and
::deleteQuotedMessage method stubs.