Commit graph

1843 commits

Author SHA1 Message Date
Gabriel Wicke e584e35ecb Improve nested definition list serialization
Basically only prefix all bullets if the serialization output is going to be
in start-of-line context. The test for that is currently inline, but should
perhaps be factored out to a method or state flag instead.

We could alternatively consider to return the start-of-line prefix and let it
be used in _serializeToken in case we end up in start-of-line context.

This patch also fixes a newline issue on input like this:

:d1
::: d3

Both the list and list item handlers now set the startsNewline flag
dynamically depending on the context, so that we don't depend on the
suppression of newlines from list syntax by the singleLineMode any more.

There is still an extra newline inserted between list items in the following
example:

;t1 :d1
;;t2 ::d2

This looks like a bug in the produced DOM and not in the serializer, since the
outer definition list is closed and re-opened between d1 and t2.

Change-Id: I78e3a1ef34cf9159d5a1e86fb64c774ff111e71d
2012-06-21 15:28:43 +02:00
Gabriel Wicke ab286d6a59 Empty elements only use the start handler info
Thus move the 'endsLine' attribute to the start section.

Change-Id: I8490d866b84aa99205ca9e8e3ee137026fb18501
2012-06-21 10:30:11 +02:00
Trevor Parscal 861ce8d54f Fixed pressing backspace in a slug, now we just move the cursor to some nearby content
Change-Id: Idaf61264fb493169cfef1c48613036c292d590f0
2012-06-21 00:01:32 -07:00
Trevor Parscal c548b3cdba Merge changes I44515c86,Ife902ace,Ia6510de1
* changes:
  Got rid of iteration to get the surface
  Removed attach and detach methods from ve.ce.Node
  Track adjustments in DocumentSynchronizer and apply them to oldRange
2012-06-21 06:41:57 +00:00
Trevor Parscal 07eb2df53a Got rid of iteration to get the surface
Also added a safety check to make it easier to spot a regression

Change-Id: I44515c867852f2f726be74161f6b8e466c0933da
2012-06-20 23:40:38 -07:00
Trevor Parscal 00c555ebe5 Removed attach and detach methods from ve.ce.Node
Added some needed functionality in ve.Node to make up for this

Change-Id: Ife902aceb4e8535411dc653ae61087aecf67a0c6
2012-06-20 23:40:38 -07:00
Catrope dc646ff32c Track adjustments in DocumentSynchronizer and apply them to oldRange
This is needed because oldRange is relative to the state of the model before any changes were made, but when we call selectNodes() it's gonna operate on a partially updated model tree.

This is a genuine bug in DocumentSynchronizer proper, which means I owe the entire team lunch

Change-Id: Ia6510de19df02e961c7f25fb8e7833abceb8d25b
2012-06-20 23:40:38 -07:00
Trevor Parscal cb3eba185d Merge "Fix adjustment of newRange in TransactionProcessor" 2012-06-21 06:38:42 +00:00
Catrope df4e5f0200 Merge "Fix minor bug with space replacement in TextNode" 2012-06-21 06:37:56 +00:00
Catrope 0b9934b2cc Fix adjustment of newRange in TransactionProcessor
* Adjust both start and end for preceding operations
* Adjust end for the current operation as well

Change-Id: I2f96d609bddf3788aa5700ad1f0b46208f3517d7
2012-06-20 23:37:55 -07:00
Inez Korczynski 74440be132 Fix minor bug with space replacement in TextNode
Change-Id: Iafdc59d9fd8654444079e55a2ad36a40cc21fa4c
2012-06-20 23:33:22 -07:00
Inez Korczynski ab16987ae8 Better support for left & right arrow keys
Change-Id: Iad56f8179d3ed90828e31ad0203a5cec9e9d2458
2012-06-20 23:06:47 -07:00
Trevor Parscal 3008b04126 Merge "Properly hide and show inspectors." 2012-06-21 05:56:30 +00:00
Trevor Parscal 709c5946ed Merge "Allow initial value to be accepted in link inspector if it is the default text." 2012-06-21 05:55:40 +00:00
Trevor Parscal 88ef5b1517 Merge "Logic for moving cursor left and right programmatically" 2012-06-21 05:54:50 +00:00
Trevor Parscal c12eca96fc Merge "Support protocol-relative URLs in the link inspector" 2012-06-21 05:53:43 +00:00
Trevor Parscal 7e892daac9 Merge "Fixing backspace when at the beginning of the document." 2012-06-21 05:52:45 +00:00
Trevor Parscal a7b47a2c00 Merge "Pressing enter in the last listItem, if empty, will exit the list" 2012-06-21 05:50:51 +00:00
Trevor Parscal e657cd802f Merge "Support for insertion in slugs." 2012-06-21 05:50:09 +00:00
Rob Moen 4d7e467780 Properly hide and show inspectors.
Change-Id: I1de85c8364df67bf547b4fec498829e61f7ab07f
2012-06-20 22:29:50 -07:00
Inez Korczynski 9b1e96cd46 Logic for moving cursor left and right programmatically
Change-Id: I48844cfbebaf3933ad61dc462ab5ea73be45a8aa
2012-06-20 22:24:12 -07:00
Inez Korczynski 772716bce9 Fix the exception that is thrown when document is passed as a start parameter to traverseLeafNodes method.
Change-Id: Ie8c5a0fd9ad8e003fef706fdf61749499ad27e31
2012-06-20 21:53:42 -07:00
Rob Moen 11c3e8b0fb Allow initial value to be accepted in link inspector if it is the
default text.

