Commit graph

3172 commits

Author SHA1 Message Date
Trevor Parscal df12ed58f4 Fix for I7f26b47e9467e850c08b9c217c4f1098590de109
I overlooked this when I did the review.

Change-Id: I942ce92c0c8f847149bb24697fc1aab0e67b8c67
2012-12-04 11:13:59 -08:00
Trevor Parscal 03d56bfe2d Merge "Clean up, fix errors on demos." 2012-12-04 19:05:21 +00:00
Rob Moen 0ceee83950 If more than one title in suggestions match, select the first item.
Addresses (Bug 42665)

Change-Id: I8c425b79e34e931beb78538146a035c25023ce8a
2012-12-04 11:01:51 -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
Timo Tijhof 381472ac99 init.Platform: Refactor parsed messages.
Rewrite VisualEditorMessagesModule:
* Replace copy-paste dump of user-css module with stuff for
  VisualEditor (class commend and module::$origin).
* Remove duplication between getMessages and getScript.
* Actually implement getModifiedTime so that the comment in
  getMessages() about cache invalidation is actually true
  Fixes bug 42670: ext.visualEditor.specialMessages cache broken

ve.init:
* Implement addParsedMessages and getParsedMessage so that we
  don't mix up plain messages with raw html messages (minoredit
  was previously overloaded in mw.msg storage with a parsed html
  message and retrieved though ve.msg, which is documented as
  retuning plain text, not raw html). This is now separated into
  a different method.
* Improved documentation of the other msg methods to emphasise
  their differences
* Removed redundant code in attachSaveDialog() that was
  (partially) already done in setupSaveDialog() and moved the
  remaining bits into it as well. Checked all callers of these and
  they are both only called from ViewPageTarget.prototype.onLoad
* Also implement them in the standalone platform implementation,
  with the html escaper based on mw.html.escape
* Update init.platform.getMessage to use undefined instead of
  discouraged 'if-in' statement.
* Add test suite.

demos/test:
* Re-run makeStaticLoader.php on test to add ve.init.Platform.test
* Re-run makeStaticLoader.php on demos and update i18n caller
  to use ve.init.platform.addParsedMessages (also moved out of the
  auto-generated block for easier updating)

Change-Id: I7f26b47e9467e850c08b9c217c4f1098590de109
2012-12-04 07:56:41 +01:00
Catrope bbf7100041 Merge "(bug 42661) Initially hide context, then update after animation" 2012-12-04 02:49:09 +00:00
Catrope be0f6f7bd7 Merge "(bug 41929) Unlist button overzealously unlists the whole list" 2012-12-04 02:48:32 +00:00
Catrope b6dd2340ad Merge "Added destroy methods and called them on deactivate" 2012-12-04 02:45:40 +00:00
Trevor Parscal 9a7b0eafb6 Merge "(bug 42469) Leading newlines in <pre>s get eaten" 2012-12-04 01:16:25 +00:00
Catrope e95cc34978 (bug 42469) Leading newlines in <pre>s get eaten
HTML DOM has annoying behavior for <pre>s where .innerHTML eats the
first newline in a <pre>. Work around this by explicitly adding a
newline in the data->DOM converter if the <pre> already contained a
newline.

There is a separate bug in Parsoid that causes the newline to be lost
anyway, filed as bug 42666

Change-Id: Ia26cd4a4c61afbe439b0562deb7f24ee8b8147d7
2012-12-03 17:14:33 -08: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 4c4372255a Merge "Don't phantomize inline aliens when dragging" 2012-12-04 00:56:55 +00:00
Trevor Parscal de6f4a4254 (bug 41504) ve.ce throws error when surface loses focus
ve.ce.Surface
* Used getModel() as per TODO
* Simplified code by pre-calculating 2 statements that were being used 4 times each
* Re-structured logic so that simple insertion and deletion are only possible if next and previous have a range, triggering complex change otherwise
* Added some documentation

ve.ce.SurfaceObserver
* Added checks for whether rangy found a branch node within the document or not before accessing it's node via .data() and made it so we are only performing DOM > document range conversion if we did
* Removed some commented out code

Change-Id: Iaaf30a5b201710ab4235e775f18808a8d512f1f9
2012-12-03 16:34:27 -08:00
Trevor Parscal b04a920616 (bug 41929) Unlist button overzealously unlists the whole list
ve.IndentationAction
* Fix incompatibility with working with multiple nodes by using surface fragments
* Bug was caused by unindent causing rebuilding, which for all groups other than the first meant their nodes were detached and broken

ve.ListAction
* Employ unindent in a loop to remove all list levels

This is all still a bit hacked together, the use of surface fragments saved us this time, but we need to refactor this code. Badly. Next year.

Change-Id: Idddef35230b04d64cf8338d53bbab730fadec2fc
2012-12-03 15:57:10 -08:00
Christian Williams b02ea35298 Don't phantomize inline aliens when dragging
This will prevent inline alien phantoms from appearing while dragging. This was a usability enhancement identified by Inez/Christian.

Change-Id: Idf046db72e25875e899f5926ab7d50d2f514586b
2012-12-03 15:52:36 -08:00
Krinkle d045722240 Merge "(bug 40339) Out of bounds errors" 2012-12-03 22:36:33 +00:00
Trevor Parscal cb4877b0d0 (bug 40339) Out of bounds errors
Detecting contextChange events was making assumptions about the previous state, and causing a mess of problems.

Solution: detect contextChange events in a smarter way.

We also now emit contextChange event when moving to a different node. This helps fix other issues because it's possible for the selection to be the same, but the node at that range to change, and that's a context change for sure. Example would be changing the heading level.

