Commit graph

10 commits

Author SHA1 Message Date
Michael James Gratton
977bb2827a Minor code cleanup. 2017-02-01 00:41:43 +11:00
Michael James Gratton
17fda41b85 Fix non-breaking spaces breaking formatting in sent messages.
This ensures that non-breaking space chars (not HTML entities) are
removed from text obtainined from the composer, and moves the F=F text
formatting from JS back to Vala, to minimimse the JS footprint and return
to using the old (working) version again.

* src/client/composer/composer-web-view.vala (ClientWebView::get_text):
  Restore the old F=F formatting code previously in webkit-util, apply it
  to plain text obtained from the composer.

* test/client/components/client-web-view-test-case.vala: New base class
  for tests involving ClientWebView.

* test/client/composer/composer-web-view-test.vala: New tests for
  ComposerWebView::get_html and ::get_text.

* test/js/composer-page-state-test.vala: Reworked to use
  ClientWebViewTestCase, updated tests now that JS is returning
  QUOTE_MARKER-delinated text, not F=F text.

* test/testcase.vala (TestCase): Move ::async_complete and ::async_result
  from ComposerPageStateTest so all test cases can test async code.

* test/CMakeLists.txt: Add new source files.

* test/main.vala (main): Add new test.

* ui/composer-web-view.js: Update doc comments, remove F=F code, break
  out non-breaking space replacement so it can be tested.
2017-02-01 00:41:43 +11:00
Michael James Gratton
536fb04840 Minor code updates. 2017-02-01 00:41:43 +11:00
Michael James Gratton
22de6b122e Fix JS error getting F=F text from ComposerWebView. Add JS unit tests.
* ui/composer-web-view.js (ComposerPageState::resolveNesting): Apply JS
  RegExp globally, to match default GLib RegEx behaviour.

* test/js/composer-page-state-test.vala: New tests covering generation of
  HTML and F=F text from JS ComposerPageState object.

* test/CMakeLists.txt: Add the new test.

* test/main.vala (main): Add a test suite for JS tests, add the new test
  to it.

* src/client/components/client-web-view.vala (ClientWebView): Add a
  reason to the JSError domain for when a JS exception is thrown.

* bindings/vapi/javascriptcore-4.0.vapi (JS::Context): Add JS.Type and
  some additional methods needed for the unit tests. Move most
  GlobalContext methods to Context so we can pass the lowest common
  demominator around.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d4a4c5b45f Initial pass at implementing Format=Flowed formatting in JS for WK2.
May not actually be working, needs testing, may eat your replies, etc.
2017-02-01 00:41:43 +11:00
Michael James Gratton
6edc097e50 Ensure basic rich text editing controls work under WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
a023b8aa6b Re-implement select-link-on-click for WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
6933f3b6f2 Re-enable rich/plain text editing toggke for WK2. 2017-02-01 00:41:43 +11:00
Michael James Gratton
b1027fcbbf Implement getting HTML and plain text from ComposerWebView in WK2.
* src/client/composer/composer-web-view.vala (ComposerWebView): Implement
  both ::get_html and ::get_text as async JS calls, make the methods
  async and update cal sites to handle that.

* src/client/composer/composer-widget.vala: Make saving deafts and
  sending message async, to handle editor returning message body text
  async. Remove uneeded ::get_html and ::get_text functions, update call
  sites to call same directly on the on editor instead.

* src/client/web-process/util-composer.vala: Remove obsolete ::get_html
  and ::get_text functions.

* ui/composer-web-view.js (ComposerPageState): Initial implementation of
  getHtml and getText methods.
2017-02-01 00:41:43 +11:00
Michael James Gratton
3f90f7785a Reimplement loading and cleaning message into WK2 composer web view.
* src/client/application/geary-controller.vala (GearyController::open_async):
  Load ComposerWebView resources.

* src/client/composer/composer-web-view.vala (ComposerWebView): Move
  HTML/CSS template here from ComposerWidget. Load composer-web-view.js
  on app init and add it to the web view's user content manager.
  (ComposerWebView::load_html): Overridden to require HTML body and
  signature, assemble complete HTML as appropriate before chaining up to
  the default impl.
  (ComposerWebView::load_finished_and_realised): Remove redundant method.

* src/client/composer/composer-widget.vala (ComposerWidget):
  Remove 'message' prop since it is unused and onerous. Cache current
  account's signature as a field so it can be passed through to the
  editor as needed. Port on_link_clicked to composer-web-view.js.

* src/client/web-process/util-composer.vala: Remove function ported to JS
  in composer-web-view.js

* ui/CMakeLists.txt: Include new ComposerWebView JS resource.

* ui/composer-web-view.js: Port composer HTML sanitisation methods to JS,
  add to a custom subclass of PageState. Instantiate it and hook it up to
  onload.
2017-02-01 00:41:43 +11:00