Commit graph

216 commits

Author SHA1 Message Date
Timo Tijhof 0031725751 Cleanup: Omit second argument to setTimeout for "nextTick"
Not 0 or 1.

Change-Id: Ia6eb985e649c5bd196f87aac98c3919e60be9a86
2013-02-26 00:34:58 +00:00
Trevor Parscal 59c67e1e94 Modify styles, add disabled and read-only for widgets
demos/ve/demo.css, demos/ve/index.php
* Style changes for utilities and dump output
* Initially disable the log range button, activate when there's a range to log
* Make range inputs read-only
* Rename some widget variables
* Add extra structure and classes to dump output

ve.ui.Widget.css
* Remove left/right margin for buttons
* Simplify opaque white color
* Modify selector for disabled buttons - see changes in ve.ui.Widget.js
* Added styles for text input widget's readonly and disabled states

ve.ui.Widget.js
* Added disabled state

ve.ui.ButtonWidget.js
* Moved click event handler to method

ve.ui.InputLabelWidget.js
* Moved click event handler to method

ve.ui.InputWidget.js
* Moved input change event handler to method
* Added readOnly state

ve.ui.LinkTargetInputWidget.js
* Corrected documentation

ve.ui.MenuWidget.js
* Blocked interaction while widget is disabled

ve.ui.MWLinkTargetInputWidget.js
* Corrected documentation
* Blocked interaction while widget is disabled

ve.ui.TextInputMenuWidget.js
* Blocked interaction while widget is disabled

Change-Id: I7ea89873b50a98d058d1dd1e309e3e8b7c8e7b2e
2013-02-25 12:10:26 -08:00
James D. Forrester 82114467f1 Bump copyright notice year range to -2013 over -2012
199 files touched. Whee!

Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
2013-02-19 15:37:34 -08:00
Trevor Parscal d0ff691f9e Add user interface widgets
* New! Button and InputLabel widgets
* Using new buttons in the demo
* Moved styles around to generalize input styles

Change-Id: Ic42e133f8fe0fffcb61374c09dd5668db82a4799
TODO: Use these buttons other places! (like ve.init)
2013-02-13 18:04:04 -08:00
Trevor Parscal d42a52bb59 Added new icons
Icons needed for upcoming generated content editor.

* Parameter (big and small)
* Parameter Set
* Source (big and small)
* Template (big and small)

Change-Id: I9c5df7970e3f0991ac6a66590212f40d83af9c0a
2013-02-13 16:06:29 -08:00
Rob Moen 4d3ccb7b99 Annotate newly inserted target text as a link.
Fixes (Bug 44086)

Changes:
ve.ui.LinkInspector.js
- Annotate fragment for affected range.
- Fragment returned by insertContent was a zero length range, therefore
no content was being annotated.  It is questionable whether insertContent
should return the affected range or not.
- Also changes behavior of editing existing link annotations so that the cursor is after the annotation rather than covering it when the inspector is closed

Change-Id: Ic53b9844f84781cad05ac1f63964c9aaf7de68c3
2013-02-07 16:06:08 -08:00
Rob Moen 78a99fb0a3 Check for instance of generic LinkAnnotation when querying target.
Resolves (Bug 44686)

Change-Id: I0ff962330e061aea66a25a923f46d6759e5ff6af
2013-02-05 11:55:27 -08:00
jenkins-bot 6c5d83449d Merge "Remove trailing commas" 2013-02-02 00:26:59 +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
jenkins-bot 9bf5eb5b5b Merge "Added support for passing data into annotation constructors" 2013-01-29 23:15:21 +00: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
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
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
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
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
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
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
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
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
James D. Forrester 851bd1a76e Fix outdent tooltip calling for a non-existant message
Change-Id: I8b39f116181310b86d804a567eedf9c68bde594f
2012-12-14 15:53:53 -08:00
Trevor Parscal 5e50f6de2c Added disable/enable methods to ve.Surface
Change-Id: I65a93c590ace58b666adcb792bc825174a3f95c6
2012-12-11 16:28:39 -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
jenkins-bot 220d07ac43 Merge "Prevent Inspector frame from reloading on close." 2012-12-11 02:56:00 +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 50f89a675e Add recursion guard back in
This was removed in I0873d906c058203b83b8d4bbe5a4b274f05a26fd because I had fixed another cause of the recursion - this is still needed however because the following still happens:

1. Link inspector is opened away from a word, so it goes into a mode that will insert text based on the chosen target
2. The link inspector is closed, causing a context change when the new annotated text is inserted
3. The context change event triggers the link inspector to close, leading us back to step 2
4. Browser dies in infinite loop hell

We may be able to fix this in a different way, like performing the document changes after the inspector has already closed by running it in a timeout. In any case, this works for now, and we can improve the design of this area of the code later on.

Change-Id: I7f3c17dad08521bb1ae7c2a1e8a4e21e2c4ba210
2012-12-10 18:01:10 -08:00
Rob Moen 1953f12fd8 Prevent Inspector frame from reloading on close.
In the event the page explodes from a huge js error, prevent
the iframe from reloading to slightly reduce the confusion of the
user.

Change-Id: I0c88678437f0bad994fa97f4df63d8b288f69e7a
2012-12-10 17:43:40 -08:00
Trevor Parscal 353297e5b5 (bug 42925) Inspector doesn't open properly
ve.Range
* Rewrote truncate so that it works as expected, truncation should always reduce the length using the start/end values, not the from/to values

ve.ui.Inspector
* Added a comment about where the name argument to onBeforeInspectorOpen comes from, since it's a little bit confusing on first read (and I wrote it!)
* Calling onInitialize, onOpen and onClose methods directly, since we need to control the before or after-ness of listeners getting in there and doing their stuff - plus it's more direct
* Removed onRemove stub, which is never actually called
* Added before/after versions of initialize, open and close events
* Got rid of recursion guard since we don't need it anymore thanks to changes made in ve.dm.Surface (see below)

ve.ui.Context
* Updated event names to deal with new before/after naming of initialize, open and close events
* Removed fade-in logic since fading in doesn't even work anymore - since now we now annotate first, then open the inspector, the menu will actually exist and be open when we open the inspector even though you don't see it because it's quickly obscured

ve.ui.LinkInspector
* Made fragments non-auto selecting, in the case of onInitialize we actually call select(), which is silly since we were using an auto-selecting fragment - it's clear that this was a mistake

ve.dm.Surface
* Moved locking (polling stop and start) to the far outside edges of the change method
* I need a lot of eyes and testing on this change, it seems OK to me, but I'm suspicious that it may have side effects
* What was happening is that selection changes were being applied and then the poll was picking them up, and then the selection was coming in again as a change, but it wasn't a change at all, it was just feedback - this change event was then closing the inspector the instant it was opened - the odd part was that this only occurred when you selected backwards, which seems to be caused by the range being normalized, so it looked like a new selection even though it wasn't

ve.dm.Document
* trimOuterSpace from Range didn't consider annotated spaces to be spaces, by using the [0] trick (first character of a plain text character string or first element in an annotated character's array both are the character's value - but elements don't have a property named '0' so it skips those safely as well) we can always get the right value for comparison

