Commit graph

2662 commits

Author SHA1 Message Date
Trevor Parscal 363961a9e2 Node cleanup
ve.Node.js
* Removed unused emitUpdate property
* Made traverseUpstream a dynamic method rather than static

ve.ce.Node.js, ve.ce.Surface.js
* Updated calls to traverseUpstream

Change-Id: I28a2dac61aa32668d35854fbdb7712401c42336a
2013-02-01 15:35:48 -08:00
jenkins-bot 7155bcea16 Merge "i18n icons" 2013-02-01 23:34:15 +00:00
Trevor Parscal f49d80d27a i18n icons
Graphics (*.ai, *.png, *.svg)
* Took a pass on all images making them sharper and clearer
* Renamed bold and italic to bold-b and bold-a
* Added bold-f, italic-k, bold-a and italic-a
* Reorganized illustrator file

ve.ui.Icons-raster.css, ve.ui.Icons-vector.css
* Added classes for new icons
* Appended bullet, number, indent and outdent class names with "list"

ve.ui.*ButtonTool.js
* Added definitions for static icon property
* For bold and italic, added i18n style definitions

ve.ui.ButtonTool.js
* Switched from re-using the name property (which is intended to be the symbolic name of the tool used when registering with the tool factory) to using an static icon property for defining the icon

Change-Id: I43e7c35835a1e6dfb06f2a70226fac0d395008e8
2013-02-01 15:29:18 -08:00
Catrope 46957736a4 Remove trailing commas
JSHint doesn't detect this (this is an open bug against jshint), but
Eclipse does

Change-Id: Iebfc0f9c6263f60898739c9d19400357a65da0e9
2013-02-01 14:45:35 -08:00
Catrope a97f777685 Introduce context object in getDataFromDom()
* Introduce context object as specified for
  ve.dm.Node.static.toDataElement()
* Remove wrapping variable in favor of context.wrapping
* Remove wrappingIsOurs in favor of context.canCloseWrapper
* Introduce originallyExpectingContent and use it to repopulate
  context.expectingContent after closing a wrapper
* Replace most uses of branchHasContent with context.expectingContent
** Except for two cases where we need originallyExpectingContent

These changes fix a case where a metaBlock was generated in an inline
position. Updated the tests to reflect this.

Change-Id: I6baf6053f8a3a0b7d91487f812b9235a7b2b3db1
2013-01-31 15:00:00 -08:00
Catrope 1927330352 Use AnnotationSet rather than array in getDataFromDom()
Change-Id: Ie5f1f94bd62739ccf74c027dd0ba418fe2d91fa6
2013-01-31 15:00:00 -08:00
Catrope e083afb029 Hybrid-ify MetaBlock/MetaInline
Change-Id: I7b7a2d50637e2009742b290cb1bd0f4fc0395934
2013-01-31 15:00:00 -08:00
Catrope c0690634ee Hybrid-ify AlienBlock/AlienInline
Change-Id: Ieda8383c0c04df208f4c5f2aa7380427467049b7
2013-01-31 14:59:59 -08:00
Catrope ac6c9b2418 Specify (but do not implement) the context parameter to toDataElement()
This allows the converter to provide the node handlers with context
information, which hybrid nodes (such as alien and meta) need to decide
which shape to take.