Change-Id: Ife8e8742b57bc9ff75cf147d6abc913f2a2ada7c
2012-06-20 21:52:42 -07:00
Catrope dd1db50a3c Support protocol-relative URLs in the link inspector
Change-Id: I78ed64d90e562de1a972807c16196f10d805b959
2012-06-20 21:51:07 -07:00
Christian Williams 4df69b01de Fixing backspace when at the beginning of the document.
Change-Id: Ib4c463c6a1eb27897a39c96c46617047d8ee4325
2012-06-20 21:34:11 -07:00
Inez Korczynski 7eae9cdba6 Support for insertion in slugs.
Change-Id: I8e144206520b59271edf854020b87ce947fe0559
2012-06-20 21:32:26 -07:00
Christian Williams 0ab3b65c03 Pressing enter in the last listItem, if empty, will exit the list
Change-Id: I084fabac09654adf50db97b554e937d2772f9a37
2012-06-20 21:10:48 -07:00
Catrope 48bba8fcb8 Merge "Added onbeforeunload handler which warns before someone leaves the page if they have unsaved changes" 2012-06-21 03:51:36 +00:00
Catrope ed399608fc Merge "Added getSelectionText method to link inspector so that the default text for a link is the selected text. patchset 2 - add case for if data offset is an object, be sure it is a string prior to adding it. truncate to 255 chars. patchset 3 - actually add the patched file Change-Id: Ibddf942c2a0ba3412d93cf9730f74eb858025fad" 2012-06-21 03:48:53 +00:00
Rob Moen 8bccdf9d78 Added getSelectionText method to link inspector so that the default
text for a link is the selected text.
patchset 2 - add case for if data offset is an object, be sure it
is a string prior to adding it.  truncate to 255 chars.
patchset 3 - actually add the patched file
Change-Id: Ibddf942c2a0ba3412d93cf9730f74eb858025fad
2012-06-20 20:45:56 -07:00
Trevor Parscal 36ee49614c Added onbeforeunload handler which warns before someone leaves the page if they have unsaved changes
Change-Id: I0ffb17987ee40995f7f7e3ffc386aa71c9db37a7
2012-06-20 20:16:10 -07:00
Christian Williams 8556888a9a Fixing handleEnter to allow splitting headlines
Change-Id: I4f75ee1b454f66c4b112a1ab59386994bb249792
2012-06-20 20:02:25 -07:00
Trevor Parscal a9d62184ed Merge "Disable indentation button tool, doesn't work yet" 2012-06-21 02:42:53 +00:00
Trevor Parscal 9c0b8f57b2 Merge "Use getClonedElement() rather than manually building a node" 2012-06-21 02:40:11 +00:00
Trevor Parscal 1bfb8f7579 Merge "Hide each inspector in the iframe, works for now. Will need to be rewritten for multiple inspectors" 2012-06-21 02:38:25 +00:00
Trevor Parscal f529c5ebbe Merge "i18n for error messages" 2012-06-21 02:37:21 +00:00
Trevor Parscal 9ecb3053e4 Merge "Document how to remove attributes" 2012-06-21 02:36:29 +00:00
Christian Williams 691de5fb76 i18n for error messages
Change-Id: Ib0d3350985a64df28a4a2d2c5e68d7dc341330b3
2012-06-20 19:33:19 -07:00
Catrope 9b514b7cbf Fix off-by-one bug in the ve.msg's fallback $1 replacement
Change-Id: I62df4ce4b801c7eec5c08958e1c3b4f835f60957
2012-06-20 19:26:03 -07:00
Trevor Parscal f49ef7dfc0 Cleaned up selection and focus code for inspectors
Change-Id: Iee1a3525015967f1de461c9e0ebea84834346172
2012-06-20 19:22:38 -07:00
Inez Korczynski 7291485ce5 Move slugs logic into doSlugs since it is being used in onSplice and in cleanup methods.
Change-Id: I10395bbdfd71fda2913e6da736189f0ff8216702
2012-06-20 19:10:28 -07:00
Catrope ac835c2d69 Merge "Keyboard shortcuts for bold and italic" 2012-06-21 02:09:28 +00:00
Christian Williams 14054becb5 Keyboard shortcuts for bold and italic
Change-Id: I12b80134152bbbbd2dfa42b32fec072cde29baa5
2012-06-20 19:09:06 -07:00
Rob Moen f3b74549cf Hide each inspector in the iframe, works for now.
Will need to be rewritten for multiple inspectors

Change-Id: If94b60d4a1024bdbcdba24f94e318a29341bf18a
2012-06-20 19:03:48 -07:00
Catrope 319ff040bb Merge "Fix method hasSlugAtOffset to return true when length of the element is 0" 2012-06-21 02:00:51 +00:00
Trevor Parscal 09fd90f66f Merge "Add slugs inside empty branch nodes so cursor can be correctly placed." 2012-06-21 02:00:17 +00:00
Catrope 7be404f818 Merge "Removed trailing whitespace and other cruft" 2012-06-21 01:59:57 +00:00
Catrope e8702e8f0f Use getClonedElement() rather than manually building a node
Change-Id: I3d6390830c6a01235e55b1484e161d1f6737ac01
2012-06-20 18:59:12 -07:00
Catrope 7f3106802c Merge "Modified handleEnter to insert a paragraph above/below a non-paragraph if at the edges" 2012-06-21 01:57:58 +00:00
Trevor Parscal 3743b75d59 Modified handleEnter to insert a paragraph above/below a non-paragraph if at the edges
Change-Id: Icfe650890ceb32f77c79347bebdf8be9612cfdbb
2012-06-20 18:57:35 -07:00
Catrope 01407b1ec5 Merge "Typo fixes throughout the codebase" 2012-06-21 01:49:15 +00:00
Catrope 22677ac475 Merge "When there is a selection range, pressing arrow keys should not remove the selection in Firefox." 2012-06-21 01:48:30 +00:00
Christian Williams 58917f5015 When there is a selection range, pressing arrow keys should not remove the selection in Firefox.
Change-Id: I93bca05dd0f37fd8f87eba3f407a68c922ed66e3
2012-06-20 18:48:02 -07:00
Catrope 9f2a8757f4 Merge "Add commented-out tab key support for indentation button tool" 2012-06-21 01:46:36 +00:00
Rob Moen 1462a6cf37 Add commented-out tab key support for indentation button tool
Change-Id: I4741182bb79becf08288287142a930ddf7f547ad
2012-06-20 18:45:44 -07:00
Catrope c5ddfb7c7a Disable indentation button tool, doesn't work yet
Change-Id: I582289067139e3e1b7ef14c32d82373d1a1c2b5a
2012-06-20 18:42:27 -07:00
Catrope f2c178f020 Document how to remove attributes
Change-Id: I9a30a6510d62fb2ee4e6341ef74f2f5558125e72
2012-06-20 18:40:24 -07:00
Rob Moen 5ac30a2f5f Apparently every object in FF has a watch() method. Added better
Checking for this for when mw.page.watch module is not loaded.

