Commit graph

1971 commits

Author SHA1 Message Date
Subramanya Sastry 01d6f17a3e Renamed ext.Util.js to mediawiki.Util.js
Change-Id: I909847686c8239a0b00cbaa9a0b1583826ee1487
2012-07-24 13:07:53 -05:00
Subramanya Sastry 85fb2ab9ed Addressed review comments from recently merged debug_output branch.
* Got rid of mergeProperties monkey-patch from core-upgrade.
* Reformatted class defns in mediawiki.parser.defines.js.
* Protected unconditional tokenization of list handler output with an
  env.trace check.
* Other minor formatting fixes to respect 80-100 column code width
  guideline.

Change-Id: Ida769e0e239b01a813b2d30a65aba60216262a43
2012-07-24 13:05:04 -05:00
Gabriel Wicke fe97271394 Use various RDFa types for links
* the used RDFa types for links are now identical to those listed in
  http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary, and are supported for
  serialization
* Editors are responsible for adjusting the type when converting between link
  types. Adding a caption to an mw:UrlLink for example should convert it into
  an mw:ExtLink.

Update: rebased on top of trace patches

Change-Id: Ie1b882e2b3fbad08be94769e1167dccd8dfea65d
2012-07-24 10:59:31 -07:00
Gabriel Wicke 9aa22ca0e2 Implement plain image mw:Image and eliminate data-gen
* Source-based round-tripping now uses typeof="mw:Placeholder" instead of
  data-gen.
* mw:Image is supported for round-tripping, but not yet for modifications as
  it is still source-based

Change-Id: Ie5cf4e54de0163168c25c2b5c09380657a15970f
2012-07-24 10:55:12 -07:00
GWicke 8f2c82289a Merge changes Ife2f840b,I657b1f33,I9d6a03cc,Ib81f96b8,Ia7469b4f,I160ba0c4,I03ae705b,I8343e5c0,I3ab637b7,I50346029
* changes:
  Additional work on readable tokenizer debug output
  Added 'href' key to anonymous KV wikilink and isbn attribute.
  Removed utility functions from mediawiki.parser.environment
  Added utility methods to ext.Util.js
  Added missing var keyword
  In trace mode, wrap transform to output trace info
  Output chunk tokens to console only in trace mode
  Further refinement of readable pretty-printing of tokens.
  More fixes on the way to readable debug/trace output.
  Added mergeProperties function to Object.prototype
2012-07-24 17:01:17 +00:00
Subramanya Sastry ddc6899b1b Added html2wt command-line option to parse.js
* A quick way to see how a html fragment serializes
* Minor JSHint tweaks.

Change-Id: I901398ec15700905c53de6f39cde93400b2f964a
2012-07-24 10:30:44 -05:00
Catrope f3f7715553 Merge "(bug 38545) Fix RTL position of the drop-down arrow" 2012-07-24 02:32:43 +00:00
Amir E. Aharoni fd0af6541b (bug 38545) Fix RTL position of the drop-down arrow
In RTL interface the drop-down arrow overlaps with the text.

The arrow was positioned explicitly in relation to the left margin, and this
can't work in a flipped RTL environment. I changed the position to "right"
and modified the arrow image a bit.

Some visual tweaks to the arrow may still be needed. Another option can be
to convert the image to SVG or to use a character like ▼.

Change-Id: Ib09a2a20b150de6e8a9531fc0db7dfffe4e95525
2012-07-23 19:27:53 -07:00
Krinkle 0949c5b9df Merge "Remove trailing commas" 2012-07-24 02:16:14 +00:00
Catrope da2e945ead Remove trailing commas
Change-Id: Iffd10561fbf2a5bc92acb50b9827a19016c623d6
2012-07-23 19:15:23 -07:00
Catrope d8a8e0328a Fix childNodeTypes for table
Change-Id: I0981fab7687f98859550b2ab4413a490f96d3fe3
2012-07-23 18:00:23 -07:00
GWicke df55d1e426 Merge "First pass updating debug output" 2012-07-23 23:46:46 +00:00
Catrope 1e62e9f64c Prepend a colon to internal links to Category: and File: pages
Change-Id: I77570ea6ec9f29b5d5eb06b518cb08a1b2cea0b2
2012-07-20 16:50:14 -07:00
Catrope 4eca804542 Factored out building the annotation into a separate function.
Also cleaned up some var statements.

Change-Id: I819cd9b783da71f407fe7b6b862e98f5e0cfa3c2
2012-07-20 16:50:13 -07:00
Subramanya Sastry 3004f3d3db Additional work on readable tokenizer debug output
* Added custom toString functions for extlink and wikilink
* Other minor tweaks

Change-Id: Ife2f840bfa0e77a86acdfdbfb574a230c9bd29dd
2012-07-20 18:12:37 -05:00
Subramanya Sastry d994d1292e First pass updating debug output
Change-Id: I1e0953d7b26b962e3758dd1091e87a5361257abc
2012-07-20 18:12:37 -05:00
Subramanya Sastry f558f3a33c Added 'href' key to anonymous KV wikilink and isbn attribute.
* This makes wikilink attrs more similar to ext links.
* Added 'content' key to ISBN links, but couldn't add it to regular
  wikilinks yet because of complexity of how they are handled in
  the rest of the pipeline.  Changing this requires fixing up other
  parts down the pipeline -- something for later.
* Fixed up wikilink handler to use named lookup for 'href' and
  'tail' rather than positional lookup.  Content lookup is still
  positional as before.

Change-Id: I657b1f338d38df3cfdfa99f27ac46e7fe1c9fd65
2012-07-20 18:12:37 -05:00
Subramanya Sastry 6b8a4b386e Removed utility functions from mediawiki.parser.environment
* these functions have already been added to ext.Util.js
* removed a couple jshint warnings.
* minor code restructuring in tokensToString and comments
  to better indicate what is going on.

Change-Id: I9d6a03cc35075e1a64d8fac9e167a3ce4ccd9424
2012-07-20 18:12:37 -05:00
Subramanya Sastry f87ed719e6 Added utility methods to ext.Util.js
* Copied over utility methods from mediawiki.parser.environment.js
  to ext.Util.js.
* Moved over utility method from mediawiki.parser.defines.js to
  ext.Util.js.
* Converted Util to be a singleton object rather than an allocatable
  class.  There is no reason to allocate a new utility class everywhere
  since this utility object has no useful state.
* Fixed up use of utility methods to use Util rather than env.

