Commit graph

2931 commits

Author SHA1 Message Date
Catrope bf7b243627 (bug 42121) Change markers lost for first paragraph on new page
When editing a new page, or loading an empty page into the editor, the
converter generates a paragraph so the document isn't completely empty.
This paragraph is then unwrapped on the way out, potentially destroying
change markers and generally producing strange HTML output.

Mark this paragraph with generated=empty rather than generated=wrapper,
and only unwrap it on the way out if it's still empty. This means we
cleanly round-trip empty documents (and empty list items and the like),
but if the user enters text, we create a paragraph like we're supposed
to.

Change-Id: Id0241221a67b769445676b833b5741320d99ea5f
2012-11-21 13:54:52 -08:00
Catrope 662880605c (bug 42119) Handle alienation in wrapping mode properly
When alienating in wrapping mode, we need to look at the type of tag to
decide whether to create a wrapped alienInline, or to interrupt the
paragraph for an alienBlock.

This was being done just fine for the general alienation case
(unrecognized tag), but not for the special cases (mw:unrecognized,
about groups).

* Centralize the logic for ending a wrapper in stopWrapping()
* Move the wrapping-contingent block/inline detection logic into
  createAlien()
* Simplify the terrible if statement to decide whether a future decision
  requires us to stop wrapping. Instead, detect the cases in each code
  path separately and call stopWrapping() as appropriate
* Add tests

Change-Id: I4054584ae05e7d5daa71edead3e6a6588cf5d3bb
2012-11-21 13:42:13 -08:00
Trevor Parscal f71247608b Merge "Add moar demo pages" 2012-11-21 21:26:19 +00:00
Trevor Parscal e0e5e43303 Merge "Make entity nodes work in CE" 2012-11-21 21:25:03 +00:00
Catrope 8cf9193b39 Add moar demo pages
Change-Id: Id25803821ea0913f36a3c851c0542de12f7e408b
2012-11-21 13:24:38 -08:00
Catrope 0e1a6912b0 Display the lengths of model nodes in the demo debugging thingy
Also use .text() instead of .html() where appropriate

Change-Id: I9dcfd9c11c5c01f1459c48c8993c155203c94b13
2012-11-21 12:58:52 -08:00
Catrope 9f1eb9b991 Merge "(Bug 42335) Adding IE to the browser blacklist for the December release" 2012-11-21 20:33:17 +00:00
James D. Forrester 1780d4e610 (Bug 42335) Adding IE to the browser blacklist for the December release
Unfortunately support for Internet Explorer is currently insufficient in the CE module
which means we have to kill it for December; it will return once we've worked out a way
around various bugs in IE.

Change-Id: I0b44ae2c1d75ffe748a5139ca74dcda615e12a6a
2012-11-21 12:30:14 -08:00
Catrope 6230c322ec Merge "Fixed inspector behavior" 2012-11-21 20:23:35 +00:00
Catrope 0516b1d7f0 Make entity nodes work in CE
Check for all node classes in getOffsetFromTextNode(), not just
branches and aliens (an entity is neither)

Render entities with contenteditable=false. Without this, selection was
still broken, because:

Foo|€Bar was really <p>Foo<span>|€</span>Bar</p> which maps correctly.
Foo€|Bar was really <p>Foo<span>€|</span>Bar</p> which maps to the same,
which is incorrect.

With cE=false, the cursor can't be inside the span, so we get:
Foo|€Bar is really <p>Foo|<span>€</span>Bar</p> which maps correctly.
Foo€|Bar is really <p>Foo<span>€</span>|Bar</p> which maps correctly.

Change-Id: Iaf603346590a9ad553c152565eb203136be7a399
2012-11-21 12:04:31 -08:00
Trevor Parscal 8fc98868c9 Fixed inspector behavior
ve.ui.Inspector
* Removed disabled state and interfaces - this isn't needed
* Renamed prepareSelection to onInitialize
* Using event emitter to run onInitialize, onOpen and onClose methods
* Left removal up to the child class to handle in the onClose method
* Replaced calls on context to close inspector to calling close directly
* Renamed prepareSelection stub to onInitialize
* Emitting initialize event from within the open method
* Added recursion guarding to close method
* Changed the close method's argument to be remove instead of accept - the more common case is to save changes, and the only time you wouldn't save changes is if you were to remove the annotation
* Moved focus restore to close method

ve.ui.Context
* Moved the majority of the code in openInspector and closeInspector to event handlers for onInspectorOpen and onInspectorClose
* Updated calls to closeInspector re: accept->remove argument change