Change-Id: I67688288dba59aa52bba9d538682374a15169285
2012-06-20 18:35:07 -07:00
Inez Korczynski c1225acb68 Fix method hasSlugAtOffset to return true when length of the element is 0
Change-Id: Icf43eb6adfcc45eaf1ae8ff146a029546341ba33
2012-06-20 18:18:49 -07:00
Inez Korczynski a62e78292f Add slugs inside empty branch nodes so cursor can be correctly placed.
Change-Id: I075a76da50bd4927c3832a660fdf96bbd250e3b0
2012-06-20 18:18:49 -07:00
Trevor Parscal 6fe115a563 Removed trailing whitespace and other cruft
Change-Id: I8c439d2a272e01b9e26bfd6b13d9e600d324930b
2012-06-20 17:42:12 -07:00
Christian Williams 93594d1c22 Pressing backspace or delete at boundary of dislike nodes will cause adoption
Change-Id: Idd6cd40c8d4f34081851fc9ea1cc70037915244b
2012-06-20 16:28:13 -07:00
Rob Moen 4b8833942c If user is anonymous, mw.page.watch is not loaded. Only call
method if module is loaded.

Change-Id: Ieb549b701f05f1dab322baa79d59366225f42727
2012-06-20 16:22:10 -07:00
Trevor Parscal e175292c07 Typo fixes throughout the codebase
And a missing semicolon

Change-Id: I8487525ae2a7fa8f58e00c92c7dff600d9bd9520
2012-06-20 16:01:02 -07:00
Trevor Parscal 5968991d25 Broke the grouping functionality of ve.ui.ListButtonTool.list method into ve.Document.getCoveredSiblingGroups
Also fixed unlisting to not break when unlisting a range that includes things that are not list nodes

Change-Id: Ib9d4ea851c3ed9bf72a93aa87e470ce40c308453
2012-06-20 15:49:41 -07:00
Inez Korczynski bbaa17a6c4 * Replace spaces at the beginning and at the end of text node with  
* Alternate double spaces with &nbsp, "  " -> "  "

Change-Id: Ib4351ed6263e69f0d98957c2d0d8411e040fece7
2012-06-20 15:32:14 -07:00
Rob Moen 8178237c27 Update list tool updateState method so that if you have nodes not
contained by a list node the button is off.  Button is now only toggled on
if all nodes in selection have a parent list node.
Patchset 2 - cleanup whitespace
Change-Id: Ia9adc39c0d5c75e2e96580f0e172f5b602540ac3
2012-06-20 15:12:08 -07:00
Gabriel Wicke 5ff4aa4c2d Merge "First attempt at the definition list bug (work in progress)" 2012-06-20 22:03:16 +00:00
Catrope 37600d020c Add ve.dm.Transaction.translateOffset() and translateRange()
Change-Id: I21bde38056862a1de167646f6cf3030e38d3497b
2012-06-20 14:52:44 -07:00
Gabriel Wicke cf32b34b0a First attempt at the definition list bug (work in progress)
The main issue is that the bullets from dd/dt were not stored on the stack. I
added a separate field for it in each stack entry, which now fixes the basic
indent case without (afaik) breaking anything else.

There are still some newline issues, and the need to handle the single-line
dd/dt vs. the multi-line variant.

Change-Id: I65939c05e2c5dde0789bf8aefd7651161a2f137c
2012-06-20 23:51:39 +02:00
Rob Moen cc47a4d05c Add Hook for 'watch' event triggered on MW watch link or icon
to update save dialog checkbox with correct watched state.
Call mw.page.watch.updateWatchLink onSave to refresh icon
with watched state.
Patchset 2- updated event name
Change-Id: I23ef1aad9c8ace13df1b9a6bf0bfeddb9d8bcb37
2012-06-20 13:05:56 -07:00
Catrope 3877a0d58d Merge "Rewrote listification" 2012-06-20 19:39:28 +00:00
Trevor Parscal 5df5d8470a Rewrote listification
Now handles wrapping or converting properly, in any combination

Change-Id: If8b573f576555c9129f8316bc9f06557eda06e85
2012-06-20 12:39:03 -07:00
Trevor Parscal d429113eb8 Merge "After creating a page, refresh the page rather than going back" 2012-06-20 19:35:42 +00:00
Trevor Parscal bcf93eb695 Automatically bind and unbind context's window event bindings on documentNode focus and blur
Change-Id: Ie43165da49a36a7d0d13a52318d9c5438dad9605
2012-06-20 12:34:20 -07:00
Trevor Parscal 7a1d74fd18 Change state variable so updates work more than once
Change-Id: I7c701761b09e96e01e26164080d22cafe43019e0
2012-06-20 12:28:01 -07:00
Catrope 427406a0bc After creating a page, refresh the page rather than going back
We can't go back in this case because the action tabs etc. will be wrong

Change-Id: I8e26c43b7735ea8a2ef010bd4141f0ee8d4b1c68
2012-06-20 12:16:27 -07:00
Gabriel Wicke e8c517e48e Merge "Improve preformatted text handling" 2012-06-20 19:08:48 +00:00
Catrope 9f5f43f18a Fix residual selectNodes() breakage from fc4ba3019a
Change-Id: Icc317eab71d4e360905e902a0ae7cc88deab4cbe
2012-06-20 11:39:20 -07:00
Rob Moen b9eb06349f Switch path from ve2 to ve help with Dmrewrite merge
Change-Id: I8fbbfcb3e47a9319398af7262effc1f7cf3df51f
2012-06-20 10:49:00 -07:00
Gabriel Wicke 344fac19b5 Improve preformatted text handling
* Don't escape html-syntax pre content for now; Should parse this with a new
  pre content production later (which needs to be split out of the regular pre
  production in the tokenizer)
