Commit graph

1225 commits

Author SHA1 Message Date
Trevor Parscal 26d06a98ed Renamed API from ve-parsoid to visual editor
Change-Id: I3bfe2e813b31f9010010f63902b1e8e22f3bcd59
2012-11-30 15:00:04 -08:00
Rob Moen bad4de89b6 Add hover state to link inspector suggestion items.
Addresses (Bug 39977)

Change-Id: I159f86b070544f829ff801ac3ab913d36c5a0b30
2012-11-30 14:52:57 -08:00
Catrope 38e37f40ee Merge "(bug 42555) Fixed onUpdate over-writing in ve.ce.HeadingNode" 2012-11-30 19:44:32 +00:00
Trevor Parscal 6f3db44cc1 Merge "Restyle suggestion dropdown into a single column." 2012-11-30 19:43:56 +00:00
Trevor Parscal 23bd31a855 (bug 42555) Fixed onUpdate over-writing in ve.ce.HeadingNode
When the content rendering stuff was moved to ve.ce.ContentBranchNode the onUpdate methods being used to update the DOM wrapper in ve.ce.HeadingNode was overlooked, so heading were not rendered on update anymore.

Change-Id: I994b8c43123c3cd02b9a550d5d7eac7d5052418e
2012-11-30 11:39:46 -08:00
Rob Moen 766b5f3d3c Restyle suggestion dropdown into a single column.
* Permits longer page titles in suggestions without changing
  the width of the  dropdown.
* Addresses (Bug 40675)

Change-Id: Ie76a551970a040074b86c49bb44bda640ecd4845
2012-11-30 11:08:49 -08:00
Trevor Parscal bf98af7bcb (bug 42552) Link inspector close on selection change
The logic in ve.ui.LinkInspector.onUpdate was very flawed. This patch makes it so:
* When something happens, if there's an inspector open then so long as the selection hasn't changed the inspector is updated (such as the window being resized)
* If the selection does change, the inspector is closed
* If there's no inspector open, we try to show a menu of available inspectors

Change-Id: I859123a5fcd36bc2afb2e578f81f30a944c8583a
2012-11-30 10:12:41 -08:00
Catrope 752639bf6c Merge "(bug 42401) Cursor movement fixes" 2012-11-30 17:54:51 +00:00
Trevor Parscal 5e477cbe98 (bug 42401) Cursor movement fixes
ve.ce.Surface
* Added ve.ce.Surface.adjustCursor, which replaces repetitive and buggy code that was handling left and right arrow key presses
* New method only affects the selection target, so it won't collapse the selection on you - this was what caused bug 42401
* Made hasSlugAtOffset() actually return a boolean

ve.dm.Document
* Fixed turn-around issue in ve.dm.Document.getRelativeOffset - if the offset is already valid and we can't move in the direction we want, we should just leave it be, not turn around
* Since this method was being used by ve.ce.Surface to correct the cursor position on arrow key presses, it was causing the strange cursor jumping when you pressed an arrow key while at the edge of a document

ve.dm.SurfaceFragment
* Fixed typo where getAnnotationRangeFromSelection was preserving selection direction, but checking the wrong properties

ve.dm.Document.test
* Added tests that verify turn-around issue is fixed

Change-Id: Iba55cfc3d531e7d1333b78c94912ff22179aace8
2012-11-30 09:50:47 -08:00
Rob Moen 9ba19af1c0 Immediately provide default suggestions based on 0 results.
Allows suggest tool to open immediately and provide new page and
external link suggestions for link inspector.

Resolves (Bug 42341)

Change-Id: I79bc3e31033b5c38c3ed6ab23e601476cb17ba8f
2012-11-29 15:26:47 -08:00
Trevor Parscal 1d0ad9573e (bug 37828) Handle edit conflicts
ApiVisualEditor
* Added basetimestamp and starttimestamp to all methods where appropriate
* Added new serialize method which converts HTML to Wikitext

ve.init.mw.ViewPageTarget
* Added edit conflict handling
* Moved form value reading code into getSaveOptions method
* Prevented edit warning from appearing while submitting

ve.init.mw.Target
* Added serialize and submit methods
* Fixed some documentation
* Added support for baseTimeStamp and startTimeStamp

VisualEditor.i18n
* Added edit conflict confirmation box message

VisualEditor
* Included new edit conflict message to resource loader module

Change-Id: I002c5aa23704c1c46ef46fa1970a4254614b9eb1
2012-11-28 17:55:23 -08:00
Trevor Parscal a57288575f (bug 42350) Delete and backspace broken around inline aliens in Firefox
ve.ce.Surface.handleDelete did not support inline elements. This patch resolves this by detecting them and using programatic delete instead of native browser delete.

Change-Id: I73215df88519450965be35d9e04cf4e621d1e90d
2012-11-28 16:44:34 -08:00
Trevor Parscal e1a15b8845 Merge "(bug 42221) (bug 42142) Refactor init.mw setupSkinTabs." 2012-11-28 19:38:05 +00:00
Catrope e148234c29 Render inline annotations in CE
Moved annotation rendering from ce.Textnode into the new
ce.ContentBranchNode class. This allows us to render annotations that
span across multiple nodes.

* Add ce.ContentBranchNode, inheriting ce.BranchNode
* Make ce.{Paragraph,Heading,Preformatted}Node inherit ce.ContentBranchNode
* Made ce.ContentBranchNode render its child nodes with anntations,
  using .getAnnotatedHtml() on the child nodes
* Put a default implementation for .getAnnotatedHtml() in ce.LeafNode
* Override this in ce.TextNode to do escaping and whitespace handling
* Removed rendering code from ce.TextNode (this.$ is now unused there)
* Removed ce.TextNode.onUpdate() and ce.BranchNode.clean(), now unneeded
* Have ce.BranchNode propagate update events from children, so
  ce.ContentBranchNode can rerender when its children change
* Update tests, add test case for escaping of &<>'"

Change-Id: I4600e984b287c6ff9267f4281d2f09bab9e1ad95
2012-11-28 11:21:59 -08:00
Catrope ce16b275c9 Fix rebase artefact in ve.dm.Node.getAttributes()
This caused it to always return {} when asked for all attributes with a
given prefix

Change-Id: Id3cc053e1911aebb2b7e60e3dd2f325ec7772a6c
2012-11-28 11:20:54 -08:00
Timo Tijhof a48581945b (bug 42221) (bug 42142) Refactor init.mw setupSkinTabs.
* Remove the logic where we create a ve-edit button even though
  we know there is no native ca-edit button (bug 42142).
  This was previously in place to allow ve-editing a page while
  restricting source editing, but this is no longer wanted.

* Implement new tabLayout mode "add", which adds a VE tab.
  Previous default is now the "replace" mode, which replaces the
  native "Edit" tab and creates a "Edit source" link.

Change-Id: I3fe29c52b743837c2e1d66f25ccdca6115b8bd25
2012-11-28 19:15:13 +01:00
Catrope 4de2242e72 Merge "Added contextChange event to surface model, replacing annotationChange" 2012-11-27 22:54:11 +00:00
Catrope e123a39b4e Handle annotated inline nodes in the converter
Was broken both on the way in and on the way out.

* Move alien restoration (data->DOM) out of the main getDomFromData()
  function and into getDomElementFromDataElement(). This means the
  comment about District 9 is gone (sniff), but moving this here ensures
  all code paths hit it (previously, it was assumed annotated nodes
  could never be aliens).
* In the DOM->data converter, add annotation application to
  getDataElementFromDomElement() (for content nodes) and createAlien()
  (for aliens). Previously, these nodes would not get annotations.
** ve.AnnotationSet doesn't have a constructor that takes an array, we
   should fix that.

Change-Id: I65f8e9a322111ca3af275bf9997b0b1e7ee93769
2012-11-27 14:41:40 -08:00
Catrope 5e2c421b77 Make annotating inline elements actually work
The transaction builder would step around inline content elements when
building annotation transactions. This is now fixed.

I also tweaked the processor to tolerate attempts to annotate inline
closings. This allows the builder to generate simpler transactions,
because it doesn't have to step around the closing.

Change-Id: I1e0d7f95b38bad1b35b3e125a53350d2d126a7de
2012-11-27 14:41:40 -08:00
Catrope 49963c75fd Store the data model element in the DM tree
This is cleaner than passing around the attributes separately, and it
allows us to access the annotations in dm.LeafNode as well.

Change-Id: Ie5b90988114835831cbe5cdccf63c7cd45719e31
2012-11-27 14:36:29 -08:00
Inez Korczyński a9082e6dde Only apply HTML attributes to DOM nodes that are "safe"
* Added whitelist argument to setDomAttributes which allows filtering of attributes being set
* Added prefix argument to ve.dm.Node.getAttributes to allow extracting a subset of attributes by name prefix
* Added a whitelist to ve.ce.Node which was extracted from MediaWiki's Sanitizer class
* Replaced attribute copying code with a call to setDomAttributes using the whitelist argument, passing in attributes from a call to ve.dm.Node.getAttributes using the prefix argument

Also…

* Removed comment in constructor of ve.ce.Node, documentation for properties is usually in the getters/setters, and already was in this case
* Renamed ve.setDOMAttributes to ve.setDomAttributes
* Renamed ve.getDOMAttributes to ve.getDomAttributes
* Renamed ve.getDOMText to ve.getDomText
* Renamed ve.getDOMHash to ve.getDomHash
* Updated all callers of renamed methods

Change-Id: Id556172d5d18ea431044b9d402400e1f0e67a293
2012-11-27 14:34:29 -08:00
Trevor Parscal 7404d6438a Merge "Fix tests for fda2e6c1b54a0139a3123de413f672e895ff3352" 2012-11-27 21:38:24 +00:00
Trevor Parscal d4b3910013 Merge "(bug 42277) First character in empty document behaves strangely in Firefox" 2012-11-27 21:36:27 +00:00
Trevor Parscal 2cc8f09204 Added contextChange event to surface model, replacing annotationChange
The contextChange event is fired when:
* Changes to insertion annotations
* Changes to which nodes are selected (start/end nodes have changed)
* Attributes have changed on any element (it's probably more expensive to detect if the changes are relevant than to just emit the event and let listeners do their thing)

This fixes most of the strange behavior with the toolbar not updating properly.

Change-Id: I5321d2e30bebd80987e0c779a9d8e061d8aa80bc
2012-11-26 15:57:02 -08:00
Trevor Parscal ee80af5f96 (bug 42404) Errors passing "incorrect" offsets to ve.ce.Surface.getNodeAndOffset
* Adjust offsets to correct positions before showing selection with them
* Throw an error inside of getNodeAndOffset if we can't find a match rather than mysteriously not retuning anything

Change-Id: Ia7347527e6466262e819f456404b32926fd95e34
2012-11-26 15:01:35 -08:00
Catrope 1bc74b0f6d Fix tests for fda2e6c1b5
Change-Id: I2725f3f775e092bafe7aa9dca71d2a9022f16db8
2012-11-26 21:39:14 +00:00
Catrope 568e0e5701 (bug 42277) First character in empty document behaves strangely in Firefox
This was because Firefox intially puts the selection before the first
paragraph, which translates to a model selection of (0,0). Typing with
the cursor at that position causes bad things to happen.

CE normally fixes up the selection when this happens, but it doesn't do
this automatically on initialization. So I added some code to ve.Surface
that causes this fixup to happen.

Change-Id: I0dcee3a29c1242c49ec30c743f1b69686fbb8436
2012-11-26 21:39:01 +00:00
Timo Tijhof 1ba75b7ea9 The last ever mw.ext.ve jshint fixup
Change-Id: I262673214dd59e5bcaf4e0855e68728365b041fe
2012-11-26 22:36:07 +01:00
James D. Forrester c33de35a98 (bug 42402) Split out two cases so as not to throw an error
Logic called for A || B but then used both; this splits that into two distinct
code paths.

Change-Id: I959e0649fbd5b4f404b5804e26806ba51c31c836
2012-11-23 18:25:23 -08:00
Catrope 8e2414677f (bug 42279) Inserted characters get annotated with empty set
Turns out this was actually a bug in addAnnotationsToData()

Change-Id: I0c9da662c091811e4053ab0ea2771c4a20b26e09
2012-11-21 17:05:10 -08:00
Trevor Parscal 9c74c97808 Fix even more inspector issues, and some ce ones as well
ve.dm.SurfaceFragment
* Removed flawed implementation of word mode for expandRange method and made use of new getNearestWordBoundary method in the document model

ve.dm.Surface
* Got rid of useInsertionAnnotations, which allowed disabling and enabling of insertion annotations - this isn't needed anymore because it was just a dirty hack around the improper starting and stopping of surface observer that's now solved more elegantly by emitting lock and unlock before committing or rolling back transactions
* Get annotations from the first character of the selection if the selection is not collapsed
* Only emit annotationChange events if it really changed

ve.dm.Document
* Added getNearestWordBoundary method which performs the work behind the surface fragment expandRange word method

ve.ce.SurfaceObserver
* Allow using an initial selection to avoid the observer thinking the selection has changed just because it started out with null
* Only emit selectionChange event if there was a meaningful change

ve.ce.Surface
* (bug 42279) Only annotate characters if insertion annotations are not empty
* Remove manual locking and unlocking, this is now done inside the change method of surface model
* Provide an initial selection to surface observer when we clear it
* Remove enabling and disabling of insertionAnnotations, this isn't needed anymore
* Stop/start observer on key presses that execute actions as well as those that have no special handling

ve.ce.Document
* Make getNodeFromOffsetand getSlugAtOffset return null when given -1 as an offset

Change-Id: Ibf6b26de299e54ae8688a2653bf5d5538927f8c3
2012-11-21 15:26:12 -08:00
Trevor Parscal c9d6d35968 (bug 42219) Fix for document sync issue
When working with a document containing only a slug in an empty paragraph, tree synchronization would break because it was trying to rebuild a non-existent text node.

This change makes the rebuild always occur on the outer range, rather than the inner range, which prevents absent text nodes from being asked to be rebuilt.

Thank you to Roan for debugging this for like 20 min.

Change-Id: I8c3dad921ace395f0694f77cec44305a680657fe
2012-11-21 14:59:09 -08:00
Trevor Parscal b6139ba65e Merge "(bug 42124) Store comments in the meta-linmod" 2012-11-21 22:12:41 +00:00
Trevor Parscal 43b2c86102 Merge "(bug 42140) Don't force spaces to underscores in internal links" 2012-11-21 22:00:24 +00:00
Trevor Parscal f825e0093a Merge "(bug 42212) Fix JS error when inserting after alien at the end" 2012-11-21 21:56:19 +00:00
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 e0e5e43303 Merge "Make entity nodes work in CE" 2012-11-21 21:25:03 +00: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
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
Catrope 3a047e0208 (bug 42124) Store comments in the meta-linmod
* Make converter generate meta nodes with 'style': 'comment'
* Handle style==='comment' in MetaBlockNode toDOM converter
* Add some comments to the meta test case
** Update other tests accordingly
* Change getDomElementSummary() to actually assert presence of comment
  nodes (specifically, all non-text child nodes)

Change-Id: Ieef9418f4c47df3541477d9420aa2ab8df6e3df1
2012-11-19 20:01:09 -08:00
Catrope fda2e6c1b5 (bug 42140) Don't force spaces to underscores in internal links
MWInternalLinkAnnotation was normalizing spaces to underscores. This is
bad. Instead, we now do the following:
* Normalize underscores to spaces for display purposes
* Store the original title without underscore/space mangling
* If the user didn't change the title (display title === original title
  with s/_/ /g), use the original title. Otherwise use the user's title
  verbatim, without normalizing either underscores or spaces.