Change-Id: Ib81f96b894f6528f2ccbe36e1fd4c3d50cd1f6b7
2012-07-20 18:12:37 -05:00
Subramanya Sastry 82d9c31532 Added missing var keyword
Change-Id: Ia7469b4f43bc0b34f045792561d4ee24f9228773
2012-07-20 18:12:37 -05:00
Subramanya Sastry d0cdd2e5f8 In trace mode, wrap transform to output trace info
- Added extra debug_name parameter to addTransform which is
  used in addTransform to output useful trace info.

Change-Id: I160ba0c45f681149375e32ab19f97baa439b09a8
2012-07-20 18:12:37 -05:00
Subramanya Sastry f0a465abcb Output chunk tokens to console only in trace mode
Change-Id: I03ae705bf2679233c4d4b07c25915edd8110a2e8
2012-07-20 18:12:37 -05:00
Subramanya Sastry c148470204 Further refinement of readable pretty-printing of tokens.
Change-Id: I8343e5c0e2a17116920b8585ce8e5d9bc8826286
2012-07-20 18:12:37 -05:00
Subramanya Sastry 6999246fec More fixes on the way to readable debug/trace output.
Change-Id: I3ab637b7790c359255b8bc0ad5716da12bb25884
2012-07-20 18:12:37 -05:00
Subramanya Sastry 2ee1514552 Added mergeProperties function to Object.prototype
Change-Id: I50346029a9bd8a7d2cf954b0cca011f73a6fae07
2012-07-20 18:12:37 -05:00
Gabriel Wicke e1b2555db0 Merge "Start to use the tokenCollector for links" 2012-07-20 23:07:24 +00:00
Catrope 6ca1b06641 Merge "Rename addInterwiki to setInterwiki and add removeInterwiki complement" 2012-07-20 22:41:05 +00:00
Rob Moen 0195b04f26 Bug 33163 - VisualEditor: Floating toolbar should not be displayed when the edit area is entirely off-screen
- Added limits to toolbar float, Toolbar will not go past the last node in editor.
- Added bottom mode to allow toolbar to stick above the last node until the scroll position
is above the last node.
- Actually checking toolbar config now and setting float when flag is set.
- Gave float method for top toolbar a better name.

Change-Id: Ic39c5402fa7a05e13c5e81722d8729d93776d7e9
2012-07-20 15:28:44 -07:00
Catrope c8ce42c8e3 Do not put slugs after nested lists
But still put slugs before them. Done by overriding canHaveSlugAfter()
in ve.ce.ListNode.

Eventually this should be configurable and MediaWiki-specific

Change-Id: I5ad15ca4085a2d730add4954acbea358819b3986
2012-07-20 14:07:53 -07:00
Catrope 5be1b7798c Split canHaveSlug() into canHaveSlugBefore() and canHaveSlugAfter()
These determine whether a node can have a slug before and after,
respectively. The default implementation in ve.ce.Node is to use the
same rules for both, but individual node types can override this.

I'll need this to suppress slugs after nested lists but not before them.

Change-Id: Id88c0fc98aca7c7f52ce990ed9b8c42181ef6d18
2012-07-20 14:07:53 -07:00
Catrope feab4e58a1 Make Enter in an empty list item unindent
For pressing Enter in an empty list item at the end of a top-level list,
this has the same result as the previous code, but if you're in a nested
list it has the effect of jumping down a level. A previous incarnation
of this change just made Enter insert more list items ad infinitum if
you were in a nested list, but I think this is better.

This fixes a bug where pressing at the end of a nested list inserted a
paragraph in an invalid location

Change-Id: I9c7dbaf29a98f84926ed3a05e71c6294926dfce2
2012-07-20 14:07:53 -07:00
Catrope 5b4554b47f Let Tab and Shift+Tab trigger indentation again
Fix the commented-out code: it caused unindent to be triggered by just
pressing Shift. ASCII 16 is "data link escape", no idea where that came
from, so I removed it and used e.shiftKey instead.

Also check whether indent/outdent is even possible before doing it.
Currently this is done in a very hacky way (by checking the state of the
indent button), ideally we'd refactor things such that toolbar tools can
listen for keydowns and intercept them, that would make the code much
cleaner and we wouldn't have this problem.

Change-Id: I99885ee4b8a79cd24c4958c188addfc2b0453b03
2012-07-20 14:07:53 -07:00
Catrope ce1f4dac55 Work around crazy list rendering bug in Firefox
After indenting or outdenting a list item in a numbered list, the
numbering wasn't updated. So if you had:
1. One
2. Two
3. Three

and you indented "Two", you'd get:
1. One
     1. Two
3. Three

Adding or removing items in the list using the keyboard, or even
inspecting the list in Firebug (!), would trigger a renumbering and fix
the list to display "2. Three". But then the same issue would occur in
in reverse when outdenting "Two" (either using undo or using the
outdent button):
1. One
2. Two
2. Three

The workaround is to force a reflow by requesting the height (thank you
Timo). Implemented this in an override of onSplice() in ve.ce.ListNode, so
the list is detached and reattached every time children are spliced into
or out of it.

I haven't managed to come up with a minimal test case for this, not even
by putting a list in a contentEditable div and doing the same DOM
operations that ve.ce does from a setTimeout callback.

Change-Id: I93b2a309034c411a7b4e4b6c6bd4ef9d473999eb
2012-07-20 14:07:53 -07:00
Catrope b23800a55b First stab at list indent/outdent
This works pretty well, the only problems I found are:
* when selecting multiple list items, only the first is in/outdented
* there's no special handling for child lists, so the behavior for
  in/outdenting list items that have a child list can look weird, but
  it's consistent

Also needs more documentation

Change-Id: I6f4f3725e57a590196d7d638a77b87ea85586dc8
2012-07-20 14:07:46 -07:00
Catrope 6703bfc265 Fix selectNodes bug where selecting </li><li> returned an empty result
* When ascending back up the stack, check for a start between two closings
* Also check for an end between two openings
* This introduces code duplication but selectNodes() is full of that
  already. I'll have to do a duplication cleanup soon
* Add test case for </li><li>
* Update existing test case that covered a </li>

Change-Id: Ifc80585ce0e0d6988bc54228602c69f0d519200a
2012-07-19 18:10:57 -07:00
Catrope c66724fbf1 After finding a zero-length selection between nodes, return immediately
Change-Id: I04568e053e82c6d6effc370de5edee5d749e3ae6
2012-07-19 18:09:12 -07:00
Catrope ce0371e8ae Fix bug with nested lists in getCoveredSiblingGroups()
For nested lists, this function would return multiple groups where one
was wholly contained in the other, use offsets to prevent that from
happening.