* Protect indent-pre content from start-of-line syntax escaping
* Preserve extra leading spaces in the tokenizer
* Two more (now 284) round-trip tests are passing

Change-Id: I199b89c0ee7fae12546df10c1b5117c97caccac5
2012-06-20 19:28:34 +02:00
Gabriel Wicke 6054a4aa14 Clean up serializer newline handling a bit further
Queued newlines and new trailing newlines were not cleanly separated so far,
which caused some trailing newlines to be consumed for needed leading
newlines. This change fixes several newline bugs, taking the number of passing
round-trip tests from 276 back up to 282.

Change-Id: Idb4706e15ce71e63085033e3f3f29557915c11a8
2012-06-20 16:31:39 +02:00
Gabriel Wicke 2426901e5b Fix definition lists with multiple dds
Fixed a bug in the list handler for multiple dds in a definition list. Also
fixed a few JSHint warnings.

Change-Id: I3e883786698a9521347fc2a5e6420646318813a7
2012-06-20 15:34:20 +02:00
Gabriel Wicke c9d3db8f34 Fix a few round-tripping and list issues
At least partly fixes some bugs in
http://www.mediawiki.org/wiki/Parsoid/Bug_test_cases. 276 round-trip tests are
passing.

* Fixes
  http://www.mediawiki.org/wiki/Parsoid/Bug_test_cases#extra_newline_after_empty_dd,
  except for lost newline in 'working' example before next heading