Also, per a conversation with Gabriel, we now only restore hrefPrefix
when we're also restoring origTitle, otherwise Parsoid will barf.

Change-Id: Ia74a493b2bce96c9345b60ed692eeb2e43ebceff
2012-11-19 18:55:49 -08: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
Catrope 79e4b139fb (bug 42212) Fix JS error when inserting after alien at the end
TransactionProcessor was using parentOuterRange without checking whether
it was present, so it was exploding for indexInNode results.

Now checking for parentOuterRange presence, and falling back to
nodeOuterRange when missing.

This fix causes inconsistencies with zero-length text nodes. We should
fix these eventually, but for now I've just made the unit tests
tolerant of zero-length-text-node deviations.

Change-Id: Id9eadd57a0d5fcbaf009c0781da0a03928aebb31
2012-11-19 14:35:30 -08: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
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
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
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
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
Catrope 50f94d53da Rewrite ve-parsoid API module
* Factor out getHTML(), postHTML(), saveWikitext() and parseWikitext()
* Use the API to save instead of using doEdit() directly
** This fixes a lot of integration bugs
** Get rid of the blocked user check, edit API checks this
* Check the namespace parameter
* Require tokens and POST
* Add diff functionality

Change-Id: I31891d1485985629db4e39532fb34e0e7fe23796
2012-11-14 14:47:20 -08:00
Inez Korczyński 2da5676fe1 Support for node HTML attributes
Walk through node model attributes and pick just the HTML ones, then apply them to the DOM element

Change-Id: I7e0ffd71023ad692fcad7386b853410747398793
2012-11-14 14:22:03 -08:00
Trevor Parscal 61a5d2137e Merge "Disable change marking by default" 2012-11-14 21:53:32 +00:00
Inez Korczyński 0d15980638 Display overlay phantoms for inline blocks (no need to use shields).
Change-Id: Ife362035c43daf863a3b6a5f892dc928d1f6ec80
2012-11-14 13:43:03 -08:00
Christian Williams 836f7dea9e Alien Phantoms
This changeset adds a visual treatment to uneditable AlienBlockNodes to indicate to the editor that the elements are uneditable. To deal with odd shapes, the alien's shields are cloned and added to a phantom container. The phantom container and the phantoms themselves may be styled appropriately.

Change-Id: I7ad52707966bc18be627aa4269725004edba86cd
2012-11-14 13:11:29 -08:00
Catrope 3acc6cb8f4 Disable change marking by default
It's causing problems with Parsoid in production

Change-Id: Id47493baafe1ec7f7c0e2bbdb2ea60a82913dfaf
2012-11-14 11:58:32 -08:00
Catrope c8661c0033 <br> isn't a block element
Also remove commented-out <img>

Change-Id: I7dc9f3b23c15008047cad938ed3408f55ea568d2
2012-11-14 11:27:49 -08:00
Inez Korczyński 72c564b47f (bug 41072) Add support for adding outer length in ve.ce offset getters
ve.ce.getOffsetFromElementNode now supports adding outer length
of given node to status functions.

It is temporary solution that I will review in the future.

Change-Id: If779802156aa78dbced9d4c769e8e7877120b337
2012-11-13 11:17:59 -08:00
Trevor Parscal 151db97a94 Merge "Fix JS error in unlisting" 2012-11-13 18:26:13 +00:00
Trevor Parscal da1d7e4a70 Merge "Nicely highlightable alien nodes" 2012-11-13 18:25:27 +00:00
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
Inez Korczyński 27ddb456c8 Fix for ve.ce.BranchNode.setupSlugs - insert each slug only once
When using jQuery insertBefore and insertAfter make sure to pass as a parameter jQuery selection of only one element (first for insertBefore and last for insertAfter).

Change-Id: Id469ed775642ab5be8e274ab3cb7730899e9487a
2012-11-12 15:32:22 -08:00
Catrope 2952ff344e Fix JS error in unlisting
The signature of getUnlistRanges() changed in the UI rewrite, but the
recursive call wasn't updated. This caused unlisting of lists that
contain lists to break and throw a JS error.

Change-Id: I990120a906868a5160561cff6b963f5ba5473427
2012-11-09 14:14:04 -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
Trevor Parscal 79944333a4 Add ve.dm.Node.hasMatchingAncestor()
Will be used in future commits to avoid traversing up the tree and
comparing type and attributes.

Change-Id: I993f4cbe20018406dbb4a3c9d1ce2f8766f8e1ba
2012-10-26 14:41:49 -07:00
Trevor Parscal 7d741253f3 Add ve.dm.SurfaceFragment.getAnnotations()
Change-Id: Ifb731e8fdd0f111f5da4ac0d882adaad3f48fdce
2012-10-26 11:03:51 -07:00
Catrope bc8b042e5f Merge "Fix annotation object creation in SurfaceFragment" 2012-10-26 17:53:10 +00:00
Trevor Parscal 44a78129c4 Whitespace and comment cleanup on ve.ce.SurfaceObserver
Change-Id: Ice4058f1041f3d0118c7955122b8ea4d538790e0
2012-10-26 10:27:54 -07:00
Trevor Parscal 52f1aac90a Merge "Test: Enforce # of expected assertions." 2012-10-26 16:48:18 +00:00
Krinkle b6b899c396 Merge "Documentation fixes" 2012-10-25 21:19:05 +00:00
Timo Tijhof 4cc2101ffd Test: Enforce # of expected assertions.
Change-Id: I041c792d1841f69677f8c7d38f67108475a0afc9
2012-10-25 22:06:07 +02:00
Krinkle dae235111c Merge "Fix JS error in ve.setProp()" 2012-10-25 19:55:16 +00:00
Catrope 84efb81e7e Fix JS error in ve.setProp()
Attempting to descend into a string or number would cause a JS error,
because we would attempt to create prop[arguments[i]] as an empty object
(which is ignored), then try to descend into it (which blows up because
it's undefined, even though we've just set it). Guard against this by
explicitly checking for non-object-ness.

Change-Id: Ie65550baaae0ab88476c9a1ff40cc136090740a0
2012-10-25 21:54:45 +02:00
Trevor Parscal 4e87a7a79b Fix number of doc sync tests
Follow up to I84f0368b1d7b601ed0766806607152dc97f34603

Change-Id: Ic1e9de1e755b8966b6e964b01b00f4d99d27245e
2012-10-25 11:06:12 -07:00
Catrope 2c1683ecff DocumentSynchronizer fix and cleanup
* Adjust the range in the annotation synchronizer, otherwise we emit
  events for the wrong node
* Expanded test suite to the point where it was able to catch the bug
  caused by not adjusting annotated ranges
* Removed selection.length === 0 check, no longer needed because
  selectNodes() now throws an exception in this case
* Added a FIXME comment about duplicate update events that occur when
  length adjustments are combined with something else
* Add a few more comments

Change-Id: I84f0368b1d7b601ed0766806607152dc97f34603
2012-10-25 11:02:58 -07:00
Trevor Parscal 551a30bc64 Merge "Actually use nodeOuterRange, selectNodes() has provided this forever" 2012-10-25 18:00:15 +00:00
Trevor Parscal fe5c5b78f9 Merge "Reorganize text-only replacement detection" 2012-10-25 17:56:45 +00:00
Trevor Parscal 8e7facf222 Merge "Guard transactions against double commit/rollback" 2012-10-25 17:55:56 +00:00
Trevor Parscal 9c51bb2d7b Merge "No longer copy data in ve.dm.Document constructor" 2012-10-25 17:54:23 +00:00
Catrope f1dbdac3d8 Actually use nodeOuterRange, selectNodes() has provided this forever
Change-Id: Ie1d3cbb6e475248927d10f411cf383f701a3ad71
2012-10-24 17:48:48 -07:00
Catrope 5d5335b498 Reorganize text-only replacement detection
* Lift node assignment out of the if/else
* Flip the condition so we detect text-only replacements rather than
  non-text-only replacements
* Additionally assert that there is exactly one selected node, and that
  it is a text node

Change-Id: Iaaddf532f06709e860ac44457470e6d8bfcb6dd9
2012-10-24 17:48:20 -07:00
Catrope 29cff8c105 Guard transactions against double commit/rollback
* Store the applied state in the Transaction
* Store the Transaction in the TransactionProcessor (previously, only
  its operations were stored)
* Have commit() and rollback() throw exceptions when passed transactions
  with the wrong applied state
* Add tests for this behavior

Change-Id: I27b7a96fdf4d3555d78f64c05a03702ea560c802
2012-10-24 17:47:41 -07:00
Catrope 43f1612324 No longer copy data in ve.dm.Document constructor
The data array is now taken by reference, and the caller must perform
any copying required.

Changed tests to make a deep copy of shared data sets (mostly
ve.dm.example) before passing them to ve.dm.Document().

Change-Id: Iedc64f9fd9cd689640de9a19379cf5f3db94a2bb
2012-10-24 17:32:35 -07:00
Catrope aa2836aa6e Remove 'internal' property from DM nodes
There's no use case for keeping a deep copy of the 'internal' property
in the node tree, and it was breaking some of my new tests concerning
change markers. We could keep internal data in the node tree if we
wanted to, but to be correct we'd have to synchronize every time we
changed it, which is a pain.

Change-Id: I024de1ff8b6b6154da82c103c4bb21db8ff2ec14
2012-10-24 16:47:14 -07:00
Trevor Parscal 8c3802308e Fix annotation object creation in SurfaceFragment
Also add a comment about how the way data is passed to a new annotation
needs to be improved

