Commit graph

776 commits

Author SHA1 Message Date
Christian Williams e03cef06a7 Nicely highlightable alien nodes
Browsers handle highlighting of our alien nodes differently. This change normalizes by hiding the native selection on the aliens, inserting blank image "shields" with native highlighting enabled.

Change-Id: Ica3576ef0e3c42b4aeae1da374cd1dc92f203d7d
2012-11-13 10:25:05 -08:00
Trevor Parscal 5f56694b75 Merge "Add basic support for about groups" 2012-11-08 18:23:19 +00:00
Catrope d4ea93b872 Add basic support for about groups
About groups are HTML structures like the following:
<div about="#mwt1">....</div>
<span about="#mwt1">...</span>
<div about="#mwt1">...</div>
When about groups are alienated, they are now merged into one alien
node, rather than producing a separate alien node for each sibling.

This is very basic about group handling, because it only works for
groups of directly adjacent siblings (text nodes are permitted in
between, but nothing else) assumes all about groups are aliens (which
is currently true).

* Before processing an element in the DOM->data converter, perform about
  grouping on its children. This temporarily wraps about groups in
  <div data-ve-aboutgroup="value of about attribute">
* Extended createAlien() to handle single nodes as well as wrappers
  holding multiple nodes.
* In the data->DOM converter, temporarily wrap multi-node aliens in
  <div data-ve-multi-child-alien-wrapper="true"> . This makes the rest
  of the algorithm easier.

Change-Id: I2df5f62bc222b570fc11a89fe43d353f8363ead8
2012-11-07 18:13:50 -08:00
Trevor Parscal bd72ee65d8 Added some more key bindings for IE and Mozilla support
Change-Id: Ic4bcd53d41fcd676d5929bfb94d0cbf3afb6968e
2012-11-07 16:49:34 -08:00
Catrope f10ca89888 Merge "Mapped tab key to indentation action" 2012-11-08 00:31:10 +00:00
Trevor Parscal 614dd307f7 Mapped tab key to indentation action
* Added cancelable action return value to surface execute method

Change-Id: I57a58962399a46a0e41b4e95e438dc528770d619
2012-11-07 16:26:13 -08:00
Catrope 7052730628 Merge "(bug 41865) Make the save button available immediately for oldid pages" 2012-11-08 00:05:17 +00:00
Catrope 03827764a7 Merge "Refactored commands into a registry" 2012-11-07 23:52:59 +00:00
Trevor Parscal 443c5438ab Refactored commands into a registry
* Now ve.Factory inherits from the more general ve.Registry
* New class ve.CommandRegistry
* Refactored setupToolbar and command setup code into setupComands

Change-Id: Ic548e5de95b77889727362d3e66d7be83c12a603
2012-11-07 15:52:30 -08:00
Catrope 3d76ce60fe Merge "Replaced command factory with new command class" 2012-11-07 23:51:19 +00:00
Trevor Parscal ab57bed7da Replaced command factory with new command class
The port of mousetrap wasn't really what we needed. This is much simpler, matches the rest of our code, and does exactly what we need.

Change-Id: I67f413e097fc2d4078336edb14dd9440e771f196
2012-11-07 15:47:03 -08:00
Catrope 66efe62108 Merge "Fixed line-height variations between sa and mw integrations" 2012-11-07 23:43:39 +00:00
Christian Williams 05c3e088d0 Fixing native selection rendering for floats
This fixes a problem with how Chrome renders native selection around floated elements. By adding pseudo elements before and after block aliens, the rendering is fixed.

Change-Id: I7fdbb8f4c42e29d0574b308b8c5740066bb58e94
2012-11-07 15:07:43 -08:00
Trevor Parscal f4a674e2c5 Merge "Flag pre nodes as having significant whitespace" 2012-11-07 22:12:45 +00:00
Trevor Parscal 66b3f5364d (bug 41865) Make the save button available immediately for oldid pages
Also consider making it say "Restore page" initially for oldid pages until a change is made

Change-Id: I9e5ce76520e091612afe4fbc0300cff8ca645335
2012-11-07 13:57:13 -08:00
Trevor Parscal 273c6ac7bd Made commandFactory tests not break anymore
Sequences that were scheduled directly after each other, such as "a b c" and "1 2 3" would end up overlapping sometimes, producing "a b 1 c 2 3" which failed to trigger the correct commands.

Change-Id: I27bb60e856e9d692a21e1587dc227f8aeb5fcf4e
2012-11-07 13:56:53 -08:00
Catrope 1f01100eb9 Flag pre nodes as having significant whitespace
This causes the converter not to strip inner whitespace in them, and
causes CE to suppress the whitespace mangling logic that is normally
applied (↵ for newlines, ➞ for tabs, alternating &nbsp;s for spaces).

Change-Id: I738a750c91a4ca4836c485e282865bb7525bf30a
2012-11-07 12:10:58 -08:00
Trevor Parscal 6082953562 Made jquery.multiSuggest it's own RL module
* Also updated resource paths in tests and demo pages