Change-Id: Ib03bb1c81712d805cc263c2975cc3942de63d2ed
2012-07-19 18:09:12 -07:00
Catrope d31b562dc7 Merge "Fixed issue where #sitesub was being shown even if it wasn't originally" 2012-07-20 00:44:18 +00:00
Catrope 015b85443f Merge "Converted some instances of "var\t" to "var "" 2012-07-20 00:43:02 +00:00
Rob Moen 5e27d6a7a2 Revised inspector iframe construction to allow multiple inspectors
to be added.  Create inspector elements in the propper document
scope.  Restore inspector css classnames to camel case for proof
that inspectors are being created in the correct document scope.
Previously, inspector elements created in the wrong document scope
would have css rules applied only if class names were lowercase.
Issue only surfaced in Webkit browsers.  Though, this implementation
is more future proof and will help prevent future inspector bugs.
Patch 3) Fixed global variable definition and mistake with
inspectorDoc

Change-Id: I36c0d078aea10d919689768878004a19f7f89b55
2012-07-19 17:29:15 -07:00
Trevor Parscal a0f537712e Converted some instances of "var\t" to "var "
Change-Id: I02154e0381d5ae65b482bbcfc21ac93d0bf30d86
2012-07-19 17:24:54 -07:00
Rob Moen 8d90fdd881 Bug 33088 - VisualEditor: Editing a part of text of a link doesn't work (or this shouldn't be allowed)
-Selection of part of a link now modifies selection to entire link
range on inspection.
-Retaining selection direction on new range
Only partial fix to bug as previous link annotation is not
yet properly cleared.

Bug 33053 - VisualEditor: Link creation should not include trailing
spaces, and should provide a suggestion based on selected text
-Created method to return a new range without outer spaces.
-Retaining selection direction on new range.
-Enhancement needed for link suggestion.

Bug 33108 - VisualEditor: Highlighted trailing whitespace should
not have styles applied
-Modified trim method to retain selection, added call to trim
range on annotate method.

Change-Id: I92f264e19350c62b7c2ac3cd9e78af0071afef5c
2012-07-19 16:15:07 -07:00
Gabriel Wicke b344e140aa Start to use the tokenCollector for links
Now that we have access to the contents we can more easily compare the content
with link targets. This is still to do- this commit only converts the link
handler to work on the collected tokens.

* Start to implement latest RDFa spec from
  http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary
* Capitalize types, add mw:Entity type for html entities
* Detect changes to entities using tokenCollector and srcContent

Change-Id: I45429f4b930858a16e166ef8377c8f6f5114c414
2012-07-19 14:56:32 -07:00
Trevor Parscal 6b34f09df2 Removed some whitespace
And added a license to some files that didn't have it yet

Change-Id: I3a7e60374d1198d369a0475b8f65f7415012a337
2012-07-19 14:25:16 -07:00
Trevor Parscal c40174b60c Changed to use MIT license per agreement with the VisualEditor team
This license change is aimed at maximizing the reusability of this code
in other projects. VisualEditor is more than just an awesome editor for
MediaWiki, it's the new editor for the entire internet.

Added license and author files, plus mentions of the license to all
VisualEditor PHP, JavaScript and CSS files. Parser files have not been
modified but are effectively re-licensed since there's no overriding
license information. 3rd party libraries are not changed, but are all
already MIT licensed.

Change-Id: I895b256325db7c8689756edab34523de4418b0f2
2012-07-19 13:25:45 -07:00
GWicke 977cbafbe2 Merge "Added support for hacky use of dl before tables." 2012-07-19 18:06:25 +00:00
Subramanya Sastry c5f9961423 Added support for hacky use of dl before tables.
* This is the equivalent of commit a0746946 to
  core/includes/Parser.php

Change-Id: Id093e39dabad29cb275bd21325d39bfeb7709d98
2012-07-19 10:56:16 -07:00
Krinkle ab47265c34 Merge "JSHint: Added dotfiles and fixed tons of linting warnings." 2012-07-19 17:09:03 +00:00
Trevor Parscal a564f81aa7 JSHint: Added dotfiles and fixed tons of linting warnings.
* "onevar" warning sometimes solved by just merging var statements
  other times solved by making it a function declaration instead
  of a function expression.
* Also fixed several '_this' variable names in ve.es.Surface to
  more descriptive names, and enabled warnings for dangling _
  in identifiers.

Change-Id: I7d411881e3e06cf9a7fe56d689c29375881a81de
2012-07-19 10:01:00 -07:00
Krinkle a37f539643 Merge "Updated QUnit to 1.10.0pre." 2012-07-19 04:00:20 +00:00
Trevor Parscal 4daf12ec28 Updated QUnit to 1.10.0pre.
* e98069ad58

Change-Id: If20e067a7ae8bd0e419de5e0977eec9cb5590ac9
2012-07-18 20:59:52 -07:00
Gabriel Wicke 9e0ee30446 Merge "Document GPL license for Parsoid" 2012-07-19 03:19:12 +00:00
Gabriel Wicke b91467e144 Document GPL license for Parsoid
This is just to avoid re-licensing along with VE. We want to be compatible
with MediaWiki core to make sure a closely-integrated C port is still
GPL-compatible. We could consider adding MIT to the JS implementation after
porting to C.

Change-Id: Ia83e8620e26c95625793438c4c5e8ddcf2702368
2012-07-18 20:14:13 -07:00
Catrope 326607f34d Merge "Fixed typo in checking for console.log capability" 2012-07-19 01:32:13 +00:00
Trevor Parscal fc63c771ff Fixed typo in checking for console.log capability
Change-Id: I4a3b88e4fd7d57344673572cae24eff5c6078574
2012-07-18 18:30:51 -07:00
Catrope 8ff9df6023 Merge "Renamed ve.ce.Document.css to ve.ce.DocumentNode.css to match it's contents" 2012-07-19 01:29:03 +00:00
Trevor Parscal 3afb270567 Renamed ve.ce.Document.css to ve.ce.DocumentNode.css to match it's contents
Change-Id: I3d7504dfda27309f631a5856ffa4aacd13b6edc7
2012-07-18 18:23:11 -07:00
Catrope 61008c2e44 Merge "(bug 37819) Put minoredit, watchthis messages in specialMessages too so wikitext in it is displayed correctly" 2012-07-19 01:12:51 +00:00
Catrope c3da174e8c Merge "Removed Special:VisualEditorSandbox and refactored demo" 2012-07-19 00:58:43 +00:00
Trevor Parscal 9a0380c67d Removed Special:VisualEditorSandbox and refactored demo
Also renamed ext.visualEditor.editPageInit to
ext.visualEditor.viewPageTarget