Change-Id: I693e4f5632b4eae0d2ee3468ee979454314f6364
2012-10-24 16:47:04 -07:00
Trevor Parscal f17fc65c41 Documentation fixes
Change-Id: I5020623ba59cd9d1794b7d1f97d3adf77b833d6e
2012-10-24 16:47:04 -07:00
Trevor Parscal b8dc697f17 Merge "ve.ui.CommandFactory: Initial implementation" 2012-10-24 18:48:40 +00:00
Timo Tijhof 34cbc729db ve.ui.CommandFactory: Initial implementation
Based on https://github.com/ccampbell/mousetrap.

Cleaned up to fit our coding standards, pass JSHint, and assume
jQuery's fixes where possible (e.g. no need for an addEvent
utility, no need for filling e.target, e.which, etc. cross-browser
which jQuery.Event already does).

Initially all were local functions in the constructor, but to
allow some customisations in subclasses moved various methods
to the prototype instead and marked with @private.

Really, only .register() must be called from the outside. The rest
assumes normalisation etc. or might break things if called
incorrectly.

Change-Id: Ic69a3c70759052094aefbeab623d885f8b118e14
2012-10-24 17:48:16 +00:00
Timo Tijhof 37f3a288ec Standards: Fix global variables and pass JSHint.
Follows-up:
* IK 714e29d30f
* IK 3b8a5ae4d5
* IK 72eb2825e5
* RK 7fe7182f43
* ...

Change-Id: I671f08e4899bfb9508cef272190ec72721a0af9a
2012-10-23 00:53:48 +02:00
Trevor Parscal bb97cd928b Merge "Add parentOuterRange to selectNodes() output" 2012-10-22 17:34:53 +00:00
Catrope 8d82da1fb5 Merge "Rename property "timeout" to "timeoutId" - more descriptive." 2012-10-22 17:08:39 +00:00
Inez Korczyński 88c22b3a46 Rename property "timeout" to "timeoutId" - more descriptive.
Change-Id: I198d07e3c59ba1283085135f45882ce606bb2389
2012-10-19 17:11:59 -07:00
Catrope 4e89867fc0 Merge "Removed htmlTagName and htmlAttributes from hash" 2012-10-19 23:35:57 +00:00
Trevor Parscal d09bc496c3 Merge "Fix for native deletion - it was breaking document (model and view) when deleting really fast (holding the key for example). This solution completely fix the problem, however it is not optimal - stop and start is called more often than should be." 2012-10-19 23:33:24 +00:00
Trevor Parscal 8ea206c743 Removed htmlTagName and htmlAttributes from hash
This was only causing data bloat and also errors because htmlTagName and htmlAttributes are only set if the annotation was constructed from an HTML element

Change-Id: I3d36bca6cd0194e1a4456bb51156117f70b96b13
2012-10-19 16:01:28 -07:00
Catrope 61b6c1ce86 Add parentOuterRange to selectNodes() output
This is the outer range of the parent of the node, if known. We'll need
this for change marking: when resizing a text node, for instance, we
need to mark its containing parent. This way we get the containing
parent's element's offset for free (selectNodes already tracks it in
currentFrame) rather than having to compute it with another traversal.

Change-Id: Ia335d8080ea9d414ab9f89b943e2ea0cd11d7df3
2012-10-19 15:28:26 -07:00
Trevor Parscal 54171d03b6 Merge "Do reference comparison in selectNodes() tests and fix test data" 2012-10-19 22:21:55 +00:00
Trevor Parscal 2aec6b04e8 Merge "Add missing var statement" 2012-10-19 22:20:46 +00:00
Catrope ef513244be Do reference comparison in selectNodes() tests and fix test data
Some tests were using the wrong node in the expected data, but because
only the summaries were compared, this would succeeed as long as the
type and length were equal (and paragraphs of length 1 are quite common
in our test data). Fixed equalNodeSelection() to compare each node by
reference as well as comparing the summaries. If one of the equality
tests fails, the summaries will still be displayed as expected/actual
data (even though they might be equal), and the message will  have
"(reference equality for selection[3].node)" appended to it.

This change broke the tests because a few test cases had bad data, fixed
those in this commit as well.

Change-Id: Iab420cf29d47f7368c8a9ce79f6309efae75685c
2012-10-19 13:56:46 -07:00
Catrope cc9c530690 Add ve.setProp()
Change-Id: I6f932917f8e6321e9c415900b70404406af96d5c
2012-10-19 11:22:12 -07:00
Catrope bfb7e6f40c Add missing var statement
Change-Id: I573e952c60550c29bf7958c221899b72a934fb0c
2012-10-19 11:06:46 -07:00
Christian Williams bab6ca6a60 (bug 41055) Fixing large content copy and paste from external source for Firefox/Windows
Change-Id: I7169566cca486eb5085922c5ac8d932c60a7dcbb
2012-10-18 15:59:55 -07:00
Inez Korczyński 6735a47dcb Fix for native deletion - it was breaking document (model and view) when deleting really fast (holding the key for example). This solution completely fix the problem, however it is not optimal - stop and start is called more often than should be.
Change-Id: Ied5b34f92056407311aa1e84fbff35943138987f
2012-10-18 13:22:20 -07:00
Trevor Parscal 7ee5245a2d Merge "Fix selectNodes() bug reported by Inez" 2012-10-17 23:24:43 +00:00
Catrope 937607893c Fix selectNodes() bug reported by Inez
For <p>1<br/>2</p>, selectNodes([2,2]) correctly returned the end of the
first text node, but selectNodes([4,4]) returned index 2 in the
paragraph (i.e. between the break node and the second text node). The
correct behavior is to return the start of the second text node, i.e.
the mirror image of the behavior for [2,2].