* Fixes newlines in definition lists
  (http://www.mediawiki.org/wiki/Parsoid/Bug_test_cases#dd_indentation etc),
  but does not fix missing / incorrect bullets for those

Change-Id: I21f66e265e43e1d1a4c7da70984a9984b8e6d0dd
2012-06-20 13:53:47 +02:00
Catrope c97d0a5d9e Merge branch 'dmrewrite'
This merges essentially all editor development in the past two months

Change-Id: I2c8653effc4dbb01a6b99a2ac2b87d83fbafa405
2012-06-19 18:28:49 -07:00
Catrope 6afed5e5cc Move ve2/ back to ve/
Change-Id: Ie51d8e48171fb1f84045d1560ee603cee62b91f6
2012-06-19 18:20:28 -07:00
Catrope fc4ba3019a Fix selectNodes() bug: empty range at the start of a node returned []
Because of the end>=left condition, the loop was exiting right before
hitting the startBefore case, so use end>=left-1 instead.

Fixing this exposed another bug that caused nodeRange and nodeOuterRange
to be off by one: we need to increment left after storing it in
startOffset, not before

Change-Id: I54e18fb2119c8caefb4f7a7f2be43c6129afc4c0
2012-06-19 17:12:36 -07:00
Gabriel Wicke b94cad47dc Fix single-line mode for nested lists
Known issue: breaks round-tripping of :;;;::. That test is normally disabled
anyway, so we can fix it later.

Change-Id: I7954271311bfb7e71caae59d8177e3f04a9ebbca
2012-06-20 01:48:52 +02:00
Catrope 39dbbf9455 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-19 16:19:00 -07:00
Catrope dc3be737b4 Merge remote-tracking branch 'origin/master' into dmrewrite
Conflicts:
	VisualEditor.i18n.php
	api/ParserService.js
	modules/parser/mediawiki.WikitextSerializer.js

Change-Id: I47b299ff3a6d948dcbeaf53cde5786362b23f66c
2012-06-19 16:16:53 -07:00
Trevor Parscal babb636058 Cleanup
Change-Id: I4af98700e5c4739d749ec95abc111710208d2177
2012-06-19 16:08:14 -07:00
Catrope 61f4a8af78 Update the code to account for the fact that sHref is now a string
and update tests to reflect the recent changes in link handling

Change-Id: Ie1a3e409c22c09f104c244b1db4764fd202fc885
2012-06-19 16:04:07 -07:00
Catrope b6ad91655d Make external links (mostly) work
This handles internal and external links separately, only setting
'title' for the former and only 'href' for the latter.

On the way out, detect external links using a simple regex (needs
improvement). Also don't write sHref any more per Gabriel's request.

Change-Id: Ibc2436d0a12de1d027e116f181db640cbcf3d522
2012-06-19 16:04:07 -07:00
Catrope a80dcf84c6 Prevent the newline hacks from adding newlines before a link
We might be able to get rid of these altogether but I'd rather not touch
this too much for now

Change-Id: I0b55af017df7d9dc023b2d23ecd4f891cb75946b
2012-06-19 16:04:07 -07:00
Catrope 980ae78861 Prevent the converter from creating empty list items
Change-Id: Iae7d5d791d09400f7d3d799043efe6b8714465ec
2012-06-19 16:04:07 -07:00
Trevor Parscal 268e793b03 Fixed class names to match what's in the DOM now, fixes inspector positioning
Change-Id: I0e15c4a9a50b5894a31b1d37251adb3fd4893539
2012-06-19 15:47:17 -07:00
Gabriel Wicke 33dc9abb0d Clean up sHref handling a bit
* sHref is now always a string
* fixes crasher when sHref is not set

Change-Id: If5756948ac6bc26c2d7c04d970b5aba5331cb8bb
2012-06-20 00:34:57 +02:00
Trevor Parscal ba88697145 Remove the context menu stuff when tearing down
Change-Id: I7332d449e428aeec8952f7c70d325db7c5d5366a
2012-06-19 15:32:22 -07:00
Trevor Parscal c39577a06c Made context menu not open after selection ends over top of it
Also fixed some of the positioning to stay correct while scrolling and resizing a window

Change-Id: I40d57b4fb035aea0b43b998251a93a83a46b9735
2012-06-19 15:26:37 -07:00
Gabriel Wicke e117f09362 Wikitext escaping and quite complete source range tracking
* Started to add more complete tag source range (tsr) annotations to most
  start / empty tags. These replace the old sourcePos and sourceTagPos
  annotations, and look more promising for general round-tripping than block
  source ranges (bsr). See
  http://www.mediawiki.org/wiki/User:GWicke/Parsoid_source_ranges for some
  notes on this.
* Added an escapeWikitext method in the serializer that tokenizes supposedly
  text-only content from the DOM with the tokenizer and wraps runs of returned
  non-text tokens into nowiki tags. The source corresponding to non-text
  tokens is retrieved using the tsr annotations.
* Removed old (unused) table productions to avoid confusion.
* 276 round-trip tests are passing, vs. 283 without escaping.

Known issues:
* harmless for now, can be improved later: urllinks in external link captions
  are wrapped in nowiki. Example HTML:

<a rel='mw:extLink' href="http://example.com">http://example2.com</a>

* some start-of-line syntax in wiki-syntax preformatted blocks might be
  wrapped into nowiki when that would not really be needed. Example HTML DOM:

<pre>
* foo
* bar
</pre>

Change-Id: I01c34aedd5c566614d36924add47a6a960e91987
2012-06-19 23:36:44 +02:00
Rob Moen 89df02cdb6 remove on transact proxy as only listening to change
Change-Id: Ifb809a24427f9970fd9a885507fdb376b2dad509
2012-06-19 14:15:31 -07:00
Trevor Parscal 44d50c980f Added i18n messages to mw.msg fallback
Change-Id: Ic4b44eb6ab31392fa727f14ec38800fe6b185d44
2012-06-19 13:58:54 -07:00
Trevor Parscal 39dc10d1d8 Fixed drop-down styling to avoid wrapping
Now that the message keys are showing in the demo we can see how bad things look if the drop-down label is too big and wraps

Change-Id: I776a7e480a3f6240c0929f2f50a865c2de4ec0a5
2012-06-19 13:48:50 -07:00
Trevor Parscal dc6ab4fb95 Introduced ve.msg, an alias for mw.msg if it's available
Change-Id: I67c737e585033edc565e2d941c5a729836a2dbec
2012-06-19 13:44:34 -07:00
Trevor Parscal ecabf9d0cf Fixed the history buttons to be locked out when disabled
Change-Id: Ie68737a271c683ba0e196d910ef562ac1313c69b
2012-06-19 13:05:32 -07:00
Rob Moen 9f3a8e719f Rewrite updateState for listButtonTool
Change-Id: I690ce70304ed49e71836297c701eceb2269d9b97
2012-06-19 12:57:51 -07:00
Trevor Parscal cc17c81469 Convert content branches to paragraphs before wrapping them in a list
Change-Id: I987a92e838b817dfe7afbcaae19c03b9437f7b66
2012-06-19 12:50:01 -07:00
Trevor Parscal 70c8a4fe35 Allow retry after load failure
Change-Id: Ib0766427013a20e70cca3c17c29246d25690079f
2012-06-19 12:26:08 -07:00
Trevor Parscal 9dd09e6b4f Improved error handling and locked the save dialog save button while saving
Change-Id: I57483f242ef81e17ec1c9d30871c07c2a177a590
2012-06-19 12:15:57 -07:00
Catrope 4192d1784a Actually fix the error in the previous commit
Change-Id: I5dd841692b2f39c807527dbeb116c904c7cb0994
2012-06-19 12:14:57 -07:00
Catrope 56a98e0d9c Use jQuery for lastChild as well, for consistency and to prevent errors
Change-Id: Ia024dbc5ca60e857987aeb652a9c8af5d423c2d0
2012-06-19 12:10:29 -07:00
Catrope f2a07014e3 Set sHref on links on the way out
This fixes handling of internal links, but this code needs more love

Change-Id: I2424d23bd7e795bd7c9cc3443fe4ec4001f2a8c9
2012-06-19 11:59:28 -07:00
Catrope f08c0ca3a0 Don't add newlines to text nodes inside lists
Change-Id: Ife11f7b87ab540a8a99f13315f889c2aa41a6a32
2012-06-19 11:55:45 -07:00
Trevor Parscal a62e011d68 Reduced selecting on the documentNode
Change-Id: I6f90e931eedad518d6716cb965606b8fb9387f1e
2012-06-19 10:50:41 -07:00
Trevor Parscal fed9915ba5 Reset the save dialog between uses
Also fixed the watchList binding for loading the right state

Change-Id: I25822ba9dfb25d5f8ade765baf6ae69adc9d40ae
2012-06-19 10:50:41 -07:00
Rob Moen d3cb2ccb26 write update and unlist method for list button tool
Change-Id: Ie1f0f8755aac7058d93890e13efefb3c63ee9710
2012-06-19 10:08:05 -07:00
Catrope 97a1edfd72 Crusade against hardcoded English, i18n for everything
Change-Id: Ibc658e5f67a373394a4ba149e9b9003f3803023a
2012-06-19 01:30:30 -07:00
Catrope 6a48f2b829 Fix inconsistent parameter lists for loadError and saveError events
Change-Id: I7d195793f05f98ff3218f494ef78f9981f6b716f
2012-06-19 01:24:40 -07:00
Catrope c15b9d04a0 Fix typos in license text
Change-Id: I0777955b976c2a5d11e5cde78d12b403b8ec7828
2012-06-19 01:24:40 -07:00
Catrope 5db6504cd3 Fix method docs for change(), you can't actually pass multiple transactions
Change-Id: I24dd0bd009cd2a7588d8bd45c4580460d49271c7
2012-06-19 01:24:40 -07:00
Inez Korczynski 3ac2c8e494 Improve handling for enter key - and support typing "on the selection" by removing selection first. 2012-06-18 22:25:16 -07:00
Inez Korczynski 4cef63538f Replace every second space with &nbsp; and do the same for the first space and last space. 2012-06-18 22:24:18 -07:00
Inez Korczynski 5e845979b8 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-18 22:23:15 -07:00
Trevor Parscal ca4f19c726 Fixed remaining uses of transact to change
Change-Id: I63c8fb183be8b37db85ed386d7bf33633e821f80
2012-06-18 22:05:05 -07:00
Trevor Parscal d6dd113d8d Adjusted fades and cleaned up URI objects
Change-Id: I2c6d5758c958ddc222293152707f13d7ae560343
2012-06-18 21:47:43 -07:00
Trevor Parscal 26dee2c8ea Switched to using "pageName" instead of "title" since page names include the namespace prefix, so it's more correct
Change-Id: Icd1a76ad317fc88f7895654ec1c41144c2695648
2012-06-18 21:47:43 -07:00
Trevor Parscal ea81d217b5 Work around broken .clone in mw.Uri
Change-Id: I5e3605c626fc3429c332feab839f555d279e11f7
2012-06-18 21:47:43 -07:00
Catrope 675bd284c5 Make the converter not return an empty document
Various parts of DM and CE choke on completely empty documents, so
return an empty paragraph instead.

Change-Id: I67062b66a44efe53a1bdaf60907653f0cc55dd25
2012-06-18 17:42:12 -07:00
Catrope 0e95b20cda If the page doesn't exist, create a "Create" tab, not an "Edit" tab
Change-Id: Ic9fa936ac96539ca65e2d570a2c5419dc19334df
2012-06-18 17:42:11 -07:00
Trevor Parscal 44d297f8ff Fixed post-save behavior
Change-Id: Ib9bb5d725b1cba2f3e8eb9aa9cf4f2dd2fc87229
2012-06-18 17:39:31 -07:00
Trevor Parscal 4ffc6fff60 Was checking the wrong thing for undefined
Change-Id: I11b813fe8708ef03db2f8b884b3766d8cbe887ce
2012-06-18 17:37:12 -07:00
Trevor Parscal cf1c033bff Added section edit link functionality from diff pages
Change-Id: I2dce543d352f4e086b96c65e53f1a90ef58072fb
2012-06-18 16:52:37 -07:00
Inez Korczynski f97ef02370 Early version of support for typing in "slug" (turning it into paragraph) 2012-06-18 15:50:20 -07:00
Inez Korczynski 6276938d21 Fix problem with turning elements of one type into elements of another type. 2012-06-18 15:30:23 -07:00
Inez Korczynski 6d5e524817 Cleanup in ve.ce.Surface - no significant changes 2012-06-18 15:11:54 -07:00
Inez Korczynski 52aaabd499 Fix ListButtonTool to use method "change" instead of old "transact" 2012-06-18 15:04:30 -07:00
Inez Korczynski 79b1726b70 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-18 15:04:00 -07:00
Inez Korczynski 78028ff588 Ported method debounce from underscore.js to ve. 2012-06-18 15:03:38 -07:00
Trevor Parscal f49aa141aa Redirect through the view page when coming from a diff page
Also added URL mixup using window.history.replaceState

Change-Id: If84998b0fe945d82fdfa9a8c88391db30286e972
2012-06-18 14:53:28 -07:00
Inez Korczynski 81375698a2 Fix minor bug in ve.log 2012-06-18 14:48:42 -07:00
Trevor Parscal 70b8c92660 Converted more uses of console.log to ve.log
Change-Id: Id41130de088e56dbe8774689317002baa66f5950
2012-06-18 14:19:07 -07:00
Trevor Parscal 76bca4f520 Added veaction param which auto-initializes the editor
Made edit tabs rendered on non view pages work correctly by routing them to the view page with an extra param that auto-initializes the editor

Change-Id: I4fd9106c8b45c6fc79af9ccb44e18944e9b9d8b9
2012-06-18 14:13:26 -07:00
Gabriel Wicke 5fbc80321b Improve newline handling for comments and nowiki/noinclude tags
* Added a newlineTransparent flag to handlers that prevents changes to the
  onNewline status, so that content following it is still considered to be in
  start-of-line context. This fixes a few rt tests where a comment or nowiki
  tag is at the start of the line, and following content should end up on the
  same line.
* 283 rt parser tests are now passing.

Change-Id: Ie58dcb9e5e9af9000fff61c2e1db5d8649ffc3f6
2012-06-18 22:56:41 +02:00
Trevor Parscal 11a3d883f2 Using resource loader debug scripts to unstub ve.log
Also added ve.dir and converted use of console.log to ve.log

Change-Id: Ibbfd78b6ece163f54f40e997c79a01de6609c2b4
2012-06-18 13:30:39 -07:00
Inez Korczynski 1fa1908402 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-18 13:19:24 -07:00
Inez Korczynski 8b823a7dc6 Introduce new method in Surface model called "change" and get rid of "setSelection" and "transact". Start using new method in Surface view - which right away fixes two bugs - typing at the and of the document, and typing in newly created paragraph/heading. 2012-06-18 13:19:07 -07:00
Trevor Parscal 005721cb81 Major cleanup, fixes and refactoring of ve.init
This solves lots of issues in the integration work, and also makes it much easier to extend this class to integrate it into other skins

Change-Id: I3b3c5b22a5664e6cf37e429cc0ac3be2e75b630f
2012-06-18 13:12:47 -07:00
Trevor Parscal debef5671c Made the first paragraph in a list item have no margins or padding to simulate raw text
Change-Id: I7e0aeb9a15db4a56f2a3552430c0da0202f97a97
2012-06-18 13:12:47 -07:00
Gabriel Wicke 97fb2d3c0d Serializer refactoring
* tokens are not modified any more (they are supposed to be immutable)
* handler info is now split in start / end objects and potentially a 'make'
  method; added more flags to govern the newline behavior of different tags
* added a generic singleLine mode for single-line syntactical environments
* switched the web service to line-based diffs to avoid issues when diffing
  the round-trip results of [[:en:Programming language]]
* 280 round-trip tests are passing now

Change-Id: I74b8ffbf69643c5d6e5ec852ec58e680c9018901
2012-06-18 21:52:15 +02:00
Christian Williams ad1e4947d7 Fixing ve.log for IE9
Change-Id: Idfcb68abcdae606a4fd78bfec51cb18a8fb495a2
2012-06-18 12:21:22 -07:00
Subramanya Sastry 18541f0286 Couple minor bug fixes in serializer
Change-Id: I961e2f4e7609cc6b264eaf494b39497401cdc55c
2012-06-18 11:25:21 -07:00
Gabriel Wicke de47a68aaa Emit SpaceCharacters token for HTML5 'space' chars
HTML5 defines space characters as [ \r\n\t\f] in
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character.
It treats these specially in a few contexts. As an example, the foster
parenting algorithm does not apply to space characters.

As a result, this change fixes the round-tripping of spaces between table
tags, which were previously moved before the table.

Change-Id: I32ab29275a9f824fc66d8286638eb42748cfc9a5
2012-06-18 11:25:21 -07:00
Subramanya Sastry 9b5404e288 First pass redoing serialization code to handle newline requirements
from Parsoid HTML output as well as VE HTML output.  There are still
some newline related failures from parser tests that needs fixing, but
this is getting close.  So committing for now so other eyes can make the
bugs shallow :).

