Commit graph

5732 commits

Author SHA1 Message Date
Catrope 6b2fb7b2e0 More dirty hacks to deal with Parsoid's behavior re newlines in <p>s
This strips certain newlines added by Parsoid so they don't end up in
the linear model, and puts them back in on the way out so Parsoid
doesn't freak out and produce invalid wikitext

Change-Id: I256aaded4229c915868dc868ec6eaa1a73e00be1
2012-06-14 19:35:39 -07:00
Catrope 7f97520af2 Don't produce an invalid range
I know this code is still being worked on but I felt like I should put
this in anyway, it might save the person working on it some work

Change-Id: I1535399b3798cd8de2fc5334cd1eac64b71e8821
2012-06-14 19:34:30 -07:00
Catrope ef0c551b79 When deleting, collapse the selection before issuing a transaction
This is needed because there are onTransact event handlers that use the
selection and expect it to be up-to-date. The previous behavior caused a
bug when pressing backspace at the end of the document, because the old
selection (at the end) was invalid in the context of the updated
document.

Change-Id: I159e37894d14d437f46495604c14804c0a13e84e
2012-06-14 19:33:13 -07:00
Catrope c0b3de327f Don't add empty annotation objects when inserting text
Empty annotation objects are unexpected by the rest of the data model
and cause weird breakage in the converter, resulting in inserted text
being in its own paragraph

Change-Id: I63de37c3c5e19ac650e7c7f2d1a0bfab21d45da9
2012-06-14 19:24:44 -07:00
Inez Korczynski da306ae08d Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-14 17:25:16 -07:00
Inez Korczynski fc138f3497 Start polling in async mode after document node is focused 2012-06-14 17:24:15 -07:00
Rob Moen 846d027ff7 Rewrite listButtonTool list and unlist methods.
Need to rewrite updateState method and polish unlist.

Change-Id: Ia18e038b4941a32f176747e00ed1881887cb1a8d
2012-06-14 17:22:45 -07:00
Inez Korczynski 9f1885bc4b Typo. Sorry )-: 2012-06-14 17:21:50 -07:00
Inez Korczynski 063cad43b9 Cleanup to startPolling, stopPolling and clearPollData 2012-06-14 17:20:41 -07:00
Christian Williams 87823835ad Starting and stopping polling for Enter
Change-Id: I398b6df242009f105bdb2214120779e6c5e57856
2012-06-14 17:21:05 -07:00
Inez Korczynski e9d02b56a2 Little bit of a cleanup to stopPolling, startPolling and clearPollData 2012-06-14 17:19:05 -07:00
Christian Williams 4ea6d7e7b9 fixing timer var name
Change-Id: Ica8d20942908f6a5fb78206873c4036e4ac7d77b
2012-06-14 17:03:25 -07:00
Christian Williams 945f39fe1a Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-14 17:02:47 -07:00
Christian Williams 0413c5bc7e Stop and start polling for undo and redo
Change-Id: I041f4c1d28a44797101da278c70e5e1759ebe6d2
2012-06-14 17:02:29 -07:00
Catrope 884e107a24 Fix typo rawr
Change-Id: Ib80b5e62aa4053c070ebdd065f327b54a30dc90f
2012-06-14 16:57:09 -07:00
Subramanya Sastry 3f92f39397 Removed newline normalization between paragraphs.
Change-Id: Ifd55db73c8fe2b3e952066a75cba2f8e13c58430
2012-06-14 18:51:56 -05:00
Inez Korczynski a57be133fb Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-14 16:41:15 -07:00
Inez Korczynski 50999cb8ad Attach handlers to mousedown, mouseup and keydown events on document node focus and disattach on document node blur. 2012-06-14 16:41:03 -07:00
Catrope 6d6914c3bc Fix missing adjustment in TransactionProcessor
I forgot to adjust a range based on this.cursor for this.adjustment .
This indirectly caused Rob to get an exception when trying to wrap
the last node in the document, because the unadjusted range was past the
end of the document.

Change-Id: If9d5b76568fae25ba2c0f405f1c4fcdd8d879e4f
2012-06-14 16:36:16 -07:00
Subramanya Sastry 54f12d1807 Fix for href handling.
- Check if href for links has the wgScriptPath prefix before
  attempting to strip it from the href.