Change-Id: Ic21b678f91ed8d1fe1c7ac2a53d89270aacf7c26
2012-11-06 16:37:01 -08:00
Trevor Parscal cd58340f1c Removed introduction of global variable
resetSequences was being called in the context of window instead of a contextFactory

Change-Id: I1b9ee25547bd18d59eac4b991ecc813b81f92a4c
2012-11-06 10:52:30 -08:00
Trevor Parscal cab7f84b55 Fixed line-height variations between sa and mw integrations
* Also fixed format drop-down's preformatted label styling

Change-Id: I983ff71959f5e78e52fbe4c585db20357b7ca2d5
2012-11-06 10:24:58 -08:00
Catrope 04a999f991 Add change marking for Parsoid's benefit
* Add map of change markers per offset to Transaction
* Map is populated by TransactionProcessor
* Markers are reversed on rollback
* Removals aren't marked, Parsoid can detect these using DSR
  discontinuities

Change-Id: I2290886ab411c6ad6162044ed85c091313613e51
2012-11-06 10:11:11 -08:00
Trevor Parscal 1e3f42f764 Merge "Styling aliens with a yellow background; preventing absolute positioning" 2012-11-06 00:09:41 +00:00
Trevor Parscal 692a67dc3d Merge "Integration revamp for December release" 2012-11-05 23:19:10 +00:00
Christian Williams 901eea203e Styling aliens with a yellow background; preventing absolute positioning
Change-Id: I86fbbda841d69beeabf4e683de3b032fb70b1ac6
2012-11-05 14:22:10 -08:00
Trevor Parscal d2b839a2cb Fixed font-size issues for monobook integration
Change-Id: If71fbd186979777b73c84f64610c8485017de654
2012-11-05 13:32:06 -08:00
Catrope efbb94e548 Merge "Improved the responsiveness of the context menu" 2012-11-05 20:52:58 +00:00
Trevor Parscal 4e377480cf Improved the responsiveness of the context menu
* Added selectionStart and selectionEnd events to ve.ce.Surface
* Switched from debouncing model change events to just ignoring
  model change events while the user is in selection mode
  (dragging mouse or pressing shift+arrow keys)
* Fixed bug with callout appearing on resize.

Change-Id: I3bb9952867a983a4f7612964ff719a1179dd0fc6
2012-11-05 12:47:47 -08:00
Catrope 4d7952d55c Integration revamp for December release
* Remove VisualEditor namespace, and restrictions on it
** For MW.org these will be moved to mediawiki-config
* Add $wgVisualEditorNamespaces
* Add visualeditor-enable preference and respect it
* Use $skin->getTitle() rather than $wgTitle
* Remove "Sandbox" from i18n message
* Remove duplicate enforcement of VE namespace from JS

Change-Id: I956f68c2dde55e4063530fcc7c90eda048e0d78b
2012-11-05 12:46:14 -08:00
Trevor Parscal 0b6c6e7bf1 Merge "Introduce meta-linmod" 2012-11-05 19:01:32 +00:00
Trevor Parscal 289e762812 Removed ve.init's dependencies on ve.ui styles
* Things broke when ve.ui stuff was refactored
* Save dialog is now completely stand-alone

This is an alterantive to Ib028e6967e8d2e158b05fd7582620c21cf9b85fb
which I believe is a better approach.

Change-Id: I7cb52d0750e859c4052e2008d929d197b88b9877
2012-11-05 10:35:36 -08:00
Catrope 857535b63f Introduce meta-linmod
* ve.dm.Converter still generates metaInline/metaBlock elements as
  before, it's not affected by this change
* ve.dm.Document constructor splits its input into "real" data and
  metadata
** Metadata is stored in this.metadata (the meta-linmod) as a sparse
   array of arrays, with an element for each offset in this.data
** this.data itself does not contain the metadata
** This means the node tree also doesn't contain the metadata
** Which means CE doesn't know about it at all
* All splice operations on the linear model are sent through
  ve.dm.Document.spliceData(), which performs the splice and syncs the
  meta-linmod
** Metadata in the removed range is reaped and added to the metadata for
   the offset immediately following the removal
* ve.dm.Document.getFullData() splices the linmod and meta-linmod back
  into each other; this "full data" is then fed back to ve.dm.Converter

Change-Id: Ief6dfd5b59cc13a8457993ed85c725413029c4fb
2012-11-02 19:06:49 -07:00
Trevor Parscal d631bac3db Merge "Base for inspectors & context menu to operate on 0 length selection." 2012-11-02 21:38:14 +00:00
Rob Moen 5d86bc4379 Base for inspectors & context menu to operate on 0 length selection.
* Allow inspector to open with 0 length selection.
* Allow context menu to open with 0 length selection.
* Fixed bug in doc.getAnnotationsFromRange on zero length selection:
  Method now returns annotations from start vs empty annotation set.