Change-Id: I8bdd04b3442067e87bccbc60dd4947aae1c7dfd2
2012-07-18 17:57:50 -07:00
Catrope 5ab6a00915 Merge "Made toolbar and dialog save buttons more visible" 2012-07-19 00:39:29 +00:00
Gabriel Wicke 68c5a6efc6 Collect tokens in a tokencollector and use cb for processing
This is work in progress, but committed for now so I can use it for links and
tweak it while doing so.

Change-Id: I757277f6efacda6d9432ca57542a957f597a98de
2012-07-18 16:18:38 -07:00
Catrope 770a8b84ff (bug 37819) Put minoredit, watchthis messages in specialMessages too so wikitext in it is displayed correctly
Change-Id: I5fbb7a6ff0de50744bfd5816ebf7d06f04c315b8
2012-07-17 15:23:43 -07:00
Gabriel Wicke 681b0d4d40 Merge "Rename data-mw into data-rt" 2012-07-17 17:20:37 +00:00
Subramanya Sastry 80d74e1c16 Changed add/remove/get transforms.
* This code change is an attempt to address the FIXME about constant
  resorting of transformations in _getTransforms.  This caches sorted
  transformations and selectively clears/updates the cache on add/remove.

Change-Id: If24a807b84d494aa4e5597339039a5573a30905e
2012-07-17 12:03:48 -05:00
Gabriel Wicke 3172afb750 Rename data-mw into data-rt
This hopefully makes it clearer that data-rt contains private round-trip info
instead of semantically interesting data.

Change-Id: I03b476ed112a4b627c9871ee3677c450f943429a
2012-07-16 12:10:08 -07:00
GWicke 235739e253 Merge "Bug fix and minor code cleanup." 2012-07-13 22:40:20 +00:00
Subramanya Sastry 141ce901d2 Bug fix and minor code cleanup.
Change-Id: Ic446c8822bf1b8a859e045119782d7b8a40c5544
2012-07-13 17:39:30 -05:00
Gabriel Wicke 1e902fc050 Merge "Encapsulate token collection" 2012-07-13 21:08:52 +00:00
Gabriel Wicke e329455d55 Encapsulate token collection
* Arbitrary predicate support for the termination of collection mode
* tokens as property of the collector instead of a state-global thing

Change-Id: Ibcb342bc64a76fece9b04a760ea56c7878e67cad
2012-07-13 13:57:04 -07:00
GWicke 97bc6cd5d7 Merge "Serializer fixes" 2012-07-13 20:36:36 +00:00
Subramanya Sastry f4c6ba8545 Serializer fixes
* Fixed image serializer to deal with missing 'v' value in a k-v pair
  representing an image attribute.
* Added fix to deal with bare <li>'s (without surrounding <ul> tags)

NOTE: The second fix is required currently to deal with bugs in the parser
as it deals with complex cases.  But, in the future, we could deal with
this in one of the following ways:
(a) The serializer expects a well-formed DOM and all cleanup will be
    done as part of external tools/passes.
(b) The serializer supports a small set of exceptional cases and bare
    list items could be one of them
(c) The serializer ought to handle any DOM that is thrown at it.

Yet to be resolved.

Change-Id: Ib585e5c9f2a8a80854740ce0211bde705f9fd6f4
2012-07-13 15:33:09 -05:00
GWicke a742ec5ffc Merge "Fixed parser and serializer to deal with a 4+ length dash sequence." 2012-07-13 20:14:34 +00:00
Subramanya Sastry 49ed0d3adf Fixed parser and serializer to deal with a 4+ length dash sequence.
Change-Id: If7caaefec1ad55e7604712ef959ff0c843392adf
2012-07-13 15:12:09 -05:00
Gabriel Wicke ef92024b99 Rename addInterwiki to setInterwiki and add removeInterwiki complement
This makes it clear that setInterwiki can modify existing mappings, and adds a
similar method for the removal of existing mappings.

Change-Id: Ic603a4b2ccec35d086513fa7cf711702bfb2baa0
2012-07-13 12:40:30 -07:00
Trevor Parscal c611e0fc63 Fixed issue where #sitesub was being shown even if it wasn't originally
To test, add "#siteSub { display:block; }" to MediaWiki:Common.css

Change-Id: I73a80abf5f0de4ceedd47efd043afabf4b8efc0f
2012-07-10 10:34:34 -04:00
Trevor Parscal 31f111c866 Made toolbar and dialog save buttons more visible
Also made the dialog save button keyboard navigable through the tab key

Change-Id: I2f14c2da30b2bae8987264c851def488f0725458
2012-07-10 10:08:58 -04:00
Catrope d8fa2dfbee Merge "Bug 37811 - VisualEditor: editing toolbar float trigger also triggers contextView icon, although there is no context to act on -Remove unused updateContext method. -Added check for selection length in contextView set method." 2012-07-07 15:49:45 +00:00
Rob Moen b71586f296 Bug 37811 - VisualEditor: editing toolbar float trigger also triggers contextView icon, although there is no context to act on
-Remove unused updateContext method.
-Added check for selection length in contextView set method.

Change-Id: I1d5791c69deea80c54cff3e021ba4c90cdac2cc4
2012-07-07 08:47:51 -07:00
Catrope ca868f6cb6 Merge "Bug 38008 - VisualEditor: Tooltips for formatting menu are broken Fixed inconsistency with message name being used for format dropdown" 2012-07-07 15:46:27 +00:00
Catrope 970873595b Merge "Made extendClass accept a variadic list of base classes to extend with" 2012-07-07 04:31:48 +00:00
Catrope b4b9634e76 Merge "Added feedback button to toolbar" 2012-07-07 04:30:44 +00:00
Catrope 82fbb943df Merge "Removed unused variables" 2012-07-07 04:24:52 +00:00
Catrope bf886937bf Merge "Fix link inspector css in new version of chrome. Chrome engine modifies CSS names to lowercase when inside iframe..." 2012-07-07 02:05:06 +00:00
Catrope bc0c8ae525 Merge "Rename ve.ce.BranchNode.doSlugs -> ve.ce.BranchNode.addSlugs" 2012-07-07 02:04:17 +00:00
Trevor Parscal 12b8818a02 (bug 37848) Fixing delete key at end of document, removing whitespace.
Change-Id: I64cc9e7a3251b7326b104cd3b8ecb0d07240cd77
2012-07-06 19:02:01 -07:00
Rob Moen 74ab4688cc Bug 38008 - VisualEditor: Tooltips for formatting menu are broken
Fixed inconsistency with message name being used for format dropdown