Change-Id: Ia6a218ee9fb3e18fe0573c89ff3a4236779e1e64
2012-06-18 11:25:21 -07:00
Subramanya Sastry 2271f19ecf Removed newline normalization between paragraphs.
Change-Id: Ifd55db73c8fe2b3e952066a75cba2f8e13c58430
2012-06-18 11:25:21 -07:00
Subramanya Sastry 8fd901850c 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-18 11:25:21 -07:00
Subramanya Sastry 18de05ba7f 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-18 11:25:21 -07:00
Subramanya Sastry 9e5ed592fc Minor code refactoring
Change-Id: Ib7f70a3ac42e3d5a5985e9a9bcffa313bdac289b
2012-06-18 11:25:21 -07:00
Subramanya Sastry 031602f525 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-18 11:25:21 -07:00
Subramanya Sastry 7c5a0f680f Refix <pre> serialization.
- Effectively reverted fix from f882a65153
  and added a new fix.

Change-Id: I8b81e26525a5f1a22acaf2c7067f2dcd9b962818
2012-06-18 11:25:21 -07:00
Subramanya Sastry f745633797 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-18 11:25:20 -07:00
Subramanya Sastry f1d03f325e Couple minor bug fixes in serializer
Change-Id: I961e2f4e7609cc6b264eaf494b39497401cdc55c
2012-06-17 22:41:14 -05:00
Gabriel Wicke 41d8212573 Emit SpaceCharacters token for HTML5 'space' chars
HTML5 defines space characters as [ \r\n\t\f] in
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character.
It treats these specially in a few contexts. As an example, the foster
parenting algorithm does not apply to space characters.

