Commit graph

2611 commits

Author SHA1 Message Date
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
Timo Tijhof 0cec349074 Save dialog: Fix too-wide diff box.
The rules have changed, these constraints are no longer needed
and actually causing the table.diff to ignore the restrictions
and bump out of the container beyond the width of the window.

This restores the condition under which table.diff is displayed
by core EditPage.php.

Follows-up I5f59482f4db.

Change-Id: I456644bf14efab7dac351818d5c3bb69b9b3c993
2012-12-12 04:32:55 +01:00
jenkins-bot 0ca661345f Merge "Remove cruft from suggestion tool." 2012-12-12 01:59:08 +00:00
jenkins-bot 20dd91423a Merge "Save dialog: Implement new "Review and Save" model." 2012-12-12 01:57:36 +00:00
Timo Tijhof cdee18dae8 Save dialog: Implement new "Review and Save" model.
Basically saveDialog-body now has three slides:
* review
* report
* save

There is a viewPage.swapSaveDialog method that is called like this
 viewPage.swapSaveDialog( 'review' );
initially called from showSaveDialog.

Misc:
 * Replaced more reused core message with a ve ones:
   savearticle => visualeditor-savedialog-label-save
   showdiff => (removed)

 * Removed min-height from saveDialog. When slide-review is
   load, it is very short and there shouldn't be 10em's of
   whitespace below the loader + buttons.

To avoid problems with diff cache being cleared while looking
at the save dialog, we lock and unlock the surface.
We could later remove this as and optimise it as feature, but for
now this fixes a bug.

Change-Id: I5f59482f4db16264014720b199d7652843c36108
2012-12-11 17:52:48 -08:00
jenkins-bot 8e7593dd0a Merge "Store HTML before the converter messes with it" 2012-12-12 01:31:21 +00:00
Rob Moen fd4775e1ee Remove cruft from suggestion tool.
-Prevents previously inspected link suggestions from showing prior
to rebuild.
-Ability for onInput to be executed immediately.
-Removed duplicated logic from open method.
-No longer calling onInput on enter key.

Change-Id: I11792b03ec01cc1929009fb76089adcc86c97629
2012-12-11 17:30:20 -08:00
Catrope 541aa0d3d6 Store HTML before the converter messes with it
Change-Id: I51f0a97a266522e46f415fd7618c3ef26a8924cd
2012-12-11 17:20:18 -08:00
Trevor Parscal 5e50f6de2c Added disable/enable methods to ve.Surface
Change-Id: I65a93c590ace58b666adcb792bc825174a3f95c6
2012-12-11 16:28:39 -08:00
Timo Tijhof 95742d65f6 Save dialog: Various clean up.
Drop "-down" class in favour of :active CSS pseudo-class.
* http://kimblim.dk/css-tests/selectors/
* http://www.quirksmode.org/css/contents.html
* http://caniuse.com/#search=css%202.1

Rename methods consistently to enableFoo and disableFoo.

Use mw.notify instead of mw.util.jsMessage (the latter takes a
string of html and parses it, instead of taking text).
Also, jsMessage is obsolete (legacy wrapper around mw.notify).

Rename slide-main to slide-save in preparation of other slides
and introduction of multi-step save dialog.

Re-introduce "disabled" state (not css, but actual state) so that
pressing "Show changes" multiple times will not spawn multiple
async operations. The save function guards against this by keeping
a static property in the internal helper method, but there are
still some operations happening between the button and that method
this should be guarded in the UI instead. Follows-up I67819168.

Change-Id: Idf0331377e6be814ccae853228d6159b4ad5a159
2012-12-11 23:13:54 +01:00
jenkins-bot ffc8ec5e50 Merge "Re-apply fixes made in a patch set that were accidentally reverted on rebase" 2012-12-11 21:35:31 +00:00
Catrope 3f903adb09 Add .reportProblem() to submit reports
Change-Id: I55ffd8bfc7664ead3827ef6be178a0b6f3b991a1
2012-12-11 13:19:51 -08:00
Trevor Parscal baa5754b2f Re-apply fixes made in a patch set that were accidentally reverted on rebase
In the change: I6781916822b4173ba906b9bc4c341219fbf10d82

71b97ec45b was reversed when I submitted 1789545284

Change-Id: I6cc59a27817bfbe55c7cbf45bba746a4bd6c375f
2012-12-11 13:06:40 -08:00
jenkins-bot 6460df5cff Merge "Improve truncate and truncateRange to allow negative values" 2012-12-11 19:34:07 +00:00
jenkins-bot 49bd56ffe9 Merge "Move the cursor to the end of newly inserted links" 2012-12-11 19:34:02 +00:00
jenkins-bot a9f5639aab Merge "Fix the "list of US Presidents" bug" 2012-12-11 19:24:25 +00:00
Catrope 045b597253 Fix the "list of US Presidents" bug
I noticed this bug on [[List of Presidents of the United States]]. When
there's HTML that looks like "<td>Foo\n<meta/></td>", the converter will
collect the newline in wrappedWhitespace, then attempt to splice it out
and store it in internal data. But instead, it ends up splicing out the
/metaBlock element, which causes strange unbalanced input, which causes
an empty table in the node tree.