Change-Id: Id1e3dd1fe61177d7592b449e227ef2527f4d30a1
2012-07-06 16:28:16 -07:00
Rob Moen b345915d0f Fix link inspector css in new version of chrome.
Chrome engine modifies CSS names to lowercase when inside iframe...

Change-Id: I9cd8ccba011d82549ad71acd2b18c6241ec47ca4
2012-07-06 14:50:19 -07:00
Inez Korczynski d4bfa89b32 Rename ve.ce.BranchNode.doSlugs -> ve.ce.BranchNode.addSlugs
Change-Id: I162067be5a544817e36986eeb0acd0497d37f443
2012-07-05 16:55:45 -07:00
Subramanya Sastry e529ae7e0e Serializer fix for empty headings (BUG-33089)
Change-Id: Ia7b018335ac9e31938052473fc47ce38443fdeb4
2012-07-05 16:50:48 -05:00
GWicke 46d6502ca5 Merge "Fix for Bug 37913" 2012-06-30 08:56:48 +00:00
Gabriel Wicke 1736e52bfb Abstract out chunk emission from tokenizer
Patch by Adam Wight, fixes bug #35377.

Change-Id: I183baeed8dd78e7d3c775f44d62bec8e6f9fc608
2012-06-30 10:39:12 +02:00
Subramanya Sastry 166e7a75c9 Fix for Bug 37913
* Strips the first paragraph tag in a list item or table cell context
  if there are no attributes on it and stx:html is not set

Change-Id: I74988645fe505c662f86488e32d0f11d464ffe41
2012-06-29 23:47:59 -05:00
Gabriel Wicke 9ddc863d89 Up entity name length limit even further
There are some really long names in
http://www.w3.org/2003/entities/2007xml/unicode.xml

Change-Id: I0138c9610bb288cd8f29e3600b8a21f932e7bcd9
2012-06-29 23:38:10 +02:00
Gabriel Wicke cf7f437966 Match named entities with up to eight chars
The longest entries in
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references.

Change-Id: I2c9f102fe6a905e339e12520d08c1b1b0a4002d8
2012-06-29 23:15:30 +02:00
Gabriel Wicke 370fb607c8 Insert separation between adjacent pres
Change-Id: I55aa649b4e076cae32b3c970d6384ab2ed4cdd6c
2012-06-29 23:05:06 +02:00
Gabriel Wicke 6c8dfa26fa Escape ampersands in entities from plain text DOM content
Change-Id: I0826077cf48b67e38a525090be66411c38d7b65f
2012-06-29 23:02:21 +02:00
Subramanya Sastry 5874d9a5f1 More thumb roundtripping fixes.
* Looks like I misled myself in commit 88fc91 -- that wikitext
  roundtripped perfectly because it went through the 'src' route
  because it was a thumbnail with an explicit image which doesn't
  go through renderThumb -- so, the serializer simply spit out the
  original 'src' string and hence perfect rt :).
* More whitespace preserving fixes in LinkHandler.
* Also changed resource value in the img tag to use the original
  filename rather than the normalized capitalized filename.
* 2 more parsertests rt -- now upto 400.

Change-Id: I144a6486dd9d07da8a74a68700fe96c78d192826
2012-06-29 00:30:13 -05:00
Subramanya Sastry ba6a304102 Prettified Wikitext Constants hash
* Something to be said for code alignment - easier on the eye!
* Maybe a good case for breaking mediawiki coding guidelines.
* But, happy to abandon commit if not useful. :)

Change-Id: I1133af488f572ac7f8727be9108e08e14c4e6420
2012-06-28 19:08:48 -05:00
Subramanya Sastry 88fc91a292 Next round of image roundtripping fixes
* Changed PrefixImageOptions so that thumb and thumbnail are
  distinct key-value pairs.  Without this fix, cannot distinguish
  between thumb=foo.jpg and thumbnail=foo.jpg
* Fixed link handler so whitespace is preserved around prefixed image
  options.
* Fixed figure handler to process the 3 different kind of image options:
  size, simple image options, and prefixed image options.
* There is a hack/fixme for "upright: aspect" prefixed image option
  which needs to be looked into.
* Still need to fix uppercasing of the image resource name.

With these fixes, the following wikitext roundtrips perfectly
(after newline breaks are removed)

[[Image:Foo.jpg|thumbnail = 'baby.jpg'|100x100px|center| alt =bbbbb|
upright=true|bottom|link='http://foo.bar'|
This is a [[Linked Caption]] in the image]]

Change-Id: I6606df56874c2b97f00f08cb6bbeaec9878167d3
2012-06-28 18:55:47 -05:00
Subramanya Sastry 11e7c1031a Created a constants object for extracting wikitext markup properties.
* For now, extracted image markup options out of the link handler.
* This info will also be used by the serializer.
* More properties/global constants can be moved into this structure
  over time.

Change-Id: I4cfbfd703f42e93fbad52b38b435f68d8a5c22ee
2012-06-28 17:45:17 -05:00
Subramanya Sastry d9d584e1b8 Minor tweaks/fixes to LinkHandler
* Minor refactoring
* Cleared src in dataAttribs in renderThumb since we can serialize
  thumbs now (or at least we can once all bugs are fixed and missing
  pieces are handled).

Change-Id: If18865801cdd3d89c1477e68bfa3e13107c45b40
2012-06-28 13:14:52 -05:00
Gabriel Wicke 9f753d8009 Source-based round-tripping for behavior switches
Change-Id: I46d12d338314a8dbfdc9a8448a74680e67c3a720
2012-06-28 18:20:13 +02:00
Gabriel Wicke 39b82fc3fa Simple source-based round-tripping for category links
Change-Id: I5a8a03e74a95c6dceda432f0356cce6a3af77c67
2012-06-28 18:12:19 +02:00
Gabriel Wicke ff414ad825 Add generic source round-trip mode, and use it for plain images (for now)
Anything with data-gen="both" and dataAttribs.src defined serializes to
dataAttribs.src and drops its contents (if any). We can use this to round-trip
elements we don't properly parse or serialize yet. Without RDFa info, the
editor will not touch the contents after encountering data-gen="both".

Change-Id: Ia39e5fdd765c2c9b36f26313455685d29f118839
2012-06-28 17:44:26 +02:00
Gabriel Wicke 8976b66558 Merge "Fix round-tripping of invalid external links somewhat" 2012-06-28 15:30:31 +00:00
Gabriel Wicke e1a7d10063 Fix round-tripping of invalid external links somewhat
* Don't consider them for auto-numbered links
* Don't insert a trailing space if the content is empty