Fixed this by applying the startBetween/endBetween logic only if the
relevant adjacent node is wrapped (or if it's missing). In the code,
this is expressed as !(adjacent node present && adjacent node wrapped).

Change-Id: Ie3b7fdf1de38ee253a798a7a73bc89734f4ca4fa
2012-10-17 16:09:49 -07:00
Inez Korczyński 4b1b63d357 "Is there data?" a.k.a. Insert data only if there is a data to be inserted.
Change-Id: If5957c38668f4dedcba72fc79f9a273614c6dce3
2012-10-17 16:08:02 -07:00
Trevor Parscal 435d45cf9e Merge "Fix bug in ve.ce.BrancNode.setupSlugs. It was removing slugs from the DOM, but not from the internal (this.slugs) collection, so getSlugAtOffset was returning incorrect information." 2012-10-17 21:17:23 +00:00
Inez Korczyński 829b070330 Fix bug in ve.ce.BrancNode.setupSlugs. It was removing slugs from the DOM, but not from the internal (this.slugs) collection, so getSlugAtOffset was returning incorrect information.
Change-Id: I0307d2dfe5c62f992287532ef8925fead2899c58
2012-10-17 13:54:14 -07:00
Catrope 84e598953a Wrap inline elements properly
The HTML "1<br/>2" was being converted to a linmod that looked like
"<p>1</p><br></br><p>2</p>". This commit fixes the wrapping logic such
that the result is "<p>1<br></br>2</p>" instead. In general, inline
nodes (content nodes) should not interrupt the wrapping, but block nodes
should.

This creates a problem for alien nodes: normally, we determine whether an
alien node is a block alien or an inline alien based on context, but if
we're in wrapping mode we're unsure of the context. We can't tell the
difference between "1<tt>Foo</tt>2" (should be wrapped as one, because
tt is inline) and "1<figure></figure>2" (1 and 2 should be wrapped
separately, because figure is block) using context alone, so in these
cases (and ONLY in these cases) we look up whether the HTML tag in
question is an inline tag or a block tag and use that to decide.

Change-Id: I75e7f3da387dd401d9b93e09a21751951eccbb83
2012-10-17 13:50:29 -07:00
Christian Williams 156e56b47b Fixing location of ve.ce.CenterNode.js and adding comma between variable declarations
Change-Id: If54e314f47860ac30060bec6b3f5997ed3709e0b
2012-10-17 13:18:57 -07:00
Inez Korczyński 5c83742313 (Bug 41120) Missing coma. Who knows how it happened...
Change-Id: I4c0a65cc751bf378368df9f8b793f672fb7cca15
2012-10-17 12:48:11 -07:00
Trevor Parscal 5cd4222d9c Whitespace and comment cleanup for dm annotation classes
* Added comments to classes and methods
* Quieted a jshint warning
* Broke some long lines
* Replaced instances of "var\t" with "var "

Change-Id: I1d617ed9e5180f1a3dff42078fb5debb5d718407
2012-10-17 12:35:28 -07:00
Trevor Parscal 1c5ac9d502 Merge "Fix exception when deleting all text (Ctrl+A Backspace)" 2012-10-17 19:33:48 +00:00
Inez Korczyński 874adec1ac (Bug 41120) When getOffset is called for a slug offset there is no need to traverse DOM - we can simply just call getSlugAtOffset and use that information.
Change-Id: I46b21ca0d3ca11d72c77feeb884f7d92a201de36
2012-10-17 12:32:27 -07:00
Trevor Parscal 64442e03d8 Merge "Fix JS error in DocumentSynchronizer when adding to an empty document" 2012-10-17 19:28:58 +00:00
Trevor Parscal 020a04f3dc Merge "Get annotations from first character of a range" 2012-10-17 19:28:05 +00:00
Trevor Parscal a981d98b1e Merge "Fix path issues with missing files, inconsistent subset in demo, test & mediawiki." 2012-10-17 19:27:16 +00:00
Christian Williams 280b0a368e (bug 41092) Fixing cut
Surface was being accidentally locked when we actually want the surface to re-render.

Change-Id: I1d20faec8e55934e1fff7534c7d8cfe94d19031d
2012-10-16 23:33:28 -07:00
Christian Williams 7a2faf7daf Ignore backspace keypress
Firefox triggers a keypress event for backspace. We handle backspace in keydown, so this keypress event should be ignored.

Change-Id: I6a481dbd5df0cf4558a5f1975717ca809250ccda
2012-10-16 12:23:57 -07:00
Timo Tijhof edc5f38d4c Fix path issues with missing files, inconsistent subset in demo, test & mediawiki.
* CenterNode missing in ResourceLoader registry
* UI classes and rangy not in static test/index.html
* Transaction and TransactionProcessor listed twice

Added a maintenance script that generates the <script> and <link> tags for all
files in the same order everywhere.

Change-Id: I5d22d33769b4e356e8065d295505f6f9a8b0bea8
2012-10-16 10:03:26 -04:00
Christian Williams 177557808b (bug 33064) Ignore non-content keypresses
Ignore keypress handling for any keypress with e.which of 0.

Change-Id: Ifa8a562eb882b337bad466183849ba9871605653
2012-10-15 23:05:47 -07:00
Christian Williams 40cc89eb50 Get annotations from first character of a range
If you select some text and start typing, we will now remove the content in the range and new content will be annotated with the annotations from the first character in the deleted range. This is similar to other editors.

Change-Id: I46ced52665ab10f9b724dbb225df5687c18a4c3a
2012-10-15 17:39:28 -07:00
Catrope 0054cd2a57 Fix exception when deleting all text (Ctrl+A Backspace)
Exception was caused by passing -1 to getAnnotationsFromOffset(). So
check for -1 before passing it in; getNearestContentOffset() can
legitimately return -1 if there are no content offsets in the document,
which occurs when the document is empty.

I was originally going to change getNearestContentOffset(start - 1, -1)
to getRelativeContentOffset(start, -1), but Inez correctly pointed out
that that would have unwanted results when near an inline node.

Change-Id: Ife4b497b1c5fd04d411bb25cea99e6ea2abf146f
2012-10-15 15:03:08 -07:00
Catrope 91964a48d0 Fix JS error in DocumentSynchronizer when adding to an empty document
This was reproducible by blanking the entire document (Ctrl+A Delete),
then undoing that (Ctrl+Z). AFAIK that's the only way to trigger an
insertion on a document that is completely empty.

Change-Id: I22252d5972a413dff614880a90c4c6b22e79672d
2012-10-15 15:01:39 -07:00
Rob Moen 7db62daac7 Fix bold and italic key commands in surfaceView.
Change-Id: Iefc436a27285fd811b9d1ac2c684160fe7818a30
2012-10-15 14:47:40 -07:00
Inez Korczyński dac224e110 Added support for Ime in IE. In IE when starting IME sequence 'compositionStart' is called to late, but fortunatelty we can do all necessary job in handler for 'keyDown'.
Change-Id: Id6f15015c45afd81cf8e74d3e03f7fa21611862d
2012-10-14 12:28:06 -07:00
Catrope a64587e44f Merge "Reversed the default value of autoSelect in surface fragments" 2012-10-13 01:10:10 +00:00
Catrope a328a43373 Fix UI for annotation API changes
Change-Id: Ib8341436ba966628c93854a742d8b3a5b45a1d83
2012-10-12 17:53:42 -07:00
Trevor Parscal 6c3878be9e Added multiple name registration to ve.Factory
Also changed from using "type" to "name" to make it less specific and added a test to make sure it's working.

Change-Id: I150a7ab1a57b3df85b459dbc411c2eaefe08b5bb
2012-10-12 17:43:04 -07:00
Trevor Parscal 4fbf7308f7 Reversed the default value of autoSelect in surface fragments
Arguments with default truthy arguments are evil

Change-Id: I3fb972af1b8f52837497950281c537fe09eb7975
2012-10-12 17:34:15 -07:00
Rob Moen ab7c39cf79 Fix context icon in surfaceView
Change-Id: I742b6df25679827fd0e3096a58bb5291c5f4f77d
2012-10-12 17:18:32 -07:00
Catrope 405581f6b8 New annotation API: update tests
Change-Id: I301a1d89c33dd68197d629d187a9a5be8cbf3852
2012-10-12 15:07:28 -07:00
Catrope 8d56cadb82 New annotation API: ve.ce.TextNode integration
Finally getting rid of .annotationRenderers, yay!

Change-Id: I17cb2598de9747d1e3b68ff18ebb02efd56c04c3
2012-10-12 15:07:28 -07:00
Catrope 735ee449e3 New annotation API: ve.dm.Converter integration
The annotation-related code in the converter is greatly simplified
because the API itself takes care of almost everything already.

Change-Id: Ib48f52bad6b650a05dc4e7ef82db4158c19b3cf5
2012-10-12 15:07:28 -07:00
Catrope 613dd14332 New annotation API: convert existing annotations
This changes ve.dm.LinkAnnotation to be a generic annotation for <a>
tags, and adds ve.dm.MWInternalLinkAnnotation and
ve.dm.MWExternalLinkAnnotation as MW-specific subclasses. This nicely
splits out the MW-specific parts in LinkAnnotation, and ideally we'd
also move these files somewhere else to reflect their MW-specificity,
but I haven't gotten to that yet.

Similarly, ve.dm.TextStyleAnnotation is now a generic base class for
simple tag-only-no-metadata annotations, and it has 11 subclasses, one
for each tag we support. This is quite a bit more verbose than the
previous code, but I think it's cleaner and more flexible. I considered
writing a function that would generate a TextStyleAnnotation subclass,
then calling that 11 times, but that's not possible if we want to keep
named functions for the constructors.

Change-Id: Ifba10153eef40280e44025dd72d4e9d9f33b0632
2012-10-12 15:07:25 -07:00
Catrope 7fe7182f43 New annotation API: Annotation and AnnotationFactory classes
Fleshes out ve.dm.Annotation to a class. Annotations in the linear model
will be instances of a subclass of ve.dm.Annotation. Annotations are
defined by subclassing ve.dm.Annotation and registering this subclass
with ve.dm.AnnotationFactory.

ve.dm.AnnotationFactory keeps track of which annotation classes are known,
and has code to match an HTML element to an annotation class, for use in
the converter.

Change-Id: I68802bdb8736ced1f9e04ee49c623944b448141c
2012-10-12 15:07:02 -07:00
Catrope 9ca5da44ee Merge "Revert "No longer create zero-length text nodes"" 2012-10-12 18:04:22 +00:00
Catrope 0a6a2c7cd8 Revert "No longer create zero-length text nodes"
Inez asked for this to be merged but now says it's broken

This reverts commit 7702ec10dc
2012-10-12 18:04:15 +00:00
Inez Korczyński 3c69871f4a Refactored method ve.ce.Surface.handleInsertion. Now handling slug and insertion annotations is combined.
Change-Id: I70494c185addcf4d07d385dc1e9745aca2f9d05b
2012-10-11 16:32:32 -07:00
Trevor Parscal 55a31122b5 Merge "Support for pre-unannotating test" 2012-10-11 23:28:18 +00:00
Trevor Parscal e02a253e0e Merge "Native cursor movement" 2012-10-11 23:27:25 +00:00
Christian Williams 011069d17c Native cursor movement
The cursor will move natively when it can, allowing for word jumping with alt/ctrl keys. Special conditions exist for slugs and node boundaries that result in programatic movement.

Change-Id: Ife156bf94d8192ddd322c016ca8359855b17d7fc
2012-10-11 15:51:45 -07:00
Inez Korczyński a78719d7e4 Added missing call to surfaceObserver.clear();
Change-Id: I64eeeef8339d5765d5ce732e660eeba35482d7d3
2012-10-11 13:59:30 -07:00
Christian Williams 9719589e9a Support for pre-unannotating test
Removing check for insertAnnotations length because it's also important to know if we're pre-unannotating text.

Change-Id: I7fab39ca353d7656de3ce2985a821cb54384100e
2012-10-11 13:38:54 -07:00
Trevor Parscal f94063db12 Merge "Introduce new method in ve.ce.Surface called handleInsertion that is responsible for the magic around inserting content with new annotation, or in a slug, or with IME." 2012-10-11 19:43:18 +00:00
Trevor Parscal b3a90966f3 Merge "No longer create zero-length text nodes" 2012-10-11 19:42:52 +00:00
Inez Korczyński 4c08740794 Introduce new method in ve.ce.Surface called handleInsertion that is responsible for the magic around inserting content with new annotation, or in a slug, or with IME.
Change-Id: Ia558376d3e509d15a0746297a9dd29d09beec652
2012-10-11 12:06:17 -07:00
Trevor Parscal 2a1eb1394d Merge "Add ve.getProp()" 2012-10-11 18:26:31 +00:00
Trevor Parscal 5ad9b0c8a9 Merge "Support custom hashes in ve.getHash()" 2012-10-11 18:17:21 +00:00
Trevor Parscal 9b7f9cda42 Merge "Add ve.getOpeningHtmlTag()" 2012-10-11 18:16:55 +00:00
Trevor Parscal f72083f85c Merge "Add setDOMAttributes()" 2012-10-11 18:16:13 +00:00
Catrope a7a64abcf5 Add ve.getProp()
Change-Id: Iad9f53ae252acbeb2842645e6e66c0dfc7618f9f
2012-10-10 17:50:19 -07:00
Catrope b630b8a2a6 Support custom hashes in ve.getHash()
Change-Id: I9193472773b999b45ce850a609ad5fe141421dbf
2012-10-10 17:31:11 -07:00
Catrope 22c7f16b99 Add ve.getOpeningHtmlTag()
Utility function to generate an opening HTML tag. Needed to integrate
the new annotation API with ve.ce.TextNode

Change-Id: I6804bbf6f79346fde1887fa82d29ec5cd0342d60
2012-10-10 17:30:07 -07:00
Catrope 3f4c656275 Add setDOMAttributes()
Change-Id: I1406998400c4f7f3d0983a43e3f86afe4ffd29a6
2012-10-10 15:10:31 -07:00
Christian Williams f2d08f913b Added reversed boolean for translateOffset
Previously, Undo used a transaction's lengthDifference to calculate the selection to display after the transaction was undone. Now, translateOffset with the reversed boolean set to true will properly translate the inverse of a transaction's selection change. Fixes bug #40538

Change-Id: I110bc0cbb5824547842efd391b9f2948b037b758
2012-10-10 14:59:30 -07:00
Catrope 7702ec10dc No longer create zero-length text nodes
We were populating empty content nodes with zero-length text nodes to
make round-trip tests in the test suite work (otherwise blanking a
paragraph leaves behind a zero-length text node whereas creating an
empty paragraph does not), but the empty nodes are causing problems in
CE apparently.

* Do not create empty text nodes when constructing a node tree
* Be more careful with text-only replacements:
** Don't resize a text node to zero, remove it instead
** There may not be a text node to resize at all, build it in that case
** Switch nodeRange to nodeOuterRange, this was probably broken before

Tests:
* Change test case for zero-length text node to assert that there is
  *no* zero-length text node :)
* Remove a test case concerning an empty text node from the
  ve.ce.TextNode suite

Change-Id: Ie677457f2f0a7823a517ba3077b844ef52a20fcc
2012-10-10 14:48:47 -07:00
Timo Tijhof 07c86fc5d3 inheritClass: Implement inherited 'static' property for classes.
Previously tests for inheritClass (and other object management
utilities) were absent (as they were copied from upstream K-js).

I've copied the upstream test suite for this method here and
extended it with tests for this new feature.

Had to add es5:true to .jshintrc due to a bug in JSHint.
Repeated the setting in ve.inheritClass for future reference.

Source: https://github.com/Krinkle/K-js/blob/master/test/K.test.js

Change-Id: I63ac620d6ce7832ebfee454ddf7b7c90f6eb6121
2012-10-09 18:29:41 +00:00
Trevor Parscal bbb38c590e Merge "Add missing return in ve.getDOMAttributes()" 2012-10-09 18:21:35 +00:00
Trevor Parscal 87cb7045c1 Merge "Removing onKeyPress return statement" 2012-10-09 17:54:51 +00:00
Christian Williams 4e585eb092 Removing onKeyPress return statement
Also switched to using surfaceObserver and cleaned up some trailing whitespace.

Change-Id: If9a2b390e86f54b4c5ddfd499eefb31f0ab2c96f
2012-10-09 10:54:27 -07:00
Timo Tijhof 73851696f1 ve.Factory: No need for a-b-c workaround, createObject and apply.
This works just fine, as also previously tested/proven by
ve.cloneObject, which uses the same concept of creating an object
identical to what invoking the constructor with "new" would do,
but without invoking the constructor function (which has side-
effects).

Except in this case we do invoke the constructor function, but
we can't use new in ve.Factory because of the arbitrary number of
arguments.

Added a test to assert that 3+ arguments and that instanceof
work as expected.

Change-Id: If0add3da7475886e476900044acda2ba7d01fb11
2012-10-09 19:36:48 +02:00
Timo Tijhof a15b2f77f2 Fix constructor names; remove redundant hasOwnProperty.
Add some missing constructor names and rename the ones with a
lowercase 'v'.

I previously changed Object.create and others to using hasOwn,
but that turned out to be useless. The thought at the time was
to only use the native one if it really is a native one (and not
a polyfill from another script), however in then hasOwn is only
relevant on prototypes and when negated. For static members it
would be an own-property either way.

Follows-up:
* Id6783fcfc35a896db088ff424ff9faaabcaff716 (metanode)
* Iab763954fb8cf375900d7a9a92dec1c755d5407e (object-management)

Change-Id: Ia6ef597e5e5453277472dfc23f25d2878b68b7f6
2012-10-08 06:15:20 +02:00
Catrope ac4c259a19 Add missing return in ve.getDOMAttributes()
Change-Id: I659667a0424bf166cee95b743469e716ff11f3d9
2012-10-05 18:18:51 -07:00
Inez Korczyński 1ed7b3f96e Update ve.ce.Surface to call SurfaceObserver.stop/start/clear instead of stopPolling/startPolling/clearPollData.
Change-Id: I164599dd34304a3eaef285859a66428cf839accb
2012-10-05 14:57:42 -07:00
Catrope f434da5140 Merge "Changed method name to setAutoSelect to avoid collision" 2012-10-05 21:25:51 +00:00
Catrope ffc34ee15a Merge "Got tests working again" 2012-10-05 19:01:38 +00:00
Trevor Parscal 51ac385c98 Merge "Created QUnit tests for ve.Document.selectNodes method (mode "branches")" 2012-10-05 18:57:37 +00:00
Trevor Parscal da2d89ee3a Changed method name to setAutoSelect to avoid collision
Plus, this is more consistent with the rest of the method names