Change-Id: I0873d906c058203b83b8d4bbe5a4b274f05a26fd
2012-12-10 16:48:13 -08:00
Inez Korczyński f93fd9ffe3 (bug 42842) Do not call update (temporary solution to prevent error
Solution: do not call update (temporary solution to prevent error - however content will never be at offset 0 - so it should never hurt)

Change-Id: I9ed6f9fbea23d5e2e55c56f8483321442049bd51
2012-12-10 10:41:01 -08:00
Trevor Parscal 2473a5e7ca Static composition of 'can' and 'not', may improve performance slightly
Or at least irritate Roan less…

Change-Id: I9ea503725133ed0971f3876f199e0858c35c5aa1
2012-12-07 13:38:00 -08:00
Rob Moen 63f96b6539 Add tooltips to close and remove inspector controls.
Addresses (Bug 41153)

Change-Id: I6fa0bb8acafbc9e4e7763f9f0e158b853bc1afaa
2012-12-05 17:18:36 -08:00
Timo Tijhof 278e5f7640 Clean up, fix errors on demos.
* Fix 404 error for ve.ui.Icons-{raster,vector}.css
  Follows-up 9563f08 / I840f72426f9a.

makeStaticLoader.php:
* Clean up old code.
* Error out early for missing module.
* Put i18n stuff in the right place
  (some modules access ve.msg from the global scope to
  assign status variables, for standalone on demos this was
  failing due to wrong load order)

Change-Id: Idbff4c5136d567da747d9ae373cd2f6c3ee7fb1c
2012-12-04 08:58:20 +01:00
Catrope b6dd2340ad Merge "Added destroy methods and called them on deactivate" 2012-12-04 02:45:40 +00:00
Rob Moen 30dadb6c8c Address error caused by changing focus from context menu to window.
DocumentNode element loses focus when the context is opened.
When clicking out of the context into window, polling error
occurs.

Change-Id: Ie8f8af763d221c59e47e8c240653f8b817c26f64
2012-12-03 16:59:14 -08:00
Trevor Parscal c051107b39 Removed all browser-specific box-shadow rules
These aren't needed for any of our target browsers anymore.

Change-Id: Idae4acb5f0f6387cad52f2ea7594dbad1929af59
2012-12-03 23:08:33 +01:00
Krinkle 3b3dab11c7 Merge "Removed all browser-specific border-radius rules" 2012-12-03 22:05:59 +00:00
Trevor Parscal 5812c8babe Removed all browser-specific border-radius rules
These aren't needed for any of our target browsers anymore.

Change-Id: I86d1964f163827673c090b67a472254b73e365a4
2012-12-03 23:05:30 +01:00
Krinkle 46e52ae7bc Merge "(bug 42220) Added support for edit notices, which appear on the toolbar" 2012-12-03 22:02:16 +00:00
Trevor Parscal a55217ec3b Added destroy methods and called them on deactivate
This prevents memory waste when switching between read and visual editor tabs, which happens entirely on the client.

Change-Id: I31b50accac38d72a9367b9035504552dc0150104
2012-12-03 13:45:38 -08:00
Trevor Parscal a63f812d52 (bug 42220) Added support for edit notices, which appear on the toolbar
ApiVisualEditor
* Including notices in response to parse actions

ve.init.mw.ViewPageTarget
* Added styles for editNoticeButton and editNotices

ve.init.mw.ViewPageTarget
* Added toolbarEditNoticeButton and toolbarEditNotices
* Combined toolbarEditNoticeButton and toolbarSaveButton setup
* Moved toolbar buttons setup to onLoad (it could vary per-parse now)
* Added tearDownToolbarButtons which fires on deactivate
* Renamed some instances of teardown to tearDown
* Added click handler for toolbarEditNoticeButton
* Added toolbarEditNotices setup method, called on load
* Made notices fade in and out, in by default on load if any
* Made notices hide when save dialog is opened

ve.init.mw.Target
* Added storing of notices on parse

icons, alert, ve.ui-Icons
* Added alert icon

VisualEditor.i18n, VisualEditor
* Added notices button message

Change-Id: I581bf5a005a9c18422f952d71064d17d0ba9b540
2012-12-03 11:49:33 -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
Trevor Parscal 6f3db44cc1 Merge "Restyle suggestion dropdown into a single column." 2012-11-30 19:43:56 +00: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
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 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 8fc98868c9 Fixed inspector behavior
ve.ui.Inspector
* Removed disabled state and interfaces - this isn't needed
* Renamed prepareSelection to onInitialize
* Using event emitter to run onInitialize, onOpen and onClose methods
* Left removal up to the child class to handle in the onClose method
* Replaced calls on context to close inspector to calling close directly
* Renamed prepareSelection stub to onInitialize
* Emitting initialize event from within the open method
* Added recursion guarding to close method
* Changed the close method's argument to be remove instead of accept - the more common case is to save changes, and the only time you wouldn't save changes is if you were to remove the annotation
* Moved focus restore to close method

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

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

ve.dm.SurfaceFragment
* Added word mode for expandRange

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

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

Change-Id: I38995d4101fda71bfb2e6fe516603507ce820937
2012-11-21 12:01:14 -08:00
Trevor Parscal 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 f856a10fa0 Merge "Added undo-before-apply for new link annotations" 2012-11-20 01:10:29 +00:00