Change-Id: I99d6fa94fae76aa940077abc9b5beacd38eb7b0b
2012-12-03 14:23:58 -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
Trevor Parscal 98ef0da3ee (bug 42661) Initially hide context, then update after animation
Change-Id: I35a0c3359ffc1a62ee3c0456c33475e32189f4b4
2012-12-03 14:06:24 -08: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
Timo Tijhof 0760d2b4a9 (bug 42137) Sync availability of "minor edit" with MW backend.
Which for now is just "not when creating a new page". This is
already strictly enforced in the MediaWiki backend through EditPage.php, but not reflected in the Save dialog of VE yet.

Now the checkbox for Minor edit matches the logic for EditPage.

Change-Id: I9c659845feebb3e9bbf8e13ee67be27c6adb4321
2012-12-03 12:22:31 -08:00
Timo Tijhof 42757a724d Cleanup oldid: Use mw.config for page existence and revision id.
Use mw.config wgCurRevisionId for oldie instead of uri query.
That way it also set on regular views, and as a bonus it the
normalised value (e.g. if on a page with oldid in query but the id
doesn't exist or is somehow invalid, it won't use it).

Centralise page existence logic in JS and rename Target.oldId to
Target.pageRevId (to further indicate that it is always set, not
just on oldId views. To detect an oldId view, do a boolean check
on value from currentUri.query.oldid directly).

In PHP Api, move oldid logic to execute() method instead of
locally from the getHTML call. That way it is always set, avoids
hitting this bug in other methods instead of just getHTML().

Since the mw.Target constructor now retrieves the ID from
mw.config directly, the second argument was removed.

Change-Id: I223235a6ea8b4178c50beeaaedb709b2de7cf0b5
2012-12-03 12:22:30 -08:00
Timo Tijhof 04fc47b919 (bug 42553) Only replace url on veaction=edit if there is no other query
Change-Id: Ia63c937d3a0a68acaa178486ab439bc1ea9db8af
2012-12-03 12:22:30 -08:00
Timo Tijhof bae3eb081a mw.Platform: Only show minor edit option if user has "minoredit" right
Had to make the retrieval of the Save dialog html template
asynchronous due to mw.user.getRights being asynchronous.

Entire block indented, ignore whitespace changes.

Also:
* Fixed 2 cases where ve.msg value was interpreted as HTML
instead of adding a text node directly.
* Alphabetically sorted the dependencies (after adding
  user.options and mediawiki.user).
* Removed redundant inline jshint comment, multistr is already
  tolerated from the central .jshintrc file.

Change-Id: Ie09bb5c8bdbfbb3ec0d4983b74d0697b941153e0
2012-12-03 12:21:35 -08:00
Trevor Parscal 4d073cdaa5 Merge "Init: Fix incorrect context for mw.msg.apply." 2012-12-03 20:01:43 +00:00
Trevor Parscal f740198933 Merge "(bug 41159) Position of VisualEditor's "Create" tab is wrong." 2012-12-03 19:59:51 +00: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
Translation updater bot 727c79f23a Localisation updates from http://translatewiki.net.
Change-Id: I2269608d54880f164e508b2c727e883da4593232
2012-12-02 20:46:01 +00:00
Timo Tijhof 407de829dd Init: Fix incorrect context for mw.msg.apply.
Context should be 'mw', not 'mw.msg'.
Also updated to using ve.bind instead and documented that ve.msg
cannot ve.bind because the reference 've.init.platform.getMessage'
does not exist yet at run time of the ve.js file.

Change-Id: I7eb692bdc4b63cc44fab118054d8eea05c2a71ff
2012-12-02 03:45:51 +01:00
Krinkle f614019b5d Merge "Renamed API from ve-parsoid to visual editor" 2012-12-02 02:02:39 +00:00
Timo Tijhof 105b5865aa (bug 41159) Position of VisualEditor's "Create" tab is wrong.
Change-Id: Id88a160621093e4db4cf01c0fa34793cc1a929b4
2012-12-02 02:52:15 +01:00
Trevor Parscal c0e7f711c6 Merge "Add hover state to link inspector suggestion items." 2012-11-30 23:16:04 +00:00
Trevor Parscal 26d06a98ed Renamed API from ve-parsoid to visual editor
Change-Id: I3bfe2e813b31f9010010f63902b1e8e22f3bcd59
2012-11-30 15:00:04 -08:00
Rob Moen bad4de89b6 Add hover state to link inspector suggestion items.
Addresses (Bug 39977)

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

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

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

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

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

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

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

Change-Id: Iba55cfc3d531e7d1333b78c94912ff22179aace8
2012-11-30 09:50:47 -08:00
Catrope d96b6a9622 Merge "Immediately provide default suggestions based on 0 results." 2012-11-30 17:27:59 +00: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
Translation updater bot a525cd86b5 Localisation updates from http://translatewiki.net.
Change-Id: I773eb9c1114a64e83335024611612efd25d55dce
2012-11-29 21:04:07 +00:00
Trevor Parscal 1d0ad9573e (bug 37828) Handle edit conflicts
ApiVisualEditor
* Added basetimestamp and starttimestamp to all methods where appropriate
* Added new serialize method which converts HTML to Wikitext

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

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

VisualEditor.i18n
* Added edit conflict confirmation box message

VisualEditor
* Included new edit conflict message to resource loader module

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

Change-Id: I73215df88519450965be35d9e04cf4e621d1e90d
2012-11-28 16:44:34 -08:00