Change-Id: I713f1bfc28d22cc259ce5dba69ea053817fd43f8
2012-10-05 11:07:10 -07:00
Inez Korczyński 2d752fe60c Small clean-up in ve.ce.Surface constructor.
Change-Id: I679511cd0b22192213873ceca5d8410b56d5def9
2012-10-04 17:08:26 -07:00
Inez Korczyński 4ab9d112b7 Created QUnit tests for ve.Document.selectNodes method (mode "branches")
Change-Id: Iee243ffe1a71a23a3ad540421a0cbbb973433f58
2012-10-04 15:24:02 -07:00
Inez Korczyński b2295a2de3 Fix minor bug with incorrect usage of hasSlugAtOffset.
Change-Id: I413fc5850cd7bcae9b1d955eb951394e1ed9df36
2012-10-04 14:31:25 -07:00
Inez Korczyński 72eb2825e5 Start using ve.ce.SurfaceObserver inside ve.ce.Surface. Moved methods getOffsetOfSlug, getOffsetFromElementNode, getOffsetFromTextNode and getOffset to ve.ce.js and made them static.
Change-Id: If6ce0ae10c494392cc384341cc87b61658d4934a
2012-10-04 14:28:54 -07:00
Inez Korczyński c4299fd838 Retire ve.ce.Surface.render variable and instead of it use variable "locked" via methods lock(), unlock() and isLocked().
Change-Id: Ic476a51e9e7766bd2793c2a7d773734cf9bcd0b6
2012-10-04 14:26:06 -07:00
Inez Korczyński 3b8a5ae4d5 Initial import of ve.ce.SufaceObserver
Change-Id: Ifc14a6cc30e46c8ae99c59dcb916795c603329ed
2012-10-04 14:24:12 -07:00
Inez Korczyński 15b151ef58 Setup variable ve.debug to true when ve.debug.js is loaded.
Change-Id: I22309ddfda8271456665eb40c4b698c160061de4
2012-10-03 18:02:31 -07:00
Trevor Parscal 2c3142225f Got tests working again
I think what happened here is I added the skeleton code, Kranitor came through and removed the unused arguments, then I merged in my implementations without pulling, then pushed - git merged cleanly, the arguments I thought were there were not there, and tests broke.

Change-Id: I5aa2968fef164c774a10db83a6df1753c93cd2dc
2012-10-03 16:03:33 -07:00
Inez Korczyński 0b135ede31 Add 'branches' mode to ve.Document.selectNodes method. Tests TBD.
Change-Id: Id466b9452fd0b515831a2536ccc32caa339ee885
2012-10-03 15:55:54 -07:00
Inez Korczyński 714e29d30f Created method getSlugAtOffset in ve.ce.Document and ve.ce.BranchNode, refactored the way how slugs are added.
Change-Id: I8006c7e6e1dd3c640939bf08f39192615b2e5343
2012-10-03 15:40:44 -07:00
Trevor Parscal 58e37e78a9 Merge "Fix transaction bug with Roans help." 2012-10-03 17:56:33 +00:00
James D. Forrester 03c428155e Alter the target of the Feedback link to be the right page.
Specifically, go to [[mw:VisualEditor/Feedback]] rather than [[mw:Visual editor/
Feedback]], as the primary set of pages on MWwiki have been moved some time ago
and right now we're stranding users' feedback messages at the wrong place.

Change-Id: Ia2ba0dad7d1bf0d1633fe2704a2e8354285c66da
2012-10-02 15:41:18 -07:00
Rob Moen 3a48860602 Fix transaction bug with Roans help.
Fixes (Bug 40339)

Change-Id: Ice26bf08071cba5c5500aa9196ade169381a9aea
2012-10-01 16:31:16 -07:00
Trevor Parscal 1ab5fac1aa Merge "Using getRelativeContentOffset for insertAnnotations" 2012-10-01 21:27:54 +00:00
Trevor Parscal 57ec680d76 Merge "Add utility function to get DOM attributes as a plain object" 2012-10-01 21:27:21 +00:00
Krinkle 5ba4c9694d Merge "Added surface model lock and unlock events" 2012-10-01 21:25:08 +00:00
Trevor Parscal 903acdfdf2 Added surface model lock and unlock events
This allowed me to move ve.ce.Surface particulars (such as the starting, stopping and clearing of polling) out of the UI code.

Also cleaned up some switch statements.

Change-Id: I7b85e42a4e01f8d76237d995e25275f2424541ea
2012-10-01 14:23:11 -07:00
Catrope 7cc8096864 Add utility function to get DOM attributes as a plain object
Change-Id: I64abfb7479ae687f95e604f1df48dfe8439176ed
2012-10-01 14:14:52 -07:00
Christian Williams 75c154ef6c Using getRelativeContentOffset for insertAnnotations
Previously, we were looking one offset to the left to load the insertAnnotations. This would fail at the beginning of a document that began with a slug, and probably other cases too. Now using getRelativeContent offset.

Change-Id: I31b24e2ccfa9fda2ce7fb19d1221f8708a96083f
2012-10-01 13:43:27 -07:00
Trevor Parscal 4ae9096632 Merge "Make getDomText() return an empty string for slugs" 2012-10-01 20:06:26 +00:00
Robmoen 8815c3eae4 Merge "Throw an error for bad offsets in getNodeFromOffset()" 2012-10-01 18:46:36 +00:00
Catrope 40b60ebda8 Make getDomText() return an empty string for slugs
Slugs aren't represented in the model at all, but in the DOM they do
contain a single character (&nbsp; or &#xFEFF;), so we have to override
the return value of getDomText() to be empty.

Change-Id: Ic93cb694b0632bc81d8d0749149e4d739232ed48
2012-10-01 11:37:39 -07:00
Catrope 7ec1b8d76d Add exception to getAnnotationsFromOffset() for easier debugging
Change-Id: Ief1209267d2d6f91f8572e4fa15a49e886bc0a30
2012-10-01 11:30:53 -07:00
Catrope 9488a38cca Throw an error for bad offsets in getNodeFromOffset()
Will ease debugging of bug 40463

Change-Id: I3fbacb3e6e2f242c1584f51581d2b4e7c4bdd4dc
2012-10-01 11:25:31 -07:00
Robmoen ff6d0b4a31 Merge "Made save dialog float with toolbar" 2012-09-28 21:04:30 +00:00
Trevor Parscal bfeb0455d9 Added callout icon
Change-Id: I1641c91a2729ada40ccada6b85e9f0e46e1d0c21
2012-09-28 14:00:46 -07:00
Trevor Parscal 57599e1c95 Made save dialog float with toolbar
Change-Id: I6c66c3817669adcee6314c16fcf49ef1a8db7b65
2012-09-28 13:44:51 -07:00
Trevor Parscal 0cbec61b73 Merge "Create method ve.Range.isCollapsed() and added some tests for ve.Range class." 2012-09-28 20:35:16 +00:00
Inez Korczyński 15e0c13fa9 Create method ve.Range.isCollapsed() and added some tests for ve.Range class.
Change-Id: I866b00db196a768460b32766b82fbdf896a48fdd
2012-09-28 13:32:26 -07:00
Christian Williams ffefe63063 Insert Annotations
Change-Id: Ibc927730a668cdcea9c90fe4fc2cb3db4d20480e
2012-09-28 13:28:47 -07:00
Trevor Parscal 50ddba4d12 Really remove all, not just half
Iterating forwards while removing from an array is a good way to get half way there and be confused as hell.

Change-Id: I74db84eee87c73d8e035f6dc8a92be0d0b9b3dad
2012-09-28 12:17:04 -07:00
Trevor Parscal 5f0ccc807a Removed a single space.
Change-Id: Id4f96d980306e00b81a13441c38a3913ae312535
2012-09-27 11:57:50 -07:00
Robmoen 2737b0d0c8 Merge "Icon improvements" 2012-09-26 22:03:53 +00:00
Trevor Parscal 4c9b1d6035 Icon improvements
* Added some new icons (to be used soon in the inspector redesign)
* Added right-to-left icons for lists
* Renamed some icons for future RTL use

Change-Id: I10e3e3fcda82786e3064176e7eefe211b88db95c
2012-09-26 14:53:11 -07:00
Robmoen 6d03a58f21 Merge "Fixed ve.OrderedHashSet.filter" 2012-09-26 21:02:14 +00:00
Trevor Parscal b696e1e84b Fixed ve.OrderedHashSet.filter
Was cloning the original set, then adding to it - resulting in always containing the whole set in any match.

Also using test instead of exec since exec returns a string result, which under strange circumstances could return a falsy result, despite the RegExp finding a match.

Change-Id: I09a7cb264521d58f02d6ff2547edad9a740b23b2
2012-09-26 13:57:19 -07:00
Rob Moen 4613707909 re: AnnotationSet, fix JS error in getFirstLinkAnnotation.
Change-Id: I6a3cb4eb2164bf1c4c8f715e42117ac06cccac04
2012-09-24 17:16:10 -07:00
Catrope 5075d79c4b Merge "Regression fix, clearing only link annotations when creating link." 2012-09-24 22:06:00 +00:00
Rob Moen d5d44df053 Regression fix, clearing only link annotations when creating link.
Clearing only existing selected links when:
1) Creating a link
2) Pressing clear button

Change-Id: I4b1bcd9a3ac177b2f9b4af2d562d4c4fec09d5c5
2012-09-24 15:03:53 -07:00
Catrope 31fc2dc2b4 Merge "re: AnnotationSet, annotationButtonTool properly clears annotation." 2012-09-24 22:00:26 +00:00
Rob Moen 7be9f92de7 re: AnnotationSet, annotationButtonTool properly clears annotation.
Surface model annotate method previously cleared basic tool annotation objects.
Now that bold and other annotations have htmlAttributes from parsoid,
we must gather annotations by type from selection and iterate through
to properly clear.

Change-Id: Id53bf5733078524ae5aac376e01b9679eb8c32df
2012-09-24 14:58:55 -07:00
Krinkle a5a745de69 Merge "ve.dm.SurfaceFragment: Implement wrapNodes and wrapAllNodes" 2012-09-24 19:11:35 +00:00
Trevor Parscal eabe5e6f61 ve.dm.SurfaceFragment: Implement wrapNodes and wrapAllNodes
Change-Id: I378f0aad0286a6c90adeb4602a57d6617154e8b6
2012-09-24 21:11:16 +02:00
Krinkle db2c44ef2d Merge "Added CSS rules back in to put the menu above/below" 2012-09-24 01:56:26 +00:00
Trevor Parscal bee50ae84f Merge "Use inspector specific icon css files vs entire icon set css." 2012-09-21 22:49:01 +00:00
Krinkle 7b15b24496 Merge "Added missing annotation types to domElementTypes array" 2012-09-21 02:02:55 +00:00
Krinkle 717edd5ed4 Merge "Whitespace and comments" 2012-09-21 01:55:53 +00:00
Rob Moen ff1fc7ef08 Use inspector specific icon css files vs entire icon set css.
Change-Id: I9c519abc478ac22976a8d86aac461d90c92c8a57
2012-09-19 17:16:05 -07:00
Trevor Parscal 71f91dd92c Added CSS rules back in to put the menu above/below
Change-Id: I34d9031c04bed4944d2b3cd184fed021fc31d4a9
2012-09-19 12:37:06 -07:00
Trevor Parscal f2454bab68 Merge "Optimize UI tool state updates." 2012-09-19 19:34:29 +00:00
Rob Moen 96d97c2aa8 Optimize UI tool state updates.
Rather than each tool requesting annotations, and nodes pertaining to selection,
Emitted event supplies annotations and nodes to each tool's update method.

Using select vs. of traverseLeafNodes for code optimization.
Better documentation for updateTools()

Removed unneeded code.

Change-Id: I7c0baa1cc0f7fb731d6e28b175a76e931e9e2961
2012-09-19 11:16:10 -07:00
Trevor Parscal daa7e76807 Merge "Add a node type for meta nodes" 2012-09-18 18:15:46 +00:00
Trevor Parscal 944228aec7 Whitespace and comments
* Added documentation for ve.AnnotationSet
* Replaced uses of "// Inheritance" with "// parent Constructor"
* Added "// Mixin constructor" where needed
* Added missing section comments like "/* Static Methods */"
* Cleaned up excessive newlines (matching /\n\n\n/g)
* Put unnecessarily multi-line statements on a single line

Change-Id: I2c9b47ba296f7dd3c9cc2985581fbcefd6d76325
2012-09-17 16:53:03 -07:00
Trevor Parscal adda2b85c3 Merge "Documentation & clean up" 2012-09-17 23:21:49 +00:00
Timo Tijhof ab7d6bf082 Documentation & clean up
* Commands for Sublime:

  Find*: "(\* @[a-z]+) ([^{].*) \{(.*)\}"
  Replace: "$1 {$3} $2"

  Save all && Close all

  Find: " function("
  Replace: " function ("

  Save all && Close all

  Find: "Intialization"
  Replace: "Initialization"

  Save all && Close all

* Consistent use of types (documented in CODING.rm):
  - Merged {Integer} into {Number}.
  - Merged {DOM Node} into {DOMElement}.

* Remove work-around /*jshint newcap: false */ from ve.js
  Calling Object() as a function to to use the internal
  toObject no longer throws a newcap warning in JSHint.
  It only does that normal functions now .

  (e.g. var a = Cap(); or var a = new uncap();)

* Add missing annotations (@static, @method, ..).

* Remove unused variables