These links are still wrapped in nowiki on round-tripping since the
valid/invalid url determination is done in the LinkHandler and not the
Tokenizer as it is configuration-dependent. Not incorrect for rendering (and
perhaps easier to understand for humans too), but might still introduce a
dirty diff. We'll still need reconciliation / damage tracking in the end ;)

Change-Id: I959ebc1b7f81d110a1141bb38ba5ee97f52ebf96
2012-06-28 16:12:23 +02:00
Gabriel Wicke 4f94492f08 Merge changes I27bdc9c5,Ic09972bb
* changes:
  Update nowiki handling to latest spec; some fixes to it
  Default to two preceding newlines for headings for better readabilty
2012-06-28 14:02:00 +00:00
Gabriel Wicke 4dcd88fc5f Merge "Fix a crasher in unbalanced heading tokenization" 2012-06-28 13:57:29 +00:00
Gabriel Wicke 198e55a32b Update nowiki handling to latest spec; some fixes to it
346 round-trip tests are passing now (up from 343).

Change-Id: I27bdc9c5e010a13c2b4dddc6f263cbf9d3adac36
2012-06-28 14:57:05 +02:00
Trevor Parscal 6828e2c8b6 Removed unused variables
Change-Id: I7fa9e60c6feba5eb5b705d64c8f3aa192aae89ee
2012-06-28 04:24:08 -07:00
Gabriel Wicke 5b4cb03ee4 Default to two preceding newlines for headings for better readabilty
This only applies to newly created headings, so headings with a single newline
preceding them will be round-tripped that way.

Change-Id: Ic09972bbd25c3934b53f6fd3b5be5a0c3185c2af
2012-06-28 12:42:19 +02:00
Gabriel Wicke 17af335748 Fix a crasher in unbalanced heading tokenization
Example input:

=== foo ==

Old result:
http://www.mediawiki.org/w/index.php?title=VisualEditor:Test&diff=prev&oldid=554403

Change-Id: I0bc135884833607cedb62ec9c045310df3649dd8
2012-06-28 12:34:32 +02:00
Trevor Parscal 49cb8a2d5a Added feedback button to toolbar
Change-Id: I1f857e46430eae0d5d4ace181475881bc5495309
2012-06-28 02:53:54 -07:00
Subramanya Sastry f995fc025a First pass serializing image thumbs.
* Collect all figure tokens and process them as a chunk
* This effectively mimics context-sensitive DOM walking,
  but since we need serialization supported on a token stream,
  we cannot use real DOM walking.  The current technique should
  also work on a token stream.
* There is a FIXME about the image filename being capitalized.
  This needs fixing in the parser or some other way of recognizing
  original unnormalized filenam.

Amended by gwicke:
* Build option list and join it with pipe to avoid stray trailing pipe
* Satisfy JSHint's weird preference to have '&&' and '||' at the end of the line

Change-Id: I1e5f6600f297fcdf81e3227a82ca3b71d4e97fc3
2012-06-28 11:29:10 +02:00
Gabriel Wicke 4e541223b0 Merge "Rename data-mw-gc to data-gen. Credit to James!" 2012-06-27 17:15:25 +00:00
Gabriel Wicke 4e86337a43 Merge "Add basic tsr on indent-pre end tag" 2012-06-27 17:11:38 +00:00
Gabriel Wicke 424a246b00 Rename data-mw-gc to data-gen. Credit to James!
Change-Id: Iacbe20b355ddf5f12fffb71ff4dd978ac4364928
2012-06-27 19:08:14 +02:00
Trevor Parscal 1067f84764 Merge "Removing some logging" 2012-06-27 16:42:34 +00:00
Trevor Parscal efe26d9be2 Merge "(bug 36201) Control-K triggers link inspector" 2012-06-27 16:41:51 +00:00
Christian Williams b9f6baba63 (bug 36201) Control-K triggers link inspector
Change-Id: I0ffd237ce51d1899d2151fb76243e818c5f5cfb8
2012-06-27 09:41:06 -07:00
Trevor Parscal 02e24d6a39 Merge "Bugzilla:37804 - Double bound events were causing double backspace bugs" 2012-06-27 16:20:43 +00:00
Trevor Parscal e1905341c1 Merge "Bugzilla:33093 - Shift-Enter splits at paragraphs instead of list items" 2012-06-27 16:20:08 +00:00
Gabriel Wicke df26663a3f Add basic tsr on indent-pre end tag
This is a zero-length tsr for now (and thus not 100% correct), but will do the
job for starttag / endtag range establishment

Change-Id: Iedd50ad319aa8d5916434fb6744deb04e031e456
2012-06-27 18:08:49 +02:00
Gabriel Wicke c02218c736 Merge changes Idfa5d6a8,I700142a5
* changes:
  Represent nowiki as span instead of meta
  Round-trip html entities and introduce data-mw-gc attribute
2012-06-27 16:07:48 +00:00
GWicke d4eb4ce741 Merge "Code cleanup and more newline fixes." 2012-06-27 13:26:22 +00:00
Subramanya Sastry 4d2a46fb44 Code cleanup and more newline fixes.
* Removed dead commented out code.
* Cleaned up newline handling in serializer some more.
* Now, onNewLine and onStartOfLine reflect serializer state
  more accurately.
* No implicit new lines for explicit html tags.
* 9 more roundtrip tests now green.

Change-Id: I9f640de2ae769c7472538fa687400dc8a40c2b2d
2012-06-27 15:23:22 +02:00
Gabriel Wicke a1d05976ce Merge "Small (and incomplete) fix to table cell tsr" 2012-06-27 12:45:39 +00:00
Gabriel Wicke 53451bfc50 Small (and incomplete) fix to table cell tsr
Change-Id: I14347939de32af698d7ce0b649165982908c49aa
2012-06-27 14:45:12 +02:00
Gabriel Wicke 7108ee985a Represent nowiki as span instead of meta
Change-Id: Idfa5d6a8ee7b2d17205779361ca69d075a79964d
2012-06-27 13:59:14 +02:00
Gabriel Wicke 0b9a420129 Round-trip html entities and introduce data-mw-gc attribute
297 round-trip tests are passing with this patch.

TODO:
* generalize data-mw-gc handling in the serializer for any tag
* use data-mw-gc="both" and data-mw.src: 'the wikitext' for round-tripping of
  wikitext structures, optionally with some presentational (but read-only)
  content
* use span and data-mw-gc="both" for nowiki