As a result, this change fixes the round-tripping of spaces between table
tags, which were previously moved before the table.

Change-Id: I32ab29275a9f824fc66d8286638eb42748cfc9a5
2012-06-17 16:16:07 +02:00
Subramanya Sastry a229f72833 First pass redoing serialization code to handle newline requirements
from Parsoid HTML output as well as VE HTML output.  There are still
some newline related failures from parser tests that needs fixing, but
this is getting close.  So committing for now so other eyes can make the
bugs shallow :).

Change-Id: Ia6a218ee9fb3e18fe0573c89ff3a4236779e1e64
2012-06-16 10:09:06 -05:00
Catrope b74f24851a Actually fix getRange() this time. Hopefully.
Change-Id: I583a9c2c1ae01370988b4a34ddbf7d3d231e0a74
2012-06-15 16:09:08 -07:00
Christian Williams 3885eb766d Using empty pseudo selector and blank image dataURI to battle IE's ridiculous hasLayout bug.
Change-Id: I2acec8ff4d7444726b94c46fc53c0085457c959e
2012-06-15 15:14:13 -07:00
Christian Williams 8805cebc6e Start/stop poll handling for cut and paste
Change-Id: I8a9dcad6f320bdc90b79bfeaad10622543483ffa
2012-06-15 11:47:05 -07:00
Rob Moen d1eba674b1 Write a better debounced onSelect method for showing the context
view icon after select events are finished being fired.

Change-Id: I4e1307b90eed14b1c9167830018e50b9c7832ae6
2012-06-15 10:46:45 -07:00
Catrope 0be0ebf4a8 Forgot to add dl as a sublist type
Change-Id: Ie04904ffdaf20402dbb22ebe96bcaf2db9ea8b8a
2012-06-15 00:07:09 -07:00
Catrope a4589106ec Add a TODO note about preventDefault in alien nodes
Change-Id: I9aa0c6bec1587bdc65f1585c9ea3562c6d2153e6
2012-06-14 23:57:40 -07:00
Catrope be05c9d7ef Add a TODO to the image code about width&height
Change-Id: I75569c1191a7846567e4a4af2dbcd45449cb729c
2012-06-14 23:54:30 -07:00
Catrope aefd6a9792 Fix domWrapperElementType entries in ce that were out of sync with dm
Change-Id: I2684af71af803bc4b57e43a48986bdfced383193
2012-06-14 23:54:06 -07:00
Catrope dae599ac2f Fix the newline workarounds (for Parsoid newline handling) for headings
* Parsoid outputs bare newlines after a heading unless it's followed by
  a <p>, so strip leading and trailing newlines in all bare text
* Adding a leading newline in <p>s is only needed if preceded by a
  heading, don't add it otherwise
* Headings need a bare newline after them unless followed by a <p>
* Headings also need a bare newline before them if preceded by a <pre>

Change-Id: Ib02f800b26453541604e920fbb3845c51cdc6dea
2012-06-14 22:50:46 -07:00
Catrope 13c44dd336 Apply <p> tag workaround to <dd> and <dt> too
Change-Id: Ie639c8fd740adc8d9fa26d61ebae2716e41eb2ba
2012-06-14 22:50:46 -07:00
Catrope 37a1bf7cc8 Fix indentation of comment, remove commented-out debugger statements
Change-Id: I7db94e262100cb83be382de4ac4858a1535bc9f5
2012-06-14 22:50:46 -07:00
Rob Moen 6b8d8d24aa Clear state of contextview when there is no selection length.
Make context update method work on single call