Change-Id: I844151ef7317476668d1306b96a2aec5a56fd0f1
2012-06-14 18:35:22 -05:00
Trevor Parscal 45bf3577b8 Restored animated toolbar positioning
Change-Id: Ie7d44c6cd0fc459cfd02b6a68fa317ceadac7e7b
2012-06-14 16:30:31 -07:00
Catrope 2393ce4627 Fix broken getRange() function, wasn't skipping the opening element
Change-Id: Ib02cf9d22ba612e1cee02a4dd75f106907b74949
2012-06-14 16:23:20 -07:00
Catrope bd69fdd93f Don't blow away attributes coming from toDataElement()
This fixed a bug where an <h2> element with HTML attributes would be
converted to a 'heading' element with those HTML attributes but without
the 'level' attribute, which indirectly caused an exception somewhere in
ve.ce

Change-Id: I8bf32ff0d8e0f9d016b2abc6cb31824df05bdfc2
2012-06-14 16:06:35 -07:00
Subramanya Sastry c0fc9e9a97 Updated newline handling around lists and nested lists.
- Something like this:
    <ul><li>1</li><li>2<ul><li>2.1</li><li>2.2<ul><li>2.2.1</li><li>2.2.2</li></ul></li><li>2.3</li></ul></li><li>3</li></ul>
  now serializes properly to:

    *1
    *2
    **2.1
    **2.2
    ***2.2.1
    ***2.2.2
    **2.3
    *3

  So does this form which is what the above wikitext parses to:
    <ul><li>1
    </li><li>2
    <ul><li>2.1
    </li><li>2.2
    <ul><li>2.2.1
    </li><li>2.2.2
    </li></ul></li><li>2.3
    </li></ul></li><li>3
    </li></ul>

- Lists (and nested lists) are not entirely newline-insensitive.
  They still depend on newlines *between* lists.  The opening
  <ul> tag for non-nested lists should always start on a new line.
  So, for example,
    <ul><li>foo</li></ul><ul><li>bar</li></ul>
  will serialize to:
    *foo
    *bar
  which is incorrect.  But,
    <ul><li>foo</li></ul>
    <ul><li>bar</li></ul>
  will correctly serialize to:
    *foo

    *bar

Change-Id: I13a0290368574865957bcf57aebab488fbbb7026
2012-06-14 17:09:59 -05:00
Rob Moen 932324c016 Fix clear button tool. Getting / clearing all annotations
Change-Id: I2fc2da20da149cd5fdf3f2cd33aeed2e033fd979
2012-06-14 15:04:40 -07:00
Inez Korczynski 7ab079bc52 Add ve.log, ve.debug and change rendering animation debug effect used in TextNode. 2012-06-14 15:00:29 -07:00
Inez Korczynski ee475cc54a Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-14 14:33:38 -07:00
Inez Korczynski 260d3c0413 Fix bug with losing selection direction. 2012-06-14 14:33:33 -07:00
Trevor Parscal 656439240d Added support for clicking section edit links
Also now hiding the TOC with animation

Change-Id: Ia355d4104e0bfc276fe0c08d6faa2719e3556c06
2012-06-14 14:31:23 -07:00
Rob Moen 1e45a06185 Debounced contextView icon on selection in surfaceView.
Squashed old list button methods, list & unlist.

Change-Id: Ic522c761636b2126990ee194b7a441e8bf0396aa
2012-06-14 14:27:01 -07:00
Subramanya Sastry 8978e406fc Minor code refactoring
Change-Id: Ib7f70a3ac42e3d5a5985e9a9bcffa313bdac289b
2012-06-14 15:18:53 -05:00
Translation updater bot 1a92d59ebb Merge "Localisation updates from http://translatewiki.net." 2012-06-14 20:12:50 +00:00
Translation updater bot adb46c5e4f Localisation updates from http://translatewiki.net.
Change-Id: I9099f8cd45dd932a9daac0404c310aad37a14768
2012-06-14 20:08:18 +00:00
Subramanya Sastry d7e83c4e2b Fixed/updated newline handling for <p> tags
- More pieces are now simplified and all(?) newline handling
  is now centralized in the serializeToken function.

- This commit fixes bugs in rt-ing some code snippets
    ----------
    Ex 1: foo<p>bar</p>baz
    ----------

- This commit fixes bugs serializing VE generated html
    ----------
    Ex 2: <p>foo</p><pre>bar</pre> ==> foo\n bar
    ----------

- But, this round of fixes introduces RT failures for certain
  code examples in parserTests.txt.  In all these failing cases,
  inline text/html is embedded within a generated <p> tag during
  parsing.  If these generated <p> tags can have a "gc:1" attribute
  added to them, we can properly serialize them to the original
  form.
    ----------
    Ex 3: foo<pre>bar</pre>
          Parsed HTML: <p>foo</p><pre>bar</pre>
    ----------
  Note how this parsed HTML is identical to what the VE outputs
  in Example 2 above.  So, without the gc:1 attribute, we now
  have conflicting requirements on the example same HTML.
  This increases confidence in the correctness of my commit here.