Change-Id: I700142a56818977c20c8c06e6a5f2e77a708d25e
2012-06-27 12:52:52 +02:00
Subramanya Sastry 1a504a5f54 Added tokenizer support for ----
Change-Id: Idc5519350d11ae91b2ec64553f847d56e22d63bb
2012-06-25 16:40:34 -05:00
Subramanya Sastry d5e6ec34aa Deleted dead PEG productions
Change-Id: I9b859f79f9900b3d320aa1ad0283a4b5ae6c4331
2012-06-25 13:17:01 -05:00
Gabriel Wicke 08b5ed1a43 Use _inNewlineContext method instead of bare onNewline
This makes sure that we escape start-of-line syntax when needed, since
onNewline is often not yet set.

Discussion / background:
[19:18] <subbu> this will fix it, but, i think this is asking for another
minor refactoring of these flags ... because this is a subtle fix which means
it might be possible to make it clearer.  onNewline is one true in on
direction, i.e. if true, we are in a new line state, but if we are in a
newline context, onNewline is not true, which is why this new method is
needed.
[19:19] <subbu> i dont know if it is possible, but it seems like it shoudl be
possible.  but, something for later.
[19:20] <subbu> badly phraed.  "onNewline" ==> in new line context, but if in
new line context, onNewline may be false.
[19:20] <gwicke> we should perhaps update it as early as possible instead
[19:21] <subbu> i cannot today, but possible monday.  i am heading out in
about 15-30 mins.
[19:22] <gwicke> will need to check all conditions depending on it in
_serializeToken
[19:22] <subbu> oh, i misunderstood you :)
[19:22] <gwicke> and if there are cases where the onNewline / onStartOfLine
state could be reverted later
[19:23] <subbu> you were referring to the flag, i thought you meant we should
fix this sooner than later.
[19:23] <gwicke> yes, I wasn't terribly clear
[19:23] <gwicke> you wrote something about following productions swallowing
newlines, but I think we don't actually do that any more
[19:24] <gwicke> I'm quite optimistic that updating those flags much earlier
would work
[19:25] <subbu> yes, it could fix it.
[19:26] <subbu> you might be right reg. swallowing.  it was happening earlier.
but, not right now, after single-line mode and other fixes.

Change-Id: Ic1d8141c04eb54a59977d0ba87bcf06bafd421e0
2012-06-23 19:27:56 +02:00
Gabriel Wicke d4dc8d86d9 Entity-escape [<>] in text content
This should not really be needed if the tokenizer did not decode html entities
on the fly. It is still a quick way to make sure no htmlish content can be
inserted even with the current decoding.

The next step and proper fix is to make entity decoding either optional in the
tokenizer (flag-controlled), or move it to a later stage in the token
processing pipeline.

Change-Id: Ife093dcfb95113763dab5635b098c795d3550586
2012-06-23 17:06:10 +02:00
Subramanya Sastry 5f584909e1 Added documentation + minor code refactoring
* Renamed defaultOptions to initialState
* Got rid of unused state property
* Added comments explaining how state attributes
  and tag handler flags are used
* Refactored listItemHandler check into functions and
  added FIXME possible rewriting of that check.
* Protected serializeDOM in a try-catch handler to
  catch exceptions and output the exception to the console.

Change-Id: I3d351c06e4b86baeb5a55243b11dbfa9baca5bb7
2012-06-22 18:29:46 -05:00
Christian Williams a26708dd6e Removing some logging
Change-Id: I2876e56d2e3680d21877103618e59afec1c81ef9
2012-06-22 15:49:34 -07:00
Christian Williams 89e0f3d6ad Bugzilla:37804 - Double bound events were causing double backspace bugs
Change-Id: I589185d077e1efe6fb2c0457a290a8ac9ce8bceb
2012-06-22 15:39:43 -07:00
Christian Williams 122a31a021 Bugzilla:33093 - Shift-Enter splits at paragraphs instead of list items
Change-Id: Ie32e878cf9c71f7179143c631a01c0e2e671ed18
2012-06-22 15:05:35 -07:00
Trevor Parscal 02b0c7a6f4 Made extendClass accept a variadic list of base classes to extend with
Change-Id: I6d2307ce39da47ad2673dd439789a2f74632c59f
2012-06-22 10:50:41 -07:00
Trevor Parscal 1ea3999e04 Fixed drop-down menu to match items more carefully
Change-Id: Ibd46861be243d2872f4edaa9a182d3931d4f9fab
2012-06-21 17:50:46 -07:00
Trevor Parscal 7af5af7683 Merge "Adjust oldRange in the rebuildNodes call as well" 2012-06-22 00:43:29 +00:00
Trevor Parscal 5af7c4d833 Merge "When trying to turn list items into headings, unlist them" 2012-06-22 00:42:51 +00:00
Catrope fb38655ff0 When trying to turn list items into headings, unlist them
This requires splitting the list and unwrapping the items

Change-Id: Ie77fe00d2396e4f7d2f1b28bfc0b0301255454a4
2012-06-21 17:41:58 -07:00
Catrope 62b78c9109 Adjust oldRange in the rebuildNodes call as well
This fixes a bug Trevor reported where selecting from a list item across
a heading and into a paragraph, pressing backspace, then clicking undo
caused an exception.

Change-Id: Id2851271529e10548f6979a030a198054aa1c48f
2012-06-21 17:26:17 -07:00
Catrope a0d87989cf You know what, just don't render hrefs, these links aren't clickable anyway
Change-Id: If5f0c9a2fa41f09569195fe7807aba9a8207a3c9
2012-06-21 16:12:17 -07:00
Trevor Parscal b560924467 Merge "Use title for rendering internal links, and guard against undefined" 2012-06-21 23:04:11 +00:00
Catrope 6ddfc4bcab Use title for rendering internal links, and guard against undefined
Change-Id: I18a4e5e06303fcd9540fde8c3b21fe8f8887417e
2012-06-21 15:52:25 -07:00
Trevor Parscal f021b02ce1 Merge "Reconcile the order and completeness of textStyles in 2 different places" 2012-06-21 22:33:41 +00:00
Catrope 9576f8fc48 Escape the href attribute on links
Change-Id: I3edaa5c9346f5c8c222c482bcb190acad2bac24d
2012-06-21 15:28:07 -07:00
Christian Williams 4f43ecefdf No need to apply selection in this transaction
Change-Id: Ia1ea5800dfbe5d89ef2fe22462712d8a558e5e3b
2012-06-21 15:20:21 -07:00
Inez Korczynski 41f5f7378b In Firefox hitting enter fires both events - keydown and keypress. We want to ignore key press for enter.
Change-Id: I49d19267cc6115342aadf11ea720e82bbf65ddb2
2012-06-21 14:52:43 -07:00
Catrope f58b5b6fc8 Reconcile the order and completeness of textStyles in 2 different places
ve.ce.TextNode listed textStyle annotations that didn't actually exist,
and failed to recognize some that did exist (such as span; bug 37808).