* Remove null-assignments to variables that should just be
  undefined. There's a few variables explicitly set to null
  whereas they are set a few lines under and not used otherwise
  (e.g. 'tx' in ve.ce.Surface.prototype.onPaste)

Change-Id: I0721a08f8ecd93c25595aedaa1aadb0e08b83799
2012-09-17 16:02:52 +02:00
Rob Moen df4391bc69 (bug 38548) Switch undo / redo buttons for RTL.
Rename the graphic files to more generic names to make them
flippable by CSSJanus.

Change-Id: Ide2540f2f281367909f7f2c7943c9106c0b36699
2012-09-16 08:39:18 -07:00
Krinkle 4edc76ab79 Merge "(Bug 33094) Disallow invalid page titles in LinkInspector." 2012-09-14 12:53:58 +00:00
Rob Moen 442a8358ea (Bug 33094) Disallow invalid page titles in LinkInspector.
Detecting page status in a similar way as WikiEditor inspector.
Disabled accept button now behaves appropriately.
Accept button status is now evaluated on enter or submit.

Change-Id: Ibfef6ffd87cb9a71e37242d6214d0f8e3af2e2c0
2012-09-14 14:51:26 +02:00
Siebrand ed66eb7a05 Merge "Revert "Added 'bytes' remaining to edit summary dialog."" 2012-09-11 20:57:39 +00:00
Siebrand a218baa8c9 Revert "Added 'bytes' remaining to edit summary dialog."
This reverts commit 75c0cdbd38
2012-09-11 20:57:21 +00:00
Reedy 4bff9bb2dc Merge "Added 'bytes' remaining to edit summary dialog." 2012-09-11 20:34:18 +00:00
Rob Moen 75c0cdbd38 Added 'bytes' remaining to edit summary dialog.
Addresses (Bug 40035)

Change-Id: Iad94ea32b62aef2e1875fa2709b6303b88c9c137
2012-09-11 12:34:19 -07:00
Trevor Parscal 80f266d582 Merge "Hiding inspector iframe by additionally setting height and width to 0." 2012-09-11 19:24:10 +00:00
Trevor Parscal c39c788105 Added missing annotation types to domElementTypes array
Change-Id: I595bce18c4a18397fdb7c91b4b033cad40e57008
2012-09-11 11:40:59 -07:00
Rob Moen 2e3821804f Pressing enter key in edit summary no longer submits save form.
Fixes (Bug 40034)

Change-Id: I5b1cca3dc97686982b8dde907c827dc6e031c312
2012-09-11 09:33:07 -07:00
Catrope 7b96fbe3d2 Add a node type for meta nodes
This node type represents <meta> or <link> (transparently, based on the
style attribute). I had to make two node types for this and hack the
toData conversion code directly into ve.dm.Converter, because we don't
have native support for node types that can be both inline and block.
(We should add this in the node API rewrite.)

The CE implementation renders a placeholder (with the same styles as an
alien node) right now. I'm not sure how nice that is, but it's better
than rendering raw <meta>/<link> tags.

This whole thing is a total pile of hacks to make VE deal with
<meta>/<link> tags until we have a proper node types API.

Change-Id: Id6783fcfc35a896db088ff424ff9faaabcaff716
2012-09-10 15:35:30 -07:00
Rob Moen 231f8b6a5d Hiding inspector iframe by additionally setting height and width to 0.
Addresses iframe bug regression

Change-Id: I498b793277fcfaeca15adffc9f33c31734dade93
2012-09-10 12:20:37 -07:00
Trevor Parscal 4cdce88b9a Merge "Fixed multiple bugs with Context Icon appearing when not relevant." 2012-09-07 23:12:31 +00:00
Rob Moen bcaab3332e Fixed multiple bugs with Context Icon appearing when not relevant.
Icon appears when scrolling and resizing window.
	Instead of always setting the context on scroll and resize, bind to the
	updateContextIcon method.
Icon appears when selecting a non content data offset.
	Changed logic to show icon changed to content length vs range difference.

Move Link inspector getSelectionText to ve.dm.document getText.
Rationale, more bits of the code depend on evaluating content.
Added new ve.Range truncate method.
Remove getSelectionText, using truncate range & document.getText instead.

Change-Id: Ibd3e99c923f18d2c96a86d92e74e2e9ebd49c85f
2012-09-07 16:12:14 -07:00
Catrope c6cb537f1a Fix bugs in whitespace preservation for aliens
This was broken in three different ways:
* On the way in, we were applying whitespace to an array of elements
  rather than the actual element, so the whitespace wasn't stored.
* Whitespace processing on the way out was skipped for aliens because
  they had their own code path. Refactored this so alien openings and
  regular openings share much more code, including whitespace output.
* Somewhat unrelatedly, innerPost output was broken for paragraphs
  containing inline elements, because the inline elements' processing
  polluted lastOuterPost. Discovered this because my test with inline
  aliens also happened to be the first test of whitespace preservation
  in paragraphs with inline content elements. Fixed by explicitly
  skipping content nodes when outputting whitespace.

Fixed these issues and added a test case.

Change-Id: I8edb61a008e60ace886b1a841b3417682ec39c32
2012-09-07 15:17:28 -07:00
Trevor Parscal 4659557fef Merge "(bug 39753) UI restores #toc as inline-block instead of table." 2012-09-07 22:01:44 +00:00
Catrope 74ed8e8766 Rename ve_foo_bar back to VeFooBar per discussion
Change-Id: Ibf6d4f08c4761727b2e3952a76e474c8221b38f9
2012-09-06 16:15:55 -07:00
Timo Tijhof 9fb43b6aeb (bug 39753) UI restores #toc as inline-block instead of table.
* Follows-up 656439240d

Change-Id: I57532e556eafe783c8638b25fce502a158597c97
2012-09-07 01:13:04 +02:00
Trevor Parscal e3375e8f23 Merge "Fix global scope leakage in the Transaction tests" 2012-09-06 22:51:55 +00:00
Catrope d43fffc2d2 Fix global scope leakage in the Transaction tests
Change-Id: I9283acb6179d0be84dadca8ad4e58d5cdd6e3bae
2012-09-06 15:47:33 -07:00
Catrope ef27a4b2b1 Fix order-of-annotation tests for hrefPrefix
Change-Id: I9fffad6cd0b186a070fec34fd0f827a5875a5d67
2012-09-06 15:40:41 -07:00
Timo Tijhof b1d9c83b5d Object management: Object create/inherit/clone utilities
* For the most common case:
  - replace ve.extendClass with ve.inheritClass (chose slightly
    different names to detect usage of the old/new one, and I
    like 'inherit' better).
  - move it up to below the constructor, see doc block for why.

* Cases where more than 2 arguments were passed to
  ve.extendClass are handled differently depending on the case.

  In case of a longer inheritance tree, the other arguments
  could be omitted (like in "ve.ce.FooBar, ve.FooBar,
  ve.Bar". ve.ce.FooBar only needs to inherit from ve.FooBar,
  because ve.ce.FooBar inherits from ve.Bar).

  In the case of where it previously had two mixins with
  ve.extendClass(), either one becomes inheritClass and one
  a mixin, both to mixinClass().

  No visible changes should come from this commit as the
  instances still all have the same visible properties in the
  end. No more or less than before.

* Misc.:
 - Be consistent in calling parent constructors in the
   same order as the inheritance.
 - Add missing @extends and @param documentation.
 - Replace invalid {Integer} type hint with {Number}.
 - Consistent doc comments order:
   @class, @abstract, @constructor, @extends, @params.
 - Fix indentation errors
   A fairly common mistake was a superfluous space before the
   identifier on the assignment line directly below the
   documentation comment.
   $ ack "^ [^*]" --js modules/ve
 - Typo "Inhertiance" -> "Inheritance".
 - Replacing the other confusing comment "Inheritance" (inside
   the constructor) with "Parent constructor".
 - Add missing @abstract for ve.ui.Tool.
 - Corrected ve.FormatDropdownTool to ve.ui.FormatDropdownTool.js
 - Add function names to all @constructor functions. Now that we
   have inheritance it is important and useful to have these
   functions not be anonymous.

   Example of debug shot: http://cl.ly/image/1j3c160w3D45

   Makes the difference between

   < documentNode;
   > ve_dm_DocumentNode
     ...
     : ve_dm_BranchNode
       ...
       : ve_dm_Node
         ...
         : ve_dm_Node
           ...
           : Object
             ...

   without names (current situation):

   < documentNode;
   > Object
     ...
     : Object
       ...
       : Object
         ...
         : Object
           ...
           : Object
             ...

   though before this commit, it really looks like this
   (flattened since ve.extendClass really did a mixin):

   < documentNode;
   > Object
     ...
     ...
     ...

   Pattern in Sublime (case-sensitive) to find nameless
   constructor functions:
   "^ve\..*\.([A-Z])([^\.]+) = function \("

Change-Id: Iab763954fb8cf375900d7a9a92dec1c755d5407e
2012-09-06 15:29:31 -07:00
Timo Tijhof 831f2f5cb1 Shared closure around utility functions in ve.js
In preparation of pushing the object-management branch, which
will need more shared variables (for efficiency) creating
a shared closure. To avoid a spegetti of immediately-invoked
functions that return functions (like ve.getObjectValues and
ve.getObjectKeys).

Less duplication of code and faster execution.

First I had the closure around it as-is but then I figured it'd
be faster to have a local reference to ve (instead of having to
go through implied globals for references to other ve.*)

So I made it a local variable and then exposed it. That way
anything inside referring to each other stays within the same
scope.

Review with ignore-whitespace for clarity.

Change-Id: I415d8635db6d82cf239f0364ccc2d63a61bd5a6d
2012-09-06 15:29:26 -07:00
Trevor Parscal 64209467df Merge "Alienate everything with an unrecognized mw: type." 2012-09-06 21:57:00 +00:00
Trevor Parscal c25e237620 Merge "Also add clone functionality, undefined guard and tests to ve.copyObject()" 2012-09-06 21:53:05 +00:00
Catrope debc429a9f Also add clone functionality, undefined guard and tests to ve.copyObject()
Change-Id: I84ca938cbedf93bfd1c73da16bf9d0d96b3bc749
2012-09-06 14:52:41 -07:00
Catrope 742a97b410 Add tests asserting ordering of annotations works
Change-Id: Iada85b95914a8728ca809ebab9a42723c1e7a02c
2012-09-06 14:43:13 -07:00
Catrope 5e7c14c868 Manage annotations in ve.AnnotationSet object
Introduced the ve.AnnotationSet class to manage sets of annotations. This
is a generalization of ve.OrderedHashSet, a class that manages a set
using an array and an object keyed by hash.

Converted everything that stores, tracks or passes around annotations to
use ve.AnnotationSet. In particular, this means the linear model now
contains AnnotationSets instead of hash-keyed objects.

This allows us to maintain the order of annotations in the linear model,
and will help fix bugs with annotation ordering and splitting.

Change-Id: I50975b0a95f4cc33017a0b59fdede9ed1eff0124
2012-09-06 14:39:38 -07:00
Trevor Parscal efa8a33559 Merge "Plug new vector icons / styles into inspector iframe." 2012-09-06 21:13:43 +00:00
Catrope e14d30f3cc Alienate everything with an unrecognized mw: type.
Currently this is done in a hacky way because we don't have a real
registry of RDFa types for node types, so we just hardcode the list of
recognized types (only links currently).

Change-Id: I5afcc55701fc6fa0ee2a360dcf5ca62b065292f5
2012-09-06 13:33:20 -07:00
Timo Tijhof d660d203ea (bug 39558) Implement byteLimit
* Also clean up ve.init.mw.ViewPageTarget...setupSaveDialog
  Consistently use viewPage instead of 'this' inside this
  function. The reason it is locally aliased is because there is
  other 'this'es used here. Using them mixed is even more
  confusing.
- No need for ve.bind, other handlers in this function also
  just use viewPage instead of binding this.

Change-Id: I25e93862a39134961bf80835f46cbf531d8109e0
2012-09-06 02:54:43 +02:00
Rob Moen 3331b16b3f Plug new vector icons / styles into inspector iframe.
Change-Id: Ibd5227de6b74c51f31093e64a4404d5830e84a4e
2012-09-05 17:15:20 -07:00
Trevor Parscal 1df15237fb Merge "Convert the last two uses of $.toJSON to ve.getHash" 2012-09-05 22:52:00 +00:00
Trevor Parscal 3e9eed623c Expanded isSomethingFishy function
No need to declare the function inline and then run the function 2x on the same data