Change-Id: I3937c5c2824c7396d0c3ee11c13ffecdbed6052a
2012-11-02 13:08:32 -07:00
Catrope 471836ef35 Merge "Cleanup tool API" 2012-10-31 18:23:45 +00:00
Trevor Parscal a4e0e83f24 Cleanup tool API
* Moved to tool specific configuration to static properties (left tool instance specific stuff in the constructors)
* Added documentation for tool configurations
* Centralized typePattern matching for inspectors

Change-Id: Ieacf61b320c10fd37ea69a05e543313fa990b403
2012-10-31 11:10:17 -07:00
Catrope 6ef9fa78ff Fix ve.batchSplice() to behave in line with docs
* Actually return the spliced data like the docs claim we do
* Remove false claim that offset can be negative
* Add that data=[] && remove=0 is invalid; native splice() doesn't allow
  this, and there is a case where we call native splice() directly
* Add tests

Change-Id: I90e77c1b22ea1c36cb61e89ea47831885a0b1cb9
2012-10-30 10:05:49 -07:00
Trevor Parscal 82a15d66fc Merge "Fix copyObject/copyArray behavior with null values" 2012-10-30 16:59:02 +00:00
Catrope d30096ebd3 Fix copyObject/copyArray behavior with null values
Previously copyObject and copyArray would silently drop null values,
which is bad, especially considering we have example data for meta nodes
that has { 'key': null } somewhere.

Also added a test case that failed prior to this change.

Change-Id: I4f233cce041fbf38f701c494f1f78ac3d8535d88
2012-10-29 19:45:25 -07:00
Catrope 6df508cf8b Add InspectorFactory to tests
Tests were completely broken because the link inspector threw a JS error
when trying to register itself with the nonexistent inspector factory.

Change-Id: I8a47222f0a5a37348262ed939b37fbc47d14e222
2012-10-29 18:36:54 -07:00
Rob Moen 765f7589ac Fix bug where link inspector / context overlay would no longer show.
Change-Id: I73281dc32eae5660662898d0290468434e7326d9
2012-10-29 10:56:11 -07:00
Trevor Parscal f2a83960f8 (bug #41434) Converting format across 2 lists with paragraphs in between fail
Thanks to Roan for suggesting this fix.

Change-Id: I754dc34fbd3aaf2bdcb78bf89bfc896b612b4ee6
2012-10-26 15:18:44 -07:00
Trevor Parscal 21ea11c161 Really properly initialize static member before adding stuff to it
Kill them console log errors 'til they're dead.

Change-Id: I7329f4c869f46a9ef664af8ab49cb2504abdf972
2012-10-26 15:10:01 -07:00
Trevor Parscal cd0b28d407 Properly initialize static member before adding stuff to it
This was causing a console error

Change-Id: Ic394cf4d4821bd7c03fd32bb9e202801dccde085
2012-10-26 15:02:24 -07:00
Catrope a87ffeefa1 Merge "Whitespace and comment cleanup on ve.ce.SurfaceObserver" 2012-10-26 21:59:00 +00:00
Trevor Parscal 3142a4e66f Add commands to ve.Surface
First stab at a simple command interface. This and commandFactory
will be refactored significantly before this code is put into
action.

Change-Id: I0de5d3271198c987baf06fb3011aebdc1671f498
2012-10-26 14:50:23 -07:00
Trevor Parscal 238feeb881 Tools changes
* Rewrite of all tools, dramatically simplifiying them and decreasing
  duplication
* Tools are now created using a tool factory instead of
  a make-shift facility built into the toolbar
* All UI object have a surface or a toolbar reference instead of a
  surface view

Change-Id: I589ecba36bf715b452d03c8fd5c0547dc3c1dc61
2012-10-26 14:48:27 -07:00
Rob Moen 9563f0880d UI context reorganization, inspector rewrite, iframe refactor, icon generalization
* Only show the inspector if the selected text has an inspectable annotation
* Replace the inline menu with a toolbar containing inspectable annotations
* Change the appearance of the inspector to match new mockups
* Add the trash can icon for removing annotations
* Move iframe handling code into a class that manages all that nonsense

Change-Id: I840f72426f9a9e50054a28de950393f0e9913153
2012-10-26 14:46:11 -07:00
Trevor Parscal 735ed96f5f Add ve.Action, ve.ActionFactory, subclasses
Moved implementation of all the tools into a reusable action
system. To execute an action just call

surface.execute( actionName, method, param1, param2, ... );

This helps keep tools simple, and opens the door to key commands
reusing the same code.

Change-Id: Ie786fa3d38d1ea17d39b5dfb8eeeb5f2256267ce
2012-10-26 14:44:17 -07:00
Trevor Parscal ed7273da25 Add ve.dm.Surface.has{Past,Future}State, add docs
Will be used by the history tools in a future commit, providing
a reasonable interface to this information rather than the tool
reaching into private members.

Change-Id: I0472349968e9b48ec17eb47b6845ec9ccf3811e2
2012-10-26 14:43:09 -07:00
Trevor Parscal fcbe1d7b9c Add ve.dm.Node.hasAttributes()
Will be used in future commits to reduce duplication.

Change-Id: Ibde934d5a55b980010e84b6242f8d968e88cea54
2012-10-26 14:42:40 -07:00