Added all annotations to both places. <span> tags are now tolerated by
the editor in that it doesn't crash anymore, but they're displayed (and
saved!) without any attributes, so <span style="color:yellow;">y</span>
doesn't show a yellow 'y' in the editor and is saved back as
<span>y</span> .

Change-Id: Iaae11ad5044150fa904010983ff83579cb37733d
2012-06-21 14:46:43 -07:00
Trevor Parscal ed33ca373f Merge "Undo and redo keyboard shortcuts" 2012-06-21 20:58:53 +00:00
Christian Williams 050134d55e Undo and redo keyboard shortcuts
Change-Id: Ia1e9db52f6fb2da79be28cdedaaf0dffc6097dc9
2012-06-21 13:58:21 -07:00
Inez Korczynski 07760653b2 Don't use custom handling for left and right arrow while metaKey is pressed as well.
Change-Id: I7e2f73ab085b877169f4a29bec04a294d6e13a2a
2012-06-21 13:56:32 -07:00
Trevor Parscal d245ac030e Merge "Fix display of edit summary message in save dialog" 2012-06-21 20:44:28 +00:00
Catrope ae48f152f9 Fix display of edit summary message in save dialog
Fixed by adding the specialMessages module which is only loaded once the
editor loads. Then after it's loaded we use the summary message from
there to update the (possibly broken) summary message in the save
dialog.

Change-Id: I67f5c59501cdf7c66c925cef8d4dd42b0f2cfde3
2012-06-21 13:39:27 -07:00
Inez Korczynski 6381709703 In case of IE use non-breaking spaces inside slugs instead of invisible separators - as in different browsers.
Change-Id: Ib6ae077206de1ad772e47e212a9f276f6b0081e0
2012-06-21 13:34:13 -07:00
Rob Moen 3f8863b05a If siteNotice is visible, add class and slide it up. On ve exit,
SlideDown fast if hidden by ve

Change-Id: I2a4104590de15da1302181a68d38bf271bcca249
2012-06-21 13:01:42 -07:00
Trevor Parscal d4e51abac6 Merge "Tear down the beforeUnload handler when redirecting after page creation" 2012-06-21 19:48:51 +00:00
Trevor Parscal 51809e728b Merge "Fix external link inspector" 2012-06-21 19:48:06 +00:00
Catrope 3a704b7491 Merge "Create init methods which hide and restore siteNotice if present." 2012-06-21 19:46:17 +00:00
Rob Moen f28a2399f4 Create init methods which hide and restore siteNotice if present.
Change-Id: I2fbc74ae46474cdb2559ecaa083cc7353b050937
2012-06-21 12:44:33 -07:00
Catrope fba013bedf Tear down the beforeUnload handler when redirecting after page creation
Change-Id: If182eb62068c3c585a98535cc6761d98ad7dd56d
2012-06-21 12:41:39 -07:00
Catrope 5784d2b55c Fix external link inspector
Wasn't loading the link target due to a typo

Change-Id: I77533f949363e79dab9b478e6ba10d05b9486acc
2012-06-21 12:40:28 -07:00
Trevor Parscal 437649e062 Merge "Fix problem in hasSlugAtOffset when a given offset is out of range of the document - so no node is returned from getNodeAtOffset" 2012-06-21 18:19:51 +00:00
Inez Korczynski 82d3040d76 Fix problem in hasSlugAtOffset when a given offset is out of range of the document - so no node is returned from getNodeAtOffset
Change-Id: I91951528c21ddd57f56d7f4854d0e626d96e04a1
2012-06-21 11:09:41 -07:00
Trevor Parscal f35c8adac8 Merge "Aggressive keyboard shortcut fix for all browsers and platforms" 2012-06-21 18:09:24 +00:00
Christian Williams 8f7ce742de Aggressive keyboard shortcut fix for all browsers and platforms
Change-Id: Ic9e6359a06752861a05526dba090b08ccd39b83f
2012-06-21 11:09:30 -07:00
Inez Korczynski 847fddd639 Fix for drawing selection in IE - temporary approach
Change-Id: Ia944e4c96b1d1d78274f9c23e7120954f694ca08
2012-06-21 11:04:26 -07:00
Trevor Parscal fc7e96b2b5 Merge "Rename watch to watchpage, per https://gerrit.wikimedia.org/r/12423" 2012-06-21 17:52:25 +00:00
Catrope ff39a448a3 Merge "Fixed output of translateOffset when collapsing a range" 2012-06-21 17:48:43 +00:00
Catrope a904bcc0f3 Rename watch to watchpage, per https://gerrit.wikimedia.org/r/12423
Change-Id: Ic38ea27ead9f98b22b1fbbad5dcbb8de2205f51a
2012-06-21 10:46:47 -07:00
Trevor Parscal 5aa3bbedc7 Fixed output of translateOffset when collapsing a range
Change-Id: Ifb40dd1f9de557d4237660f5fb7119d6aa940c65
2012-06-21 10:45:58 -07:00
Christian Williams f27425eb91 Firefox has some crazy bindings for browser features. This prevents it and properly annotates.
Change-Id: Ide294efda8b661e16f24cc1f3584a8f08785ff5b
2012-06-21 10:33:40 -07:00
Gabriel Wicke cc1afb2ad3 Support dt/dd transitions in the middle of the stack
Change-Id: I1d75caa7782d02a2c33413a078e99b17ccc4141c
2012-06-21 18:40:40 +02:00
Gabriel Wicke b3bd2ffe8d Fix definition list parsing and round-trip single vs. multi-line dt/dd
* Removed murky ' :' -> '&nbsp;:' replacement in tokenizer. This breaks four
  parser tests, and should be fixed in a token stream transformer or DOM
  postprocessor. This replacement clashes with round-tripping, and is not
  terribly important visually.
* Added stx:row annotation to single-line dt/dd pairs and use it to preserve
  single-line syntax in the serializer. There is no attempt yet to support the
  addition of nested lists in an originally single-line dd. We'd need to look
  ahead in the serializer to support this. Perhaps the editor can simply drop
  data-mw in that case.
* Switched default dt/dd serialization to multi-line. This supports all nested
  lists and multiple dds.
* Don't close dls when switching from dt to dd or back in the token stream
  ListHandler.

Overall 290 round-trip tests are passing now (up from 284, some due to &nbsp;,
some due to lists). The number of passing parser tests dropped slightly from
303 to 297 (or 301/295 on weekdays other than Thursday).

Change-Id: I85ff40571833713388c6523e6a4ba2e94daa3807
2012-06-21 17:34:25 +02:00
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