Change-Id: I41c57f2aa6e38316edb54dd0c7ebb5726d83ebcf
2012-09-05 13:46:32 -07:00
Timo Tijhof 71020f7175 Remainder JSHint fixes on modules/ve/*
[jshint]
ce/ve.ce.Surface.js: line 670, col 9, Too many var statements.
ce/ve.ce.Surface.js: line 695, col 6, Missing semicolon.
ce/ve.ce.Surface.js: line 726, col 22, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 726, col 41, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 733, col 13, Too many var statements.
ce/ve.ce.Surface.js: line 734, col 24, Expected '===' and instead saw '=='.
ce/ve.ce.Surface.js: line 1013, col 13, Too many var statements.
ce/ve.ce.Surface.js: line 1019, col 17, Too many var statements.
ce/ve.ce.Surface.js: line 1023, col 18, Too many ar statements.
ce/ve.ce.Surface.js: line 1027, col 13, Too many var statements.
dm/annotations/ve.dm.LinkAnnotation.js: line 70, col 52, Insecure '.'.
dm/ve.dm.Converter.js: line 383, col 29, Empty block.
dm/ve.dm.Converter.js: line 423, col 33, Empty block.

Commands:
 * jshint .
 * ack '(if|else|function|switch|for|while)\('
 * Sublime Text 2:
   Find(*): (if|else|function|switch|for|while)\(
   Replace: $1 (
 * ack '  ' -Q # double spaces, except in certain comments

Change-Id: I8e34bf2924bc8688fdf8acef08bbc4f6707e93be
2012-09-05 13:45:09 -07:00
Rob Moen 67749504d2 Center Ellpisis for long page titles. Misc positioning fixes.
MultiSuggest:
Added CSS Ellipsis config option which provides CSS to suggestion items.

LinkInspector:
-Configured multiSuggest for page suggestions with CSS ellipsis off and removed CSS definitions.
Instead, using jquery.autoEllpisis plugin for centered position ellipsis. (Bug 39591)
-Temporary tweak to link input padding to prevent text from overlapping down arrow.
Down arrow soon to be implemented differently.

RTL Fixes:
-MultiSuggest overlay positions correctly by setting a width.
-MultiSuggest background image position fix.

Change-Id: I806ead5a2c2621589f76cfb2b03805cbd0b0a18a
2012-09-05 13:21:29 -07:00
Krinkle 5af7cfbd4d Merge "Improved icons" 2012-09-05 18:11:36 +00:00
Krinkle 193b70f36d Merge "Fix error in ve.copyArray() and add tests" 2012-09-04 22:26:24 +00:00
Catrope da1d0d4391 Fix error in ve.copyArray() and add tests
Change-Id: I05e7971d05dfa3118db97d76f51985f64d994d8b
2012-09-05 00:26:10 +02:00
Timo Tijhof 24590a9702 ve.dm.Converter.test: Add hrefPrefix (follows-up I33eab356)
* Tests were failing since I33eab356.

Change-Id: I1fed0e3e21ea379a583ccd4f611212940264d106
2012-09-03 03:07:24 +02:00
Trevor Parscal bc211d34e0 Merge "Preserve the leading ./ and ../ in internal link hrefs" 2012-08-31 22:22:02 +00:00
Catrope 78359c35ac Preserve the leading ./ and ../ in internal link hrefs
Previously we were just discarding them, but that causes round-trip
issues with Parsoid

Change-Id: I33eab356d77acb3c13dc9da94f773915464ef690
2012-08-31 15:07:35 -07:00
Trevor Parscal b370bbd0bc Improved icons
* Moved icons into Illustrator (used to be in Photoshop)
* Added SVG icons too
* Added support for devices with pixel ratio > 1 (they use SVG)
* Cleaned up icons (little rendering errors here and there)
* Organized icons into their own folder
* Increased the horizontal margin of the down arrows in the formatting (in the toolbar) and location (in the link inspector) drop down menus

Change-Id: I29b7084c9b1145051b2a76f514cfca9826d53ddb
2012-08-31 13:23:04 -07:00
Catrope 2d36ce9465 Convert the last two uses of $.toJSON to ve.getHash
Change-Id: Iff033590a6033a8de88dc571481442a819146c90
2012-08-30 17:29:54 -07:00
Catrope 3ece6e825d Also copy cloneable objects in ve.copyArray()
Change-Id: I572afc282557bab059df0b2a4fd0347336531409
2012-08-30 17:09:00 -07:00
Trevor Parscal f26ae1662b Added tests for removeContent and insertContent
Also fixed the arguments given to insertContent and double-translating the range

Change-Id: I7cb7dcfcee1c88f2052c63e31a0ed37eaaf645ab
2012-08-30 16:55:49 -07:00
Catrope 4fbabd16dd Make translateRange() map the offset immediately before an insertion to after the insertion rather than before
This will cause ve.dm.SurfaceFragment.prototype.insertContent() to place
the selection after the insertion as well.

Change-Id: Ifa7e627daceb90408422eb58c110d475f34ba1e2
2012-08-30 15:26:43 -07:00
Trevor Parscal d208ca9002 Cleaned up uses of jQuery to create and appendTo/prependTo
* Separated DOM changes from creation of elements
* Always using parsing for element creation with known attributes
* Always using attr or addClass for variable attributes

Change-Id: Id101f56594014786892d382d06c658f416224a9c
2012-08-29 18:43:48 +02:00
Trevor Parscal a52d7ff65a Finally getting rid of all the es-* stuff and other cruft
* Switched a lot of classes from es-* to ve-ui-*
* Removed all the DOM structure left over from the old sandbox demo
* Got rid of transparent backgrounds
* Added menu font-size rule to stand-alone target
* Moved some rules around that were in the wrong places
* Got rid of some unused/unneeded methods in the mw target (attach and detach surface methods)
* Added active class to context icon with shallower shadow effect so it doesn't break your spacial perception when you click on it
* Renamed the iframe and iframe wrapper elements so it's easier to see where they came from
* Removed unused CSS rules
* Fixed some uses of prop( 'class', … ) to addClass

Change-Id: I54a660ca0baf0baa4463faca7a1edcf648130b6b
2012-08-28 13:59:35 -07:00
Trevor Parscal ab1f849ad5 Fixed position and size of toolbar in Apex skin
Change-Id: I520eb03a6b000c70d3b4892b25eeda7e43f85897
2012-08-28 13:13:37 -07:00
Krinkle 26ddaa2959 Merge "A bit of cleanup in the inspector and suggestion code" 2012-08-27 23:45:33 +00:00
Trevor Parscal a8166fe5a4 A bit of cleanup in the inspector and suggestion code
* function() -> function ()
* ){ -> ) {
* Quoted JSON keys (Look the other way Timo!)
* Using more descriptive group names, which also avoid using "new" as a key
* Line breaks at 100 columns using 4 spaces/tab
* Not setting classes on suggestion items that have no effect (such as 'external' on a div - even on an <a> tag this isn't enough to get the style because it's not inside #content)

Change-Id: I37032fa8ba93adb7b719d9797f9b1b806359cc13
2012-08-27 16:39:08 -07:00
Trevor Parscal 19b95af9dd Merge "Catching transactions that were not being committed." 2012-08-27 20:09:15 +00:00
Trevor Parscal 52859f5e27 Merge "Move caching mechanism out of multiSuggest plugin to linkInspector" 2012-08-27 19:58:04 +00:00
Trevor Parscal 495796a99e Merge "Refactor ve.getHash: Stabilize cross-browser differences; + unit tests" 2012-08-27 18:02:07 +00:00
Timo Tijhof c8ed44fb07 Refactor ve.getHash: Stabilize cross-browser differences; + unit tests
* Replaces c8b4a28936

* Use Object() casting to detect objects instead of .constructor
  (or instanceof). Both .constructor and instanceof compare by reference
  the type "Object" which means if the object comes from another window
  (where there is a different "Object" and "Object.prototype") it will
  drop out of the system and go freewack.

  Theory: If a variable casted to an object returns true when strictly compared
  to the original, the input must be an object.

  Which is true. It doesn't change the inheritance, it doesn't make it inherit
  from this window's Object if the object is from another window's object. All it
  does is cast to an object if not an object already.
  So e.g. "Object(5) !== 5" because 5 is a primitive value as opposed to an instance
  of Number.
  And contrary to "typeof", it doesn't return true for "null".

* .constructor also has the problem that it only works this way if the
  input is a plain object. e.g. a simple construtor function that creates
  an object also get in the wrong side of the if/else case since it is
  an instance of Object, but not directly (rather indirectly via another
  constructor).

* Added unit tests for basic getHash usage, as well as regression tests
  against the above two mentioned problems (these tests fail before this commit).

* While at it, also improved other utilities a bit.
 - Use hasOwnProperty instead of casting to boolean
   when checking for presence of native support.
   Thanks to Douglas Crockford for that tip.
 - Fix documentation for ve.getHash: Parameter is not named "obj".
 - Add Object-check to ve.getObjectKeys per ES5 Object.keys spec (to match native behavior)
 - Add Object-check to ve.getObjectValues to match ve.getObjectKeys
 - Improved performance of ve.getObjectKeys shim. Tried several potential optimizations
   and compared with jsperf. Using a "static" reference to hasOwn improves performance
   (by not having to look it up 4 scopes up and 3 property levels deep).
   Also using [.length] instead of .push() shared off a few ms.
 - Added unit tests for ve.getObjectValues

Change-Id: If24d09405321f201c67f7df75d332bb1171c8a36
2012-08-27 00:14:02 +02:00
Amir E. Aharoni 47d1704b2b Added a comment about possible i18n messages
For easier grepping, according to
https://www.mediawiki.org/wiki/L10n#Using_messages

Change-Id: Ib766fd9c10ddbe9fd16ccec9b9866457117b3e70
2012-08-25 14:20:33 +03:00
Christian Williams ac7376c8d6 Catching transactions that were not being committed.
Change-Id: Ic75b07f279e4db30f6730f10b31c66d506cb94e8
2012-08-24 15:10:29 -07:00
Rob Moen 986d25eea1 Move caching mechanism out of multiSuggest plugin to linkInspector
Fixed issue where overlay would be incorrectly positioned if built
from previous caching method.

Change-Id: Id7c3ba211d5344292da47917a9bd06654823ee87
2012-08-24 14:04:33 -07:00
Catrope 452c759914 Preserve whitespace between elements
This commit fully utilizes all four positions in the internal.whitespace
array. Outer whitespace is now preserved as well, and is duplicated
either in the adjacent sibling (one node's outerPost is the next
sibling's outerPre) or in the parent (a branch node's innerPre is its
first child's outerPre, and its innerPost is its last child's
outerPost). Before restoring saved whitespace, we check that these two
agree with each other, and if they disagree we assume the user has been
moving stuff around and don't restore any whitespace in that spot. The
whitespace at the very beginning and the very end of the document (i.e.
the first node's outerPre and the last node's outerPost) isn't
duplicated anywhere, nor is inner whitespace in content nodes.

The basic outline of the implementation is:
* When we encounter whitespace, strip it and store it in the previous
  node's outerPost. Also store it in nextWhitespace so we can put it in
  the next node's outerPre once we encounter that node.
* When we encounter whitespace in wrapped bare text, we don't know in
  advance if it's gonna be succeeded by more non-whitespace (in which
  case it needs to be output verbatim), or not (in which case it's
  leading whitespace and needs to be stripped and stored). The fact that
  annotations are nodes in HTML makes this trickier. So we write the
  whitespace to the temporary linmod and store it in wrappedWhitespace,
  then if it turns out to be trailing whitespace we take it back out of
  the data array and record it the usual way.
* Because text nodes can contain any combination of leading whitespace
  actual text and trailing whitespace, and because we may or may not
  already have opened a wrapping paragraph, there are a lot of different
  combinations to handle. We handle all of them but the resulting code
  is pretty dense and verbose.

More low-level list of changes:

In getDataFromDom():
* Added helper function addWhitespace() for storing whitespace for an
  element
* Added helper function processNextWhitespace() for processing any
  whitespace passed on from the previous node via the nextWhitespace var
* Rename paragraph to wrappingParagraph. Make wrapping default to
  alreadyWrapped so we can simplify wrapping||alreadyWrapped and
  !wrapping&&!alreadyWrapped. Add wrappingIsOurs to track whether the
  wrapping originated in this recursion level (needed for deciding when
  to close the wrapper).
* Add prevElement to track the previous element so we can propagate
  whitespace to it, and nextWhitespace so we can propagate whitespace to
  the next element.
* Remove previous newline stripping hacks
* Integrate the logic for wrapping bare content with the outer
  whitespace preservation code
* Remove wrapperElement, no longer needed because we have a dedicated
  variable for the wrapping paragraph now and what was previously inner
  whitespace preservation for wrapper paragraphs is now covered by the
  outer whitespace preservation code.

In getDomFromData():
* Reinsert whitespace where appropriate
** outerPre is inserted when opening the element
** This covers outerPost as well except for the last child's outerPost,
   which is handled as the parent's innerPost when closing the parent.
** innerPre and innerPost are inserted when closing the element. Care is
   taken not to insert these if they're duplicates of something else.
* Propagate each node's outerPost to the next node (either the next
  sibling or the parent) using parentDomElement.lastOuterPost. We can't
  get this using .lastChild because we will have destroyed that child's
  .veInternal by then, and we can't tell whether a node will be its
  parent's last child when we process it (all other processing,
  including first child handling is done when processing the node itself,
  but this cannot be).
* Special handling is needed for the last node's outerPost, which ends
  up in the container's .lastOuterPost property.

Tests:
* Allow .html to be null in data<->DOM converter tests. This indicates
  that the test is a one-way data->DOM test, not a DOM->data->DOM
  round-trip test. The data will be converted to HTML and checked
  against .normalizedHtml
* Update existing tests as needed
* Add tests for outer whitespace preservation and storage
* Add test for squashing of whitespace in case of disagreement (this
  requires .html=null)

Change-Id: I4db4fe372a421182e80a2535657af7784ff15f95
2012-08-23 19:08:00 -07:00
Catrope 53b8bcbd61 Merge "Bug 37904 - Show info in title of link tags" 2012-08-23 22:49:46 +00:00
Trevor Parscal ccc2248aa8 Bug 37904 - Show info in title of link tags
Internal links use the title, other links use the href

Change-Id: I1a1cfd70c222dd1d686b46cd702edf2e9d0e5bae
2012-08-23 15:21:20 -07:00
Trevor Parscal a06d8fdf21 Merge "Also strip ./ in addition to ../" 2012-08-23 22:02:22 +00:00
Christian Williams c011a5c08f Fixing enter to leave list
Pressing enter in an empty last list item should remove the list item and add a paragraph. Transaction was not being committed.

Change-Id: I0b173125d48f629eab923e051648d2036bb8956c
2012-08-23 14:34:36 -07:00
Catrope 3ed257a5d6 Also strip ./ in addition to ../
This is necessary because Parsoid is now prefixing all hrefs with ./

Change-Id: I18c4b7470cfa1dd174e25cc921bf7d4daf5ffc55
2012-08-23 14:29:43 -07:00
Catrope 8c0249bb89 Merge "Bug 37821 - Add support for oldid" 2012-08-23 21:18:37 +00:00
Inez Korczynski 06a5e30c72 Fix for method of retrieving anchor node in ve.ce.BranchNode.onSplice method.
In current implementation ve.ce.TextNode can be represented by more then one DOM node (TEXT_NODE and or ELEMENT_NODE) - for instance "Lorem <b>Ipsum</b> est" (TEXT, ELEMENT, TEXT).

Change-Id: I6530cbf1273ad1b1de3599c3eb929eb7abc2d59e
2012-08-23 13:34:09 -07:00
Trevor Parscal 5ee75fbbfd Merge "Set inspector container height and width to 0 on close." 2012-08-23 19:04:33 +00:00
Trevor Parscal fb09872781 Bug 37821 - Add support for oldid
* Added oldid param to the API
* Added oldId argument to ve.init.mw.ViewPageTarget
* Added redirect when saving an oldid page (which adds a new revision)
* Added venotify param to allow notifications even when redirected
* Added creation notification
* Added page title to saved/created notification

Change-Id: I9e957e6f5bc7920093481ffe3c33e299f87ce50a
2012-08-23 12:03:40 -07:00
Rob Moen f8a43c8776 Set inspector container height and width to 0 on close.
Addresses (Bug 38655)

Change-Id: I93076314bab521fdbc16c5441de4496c4d0b04de
2012-08-23 11:41:42 -07:00
Catrope 337b059e84 Merge "Cleaned up some CSS in ve.ui.Surface.css" 2012-08-23 18:05:19 +00:00
Trevor Parscal c6b1011931 Cleaned up some CSS in ve.ui.Surface.css
Got rid of some commented out code we aren't going to use and fixed the order of arguments to background position to x, y

Change-Id: I4e638c33b053dd916681dc91c8c0d7cff224375d
2012-08-23 11:02:31 -07:00
Trevor Parscal 9c782b29b3 Added monobook support
* Added style for monobook
* Added monobook to whitelisted skins
* Made ve.init.mw.ViewPageTarget resilliant to vector and monobook-like skins

Change-Id: Ia39e034229204ae5f1f70dce5d74c6c4db42277b
2012-08-23 11:01:20 -07:00
Catrope f948c359eb Merge "Bug 38902 - Error on onbeforunload" 2012-08-23 17:39:44 +00:00
Catrope 85d8d1cfa6 Merge "Bug 38857 - UserAgent blacklisting" 2012-08-23 17:31:06 +00:00
Trevor Parscal 9cbc2b0fb2 Bug 38902 - Error on onbeforunload
Just had to make sure the surface was still around before using it.

Change-Id: I13a2f02d256937b7da3aca3ad3c3404bd8f31244
2012-08-22 14:44:03 -07:00
Trevor Parscal b360437243 Bug 38857 - UserAgent blacklisting
Add ?vewhitelist to the URL to override this - useful when testing in a blacklisted browser.

Blacklist:
- msie < 9
- firefox < 11
- safari < 5
- chrome < 19
- opera *
- netscape *
- blackberry *

Change-Id: I6ebb3f7a7d56d395e5fe5c7c9129b606f97aeaab
2012-08-22 14:31:45 -07:00
Trevor Parscal 37b0b9a2f2 Bug 33175 - Copy dir and lang from #mw-content-text div to document
This resolves the content direction issues identified in bug 33175

Change-Id: Iaf61fb9e8ad0ba3ab70ffa00c75da4c6f01aad61
2012-08-22 14:01:38 -07:00
Catrope aae793537c Merge "Support for <center> tag" 2012-08-22 19:54:39 +00:00
Inez Korczynski 844df5c8e6 Support for <center> tag
Change-Id: I0d64561dd82b8377ee7491103e81569eaca22fee
2012-08-22 12:51:33 -07:00
Trevor Parscal d1a0d2f946 Merge "Fixing ve.log and ve.dir for IE" 2012-08-22 18:20:01 +00:00
Catrope 31fdb1044b Fix syntax error in 9d7f4e94b5
Change-Id: Ia063de19bf54cb32d4a72304f3289c6c7fa669ca
2012-08-22 11:14:23 -07:00
Catrope 31bf0ea1f8 Merge "Fix ve.ce.getDomText to work with <br/> tags by making it skip not contenteditable=false but all leaf nodes." 2012-08-22 18:09:30 +00:00
Inez Korczynski 9920fb0725 Fix ve.ce.getDomText to work with <br/> tags by making it skip not contenteditable=false but all leaf nodes.
Change-Id: I9e728e091a3021840dac07e9601fc764e7750c49
2012-08-22 11:08:11 -07:00
Catrope 487a64c3f0 Merge "Floating toolbar fixes" 2012-08-22 18:07:23 +00:00
Christian Williams 2ad6577713 Fixing ve.log and ve.dir for IE
Change-Id: Ieee1aec3e6ea45f3eecdea53e3691ebe19306a33
2012-08-22 11:04:10 -07:00
Trevor Parscal 3216c2df50 Merge "IE triggers keyPress for Esc. We should not delete selected text when this keyPress happens." 2012-08-22 17:48:27 +00:00
Trevor Parscal 43e8403273 Merge "Context module cleanup." 2012-08-22 17:42:53 +00:00
Rob Moen 8e5b7fc5ce Context module cleanup.
-Changed es class prefixes to ve.

-Organized Context & Inspector construction.

-Updated comments & Whitespace.

Change-Id: I4a387621e5147e72d3869ff46eef4790091442c0
2012-08-22 10:42:15 -07:00
Trevor Parscal 15791bef8b Merge "Remove references to data-mw-gc" 2012-08-21 21:49:32 +00:00
Inez Korczynski 36b733b716 Fix grammar.
Change-Id: Iceee6e5bf5956eb6e8917c7537207fd3fb43d103
2012-08-20 17:51:52 -07:00
Inez Korczynski 053d5ffa5f Fix transact event handle in ve.dm.SurfaceFragment to handle array of transactions being passed as the argument (instead of just one transaction as it was before).
Change-Id: Ic8f26424594cbd4a89da7e4eefb825977f440786
2012-08-20 17:49:16 -07:00
Catrope dfd78cb121 Remove references to data-mw-gc
data-mw-gc is ancient and unused. We do need to detect and alienate
generated nodes, but that is now based on RDFa types. Removing the
data-mw-gc stuff for now because it doesn't work anyway, will replace it
with proper detection later.

Replaced instances of data-mw-gc in the test suite with unregistered
node types.

Change-Id: If3f5898d382a436fa57929013264c53af5e840ba
2012-08-20 17:44:55 -07:00
Christian Williams 9d7f4e94b5 IE triggers keyPress for Esc. We should not delete selected text when this keyPress happens.
Change-Id: I8028ba960d7e7ea15e56701850cd214bacc6a232
2012-08-20 17:39:33 -07:00
Trevor Parscal 59815c2548 Merge "(bug 39512) Fix regression in I277ad5fe3f64e07c1bbf49007d6bbaecc90b7466" 2012-08-20 22:44:32 +00:00
Trevor Parscal ceb8ac9918 Floating toolbar fixes
* Added more support for making dynamic skin changes in vector (based on media queries) get applied to the toolbar while it's floating
** Added animation for toolbar wrapper margins
** Added resize handler to update left and right positions on the toolbar when it's floated
 * Changed from using generic "float" and "bottom" class names which are likely going to get re-used elsewhere and cause issues

Change-Id: Ic596b2b8aceb8a2d81539e197ef4d6e17326a87a
2012-08-20 15:43:47 -07:00
Catrope 1a85b48c87 (bug 39512) Fix regression in I277ad5fe3f64e07c1bbf49007d6bbaecc90b7466
.childNodes is live, so iterating over it ends up skipping every other
child

Change-Id: I54ac480eca8e7ed36d299d68670a97ff176f3ebd
2012-08-20 15:18:41 -07:00
Trevor Parscal 7576c0fa5f Some basic link inspector style changes
Some of the HTML structure in the suggestions might need to be changed to pull off pixel-perfect reproduction of the original design, but this gets us very close.

Change-Id: Ie574577af4815e4f0fc9f8a03e57759dd9dfff84
2012-08-20 12:32:42 -07:00
Trevor Parscal fcf4e53f14 Merge "Fix JS error about out-of-bounds selection setting" 2012-08-20 17:01:15 +00:00
Trevor Parscal 1a57e1a361 Merge "Handle uneditable nodes in ve.ce.getDomText()" 2012-08-20 16:58:13 +00:00
Reedy 7c46bf77b8 Losslessly compress png images
Change-Id: Ie0b52dcb75157a35468a1cf208f85a5adc5fc98e
2012-08-18 23:12:44 +01:00
Trevor Parscal 277b0dce58 Merge "Switching proxy to bind" 2012-08-18 00:29:02 +00:00
Christian Williams 0790a3b470 Switching proxy to bind
This enables keyboard combos like alt-backspace and control-delete

Change-Id: I9a191977ae4ec824a9778a875e8abb706fc96a84
2012-08-17 17:27:38 -07:00
Catrope 2f31681922 Handle uneditable nodes in ve.ce.getDomText()
There is a TODO about this but these were never handled. This lack of
handling caused weird offset issues when editing paragraphs containing
inline aliens, because the text of the inline alien was returned.
Instead, return an appropriate number of characters so the offset logic
keeps working.

Removed the textContent||innerText code because it would bypass the
uneditable node logic: paragraphNode.textContent would return the text
of the entire paragraph (including any aliens), and we'd never descend
into the paragraph to reach the alien node.

Change-Id: Ia05755755dd5380cb9a0b5a0334c6721b4e0d3b7
2012-08-17 17:21:15 -07:00
Catrope 961d5e77ac Fix JS error about out-of-bounds selection setting
Don't try to restore the selection after the removal part of
onContentChange, because the removal may have caused that selection to
now be out of bounds. We also don't need to set the selection there at
all, because the insertion does it anyway (where it is safe).

Change-Id: I7b340b18dd8efc77d1df78007161720c29866cb6
2012-08-17 17:19:00 -07:00
Trevor Parscal 32a67dc762 Merge "Multiple Transactions" 2012-08-18 00:17:39 +00:00