Change-Id: I86beadec91c445a7f8a6d36a639b406697daa0a2
2012-06-14 14:59:18 -05:00
Catrope bb5c82745e Handle aliens correctly in the converter
Previously, data-mw-gc (generated content) elements were unconditionally
converted to alienInline nodes, and unrecognized elements were
unconditionally converted to alienBlock nodes. This is wrong and
produced weird results when I started experimenting with <code> tags.

Instead, I made both gc and unknown element trigger alienation, but the
decision of whether we generate an alienInline or an alienBlock node is
separate and is based only on whether we're inside a content node.

Change-Id: I12335337c3fa60c725ae7bcfbfb52a1dda153fb5
2012-06-14 12:24:14 -07:00
Christian Williams 86d891605d Most of backspace and delete support, methods for starting and stopping polling.
Change-Id: Ic387d9eed3a1368dd70c7a86c7b9761400c76f93
2012-06-14 12:17:42 -07:00
Subramanya Sastry 13e03ec1d7 Refix <pre> serialization.
- Effectively reverted fix from f882a65153
  and added a new fix.

Change-Id: I8b81e26525a5f1a22acaf2c7067f2dcd9b962818
2012-06-14 13:10:02 -05:00
Inez Korczynski 9d487c1824 Special handling in pollChanges loop for case when node is null. 2012-06-13 22:23:59 -07:00
Inez Korczynski 3667c2cf83 Block triple click (select node) - temporary - as long as we don't have robust support for it. 2012-06-13 22:19:10 -07:00
Subramanya Sastry 51227f2a4a Improved, simplified newline handling in wikitext serializer.
- Eliminated newline handling from several places in code and
  mostly isolated it to serializeToken thus simplifying newline
  handling logic.
- Fixing some bugs in the process: # of green roundtrip tests
  went up by 5 (294 --> 299) but actually introduced failures on
  a few originally succeeding tests (additional leading/trailing
  newlines on the entire test output).
- Added bonus: made list serializing (mostly) insensitive to
  newlines between tags.  So, all the following DOM serialize
  identically to the following wikitext:

  *foo
  *bar

  ----------
  <ul><li>foo</li><li>bar</li></ul>

  ----------
  <ul>
  <li>foo</li>
  <li>bar</li>
  </ul>
  ----------
  <ul>

  <li>
  foo

  </li>

  <li>
  bar</li>

  </ul>
  ----------

Change-Id: I76be56c4b2789039dff5f47de4659746882e45d6
2012-06-14 00:10:51 -05:00
Inez Korczynski c3cf5617fd Use ve.ce.getDomText and ve.ce.getDomHash instead of ve.ce.Surface.getDOMText and ve.ce.Surface.getDOMHash. 2012-06-13 22:05:38 -07:00
Inez Korczynski ba680afcc3 Fix bugs in getDomText method. 2012-06-13 22:04:52 -07:00
Inez Korczynski f4a4952d18 OMG. We have typing, autocorrect and spellcheck working. (Still no IME and still may break cut/paste) 2012-06-13 21:46:29 -07:00
Inez Korczynski 94d29eaf49 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-13 21:17:13 -07:00
Catrope e6751e3f03 Set data.title based on sHref so LinkInspector can use it
Change-Id: I7589740ec5661afd7c8dd0f54e955d170e3096e6
2012-06-13 19:32:49 -07:00
Catrope f83cdc4eaa Hack around Parsoid bug in link handling
Parsoid ignores sHref when converting back to wikitext, so we have to
set the href attribute to "/$title"

Change-Id: I1068116c0be72197619d0df3b4d1231a3879fa14
2012-06-13 18:53:13 -07:00
Catrope 9c939047be Fix return value of ve.ui.LinkInspector.getSelectedLinkAnnotations()
Was returning a single annotation, but all callers were expecting an
object.

Change-Id: I55be083e5451f4ace5e54dfecb904ae53041054b
2012-06-13 18:49:38 -07:00
Catrope 9d9c06f4e2 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-13 18:31:05 -07:00
Catrope d0adb112c0 Needs copyArray instead of copyObject, d'oh
Change-Id: Ic185d328a87579262458fe24fd01539c495f09a2
2012-06-13 18:30:50 -07:00
Trevor Parscal 75ac5b03e6 Improved appearance of activating and deactivating editor
Also prevented double-initializing

Change-Id: I9e64eb1f331489f6acee469fdab64133d817e7b1
2012-06-13 18:26:21 -07:00