Change-Id: I79ed2fa9a834cc42759c7d21250d8842f563d38f
2012-12-11 11:23:31 -08:00
Trevor Parscal f8061a97eb Improve truncate and truncateRange to allow negative values
Positive values will move the end, negative values will move the start

Change-Id: I566653664bf2a8a74781f1059a51873ab72560f9
2012-12-11 11:10:22 -08:00
Trevor Parscal abdcacd68a Move the cursor to the end of newly inserted links
Inserted links happen when the cursor is not near a word, so we insert the target as text

Change-Id: I06c2c425d28db7ca61f13c438e25cc9c75f391f4
2012-12-11 11:09:26 -08:00
Timo Tijhof 3a2453b1b2 mw.ViewPageTarget: Move diff button logic, min-height for dialog.
Follows-up Ic77c5ce4 and I9d05ef6e.

Change-Id: I077172d590e53737691020c1265203134eea3c9c
2012-12-11 18:33:16 +01:00
jenkins-bot 64abfff53c Merge "Enable change makers by default" 2012-12-11 07:05:48 +00:00
Catrope 0d5db4eb4e Enable change makers by default
Change-Id: I7b5af42abe81cc5f41dd80692ac5d5ff007f99ed
2012-12-10 22:55:00 -08:00
Catrope 1a195b33e1 And also use a 100s timeout for show changes
Change-Id: I437d125cd1944299991d80f22fdaedd490bcb45f
2012-12-10 21:16:21 -08:00
Catrope 2e6425a16b Set the save timeout to 100s as well
Change-Id: Ic01ffaae2a0c4bbe91bee7705c60f26b7b34d0f9
2012-12-10 20:33:34 -08:00
jenkins-bot a90f79178a Merge "Hide the show changes button when we are creating a page" 2012-12-11 03:25:50 +00:00
Trevor Parscal 1edd9ad504 Hide the show changes button when we are creating a page
Change-Id: Ic77c5ce4757fd0cf6d7cdd9a991206b649fc2e5a
2012-12-10 19:24:26 -08:00
jenkins-bot dff8570850 Merge "Check if there's a document before we try and set focus on it" 2012-12-11 03:24:05 +00:00
Trevor Parscal c59e6b1638 Check if there's a document before we try and set focus on it
Change-Id: Ia7776c70c2593e4524adab3a347230ee3cccad29
2012-12-10 19:14:43 -08:00
Trevor Parscal c91ef9306c Add left margin to save dialog, visible with show changes
Change-Id: Iaadbfd30f7270fa90dc4adefc9855a55d087ce0c
2012-12-10 19:04:01 -08:00
jenkins-bot 220d07ac43 Merge "Prevent Inspector frame from reloading on close." 2012-12-11 02:56:00 +00:00
jenkins-bot 8d04dd20ad Merge "Fix typo'ed documentation issue with gerrit change 38009" 2012-12-11 02:55:45 +00:00
jenkins-bot 6bb6f6b790 Merge "Throw edit warning on cancel." 2012-12-11 02:55:32 +00:00
Trevor Parscal 99ccfab9f0 (bug 42920) Add the feedback tool
icons, comment.*, ve.ui.Icons-*
* Added comment icon

ve.init.mw.ViewPageTarget
* Refactored editNoticeButton into being just a tool
* Added feedback tool, which shares the editNoticeButton code
* Added feedback object construction in init constructor
* Added launching code to feedback tool

VisualEditor.i18n
* Renamed editnotices-button message to editnotices-tool to match changes in code
* Added feedback tool message

VisualEditor
* Added dependency on mediawiki.feedback
* Updated changed message key
* Added reference to new message

Change-Id: I813c89a505386a9b3206bfbcb176016e28a592cb
2012-12-10 18:47:53 -08:00
Trevor Parscal 1789545284 Adjustments and fixes for styles
* Made buttons use shared CSS code
* Stopped using <button> elements and got all browsers looking the same
* Fixed focus on text area issue - had to let the stack clear first

Change-Id: I6781916822b4173ba906b9bc4c341219fbf10d82
2012-12-10 18:34:58 -08:00
James D. Forrester 00d86d69cb Fix typo'ed documentation issue with gerrit change 38009
Change-Id: I1238001949bae519d49428f98dcdd1428388aa0d
2012-12-10 18:34:37 -08:00
jenkins-bot fafd3c53c4 Merge "(bug 42937) Removing copy/pasted link annotations removes the original as well" 2012-12-11 02:22:22 +00:00
Trevor Parscal 29cdbe0ea5 (bug 42937) Removing copy/pasted link annotations removes the original as well
Basically a copy should be a deep copy, so this was a blatant mistake.

Change-Id: I702fb425783293c4ddde8b9ac568dfe6abc8f782
2012-12-10 18:12:55 -08:00