ve.ui.LinkInspector
* Renamed prepareSelection to onInitialize and rewrote logic and documentation
* Removed unused onLocationInputChange method
* Moved restore focus (now it's in the inspector base class)

ve.dm.SurfaceFragment
* Added word mode for expandRange

ve.dm.Surface
* Added locking/unlocking while processing transactions - this was not an issue before because this was effectively being done manually throughout ce (which needs to be cleaned up) but once we started using the content action to insert content dm and ce started playing off each other and inserting in a loop - we already do this for undo/redo so it makes sense to do it here as well

ve.InspectorAction
* Updated arguments re: close method's accept->remove argument change

Change-Id: I38995d4101fda71bfb2e6fe516603507ce820937
2012-11-21 12:01:14 -08:00
Trevor Parscal 53016c294b Merge "(bug 42218) Add MWEntityNode" 2012-11-21 00:20:26 +00:00
Catrope 1234a702c9 (bug 42218) Add MWEntityNode
<span typeof="mw:Entity"> tags are now correctly represented in the
model, and rendered in CE. There are still issues with cursor movement
etc. in CE.

Because the prioritization mechanism for annotations vs nodes is broken
in the current "node API", I had to hack two special cases for mw:Entity
into the converter. I also had to change the converter to ignore the
children of inline nodes (this was a legitimate bug, but had never come
up before).

Change-Id: Ib9f70437c58b4ca06aa09f7272bf51d9c41b18f2
2012-11-20 16:19:55 -08:00
raymond a54441611c Fix message key, probably c&p error in I1cc00844
Change-Id: I4400ceeda59d76e433cda61c546a196cb3400ba8
2012-11-20 22:09:41 +01:00
Translation updater bot a1a6121c9d Localisation updates from http://translatewiki.net.
Change-Id: Ie3c5ab02ac00f19f5f7b0bf2f65782eb748e990b
2012-11-20 20:55:23 +00:00
Trevor Parscal 05e39c1733 Always apply inspected annotations to the right range
When you leave the inspector by changing the selection, we need to apply changes to the old selection.

ve.ui.Inspector
* Added initialSelection
* Change getMatchingAnnotations to use a given fragment rather than generating it's own
* Set initialSelection on open

ve.ui.Context
* Make hiding the context accept changes

ve.ui.LinkInspector
* Passing a fragment into getMatchingAnnotations now
* Using fragment API instead of actions API to control the range of the fragment

Change-Id: If6c8845285d87d0f144b15d50c38e192c797be59
2012-11-19 17:54:55 -08:00
Catrope a833691421 Merge "Fixing Pre-Annotations" 2012-11-20 01:11:04 +00:00
Catrope f856a10fa0 Merge "Added undo-before-apply for new link annotations" 2012-11-20 01:10:29 +00:00
Trevor Parscal 9c22ee346a Added undo-before-apply for new link annotations
When the link inspector is used to create a new annotation, the text is annotated with the default link target derived from the selected text. Then if the inspector is used to change that value, yet another transaction is processed when the inspector is closed.

To avoid having to press undo 2x, this change makes the inspector undo it's first change before applying the changed annotation.

This change also introduces insert, remove and select content actions.

Change-Id: I3e29189158fb01336d6b053bc2a8bda2a91a0a46
2012-11-19 17:10:05 -08:00
Christian Williams 9787166bab Fixing Pre-Annotations
AnnotationAction and SurfaceFragment now use insertAnnotations.

ve.dm.Surface.test
* Removed test for annotate method (not needed anymore)

ve.dm.SurfaceFragment
* Now using getInsertionAnnotations method
* Added support for modifying insertion annotations when annotating a zero-length selection

ve.dm.Surface
* Moved in insertion annotations state from document model
* Added insertion annotation interface (enable, disable, areEnabled, get, set, add, and remove)
* Simplified handling of annotations on change
* Removed annotate method (not used anymore)

ve.dm.Document
* Removed insertion annotations (moved it to surface model)

ve.ce.Surface
* Cleaned up handleInsertion and changed it to use the insertion annotations interface on the surface model

ve.AnnotationAction
* Moved insertion annotation handling out of here since it's now included in the surface fragment

Change-Id: I047d656acf7fa1c63f726ca2b0801e1476f84f96
2012-11-19 17:09:08 -08:00
Trevor Parscal 96fcbbd695 Cleanup var statements
Put non-assignment vars first

Change-Id: Id868976bc4d7c21032aef5020fe5fd0eb5df7a14
2012-11-19 17:05:34 -08:00
Catrope 22a01bfc4f Merge "The great inspector and context rewrite of 2012" 2012-11-19 23:23:48 +00:00
Trevor Parscal d2476a26d2 The great inspector and context rewrite of 2012
ve.AnnotationAction
* Added filter to the clearAll method to allow clearing all matching annotations only

ve.dm.Document
* Some variable renaming for consistency

ve.dm.SurfaceFragment
* Added truncateRange method
* Added annotation scope to expandRange method
* Added support for passing an annotation object into annotateContent method
* Switched to using name instead of type in annotateContent method to match the ve.dm.Annotation class
* Fixed logic in annotation mode of expandSelection so that expansion only takes place if the annotation is found

ve.ui.LinkInspector
* Moved most of the functionality elsewhere
* General reorganization
* Changed setOverlayPosition to accept 2 arguments instead of an object with 2 properties and renamed it to positionOverlayBelow
* Check for annotation object before extracting target information from it
* Initialize default target as empty string to avoid undefined being cast to a string and the default target becoming 'undefined'

icons.ai, inspector.png, inspector.svg
* Added generic inspector icon which will be used when a custom icon is not specified in future inspector subclasses

ve.ui.Inspector.Icons
* Added inspector icon
* Renamed clear icon to remove to match it's actual image

ve.ui.Context
* Greatly simplified the interface, reducing the number of methods by inlining a few things and combining others
* Now always listening to resize events on the window rather than only while document is focused
* Not listening to scroll events anymore, they used to affect the top/bottom positioning of the menu which we don't do anymore
* Lots of cleanup and reorganization
* No need to fallback to empty array since getInspectorsForAnnotations does so already
* Only consider fully-covered annotations for inspectors

ve.ui.Frame
* Simplified the constructor by introducing the createFrame method
* General cleanup
* Typo fixes

ve.ui.Inspector
* Generalized lots of functionality previously located in the link inspector class which will be useful to all inspectors (such as title, clear button, saving changes, etc.)
* Added setDisabled and isDisabled methods to manage CSS changes and avoid needing to check the CSS to determine the state of the inspector (storing state in the view is evil)
* Added getMatchingAnnotations method for convenience
* Added prepareSelection stub
* Lots of cleanup and documentation
* Type pattern is now defined in base class
* Added stubs for onOpen and onClose with documentation so that subclass authors know what these methods do
* Removed checks for onOpen or onClose methods since they are now noop stubs and are always there
* Added stub and removed checks for onRemove
* Made esc key close and accept - the illusion is supposed to be that the link changes are applied instantly, even though they are only updated when you close, so all closing except for when removing should apply changes - i.e. esc is now equal to back rather than being a special function that doesn't have an associated affordance
* Only consider fully-covered annotations when getting matching annotations

ve.ui.InspectorFactory
* Depending on type pattern now since it's always there
* Added getInspectorsForAnnotations method
* Return empty array if annotation set is empty

VisualEditor, VisualEditor.i18n
* Added default inspector message

Change-Id: I1cc008445bcbc8cba6754ca4b6ac0397575980d5
2012-11-19 15:21:27 -08:00
Translation updater bot 3f731b76e0 Localisation updates from http://translatewiki.net.
Change-Id: I0fd2a0761ab62d22a4c76a218a85e82eb8cd0696
2012-11-19 20:21:34 +00:00
Translation updater bot b06324bd2b Localisation updates from http://translatewiki.net.
Change-Id: I24b10d41bc7ffac229c3335724df8edaf169f797
2012-11-18 20:39:47 +00:00
Translation updater bot b767f34852 Localisation updates from http://translatewiki.net.
Change-Id: Ib32c20bdd01c5113a5600fa70a6c238ed1e8a347
2012-11-17 20:52:42 +00:00
Catrope 7fb9b1c09a Merge "(bug 42123) Add i18n for aliennated content tool tip." 2012-11-17 01:08:07 +00:00
James D. Forrester c7fd1819a3 (bug 42123) Add i18n for aliennated content tool tip.
Change-Id: Ibb98d256fb989cd69407b487df673ee22f8c9758
2012-11-16 16:52:22 -08:00
Trevor Parscal 2c8411eb62 (bug 41947) Propagate change markers when unwrapping generated nodes
Editing the text of a list item results in a change marker on the
paragraph within that list item. However, that paragraph usually isn't
present in the HTML, so the converter unwraps it when converting back to
HTML, and the change markers are lost. Instead, transfer the change
markers to the <li>.

Change-Id: Id675075d19c08d69bc8e990174841dc393b749fc
2012-11-16 15:39:35 -08:00
Catrope 29a0c38e05 Add ce.AlienNode to tests
Change-Id: I591501067732ae36c89da340398ad35e8d4b6e3d
2012-11-16 15:35:09 -08:00
Trevor Parscal 0907533b49 Merge "Phantoms not vanishing on mouseout" 2012-11-16 20:44:32 +00:00
Translation updater bot bc6a5a2a47 Localisation updates from http://translatewiki.net.
Change-Id: I7dcadb47a4996fb4995f349747c6331b3102cf50
2012-11-16 20:41:16 +00:00
Christian Williams 1932e0907f Phantoms not vanishing on mouseout
If the mouse is moved too quickly, the phantoms have a tendency to stick. This change moves the event from phantom.mouseleave to surface.mousemove.

Change-Id: I2c7e7bdc838427d4355a6c0c13bafe3198636dbe
2012-11-16 11:32:59 -08:00
Inez Korczyński ebbd297841 (bug 42134) Add shields after node is attached to the live DOM
This changeset introduces new variable property of ve.ce.Node called "live", which stores information whether or not given node is attached to the live DOM. When the value of this property changes event "live" is called.

Change-Id: I6d0ce923c25ff2c4015914f367582c9a15e62c65
2012-11-15 14:17:12 -08:00
Translation updater bot 55a5c35a14 Localisation updates from http://translatewiki.net.
Change-Id: Ida3f68c387b52b82a78519c6028c3046d6fe4417
2012-11-15 20:44:06 +00:00
Christian Williams fcfca947a9 Better Shield Logic
jQuery.css('float') returns different null values for Chrome and Firefox. This fix takes this into account and applies shields only to aliens and floated descendants.

Change-Id: I4c1db148043ee95991a17720dee8febad62c415a
2012-11-14 18:38:42 -08:00
Catrope 918c0e3266 Merge "Disable Table Editing" 2012-11-15 01:22:00 +00:00
Catrope 3fa434a7da Also increase the server-side timeout to 100s
Change-Id: Idff97fb7076251c481d1a8d7f83e6688ff0316d5
2012-11-14 17:16:13 -08:00
Christian Williams 9f4a4d9e92 Disable Table Editing
Native contenteditable execCommands were being tried before the surface was attached to the DOM. This is necessary for disabling native contenteditable object editing and resizing.

Change-Id: Idff6a30432396726deb8a38356172380ea12fced
2012-11-14 17:14:45 -08:00
Trevor Parscal 17b33dc94e Merge "(bug 41722) Remove use of the Feedback tool for December release" 2012-11-15 00:24:50 +00:00
James D. Forrester 42fb99728b (bug 41722) Remove use of the Feedback tool for December release
We do not want to use the Feedback tool for the December release, as it does not
work cleanly with LiquidThreads and would strand most users in an unfamiliar
wiki and expect them to have more complex/technical responses than they are
likely to be able to give; instead, have just purged it entirely from the code
(except for i15d strings, per Roan).

Change-Id: Ieebdca3d365943d901e2df37228120fdcff50afd
2012-11-14 16:16:52 -08:00
Trevor Parscal e808e67a64 Merge "Display overlay phantoms for inline blocks (no need to use shields)." 2012-11-15 00:11:21 +00:00
Trevor Parscal ba01a76363 Merge "Support for node HTML attributes" 2012-11-15 00:05:16 +00:00
Catrope 8a2781356c We'll want a 100s timeout, not 10s
Barack Obama takes 60s to parse, according to Gabriel

Change-Id: I1a63225c0961ca9d56dccd018d400831b1d528e9
2012-11-14 16:02:36 -08:00
Trevor Parscal 3502144106 Merge "Ignore hidden-ness of visualeditor-enable preference" 2012-11-14 23:46:33 +00:00
Catrope 4085c2f554 Ignore hidden-ness of visualeditor-enable preference
Needed to make the dark launch work

Change-Id: I1c6f22cb85fdd852bfcc9985d826032f128c6b82
2012-11-14 15:44:15 -08:00
Catrope b133c52ce8 Merge "Temporary quick fix for BugId 41223. It is just for release purpose and I will keep working on solid solution." 2012-11-14 23:04:26 +00:00
Inez Korczyński 4c7f3d2182 Temporary quick fix for BugId 41223. It is just for release purpose and I will keep working on solid solution.
Change-Id: I3f428f88b0e8d6d837f1dfd9d269ca3c99147ed7
2012-11-14 15:02:40 -08:00
Trevor Parscal fc7c0e7d4c Merge "<br> isn't a block element" 2012-11-14 22:48:36 +00:00
Trevor Parscal f9b2f94659 Merge "Rewrite ve-parsoid API module" 2012-11-14 22:48:14 +00:00