Change-Id: I2b7f3a31ea5ca1530f927a7e11827d583f134ffb
2012-06-14 21:13:59 -07:00
Rob Moen b31a25c12c Fix context icon update method
Change-Id: I1100e53a0bf4364d6435f648b06ce0be7851e8db
2012-06-14 21:06:16 -07:00
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
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
Inez Korczynski 092e84d31f Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-13 17:19:11 -07:00
Trevor Parscal 31a2a0243a Removed duplicate update event on length change and cleaned up some methods that were being called by symbolic operation name
Change-Id: Ica623d1c5619b8268eb97f631e09f9e2f5b67bf0
2012-06-13 17:16:04 -07:00
Trevor Parscal e266905b94 Moved history tracking into a startable/stoppable service
And made it not start on it's own, but be started by ve.Surface - this makes it so it's not polling in the unit tests, for instance

Change-Id: I940df04d392fd134d18847949efe0e2232328323
2012-06-13 17:16:04 -07:00
Catrope efa93c24be Copy objects in newFromWrap() to prevent reference pollution
Change-Id: Ia1f71341342bea44f6ca08088a1276d54187b22a
2012-06-13 16:56:51 -07:00
Inez Korczynski 29a8ac77c3 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-06-13 16:23:35 -07:00
Inez Korczynski 81473a8119 Make method ve.dm.Document.addAnnotationsToData accept collection of annotations as a param - instead of an array 2012-06-13 16:23:19 -07:00
Catrope 7dd65cda91 Add newFromWrap(), ported 98% verbatim from the old code
Change-Id: I81fc74b1d23bc6b60e476bfefbae4d7d9a9bf5f6
2012-06-13 16:17:23 -07:00
Catrope 0bc1693998 Fix partial undo of ab0c37 in 2ea103
Change-Id: I42225802c45b3867a2aafd40e6941754b1b415b4
2012-06-13 16:16:07 -07:00
Trevor Parscal 429225fb57 Whitespace fixes (jshint was tweaking out)
Change-Id: Id75a097ae4958029caf0a0315343c2fab9c99b89
2012-06-13 16:06:21 -07:00
Trevor Parscal 56c0f597cd Fixed use of "pre", "preformatted" is the correct symbolic name
Change-Id: Ifc7e8e3291b8dd29a7fa4c42529bb4fd36a6ed9a
2012-06-13 15:15:05 -07:00
Trevor Parscal 8cb5cbf75d Merge branch 'refs/heads/master' into dmrewrite 2012-06-13 15:00:44 -07:00
Trevor Parscal 84ce839ce5 Removed context menus on tear down of surface
There needs to be a proper tear down system for ve at some point

Change-Id: I6454423ab96a15932695fbc5429d9e731acc9071
2012-06-13 15:00:13 -07:00
Trevor Parscal 1628038bdb Using wikiLink instead of internal to match actual documents
Change-Id: I24b9c0a5f27ed8f4a7861090ab4049c4614cea78
2012-06-13 14:48:29 -07:00
Trevor Parscal 95c601c8e9 Make save dialog initially hidden
Change-Id: I8fc4bd67f16266d9355fe639487728ad91ad6ede
2012-06-13 14:44:39 -07:00
Trevor Parscal 169b7e754d Cleaned up toolbar annotation updates
Change-Id: I8cefd6c871ed6d1ad71f64eb66236de1b8b719b5
2012-06-13 14:31:46 -07:00
Rob Moen 26e0f6ed5f Real cross browser fix for invisible iframe bug.
Change-Id: Ia2d3c83562542aaaddf0b81dfeaef9aa408aaed3
2012-06-13 13:29:18 -07:00
Subramanya Sastry bf0f5d1b7e Minor code cleanup
Change-Id: Ic5d99b6c483841310b0c295c1c30246f907455b4
2012-06-13 13:47:26 -05:00
Subramanya Sastry 23ec054013 Fixed round-tripping of interwiki links.
Change-Id: If0427b9865b3e9cf8c0ad0b4efaebc9f9f7fb865
2012-06-13 13:39:18 -05:00
Subramanya Sastry 445780b4d3 Revert default tokenization result from null to ''
* As part of an earlier fix, I had changed default value of 'res'
  to null instead of ''.  But, this was potentially buggy because
  the previous check was (res !== '') which could be triggered
  by return values of handlers.  By changing the check to null,
  I was effectively changing the code paths for those handlers that
  returned ''.

Change-Id: I2302023be7422ce4fb384ff5a50fe53fa7732855
2012-06-13 11:53:05 -05:00
Subramanya Sastry cfe94eed1f Minor code refactoring
Change-Id: Iec3cb4d83d16174371f0b1f3f23b1056aeed458e
2012-06-13 09:46:34 -05:00
Rob Moen a991cefbe7 Fix inspector close bug where iframe was blocking editor below
Fix Inspector bug which prevented applying a link annotation to data
already containing annotations.

Change-Id: I6f315d50805c8c71f2155f955ea5674a7ce98656
2012-06-12 13:52:42 -07:00
Rob Moen b843762d9e rewrite comment
Change-Id: Ibc8aab4843ecc0211149aa673d312384e9bd668e
2012-06-12 13:29:13 -07:00
Rob Moen 75e9b2cb2d On transact, redraw selection
Change-Id: Ia2f82dd1516113a3c6e77377fec19047fcbd32d0
2012-06-12 13:27:23 -07:00
Catrope c9605066cd Merge remote-tracking branch 'origin/master' into dmrewrite 2012-06-12 11:57:32 -07:00
Subramanya Sastry f882a65153 Fix serialization of <pre> tags
Change-Id: I7ae95e7ec06167d0c1bfdaba3d0c67d941043299
2012-06-12 13:54:35 -05:00
Rob Moen bf5b682809 Fix clearButtonTool
Change-Id: I92e55efb9c82f4d2ef55a71bea318cdc7495c2ea
2012-06-12 11:43:56 -07:00