Change-Id: I36860bee560a38ee39a149109be3706e39258edc
2013-01-31 14:59:59 -08:00
Trevor Parscal 100e67c128 Fixed documentation warning
Please use backtick (it's to the left of the 1 key) around HTML elements in comments.

Change-Id: I473e88a2cb1f7fb725f21cd0e8b3f659189c15a0
2013-01-30 12:52:03 -08:00
Catrope 36d99ad901 Add Iceweasel to supported browsers list
Depends on https://gerrit.wikimedia.org/r/46666

Change-Id: I1192ce6687ba69504d0c4be484e479ddebedbc87
2013-01-29 17:53:09 -08:00
jenkins-bot 602d01e461 Merge "Added tests and fixed inconsistencies for empty text node handling" 2013-01-29 23:16:30 +00:00
jenkins-bot 9bf5eb5b5b Merge "Added support for passing data into annotation constructors" 2013-01-29 23:15:21 +00:00
Trevor Parscal 16310f7535 Added tests and fixed inconsistencies for empty text node handling
Continues where Ibb682332a6084e357104183641a104e3ae1e253f left off, adding tests and removing inconsistencies between the behavior of the document constructor, which was adding empty text nodes to empty paragraphs, and correcting other tests which expected empty text nodes to be there as well.

Change-Id: I414d061cdd494b8023f14e944eda2910a4dab0d4
2013-01-29 15:13:17 -08:00
jenkins-bot a9b7c5c5e3 Merge "Trigger refactor" 2013-01-29 22:03:53 +00:00
Trevor Parscal ea4b42b2b2 Automatically prune empty text nodes
When there's 2 entities or inline content nodes (like aliens) with text between them, removing that text should remove the node too. If you don't remove the node then CE won't think to make a slug between the two inline nodes.

Change-Id: Ibb682332a6084e357104183641a104e3ae1e253f
2013-01-28 17:09:56 -08:00
Trevor Parscal 294db5e3ef Trigger refactor
Objective: Simplify the registration and use of triggers

Changes:

* Renamed ve.Command to ve.Trigger
* Renamed command demo to trigger demo
* Removed language prefixing of triggers
* Generating trigger tooltips rather than hard-coding them in i18n
* Added documentation to clarify that only 'mac' and 'pc' are supported platforms, and how the default is chosen
* Simplified trigger registry's register command
* Updated trigger registrations

Change-Id: Ibab6ad5b5c86f24707f064967dc2119a81125392
2013-01-28 17:06:13 -08:00
Trevor Parscal 280c85d8e7 Added support for passing data into annotation constructors
This resolves a TODO

* Added logic to support passing an argument into annotation constructor which is used as the data property (reusing the element argument)
* Updated documentation
* Simplified instantiation of annotations

Change-Id: I142b8fa3883bf70c896a2a568088d833814ef2dc
2013-01-28 11:01:52 -08:00
Catrope d73d6e9bf0 Add extension-specific types functionality to ModelRegistry
Extension-specific types are RDFa types (or type regexes) that are
registered with the ModelRegistry separately. If an element has a type
that is extension-specific, then that element can only be matched by a
rule that asserts one of its extension-specific types.

For MediaWiki, we would call
ve.dm.modelRegistry.registerExtensionSpecificType(/^mw:/ ) .
So then an element like <span typeof="mw:foobar"> would either match a
rule specifically for mw:foobar, if one exists, or no rule at all; even
the rule for <span> would not match. The consequence of this is that
elements with unrecognized mw:-prefixed RDFa types are alienated.

Change-Id: Ia8ab1fe5dffb9f813689324372a168e8e4a3e0bc
2013-01-22 18:12:35 -08:00
Catrope 99df776543 Allow matchTagNames = null in ve.dm.Converter
This won't usefully register the node with the converter right now, but
we need to allow this because the ModelFactory tests will need to have
stub nodes with tag-only matches.

Change-Id: I023cc8ff647363ab55c73dff39b17ca47e9e6681
2013-01-22 17:45:43 -08:00
Catrope 47b728bed9 Add wrapper for Array.prototype.filter
Change-Id: Ie7d8dd4193a81bedbb75258494bd78e8236bd0e8
2013-01-22 15:55:11 -08:00
Catrope aa372b6c16 Actually use this.nodeFactory and this.annotationFactory in ve.dm.Converter
Change-Id: I138a437d2e64577ad905ff70ecedf1eb7e6c8360
2013-01-22 15:55:11 -08:00
Catrope 5a5b4b577a Drop name parameter from ModelRegistry.register(), use .static.name
Change-Id: I74eeab1195455072ae48ac0655582f2bf01806d6
2013-01-22 15:55:11 -08:00
Catrope 819b3ded33 Move matching code from AnnotationFactory to ModelRegistry
ModelRegistry registers both annotations and nodes, and performs
matching on both at the same time. It also registers annotations with
the AnnotationFactory, and nodes with the NodeFactory.

Change-Id: I5e68e506a0e573cc0afe6304ccea058ffc20d1c8
2013-01-22 15:51:37 -08:00
Trevor Parscal bf5ba1ea2b Fixed documentation errors
Many of these problems were introduced in I859b5871a9d2f17d970c002067c8ff24f3513e9f

Change-Id: Ifc2dc4934f782c4ce5107e3a356e357aef754083
2013-01-22 23:38:01 +00:00
jenkins-bot 721e69cd9e Merge changes I8ee4796a,I2629c5fd
* changes:
  Make defaultAttributes a static property as well
  Replace nodeFactory invocations with direct static access
2013-01-22 23:23:13 +00:00
jenkins-bot d15b02a374 Merge "Convert node rules to static properties" 2013-01-22 23:22:33 +00:00
jenkins-bot 12b25cc6e8 Merge "Add annotation-like static properties to nodes" 2013-01-22 23:21:17 +00:00
Rob Moen 464471b538 Enable VisualEditor in MediaWiki integration for IE 9 and up.
Change-Id: I987223589c2a6b61dde5e2db8234cca40e237eec
2013-01-22 12:59:03 -08:00
Catrope c1b6e95042 Make defaultAttributes a static property as well
Change-Id: I8ee4796a93d55db9be6e43c78f3ac7bb29a65c6f
2013-01-18 14:51:40 -08:00
Catrope 51f4b4be54 Convert node rules to static properties
Change-Id: If7d0159e984d9ccb4d5c31effb62bb9612260fda
2013-01-18 14:51:40 -08:00
Catrope de6193734d Add annotation-like static properties to nodes
Add static properties for matching, data<->DOM conversion, and name. Use
matchTagNames, toDataElement and toDOMElement. name isn't used yet.

Change-Id: I5e7df3303bbd65e6968e931b568c23d76003a9a4
2013-01-18 14:51:40 -08:00
Catrope 12544c9e82 Replace nodeFactory invocations with direct static access
Change-Id: I2629c5fd659bca166237cef425f7cc3aff13ba0e
2013-01-18 14:51:40 -08:00
jenkins-bot 9cd96cd253 Merge "Fix naming of phantoms" 2013-01-18 21:39:46 +00:00
jenkins-bot 7f22c8b0d1 Merge "Inline ve.dm.Document.offsetContainsAnnotation" 2013-01-18 21:39:22 +00:00
Christian Williams 55b025fb1a Fix naming of phantoms
Change-Id: I60e925ee83fa2670eeabc5b690928f6f029b2eb4
2013-01-18 13:32:15 -08:00
jenkins-bot c6bc26ebe3 Merge "Fixes for typos and some missing documentation" 2013-01-18 21:05:13 +00:00
jenkins-bot 8a8a731a34 Merge "Convert "var\t" to "var "" 2013-01-18 21:03:55 +00:00
Catrope 594222c81d Add TriggerRegistry to tests
Fixes tests broken by 8ba81f4d67

Change-Id: Idd53d5c28941fa738b3a790977c0e7f0e65faaa9
2013-01-18 11:42:36 -08:00
Inez Korczyński 94642c797d Introduced method replacePhantoms in ve.ce.Surface in order to avoid accessing ve.ce.Surface local variable ($phantoms) from ve.ce.AlienNode
Change-Id: I9754d98175c7353f6db5306bc2ce35d6c57fdedb
2013-01-17 17:02:02 -08:00
Trevor Parscal 5cc93b288f Convert "var\t" to "var "
Partially reverts I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc (I read the diff backwards)

Change-Id: I5a638b8d13ed27a78586ff5507a421d7c49c9679
2013-01-17 16:55:09 -08:00
Trevor Parscal fcf08e4212 Fixes for typos and some missing documentation
Lots of fixes for "it's" being used incorrectly.

ve.ce.Document.js
* Filled in documentation for missing params

ve.FormatAction.js
* Fixed incorrect tag for returns documentation

Change-Id: Ic256cc6952c31f5e6ae8be92919a0799cfe6188b
2013-01-17 15:47:34 -08:00
jenkins-bot 4aeb00dcbc Merge "Slug Todos" 2013-01-17 23:41:34 +00:00
Christian Williams 8ec2276bb5 ImageNode Todos
* Removed mousedown handler (dragging is handled in ve.ce.surface)
* Added attribute change handler to ve.ce.Node to keep attribute changes on the model in sync with the DOM

Change-Id: I1d6a7f3dc3136439ce511a4f3eb5a54797c8f996
2013-01-17 15:40:06 -08:00
jenkins-bot 96b0d8698a Merge "Add interplatform, i18n shortcuts to ui buttons." 2013-01-17 23:30:43 +00:00
Rob Moen 8ba81f4d67 Add interplatform, i18n shortcuts to ui buttons.
Objective:
* Put command shortcuts in button title attributes. (Bug 42919)
* Provide a registry for platform specific command triggers and their
corresponding i18n messages. (Bug 44012)
* Enable loading of triggers after ve.Surface is created. (lazy load)

Changes:

VisualEditor.i18n.php
* Add default trigger i18n messags for mac and pc system platforms

VisusalEditor.php, demos/ve/index.php
* Add links to files

ve.init.mw.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.sa.Platform.js
* Define getUserLanguage and getSystemPlatform methods.

ve.init.Platform.js
* Define abstract methods: getUserLangauge, getSystemPlatform

ve.ui.BoldBUttonTool.js, ve.ui.IndentButtonTool.js, ve.ui.ItalicButtonTool.js,
ve.ui.LinkButtonTool.js, ve.ui.OutdentButtonTool.js, ve.ui.RedoButtonTool.js,
ve.ui.UndoButtonTool.js
* Add registration for command triggers.

ve.Surface.js
* Methodize loading of triggers.
* Bind register event to ve.triggerRegistry to allow lazy loading of triggers.

ve.ui.Tool.js
* Init pre-registered tooltip messages.
* Update tool titles when new triggers are loaded.

ve.CommandRegistry.js
* Remove command registration ( moved to buttons themselves )

ve.TriggerRegistry.js
* New class for registering triggers.

ve.init.mw.ViewPageTarget.js
* Changed instance of unindent command to outdent.

Change-Id: Id8580a3f81aac751db0b7482422a73912648dfed
2013-01-17 15:28:32 -08:00
Christian Williams e4ef6163a0 Double spaces optimization
Moved the sequential space check into the whitespaceHtmlChars and htmlChars loop

Change-Id: I835cccf868fed851f25f5ccbba1386697b0ea66b
2013-01-17 15:16:33 -08:00
Christian Williams b80f2ef7dd Reorganization of ve.ce.Surface methods
Logical grouping for Init, Browser Events, Custom Events, Utilities, Helpers, Getters, and Setters. This may be a precursor to a future, larger refactoring.

Change-Id: I059f88a604f0b5bc383eb3ae274bab0fe2dc476b
2013-01-17 15:12:03 -08:00
jenkins-bot 4167b7c638 Merge "Cleaned up paste target and surface styles" 2013-01-17 23:04:37 +00:00
Trevor Parscal a30e4c325b Cleaned up paste target and surface styles
Resolves a TODO related to the paste target div.

VisualEditor.php
* Added link to ve.Surface.css

ve.Surface.js
* Cleaned up initialization of .ve-surface element
* Removed float clearing div (see ve.Surface.css)
* Removed paste div (moved to ve.ce.Surface)

ve.Surface.css
* Added rule which adds an ":after" element to handle clearing floats

ve.ce.Surface.js
* Cleaned up initialization of DOM elements
* Added paste target div
* Replaced paste element selectors with direct references to this.$pasteTarget

ve.ce.Surface.css
* Changed paste div styles to use a namespaced class instead of a generic ID

demos/ve/index.php
* Added link to ve.Surface.css

Change-Id: Ib93d45ac82ae643fc8e659f5a063c02a8ddacdde
2013-01-17 15:02:47 -08:00
Christian Williams 81e061eb9d Slug Todos
Setting display of block slugs with CSS.

Change-Id: I249015618f934f8c162912883dbd4452fa266b3f
2013-01-17 15:00:11 -08:00
jenkins-bot 391760fbc0 Merge "Minor cleanup." 2013-01-17 22:14:16 +00:00
Inez Korczyński 52ce01e3d0 Fix minor bug (typo - was: ve.ve, is: ve.ce)
Change-Id: I588d7237fb57be28fcfbb8aa3b0ff2288c3bdae6
2013-01-17 14:13:11 -08:00
Inez Korczyński d84b02610a Minor cleanup.
Change-Id: I45ee3fd5b2131131f3d10e05a1cc2f32a3e091cc
2013-01-17 14:05:31 -08:00
Trevor Parscal 113c670305 Inline ve.dm.Document.offsetContainsAnnotation
Resolves TODO

ve.dm.Document.js
* Removed offsetContainsAnnotation method
* Inlined uses of removed method

ve.dm.Transaction.js
* Inlined uses of removed method

ve.dm.Document.test.js
* Removed test for removed method

Change-Id: Ie970234ad5d8c0417389b8a45defec9fd5be6a79
2013-01-17 12:07:14 -08:00
Trevor Parscal 6f8b0965f2 Remove range.normalize (not needed), use range.isCollapsed more often
The normalize method doesn't need to be explicitly called anymore because there's not any code that changes the properties of a range directly anymore.

A good way to prove it's not needed anymore is to move the normalization logic to the constructor and then add "console.log(this.from <= this.to );" to the normalize method - you will find that it's never actually doing anything at all because the range was normalized by the constructor.

ve.Range
* Moved normalization logic to constructor
* Removed calls to normalize method
* Removed normalize method
* Simplified documentation for flip method
* Whitespace fixes

ve.Document, ve.dm.Transaction, ve.dm.Surface, ve.dm.Document, ve.ce.Surface
* Removed calls to range.normalize
* Switched to using range.isCollapsed instead of comparing properties directly

Change-Id: I80bfd06f88579c34dce2083c2b70d63ab92f1275
2013-01-16 15:38:07 -08:00
Trevor Parscal 8d33a3de0d Major Documentation Cleanup
* Made method descriptions imperative: "Do this" rather than "Does this"
* Changed use of "this object" to "the object" in method documentation
* Added missing documentation
* Fixed incorrect documentation
* Fixed incorrect debug method names (as in those VeDmClassName tags we add to functions so they make sense when dumped into in the console)
* Normalized use of package names throughout
* Normalized class descriptions
* Removed incorrect @abstract tags
* Added missing @method tags
* Lots of other minor cleanup

Change-Id: I4ea66a2dd107613e2ea3a5f56ff54d675d72957e
2013-01-16 15:37:59 -08:00
Catrope b062691deb Make ve.dm.AnnotationFactory a named function rather than an anonymous function
Trevor, this could be another target for a cleanup spree, maybe?

Change-Id: Id37903ef452ff9758ac6c70c9e21faaff66c6f0b
2013-01-15 17:36:47 -08:00
Trevor Parscal f31dc45da8 (bug 43841) Major ve.ui rewrite, especially ve.ui.LinkInspector
Objectives:

* Make the link inspector easier to use
* Try to resolve a few bugs (bug 43841, bug 43063, bug 42986)
* Stop using jquery.multiSuggest (which didn't really understand annotations)
* Better divide MediaWiki specifics from generic implementations

Changes:

VisualEditor.php, modules/ve/test/index.php, demos/ve/index.php
* Updated links to files

ve.Registry
* Fixed mistake where registry was initialized as an array - this didn't cause any errors because you can add arbitrary properties to an array and use it like any other object

ve.Factory
* Removed duplicate initialization of registry property
* Added entries property, which is an array that's appended to for tracking the order of registrations

ve.CommandRegistry
* Added mwLink command which opens the mwLink inspector

ve.ui.TextInputWidget
* Added basic widget class for text inputs

ve.ui.TextInputMenuWidget
* Added widget that provides a menu of options for a text input widget

ve.ui.MWLinkTargetInputWidget
* Added MediaWiki specific link target widget

ve.ui.MenuWidget
* Converted ve.ui.Menu into a widget
* Moved the body of onSelect to onMouseUp

ve.ui.LinkTargetInputWidget
* Added link target widget which adds link annotation functionality to a normal text input

ve.ui.InputWidget
* Added generic input widget which emits reliable and instant change events and synchronizes a value property with the DOM value

ve.ui.Widget
* Added base widget class
* Widgets can be used in any frame

ve.ui.Tool
* Fixed line length issues

ve.ui.InspectorFactory
* Made use of new entries property for factories to select the most recently added inspector if more than one match a given annotation

ve.ui.Inspector
* Added auto-focus on the first visible input element on open
* Moved afterClose event to after re-focus on document on close
* Added documentation

ve.ui.Frame
* Adjusted documentation
* Added binding of $$ to the frame context so it can be passed around
* Added documentation

ve.ui.Context
* Added ve.ui.Widget.css to iframes
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget
* Removed unused positionBelowOverlay method
* Added CSS settings to set overlay left and width properties according to context size
* Added documentation

ve.ui.DropdownTool
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget

ve.ui.FormatDropdownTool
* Added documentation

ve.ui.MWLinkButtonTool
* Added MediaWiki specific version of ve.ui.LinkButtonTool, which opens the mwLink inspector

ve.ui.Widget.css
* Added styles for all widgets

ve.ui.Tool.css, ve.init.sa.css, ve.init.mw.ViewPageTarget.css, ve.init.mw.ViewPageTarget-apex.css
* Updated code as per moving of ve.ui.Menu to ve.ui.MenuWidget

ve.ui.Menu.css
* Deleted (merged into ve.ui.Widget.css)

ve.ui.Menu.css
* Deleted suggest styles (no longer used)

pending.gif, pending.psd
* Added diagonal stripe animation to indicate a pending request to the API

ve.ui.MWLinkInspector
* Added MediaWiki specific inspector which uses MediaWiki specific annotations and widgets

ve.ui.LinkInspector
* Removed mw global hint (not needed anymore)
* Switched from comparing targets to annotations (since the target text is ambiguous in some situations)
* Switched to using input widget, which is configured using a static property
* Removed use of jquery.multiSuggest
* Moved MediaWiki specifics to their own class (ve.ui.MWLinkInspector)

ve.init.mw.ViewPageTarget
* Added MediaWiki specific toolbar and command options

Change-Id: I859b5871a9d2f17d970c002067c8ff24f3513e9f
2013-01-15 15:05:11 -08:00
Timo Tijhof d4b24865a7 JSDuck: Fix warnings
Warning: modules/ve/test/ve.qunit.js:5: Class QUnit not found
Warning: .docs/categories.json No class found matching a pattern 've.Position' in categories file
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type MouseEvent
Warning: modules/ve/ce/ve.ce.Surface.js:1297: Unknown type int

Follows-up:
* Ic21c9d3f
* Ib521eaa6

Change-Id: I8e371a2d4d91a1f03bd4ef59d18b7df715f23238
2013-01-15 21:15:17 +01:00
jenkins-bot 1e7df79c01 Merge "MetaBlockNode should be a BranchNode, not a LeafNode" 2013-01-15 09:16:03 +00:00
jenkins-bot 3100e914f1 Merge "Make stub nodes inherit correctly" 2013-01-15 09:15:29 +00:00
jenkins-bot 81cb7b2671 Merge "Fix test breakage in 90f046799" 2013-01-15 09:14:50 +00:00
Catrope 52549e41d0 MetaBlockNode should be a BranchNode, not a LeafNode
Change-Id: Id6f99ffce553d45cb2bc0250721ceec25333e1dd
2013-01-11 20:19:17 -08:00
Catrope 131b83831f Make stub nodes inherit correctly
Some of these stubs didn't inherit Node at all. Made them all inherit
LeafNode because their rules specify they can't have children.

Change-Id: If4afc8de350f67ee78a41307c426ec2aceeb884f
2013-01-11 20:18:10 -08:00
Catrope a8e3b59141 Fix test breakage in 90f046799
The title attribute should only be rendered. It should not be put in the
HTML that is sent back to Parsoid.

Change-Id: I63c0373c71c3bf01a4238af3ccd02c835a118e2f
2013-01-11 20:18:09 -08:00
Trevor Parscal 7d09e0671e Removed code for and links to unused libraries
Removes:
* ve.Position
* jquery.multiSuggest
* jquery.json

Change-Id: Ic21c9d3f5fe8a71d37a1a3633baa6325ca5d51b3
2013-01-10 13:25:33 -08:00
jenkins-bot b248cc3db9 Merge "More {String} -> {string} conversions in documentation" 2013-01-08 21:04:52 +00:00
Trevor Parscal a379e0f91e More {String} -> {string} conversions in documentation
Follow up for I6a7c9e8ee8f995731bc205d666167874eb2ebe23

The first pass that Timo took missed the following cases

* "{Array|String}": string is just one of the values
* "{String[]}": string is followed by [] to indicate an array of strings

Change-Id: I65e595e8d37fb624802d84af9536a2d3c5d73c7d
2013-01-08 13:02:12 -08:00
jenkins-bot 90f2d9f1ba Merge "Initialization error when canceling load" 2013-01-08 20:58:35 +00:00
Catrope 080dfd7d07 (bug 42398) Kill ve.ce.Meta{Block,Inline}Node, not needed.
CE doesn't actually render meta nodes anymore now that we split them out
into the meta-linmod.

I took a stab at consolidating metaBlock and metaInline (into simply
'meta'), but we can't do that with the current node API unless we put a
lot of meta-specific hacks in the converter. So I'm leaving this for the
node API rewrite.

Change-Id: Ie83413df718eabcaeb504316a2db0d24a1be2226
2013-01-08 12:45:25 -08:00
jenkins-bot 4aec0f6d0d Merge "Triple-Click Detection for IE" 2013-01-08 20:43:52 +00:00
Christian Williams f934d91b97 Triple-Click Detection for IE
IE does not properly support MouseEvent.detail for reporting the number of clicks in a user action. The new clickCounter() function takes a mousedown event and returns the detail property if non-IE or calculates the detail by comparing to a recent history (up to 3) of mousedowns.

Change-Id: Ib521eaa695d7e436d67ebb49106159daadc2ee38
2013-01-08 12:43:09 -08:00
jenkins-bot d349f18d4b Merge "(bug 43056) Inline tags like <span> are block-alienated sometimes" 2013-01-08 20:41:28 +00:00
jenkins-bot 879a07511a Merge "BugID 43076 - Fixes to alien and phantom corner cases" 2013-01-08 20:39:34 +00:00
jenkins-bot 23ca3fcd34 Merge "Set title attributes for internal and external links." 2013-01-08 20:35:44 +00:00
Trevor Parscal ec5333030b Initialization error when canceling load
Added check for the existence of the surface before the save dialog is hidden. This oversight caused errors when there was a load error and the user clicked cancel.

Change-Id: I3b6d8d4d9f4c81ffcbd7996d6b17ac04f33bf6d7
2013-01-08 12:29:54 -08:00
Timo Tijhof b11bbed7a6 JSDuck: Generated code documentation!
See CODING.md for how to run it.

Mistakes fixed:
* Warning: Unknown type function
  -> Function
* Warning: Unknown type DOMElement
  -> HTMLElement
* Warning: Unknown type DOM Node
  -> HTMLElement
* Warning: Unknown type Integer
  -> Mixed
* Warning: Unknown type Command
  -> ve.Command
* Warning: Unknown type any
  -> number
* Warning: Unknown type ve.Transaction
  -> ve.dm.Transaction
* Warning: Unknown type ve.dm.AnnotationSet
  -> ve.AnnotationSet
* Warning: Unknown type false
  -> boolean
* Warning: Unknown type ve.dm.AlienNode
  ve.dm doesn't have a generic AlienNode like ve.ce
  -> Unknown type ve.dm.AlienInlineNode|ve.dm.AlienBlockNode
* Warning: Unknown type ve.ve.Surface
  -> ve.ce.Surface
* ve.example.lookupNode:
  -> Last @param should be @return
* ve.dm.Transaction.prototype.pushReplace:
  -> @param {Array] should be @param {Array}
* Warning: ve.BranchNode.js:27: {@link ve.Node#hasChildren} links to non-existing member
  -> (removed)
* Warning: ve.LeafNode.js:21: {@link ve.Node#hasChildren} links to non-existing member
  -> (removed)

Differences fixed:
* Variadic arguments are like @param {Type...} [name]
  instead of @param {Type} [name...]
* Convert all file headers from /** to /*! because JSDuck tries
  to parse all /** blocks and fails to parse with all sorts of
   errors for "Global property", "Unnamed property", and
  "Duplicate property".
  Find: \/\*\*([^@]+)(@copyright)
  Replace: /*!$1$2
* Indented blocks are considered code examples.
  A few methods had documentation with numbered lists that were
  indented, which have now been updated to not be intended.
* The free-form text descriptions are parsed with Markdown,
  which requires lists to be separated from paragraphs by an
  empty line.
  And we should use `backticks` instead of {braces} for inline
  code in text paragraphs.
* Doc blocks for classes and their constructor have to be
  in the correct order (@constructor, @param, @return must be
  before @class, @abstract, @extends etc.)
* `@extends Class` must not have Class {wrapped}
* @throws must start with a {Type}
* @example means something else. It is used for an  inline demo
  iframe, not code block. For that simply indent with spaces.
* @member means something else.
  Non-function properties are marked with @property, not @member.
* To create a link to a class or member, in most cases the name
  is enough to create a link. E.g. Foo, Foo.bar, Foo.bar#quux,
  where a hash stands for "instance member", so Foo.bar#quux,
  links to Foo.bar.prototype.quux (the is not supported, as
  "prototype" is considered an implementation detail, it only
  indexes class name and method name).
  If the magic linker doesn't work for some case, the
  verbose syntax is {@link #target label}.
* @property can't have sub-properties (nested @param and @return
  values are supported, only @static @property can't be nested).
  We only have one case of this, which can be worked around by
  moving those in a new virtual class. The code is unaltered
  (only moved down so that it isn't with the scope of the main
  @class block). ve.dm.TransactionProcessor.processors.

New:
* @mixins: Classes mixed into the current class.
* @event: Events that can be emitted by a class. These are also
  inherited by subclasses. (+ @param, @return and @preventable).
  So ve.Node#event-attach is inherited to ve.dm.BreakNode,
  just like @method is.
* @singleton: Plain objects such as ve, ve.dm, ve.ce were missing
  documentation causing a tree error. Documented those as a
  JSDuck singleton, which they but just weren't documented yet.
  NB: Members of @singleton don't need @static (if present,
  triggers a compiler warning).
* @chainable: Shorthand for "@return this". We were using
  "@return {classname}" which is ambiguous (returns the same
  instance or another instance?), @chainable is specifically
  for "@return this". Creates proper labels in the generated
  HTML pages.

Removed:
* @mixin: (not to be confused with @mixins). Not supported by
  JSDuck. Every class is standalone anyway. Where needed marked
  them @class + @abstract instead.

Change-Id: I6a7c9e8ee8f995731bc205d666167874eb2ebe23
2013-01-05 01:16:32 +01:00
Catrope 7bcf35e0e8 (bug 43056) Inline tags like <span> are block-alienated sometimes
This happens when the <span> is the start of unwrapped content. The
converter logic to look at the tag name in wrapping mode doesn't kick in
because we're not yet in wrapping mode at that point.

The core issue was that previously, we relied on the document
structure/state to choose between alienBlock and alienInline, and only
used the tag name where the document structure was ambiguous (wrapping).
Changed this to be the other way around: we now rely primarily on the
tag name, and if that doesn't match what we expect based on the document
structure, we work around that if possible. Specifically:
* inline tag in our wrapper --> inline alien
* block tag in our wrapper --> close wrapper, block alien
* inline tag in wrapper that's not ours --> inline alien
* block tag in wrapper that's not ours --> *inline* alien
* inline tag in structural location --> open wrapper, inline alien
* block tag in structural location --> block alien
* inline tag in content location --> inline alien
* block tag in content location --> *inline* alien
only in the fourth and the last case do we need to use the "wrong" alien type to
preserve document validity, and it will always be inline where block was
expected, which should reduce UI issues.

The condensed version of the above, which is used in the code, is:
* If in a non-wrapper content location, use inline
* If in a wrapper that's not ours, use inline
* Otherwise, decide based on tag name
* Open or close wrapper if needed

ve.dm.Converter:
* Replace isInline logic in createAlien() with the above
* Factor out code to start wrapping (was duplicated) into startWrapping()
* Call startWrapping() if createAlien() returns an alienInline and we're
  in a structural location

Tests:
* Add test cases with aliens at the start and end of unwrapped content
** The first one failed prior to these changes and now passes, the
   second one was already passing
* Fix about group test case, was exhibiting the bug that this commit fixes

Change-Id: I657aa0ff5bc2b57cd48ef8a99c8ca930936c03b8
2012-12-22 12:27:11 +01:00
Christian Williams b740e694b9 BugID 43076 - Fixes to alien and phantom corner cases
The {{coords}} template is correctly rendered as an inlineAlien, which previously did not have shields. However, the template has a deeply nested span that is positioned and floated. The fix is to shift shielding logic up to AlienNode (from AlienBlockNode) and to show phantoms on all shields (both block and inline). I've also updated the aliens demo to exhibit this corner case.

Change-Id: Ifce60c7762c0ead5c6fe29d6eabf601c1565cbfa
2012-12-21 15:20:15 -08:00
jenkins-bot b5edb71467 Merge "Fix outdent tooltip calling for a non-existant message" 2012-12-19 18:35:24 +00:00
Rob Moen 041359ba01 (bug 43098) Prevent alien node contents from floating above phantoms.
* Sets z-index of alien blocks to 0.
* Simplify alienNode css
* Add missing -ms-user-select: none;
* Add missing [-moz-|-ms-|]user-select: element
  (webkit doesn't support element, auto is closest)

Change-Id: I889074a659483ce3d48380be5f50f80abb573286
2012-12-15 00:58:52 +01:00
James D. Forrester 851bd1a76e Fix outdent tooltip calling for a non-existant message
Change-Id: I8b39f116181310b86d804a567eedf9c68bde594f
2012-12-14 15:53:53 -08:00
Rob Moen 90f046799f Set title attributes for internal and external links.
Fixes (Bug 37904)

Change-Id: Ib987f74fa9f326fe583683401424c79ba9651caf
2012-12-13 14:04:00 -08:00
jenkins-bot cf5f2ae0f5 Merge "(bug 43040) All edits were being marked as minor" 2012-12-13 04:46:25 +00:00
Catrope 892990ef17 (bug 43040) All edits were being marked as minor
&minor=false doesn't work, but &minor=0 does

Change-Id: I73e18e7b58a151d78d56aa199cdfadb6d7150f1d
2012-12-12 17:51:47 -08:00
jenkins-bot df359ce829 Merge "Typo from I65447da8." 2012-12-13 01:12:13 +00:00
Timo Tijhof de4e12367f Typo from I65447da8.
Change-Id: I27cce9784149cf1e98c4ed144ead4718978a74ae
2012-12-13 02:11:25 +01:00
jenkins-bot eca19a1618 Merge "Handle a null response in onLoad()" 2012-12-13 01:02:37 +00:00
jenkins-bot c3c2dca9f2 Merge "Close suggestions when escape key pressed." 2012-12-13 01:00:42 +00:00
jenkins-bot e5e4dafe2e Merge "Only call showSelecton on undo and redo if there is a returned range." 2012-12-13 01:00:35 +00:00
Catrope 803001d652 Handle a null response in onLoad()
Change-Id: I6ce6c3b313c4785db1bad47c8822cca5114d17a3
2012-12-12 16:58:06 -08:00
Rob Moen c9da8f61dd Close suggestions when escape key pressed.
Fixes (Bug 43051)

Change-Id: I5e6baeec62da49b10793f2ebe7d341697a63f9c4
2012-12-12 16:54:11 -08:00
jenkins-bot 8b50543b6d Merge "Save dialog: Fix too-wide diff box." 2012-12-13 00:51:25 +00:00
jenkins-bot 74b874c1fa Merge "(bug 43013) Exclude edit notices with no visible text." 2012-12-13 00:39:10 +00:00
jenkins-bot 9ad0328b56 Merge "Phase out $.toJSON, use JSON.stringify directly." 2012-12-13 00:36:54 +00:00
Timo Tijhof 4fa57b469a Phase out $.toJSON, use JSON.stringify directly.
Although $.toJSON optimises heavily for modern browsers (it
becomes a direct reference to JSON.stringify), we still load the
extra plugin.

JSON is specified as part of ECMAScript 5, but most browsers
supported this one before they supported the rest of ES5.

http://caniuse.com/#search=JSON

Cut off for native JSON is IE7, Firefox 3.0 (3.6 supports it) and
Safari 3. Not any of our concern as VE will most likely never
support those (certainly not at this point in time, and less
likely as time goes on).

Change-Id: I4e8f26ac94763fa38d29e41264de0247f53a21e5
2012-12-13 01:33:46 +01:00
Timo Tijhof 18ab361a43 (bug 43013) Exclude edit notices with no visible text.
en.wikipedia.org has a template gala for edit notices with a whole
bunch of html framework outputted by default from
MediaWiki:Editnotice-0 (even if their underlying system has no
matches for the current page).

In the core editor from EditPage.php this isn't a problem as the
element is just idling hidden above the editor.

In the case of VisualEditor (where we have a custom delivery for
the edit notices) we don't want to say "1 notice available" on
every page, so we need to be smart and quickly walk the dom of the
notice, filter out invisible nodes, and if the resulting nodes
have no contents, ignore the notice all together.

Change-Id: I65447da8b88a9bae9c24ff155544ff66b3fe9100
2012-12-13 01:26:11 +01:00
Trevor Parscal 718e72d534 Disabled VisualEditor section edit link overrides by default
Server config: $wgVisualEditorEnableSectionEditLinks
Client config: mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks

Change-Id: I859546475a32a686e318aa7108396606b5a0a78d
2012-12-12 15:35:33 -08:00
Rob Moen a09ab4d70a Only call showSelecton on undo and redo if there is a returned range.
Fixes (Bug 43033)

Change-Id: I36745a01fad135b8eb02ee0da22d74ebf0a4c118
2012-12-12 12:07:02 -08:00