Commit graph

4384 commits

Author SHA1 Message Date
jenkins-bot 3d2a33855c Merge "Re-build reference search index so they can be used mid-edit" 2013-08-30 19:12:23 +00:00
Trevor Parscal ac77d33c9e Re-build reference search index so they can be used mid-edit
The search index was only being built on initialization, rather than at
the time the list was being shown. By moving it to be built on open
the list will always be fresh. Also, just after building the index, we can
enable/disable the select existing button based on the number of
results.

Bug: 51689
Bug: 51848
Bug: 52000
Change-Id: Ib38b1b227edc3d61dc49fa58999358e7adf11b08
2013-08-30 19:09:47 +00:00
jenkins-bot 651ce4a55b Merge "Expose version information in the client" 2013-08-30 18:53:19 +00:00
jenkins-bot bc9205e0cc Merge "VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages" 2013-08-30 18:26:55 +00:00
cmcmahon 88504aa3d9 use regexp anchors to prevent false matches
Change-Id: Ib13b85986e3df431b0f900fea38165197411370e
2013-08-30 17:28:40 +00:00
Pavel Selitskas 1084cdb350 VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages
We call isRedirect to get the real language code instead of the site code.
Post-factum, lang attribute is added as well for each entry.

Bug: 53503
Change-Id: Ia6bf63a7cbe3c7b99ed05d0bd0fdd33190550c98
2013-08-30 14:39:45 +03:00
Ed Sanders a72099af66 Expose version information in the client
By passing in the information via a ResourceLoaderModule this
gets around any concerns with performance (version information
is read from the file system).

The version information is appended to the beta toolbar dialog.

Bug: 53050
Change-Id: I7836e1d4003416cbb7e18e3435aa87d82fd5c2e2
2013-08-29 18:19:40 -07:00
Timo Tijhof bdd1a73eaa data: Rename MessagesModule to DataModule
Also..
* removed an incorrrect comment referring to the old module
  name (standalone didn't use the VisualEditorMessagesModule).
* made it use debug mode to determine whether to minify or
  prettify the js code.

Change-Id: I493007649fba27e7faab0cf743eded5f68714c50
2013-08-29 18:07:35 -07:00
Moriel Schottlender 84cca4f472 Cursor fix after link insertion
When a link was inserted, the cursor position was backwards (at the
beginning of the word rather than its end) - this commit fixes that
problem.

Also, thanks for the help Ed!

Bug: 53560
Change-Id: I04fe1ca4c9126898e7bf85cdf519794d66b4f38b
2013-08-29 21:46:28 +00:00
jenkins-bot 4291b2a308 Merge "When pasting, try to use original range" 2013-08-29 18:26:53 +00:00
jenkins-bot 0cdcf2d155 Merge "Always give references names. Ignore if used once." 2013-08-29 18:26:04 +00:00
jenkins-bot 0ae19ffa40 Merge "Set contentEditable using jQuery#prop" 2013-08-29 17:54:56 +00:00
Ed Sanders 98cad0f410 Set contentEditable using jQuery#prop
Also always use strings 'true'/'false' for the value, because
it is a string property (spellcheck, however, is a boolean)
and always use a capital second 'E' in the name.

Change-Id: Ia4e1f9edfd8f236fe81df190e6a68729d7b52243
2013-08-29 09:59:55 -07:00
jenkins-bot 467ddf5ab8 Merge "Followup 41a4b3fb: use .not()" 2013-08-29 01:55:19 +00:00
jenkins-bot 53eda266d9 Merge "Add dual detection for types that Parsoid is about to rename" 2013-08-29 00:55:50 +00:00
jenkins-bot b41d3bee07 Merge "Add ULS to the standalone" 2013-08-29 00:44:02 +00:00
Roan Kattouw c68e550bb3 Add ULS to the standalone
Also rerun makeStaticLoader

Change-Id: If9fae5dc5ea37567c50ab5d462308ff05e053c8c
2013-08-28 17:35:37 -07:00
Moriel Schottlender d4c2374515 Fixing inspector popup position
The inspector popup should appear relative to the position of the related
calling method - either relative to the cursor (like in links and language)
or relative to the focusableNode (like in templates/transclusion).

Bug: 50905
Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
2013-08-28 23:59:36 +00:00
jenkins-bot ae4fee0883 Merge "AnnotationInspector insertion over blank selection" 2013-08-28 23:44:07 +00:00
jenkins-bot 1375c48488 Merge "Move contentEditable=false to protected node" 2013-08-28 23:33:09 +00:00
jenkins-bot 4493ca1f48 Merge "Rename 'DOM Changes' => 'DOM changes'" 2013-08-28 23:32:25 +00:00
Roan Kattouw 4d91e4edbf Add dual detection for types that Parsoid is about to rename
Bug: 53432
Change-Id: If404585f9a118b4155ceb46fbe8e467b41ec6b29
2013-08-28 16:30:20 -07:00
Ed Sanders 458f8d1a82 Move contentEditable=false to protected node
Because that's where it should be.

Bug: 53507
Change-Id: I9afffea238a774b884d4d2434d3523e4c4e445b2
2013-08-28 16:18:55 -07:00
Ed Sanders e0018e8e94 Rename 'DOM Changes' => 'DOM changes'
Because we don't use title case in comments

Change-Id: I5cdd3241aba0727a3cd5d0ded972ae54abf1efd0
2013-08-28 15:55:35 -07:00
Zeljko Filipin 8f7e9c27a7 Moved VisualEditor Selenium tests from browsertests repository
Requested by James Forrester at QA mailing list:

http://lists.wikimedia.org/pipermail/qa/2013-August/000339.html

Bug: 53467
Change-Id: I915b4e41d32c9190ccea73f2b3bce9a53918fe80
2013-08-28 20:14:21 +00:00
Ed Sanders 52de8b76ec Always give references names. Ignore if used once.
This avoids problems when unnamed references were copy-pasted.

Knowing that key is always non-null simplifies a lot of logic
elsewhere.

Bug: 53365
Change-Id: I3a23123ae732d9583814d38dd880a0cdf691fd5d
2013-08-28 12:47:33 -07:00
jenkins-bot c3576a5c29 Merge "Fix typo (was comma instead of semicolon)" 2013-08-28 18:54:58 +00:00
David Chan e0663b5066 Fix typo (was comma instead of semicolon)
modules/unicodejs/test/unicodejs.wordbreak.test.js
* fix typo

Change-Id: Ieef78b4f51054b760217c8e2f12a4510857ee88a
2013-08-28 11:51:52 -07:00
Ed Sanders 182d9bbeea Check clipboardData exists before accessing it
Bug fix for browsers which don't have an event.clipboardData
property. The check is done correctly in onCopy but not onPaste.

Change-Id: I3cdf4c0358aa145dcb70c2c103d08a0002001fd4
2013-08-28 11:47:13 -07:00
Moriel Schottlender ba7e0ff273 AnnotationInspector insertion over blank selection
This commit fixes two issues with insertion of annotations in blank space:
* LanguageInspector issue with inserting an language annotation inside any
  whitespace (selection of space between words or collapsed selection in
  blank line)
* AnnotationInspector issue with collapsed selection inside slugs. If
  the marker was in a slug collapsed selection, activating
  AnnotationInspector would expand the range to the closest word (on the
  next paragraph). This commit makes sure the expansion for the next word
  only happens if the selection is outside a slug.

Change-Id: I144eccefba16131a3d2ec6a3181adf47a15d6cc0
2013-08-27 20:34:57 -04:00
Ed Sanders f50102f521 Disable inserting/changing references when surface widget is empty
This listens to change events on the surface and checks to see if
there is more than just an empty paragraph node.

Bug: 53345
Change-Id: Ic8fa84d7cdcbffd154178939d0ec8c2c4f86c415
2013-08-27 17:18:52 -07:00
Ed Sanders ddb608e6bc When pasting, try to use original range
This functionality was (accidentally?) removed by I8f8a240a. It
stops us from over-zealously balancing data when we can get away
with just pasting the original selected range (e.g. it always wraps
collections of text and content nodes in another paragraph).

Bug: 53364
Change-Id: I93fa56c4e43083993c310e0050087e9d1de1e08b
2013-08-27 15:40:59 -07:00
jenkins-bot 92c7be9b31 Merge "Detect outdated pending post KeyPress handler" 2013-08-27 22:31:07 +00:00
David Chan d867ef8fc0 Detect outdated pending post KeyPress handler
modules/ve/ce/ve.ce.Surface.js
* Schedule the post-keypress async handler in a way that can be cancelled.
* Cancel it and run the handler immediately if another key event happens.

Bug: 53079
Change-Id: If139ff3230c10caa616743f71659c4606d290310
2013-08-27 13:55:02 -07:00
Roan Kattouw 10393b8773 Followup 41a4b3fb: use .not()
I claimed that it didn't preserve text nodes, but it does. It's just
that there's a bug where it doesn't preserve text nodes if the selector
passed to it is too simple, but 'link, meta, style' is complex enough
to avoid triggering this bug.

Change-Id: Id4a60dc87b8d4c613bc7013641b116dd7c331ac1
2013-08-27 13:53:17 -07:00
Roan Kattouw 051867c3ab Actually use GeneratedContentNode in AlienNode
ce.AlienNode was mixing in GeneratedContentNode, but wasn't actually using
it properly. This commit fixes this so that AlienNode can benefit from
the <meta>/<link>/<style> stripping code in GeneratedContentNode.

Also added a getHashObject() function to dm.AlienNode to summarize the
domElements attribute because ve.getHash() chokes on it otherwise.

Change-Id: Ief3be94f9730297abe0e3c57506b81a8ff1d136d
2013-08-27 13:53:17 -07:00
jenkins-bot 0ef918b6f0 Merge "Language Inspector Default Fix" 2013-08-27 20:36:42 +00:00
jenkins-bot 8b773cf9a4 Merge "Give document real focus after cut" 2013-08-27 20:21:42 +00:00
jenkins-bot 80ded50c8b Merge "Copy-paste data fixes" 2013-08-27 20:21:00 +00:00
jenkins-bot 78141a6f33 Merge "Don't render <meta>/<link>/<style> tags in GeneratedContentNode" 2013-08-27 18:28:34 +00:00
Roan Kattouw 41a4b3fb51 Don't render <meta>/<link>/<style> tags in GeneratedContentNode
There is no good reason why we'd render these tags, and their presence
causes Chrome to crash while cutting across them.

Bug: 50043
Change-Id: I611e3907cf20fa27dbef89ea941d0b787a44ba4f
2013-08-27 11:26:37 -07:00
jenkins-bot d7702819e8 Merge "Make ve.dm.Surface.{start,stop}HistoryTracking idempotent." 2013-08-27 16:27:41 +00:00
C. Scott Ananian 4fee78227d Make ve.dm.Surface.{start,stop}HistoryTracking idempotent.
Add a little robustness, guaranteeing that we don't end up with multiple
history tracking tasks running, leaking one, or try to clear a non-running
interval.

Change-Id: I41db2d6fefc7f45f150aa14ecefc648760ad6200
2013-08-27 09:25:54 -07:00
C. Scott Ananian 7fb7665608 Avoid crash after ve.dm.Surface.purgeHistory().
The selection property is never null; it is initialized to Range(0,0).
If it is set to null in purgeHistory(), the next call to
ve.dm.Surface.change() will crash.

Change-Id: Ia45c0ba26291e8ad09c445fdf2323710b5ab409f
2013-08-27 09:37:37 -04:00
Roan Kattouw ce138adbdb Kill domAttributeWhitelist in favor or renderHtmlAttributes
domAttributeWhitelist wasn't actually being observed. Instead, we
already had the code in place to treat renderHtmlAttributes as a
boolean/whitelist/blacklist hybrid, it just wasn't used that way
yet.

This makes the interface nicer and fixes the bug where all attributes
(including data-parsoid and even things like onmouseover) were
rendered by CE.

Change-Id: I02e266c7c7dc197ed845164b7a705d786846a33b
2013-08-26 18:37:50 -07:00
Ed Sanders fd410c03a7 Give document real focus after cut
If only a FocusableNode is selected the document doesn't have
real focus, so we must do it manually.

Bug: 53362
Change-Id: I781f59dda7f2884ff02f6688c2c8c037ac7ed1a6
2013-08-26 23:06:13 +00:00
Ed Sanders 99692230b1 Copy-paste data fixes
* Assign cut/copy/paste events to the document so that
  they are triggered when the CE doesn't have real focus
  e.g. only a FocusableNode is selected
* Use clipboardData.setData when available. The key can
  be stored and retrieved perfectly in text/xcustom but
  this technique doesn't work in FF or IE
* Just use text content for key as this is what is written
  to the clipboard, so this can be used directly without
  having to get the content from the pasteTarget.

Bug: 48604
Bug: 49396
Change-Id: Ib3702f9441f6ee3fa34ec071f00994dd7e591d99
2013-08-26 15:25:15 -07:00
Timo Tijhof d0d0e156b8 doc: Restore and clean up documentation for Platform subclasses
- Added missing @inheritdoc so that generated documentation is
  not empty.
- Fixed type of mw.Platform#getMessage from (implied) @property
  back to @method.
- Removed notes from mw methods. They are prepended instead of
  appended, thus overriding the useful single-line summary
  of the method with this random note. Description should either
  be replaced entirely (e.g. no @inheritdoc) or inherited.
- Rephrased a few description to be consistent with the others
  (e.g. "Get .." and "Add .." instead of "Gets .." or "Adds..").

Follows-up cbe35632f1.

Change-Id: Ie55bb9e18f1524b706f0e195300170e4d552bf73
2013-08-26 12:47:28 -07:00
Moriel Schottlender 47f9c66798 Language Inspector Default Fix
Fixes the situation where there's a language set but not a direction.

Change-Id: If353b36ff0700717f1b8fd917b39c230de5ec272
2013-08-26 03:17:45 -04:00
jenkins-bot 3f7761d242 Merge "Modify regex to allow section links as valid titles" 2013-08-22 21:21:55 +00:00
Amir E. Aharoni b10b5143ff Reverse the progress image for RTL
The reversed image was created by Ebraminio using
convert loading.gif -flop loading2.gif

Bug: 51401
Change-Id: I264d9368cf8fd030ff34540e50e0038aa42ece16
2013-08-22 23:46:59 +03:00
Ed Sanders 227f214610 Modify regex to allow section links as valid titles
Bug: 53219
Change-Id: I552d0128de2c1ca683e30ae6d4b9fb137b827c7d
2013-08-22 19:24:16 +01:00
jenkins-bot 56ff25cb7c Merge "Fix copy and paste of backwards selction" 2013-08-22 18:14:17 +00:00
jenkins-bot 9a7b7e9176 Merge "getAnnotationsFromRange should only ignore non-content data" 2013-08-22 18:12:03 +00:00
Ed Sanders f9b92e8909 Fix copy and paste of backwards selction
Was previously broken as getSlice was using ve.Range#equals to
compare ranges which is direction-sensitive.

Bug: 51538
Change-Id: Ib58d1d8fd11b62388c111a5da66171d13a9db9c2
2013-08-22 18:10:34 +00:00
jenkins-bot 97c03da395 Merge "Don't emit Surface changes back to the Surface" 2013-08-22 09:48:23 +00:00
Trevor Parscal 3886821b9b Use mw specific names for commands
Objective:

* Use the MW link specifically, since the target/command system doesn't
  understand the group/id/extension concept yet

Change-Id: I8b756fa0bb55468312bb30d45ac5b943ff7362b5
2013-08-21 23:53:53 +00:00
Ed Sanders 380b368986 getAnnotationsFromRange should only ignore non-content data
Currently ignores all non-element data, but element content (e.g.
images) can be annotated.

Added test cases and updated the test runner to only compare
store indexes for a more readable output.

Bug: 50127
Change-Id: I234586a28072811c8288aab56f6abaaa0da0c88d
2013-08-21 22:32:34 +01:00
David Chan 24dae99065 Don't emit Surface changes back to the Surface
modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitContentChanges argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitContentChanges=false to calls to start/stop in certain places
* Explicitly pass emitContentChanges=true elsewhere, to preserve prior
  behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitContentChanges=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literals (to prevent potential editor
  problems)

Bug: 50105
Bug: 50346
Bug: 50631
Bug: 51477
Bug: 52716
Change-Id: I19ec7eaa0e3224cbfc7e7188e964183d7393c9a7
2013-08-21 17:26:32 +00:00
jenkins-bot ffdbc92a41 Merge "Toolbar API" 2013-08-20 23:17:42 +00:00
Trevor Parscal 332e31fb00 Toolbar API
Objectives:

* Make it possible to add items to toolbars without having to have all
  toolbars know about the items in advance
* Make it possible to specialize an existing tool and have it be used
  instead of the base implementation

Approach:

* Tools are named using a path-style category/id/ext system, making them
  selectable, the latter component being used to differentiate extended
  tools from their base classes, but is ignored during selection
* Toolbars have ToolGroups, which include or exclude tools by category or
  category/id, and order them by promoting and demoting selections of
  tools by category or category/id

Future:

* Add a way to place available but not yet placed tools in an "overflow"
  group
* Add a mode to ToolGroup to make the tools a multi-column drop-down style
  list with labels so tools with less obvious icons are easier to identify
  - and probably use this as the overflow group

Change-Id: I7625f861435a99ce3d7a2b1ece9731aaab1776f8
2013-08-20 16:08:26 -07:00
jenkins-bot 841a414c31 Merge changes Id2328d6e,I840b689d
* changes:
  Remove language variants from bold/italic now we have fallbacks
  Implement fallback langauges
2013-08-20 21:38:33 +00:00
jenkins-bot cd5ee730ab Merge "Remove duplicate comments from platform code" 2013-08-20 21:25:48 +00:00
jenkins-bot 4f6e42b699 Merge "Subscript is one word (and so is superscript for that matter)" 2013-08-20 20:37:49 +00:00
Trevor Parscal 4e6694c75e Subscript is one word (and so is superscript for that matter)
Objective:

* Unify the capitalization of subscript and superscript

Change-Id: I5a7fbc2d864c896ebb26177cf05c7adddacd8829
2013-08-20 13:34:50 -07:00
Ed Sanders 433f1eebcb Remove language variants from bold/italic now we have fallbacks
Bug: 53094

Change-Id: Id2328d6e7f89cd9deddde67b57cd7e3fc55683e6
2013-08-20 20:18:37 +00:00
Ed Sanders 069b757afc Implement fallback langauges
Return an array of languages instead of a single language. Languages
containing hyphens return themselves along with the root code e.g.
'en-GB' => ['en-GB', 'en']

Change-Id: I840b689d0021d865f93d16d075473a2ed0a9f0d8
2013-08-20 20:12:46 +00:00
Ed Sanders cbe35632f1 Remove duplicate comments from platform code
Inherited methods don't need to repeat documentation.

Change-Id: I05c4efe8e4a394411922add5f11259d47d44e3bb
2013-08-20 21:12:33 +01:00
jenkins-bot b2c65f2f87 Merge "Fix issue in 7673a398" 2013-08-20 19:15:38 +00:00
jenkins-bot 515283d142 Merge "Correct unicode range in legal title regular expression" 2013-08-20 18:28:36 +00:00
jenkins-bot e38bb7714f Merge "Change be-tarask to use Te instead of Te-El for bold" 2013-08-20 18:13:31 +00:00
David Chan f9c41c754b Correct unicode range in legal title regular expression
The old regex was lifted from PHP, which matches on UTF-8 byte sequences.
In PHP, [...\x80-\xFF]+ matches any bytes with the high bit set, which
by the particular properties of UTF-8 will match any sequence which
represents a Unicode character above U+007F.

In Javascript, regex matching is on UTF-16 Unicode code units, so we
don't have to do byte sequence matching (and cannot do so). So the
equivalent Javascript regex should use [...\u0080-\uFFFF]+, to match any
code unit above U+007F directly. (It also matches surrogate pairs, by
the particular properties of UTF-16, so any Unicode codepoint above
U+007F is matched).

Change-Id: I674b89f757b60331dd1cb23fd7ff8b18775012e9
2013-08-20 18:03:38 +00:00
jenkins-bot 34b143eb36 Merge "Increase line height in beta warning" 2013-08-20 17:30:42 +00:00
jenkins-bot 415de687ab Merge "Preserve selection when inserting references" 2013-08-20 17:24:43 +00:00
jenkins-bot bfc87b6d08 Merge "Don't change config during toolbar setup" 2013-08-20 17:20:44 +00:00
Ed Sanders b6443b262c Preserve selection when inserting references
Some browsers (e.g. Firefox) change the CE range when the dialog
is opened, so after the first surfaceModel change (to modify the
internal item) the surface's selection is modified, and the reference
is inserted in the wrong place.

Bug: 52159
Change-Id: Ia5da33b95a599ba78f308cf0554279ad44616f50
2013-08-20 18:18:37 +01:00
Ed Sanders f25d34d0a6 Minor syntax error
End of line comma instead of semi-colon.

Change-Id: I6e8d56e378b2a0f8846d18c413b0cccfb9b780d0
2013-08-20 18:06:28 +01:00
Ed Sanders f0c99b9c1e Change be-tarask to use Te instead of Te-El for bold
Bug: 53094
Change-Id: Ia442285e0d3f868fdda0bf06b8bb8f034c6c039f
2013-08-20 17:49:31 +01:00
Trevor Parscal a51fbbb300 Don't change config during toolbar setup
Problem: When the toolbar is created twice with the same config object,
the second time around the tools are still bound to the old surface

Reason: The tool config is overwritten such that symbolic names of tools
are replaced with instances of tools, bound to a specific surface. The
second time around, the creation fails (silently in a try-catch) and then
the already translated list of tools is used to create a new toolbar
filled with old tools still bound to the wrong surface.

Solution: Leave the config object alone, and instead build a new list of
tool instances while iterating through tool names.

Bonus: Don't fail silently. Using a try-catch to detect whether a
requested tool is supported masks other errors, and is evil. Instead,
just do a lookup and skip tools in which the lookup's result is falsey.

Change-Id: Ic43ec29173e556592bb3db9399ff83787e0a6857
2013-08-19 23:41:22 +00:00
Jforrester 40fc1b1bed Revert "Don't emit Surface changes back to the Surface"
This reverts commit 1987d3aa2b.

Change-Id: I5aaa6b0c743fbf6292030f566b6f7d993de740a7
2013-08-19 22:27:32 +00:00
Ed Sanders 4a3cc06ac5 Increase line height in beta warning
See bug for screenshots.

Bug: 53045
Change-Id: Ia4e97f42786cb8ced9ab1c94b1cce9f4abd17750
2013-08-19 20:22:18 +01:00
David Chan 1987d3aa2b Don't emit Surface changes back to the Surface
modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitChangeEvents argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitChangeEvents=false to calls to start/stop in certain places
* Pass async=false in the onDocumentKeyDown call to stop
* Explicitly pass emitChangeEvents=true elsewhere, to preserve prior behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitChangeEvents=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literal (to prevent potential editor problems)

Change-Id: Ia96efad0c808b9a02e508bbfda65fdf4f5cedeff
2013-08-19 14:20:08 +00:00
Ed Sanders 708d8b5e67 Build link-less images with <span> not <a>
toDataElement part fixed in  I6d496f7. This fixes the
toDomElement part so we don't trigger a round trip warning.

Bug: 51963
Change-Id: I27a7579890d669a8b980710db1bafe066b744236
2013-08-16 20:03:46 +01:00
jenkins-bot 27c0866d8a Merge "Check for past/future state in undo/redo before setting breakpoint" 2013-08-16 02:44:45 +00:00
Ed Sanders 5bff162bff Check for past/future state in undo/redo before setting breakpoint
This isn't a problem when using the UI buttons as they get disabled
but the command keys can still trigger these methods.

Also fix hasPastState to include check for small stack. This fixes
an existing bug where the undo button doesn't become active until
~1s after the first change is commited (i.e. after the small stack
is committed to the big stack).

Bug: 52113
Change-Id: Idbd34953c805620881a609409290256462af80a5
2013-08-15 19:37:36 -07:00
jenkins-bot 916d1c2b69 Merge "Create a subscript tool" 2013-08-16 02:16:25 +00:00
jenkins-bot c01499fb66 Merge "Create a superscript tool" 2013-08-16 02:15:42 +00:00
jenkins-bot ffc513fcf3 Merge "Create an underline tool" 2013-08-16 02:13:02 +00:00
jenkins-bot db16e7ce72 Merge "Fix traversal for images with link=''" 2013-08-16 01:24:51 +00:00
jenkins-bot 103bd6e499 Merge "LanguageInputWidget Generalization" 2013-08-16 01:18:24 +00:00
Moriel Schottlender 0fd2b619c9 LanguageInputWidget Generalization
This commit prepares the LanguageInputWidget to handle both annotation
and node, so it can be used as the GUI for both the LanguageInspector
and the LanguageBlockInspector that's coming up.

Cleaned up the way annotations are read into LanguageInspector and
AnnotationInspector. The attributes are kept in the Widget (without regard
to what datamodel they will serve) and are then read from the inspector.
The LinkInspector had to be adjusted slightly to accomodate a small change
in the AnnotationInspector too.

Change-Id: I17954707c00ffc4c32fbb44a6807a61760ad573c
2013-08-15 20:48:17 -04:00
Roan Kattouw c772431927 Fix issue in 7673a398
The update event passes in a transaction object, which was interpreted
as a config object and fragmented the cache. Explicitly wrap the
update() call in an event handler to make sure the config parameter is
undefined.

Change-Id: I641c68230b92d23626fb8b12aeab6a8904a35bcc
2013-08-15 16:32:41 -07:00
Ori Livneh 825322d4ac Use internal ve.track to log events
This patch rounds off change I29740fa7a by replacing calls to EventLogging's
eventLog.logEvent with calls to VisualEditor's ve.track. ve.track publishes
events by providing an interface, ve.trackRegisterHandler, which event handlers
use to subscribe to VisualEditor events. By making it the responsibility of the
web analytics framework to register itself as a handler, VisualEditor can
remain decoupled from (and indeed ignorant of) any particular event logging
implementation. This allows VisualEditor to be integrated with many different
web analytics platforms with nothing more than a bit of glue code for mapping
ve's event semantics to those of the target platform.

The practical difference that this makes is that it frees VisualEditor from
having to know about EventLogging or from having to load EventLogging
components, which means we can remove quite a lot of gnarly code. My current
plan is to migrate the code for registering and loading the 'Edit'
schema module to Extension:CoreEvents, which is also where I'll commit the
handler for VE events. (CoreEvents exists precisely to provide an organized
place for persistent but WMF-particular instrumentation.)

Once this patch is merged and deployed, the following two configuration
variables may be removed from mediawiki-config:

- $wgVisualEditorEnableSplitTest
- $wgVisualEditorEnableEventLogging

Change-Id: Idfdf692668d2adfbe029e8f0c4ff9e96c60ff741
2013-08-15 19:43:36 +00:00
James D. Forrester 23af88edc3 Create a subscript tool
Bug: 51612
Change-Id: Ia05e09a411213cbc035ad9dd3d3156d57f8e102c
2013-08-15 19:40:15 +00:00
jenkins-bot cec28fe287 Merge "Add ve.track, a generic dispatch of analytic events" 2013-08-15 19:39:24 +00:00
Ed Sanders 67f09a0318 Fix traversal for images with link=''
We were assuming images were wrapped in <a> tags. Images with
link='' are only <span> wrapped.

Bug: 51963
Change-Id: I6d496f719cfbbc7556c55f0a660cb192040f29de
2013-08-15 20:36:49 +01:00
James D. Forrester 34a37471c6 Create a superscript tool
Bug: 51611
Change-Id: I74b6418542927eeeb7e80d664a30fcaf07b93a13
2013-08-15 12:36:35 -07:00
Steven Zhang 3c65d830f2 Create an underline tool
Bug: 51609
Change-Id: I65246d7eeb154950c35a1cb70909a113080c2323
2013-08-15 12:16:01 -07:00
Ed Sanders 37b461fe56 Reposition context menu after rerender
Add rerender event to all image loads in MWExtensioNode.
MWHieroNode's implementation of onParseSuccess is now the same as
its parent so can be deleted.

Change-Id: Iaa4999372f1ba88a7bdf1490fc3f8640af77ceae
2013-08-15 10:43:31 +01:00
Ed Sanders 6fb65ec3a1 Fix MWAlienExtensionNode's extensionName in ce update
Create getter for extensionsName which is overriden by
MWAlienExtensionNode.

Also removed angle brackets around Alien title as the inspector
already has an angle bracket icon, and a '<' close button.

Change-Id: Ice8c5d73ed621f8e585b5f372788666f8c5aeb50
2013-08-15 10:40:58 +01:00
Ed Sanders 9582432c4c Fix logical conflict from I8feefd9e8
onUpdate was renamed to update. Also neither event was
actually implemented so have just removed them.

Change-Id: Iaae1661a99f97272fa42c71223fc2cb832d50c66
2013-08-15 10:18:22 +01:00
jenkins-bot 71f4472d34 Merge "mw.Target: Removed unreachable badtoken recovery code" 2013-08-15 08:40:08 +00:00
jenkins-bot 2c4e9d8323 Merge "Support previews and concurrent updates in ce.GeneratedContentNode" 2013-08-14 22:00:12 +00:00
jenkins-bot c84c47aeba Merge "Prevent the creation of invalid MWInternalLinks" 2013-08-14 21:58:27 +00:00
Ed Sanders 79b3dbf386 Fix rendering of inspector for embedded buttons
Previously we assumed that embedded icons mean we weren't
dealing with an inspector, but that is not always the case
(e.g. MWExtensionInspector).

Bug: 52845
Change-Id: Ifc5b054568661cb9badf6d7991f512b81e649b36
2013-08-14 18:50:54 +00:00
Ed Sanders 599ad772ed Allow inspectors to not show the delete button
This functionality makes sense for annotations, but not for extensions.

Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
2013-08-14 18:50:39 +00:00
jenkins-bot ddf748e53b Merge "Generic support for multiple tags in TextStyleAnnotation" 2013-08-09 04:42:32 +00:00
Ed Sanders 00c681f0d9 Generic support for multiple tags in TextStyleAnnotation
Bug: 52477
Change-Id: If8e2f541adb045f9b84a913829a5b7430ca83299
2013-08-09 04:15:45 +00:00
jenkins-bot 49748bd23a Merge "Darker toolbar group border" 2013-08-08 15:37:27 +00:00
jenkins-bot ba8e2231f8 Merge "Alien extensions" 2013-08-08 08:57:18 +00:00
Ed Sanders ad3a7c95c8 Alien extensions
VisualEditor.i18n.php, VisualEditor.php
* Button title
* New experimental files

ve.*.MWAlienExtensionNode.js
* Very basic extension of ve.*.MWExtensionNode

ve.ui.MWAlienExtensionInspector.js
* Default to inline-block for wrapper. Should probably
  get rid of styled wrappers for GeneratedContent eventually.

ve.ui.MWAlienExtensionInspector.js
* Basic extension of MWExtensionInspector. Override title to
  use tag name e.g. '<easytimeline>'. Could be changed in future
  to 'Extension: easytimeline' or similar.

*.png, *.svg, *Icons*.css, ve.ui.MWAlienExtensionButtonTool.js
* Angle bracket icon for button (open to suggestions)

ve.ui.MWInspector.css
* Make extension inspector text input tall by default.

Change-Id: I07f0686839192cad3cd8dfd3233ae907fe5cdf6a
2013-08-08 14:27:49 +08:00
Ed Sanders c89495d014 Darker toolbar group border
Roan and I think this is way too light. The only way
I can tell it's a group is by mousing over all of
the icons back and forth really quickly :)

Increasing to 10% alpha.

Change-Id: Iab55bf64921de5247d10d611318e545efe74fe4a
2013-08-08 14:12:33 +08:00
jenkins-bot 3a83811701 Merge "Handle <tt> as textStyle/code" 2013-08-08 03:45:34 +00:00
Roan Kattouw 7673a39878 Support previews and concurrent updates in ce.GeneratedContentNode
GeneratedContentNode didn't track concurrent updates at all, so a
race condition was possible: if the node was updated a second time
before the first update had been rendered, the second update might
render first and then be overwritten by the other one.

To prevent this, we track the promise associated with the current
render. If a new update is launched while a previous one is still
pending we attempt to abort the old one by calling .abort() on it,
and ignore any future resolution or rejection from it.

Also allow rerenders based on non-model data by calling
.update( { config object } );

Change-Id: I8feefd9e8fb6c41d06b8b20131e3be5e37954e83
2013-08-08 11:34:50 +08:00
Roan Kattouw cbadaa8d8b Fix deprioritization of regex matches in ModelRegistry
If you had an HTML element that was matched by two models, one with
a direct string match and one with a regex match, then the string
match would beat the regex match (which is correct) if they both
specified a tag name, but the regex match would win (which is wrong)
if they both didn't specify a tag name.

The fix is to only check for tagName === null if we're in tag-agnostic
mode (tag === '').

Change-Id: I9943611111e4c4ff498cdd95b7b3e72f95fb413b
2013-08-08 02:52:45 +00:00
Ed Sanders 1428ea9c27 Allow customisation of ui.Window titles
Provide getTitle() so subclasses can do something fancier than just
set a message.

Change-Id: I5eb82f70e39a991fa577aae4b0e7344908134d89
2013-08-08 02:49:18 +00:00
jenkins-bot 32734767fc Merge "clean up: Consistently use MW instead of Mw in constructor names" 2013-08-07 10:29:03 +00:00
Timo Tijhof eb0eeb240a clean up: Consistently use MW instead of Mw in constructor names
Most of 'em already do. Fixed the remaining ones.

Change-Id: I1a7ccb27dd66a33265dcaddaa7d34953d328ff87
2013-08-07 17:46:01 +08:00
Ed Sanders 0d1617a627 Hieroglyphics support
Mostly as a demonstration of how easy this is with MWExtensionNode.

The icon was chosen with the following criteria:
1. Recognisable (the ankh is quite common in popular culture, right?)
2. Doesn't look idiotic to academics (I've consulted an Egyptology
   PhD and they can confirm it's not the glyph for penis)
3. Renders well at <16x16

That said it does look a little like a stick man...

Bug: 43118

Change-Id: I9f9e8af501401866bfeecf0eec3690a705fbd4db
2013-08-07 09:43:04 +00:00
Ed Sanders 671c7d3b25 Create base MWExtensionNode for simple extension support
MWMath and other simple extensions all behave in a similar way, e.g.
<tagname>Foreign syntax</tagname>.

This creates a base class that should make supporting such extensions,
and editing their contents in a plain text box, very simple.

Change-Id: Icc0acb33fe32704f71dacb552d9dfa3142eaef2b
2013-08-07 17:39:31 +08:00
Ed Sanders b0ae68dd99 Add .static.getMatchRdfaTypes() wrapper
This allows abstract classes to specify RDFa types based on a static
property overridden by a child class. The default implementation is to
just use .static.matchRdfaTypes.

Change-Id: Ic71fc552a6a1626d94f998e9517af971e8198e79
2013-08-07 17:39:24 +08:00
peter-coti 5014e122e3 Create strikethrough text style button
Experimental to avoid making toolbar too long

Bug: 51610
Change-Id: I1eb5b1361d6058a6e1533ab62c0aa7e21c9fc090
2013-08-07 16:14:19 +08:00
jenkins-bot aeace0be29 Merge changes Ic3a64363,Ib5ae8f70,I738209d1
* changes:
  Add ve.ui.ToolGroup and use within toolbar setup
  Cleanup tool styles
  Make drop down tool work with generic toolbars
2013-08-07 05:11:57 +00:00
Trevor Parscal 2717ea1645 Add ve.ui.ToolGroup and use within toolbar setup
Objectives:

* Use a class for toolbar groups to add more functionality later
* Rename addTools method to setup

Changes:

*.php
* Add link to new file
* Move ui element classes up for more general use

ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js, ve.ui.Context.js,
ve.ui.SurfaceWidget.js
* Update use of addTools method

ve.ui.Tool.css, ve.ui.Toolbar.css
* Move styles between sheets

ve.ui.Toolbar.js
* Rename addTools to setup
* Use ve.ui.ToolGroup objects when building tools

ve.ui.ToolGroup.js
* New class, encapsulates tools

Change-Id: Ic3a643634a80a8ac7d6f6f47f031d001c7efaee7
2013-08-07 05:08:20 +00:00
Trevor Parscal 9426dfd54b Cleanup tool styles
Objectives:

* Make drop down tools look more like buttons and less like inputs, since they aren't text input and are buttons
* Make context toolbars inside surface widgets render correctly
* Show outlines of groups on hover to hint tool relationships
* Make neighboring active tools look cleaner

Changes:

ve.ui.Tool.css
* Merge ButtonTool and DropdownTool styles as much as possible
* Add styles for DropdownTool active states
* Only round the corners of the first and last tool in a group
* Soften the borders between consecutive active tools

ve.ui.Toolbar.css
* Add border to groups on hover

ve.ui.Widget.css
* Isolate surface widget toolbar styles by using stricter selector

ve.ui.Tool.js
* Fix incorrect capitalization of class name

ve.ui.SurfaceWidget.js
* Add classes to toolbar and surface for better style targeting

Change-Id: Ib5ae8f705ef1e9c481e5bdf8c8dcef9c1eb22c4d
2013-08-07 05:08:08 +00:00
Trevor Parscal 5a0faf5389 Make drop down tool work with generic toolbars
Objective:

* Remove ve.ui.DropdownTool's dependency on ve.ui.SurfaceToolbar so it
  can be used with any ve.ui.Toolbar

Changes:

ve.ui.DropdownTool.js
* Bind onBlur to document mousedown in capture mode instead of trying to
  add more and more things we are listening to which is a losing battle
* Refactor activate/deactivate mode changes
* Get rid of isEnabled check - surface should disable toolbar, the tools
  shouldn't be checking if the surface is enabled after the fact (also,
  this is harmless and doesn't change any actual interactions)

Change-Id: I738209d17649358c2f9812f9abac576960af867b
2013-08-07 03:27:30 +00:00
jenkins-bot 3904915b7a Merge "Actually fix bug 47793 for Opera for real this time" 2013-08-07 03:12:55 +00:00
jenkins-bot ed5917faae Merge "Update reference to renamed init.setupSectionEditLinks method" 2013-08-05 09:20:14 +00:00
MatmaRex 487197278a Actually fix bug 47793 for Opera for real this time
I trusted you guys when you told me to use DOM .focus() instead of
jQuery's .focus() and didn't test well enough :( The former doesn't
work, the latter does.

Follow-up to I7962f59b.

Bug: 47793
Change-Id: Iddfb8d7c99325b6c7a5d151948b57cfa5f0a6a62
2013-08-04 23:09:56 +02:00
Matthew Flaschen ccd9889cd7 Tweak comment to explain isAvailable and what mw.libs.ve means
Change-Id: Ie5df644b0e70871345950afa188545279c3ee91c
2013-08-04 14:11:25 +00:00
Timo Tijhof 293b707acd Update reference to renamed init.setupSectionEditLinks method
Follows-up e1f8ee7890

Change-Id: Ib9e6c8cf472f656052adca4fbd87630ec1aaf697
2013-08-04 16:09:04 +02:00
Ed Sanders 8c77b802b3 MWMath: Fix broken usage of old ve.copyArray method
Was missed or conflicted during the migration to ve.copy.

Change-Id: I2bb528212043a1be65ca9ae5b514981e18749fa2
2013-08-03 13:13:47 +00:00
Ori Livneh 246c655b28 Add ve.track, a generic dispatch of analytic events
This patch adds ve.track; it provides a means for VisualEditor code to log
various changes of state that are of potential analytic interest. This is done
without coupling VisualEditor to a particular analytics framework by providing
a method, ve.hook.registerHandler, by which event data may be routed to a
particular analytic framework for processing and dispatch.

ve.track uses a $.Callbacks-like object for tracking analytic events which can
remember an arbitrary number of past events. This is done by maintaining an
array containing the arguments of past calls and maintaining a counter for each
callback indicating its position in the queue (i.e., how many events it has
already received.) This ensures handlers are called for each event, including
events which were fired before the handler was registered. This allows the
load-order of VE and analytics components to remain unspecified.

Change-Id: I29740fa7a0ac403e484e0acee6dfcadaf6fc4566
2013-08-03 02:51:07 +00:00
Timo Tijhof 9e687efdf9 ve.ce.MWTransclusionNode: Check for API errors
See ApiVisualEditor.php#parsefragment.

Error code is also incorrectly about Parsoid, method
parseWikitextFragment does a FauxRequest to MediaWiki. Fixed
error.info. Keeping the same error.code for now for consistency.

Bug: 52483
Change-Id: Ic473ae4a5c1e9706140f6ec4cc8157fadd02c318
2013-08-03 00:35:42 +02:00
Ed Sanders d47cfe7d02 Handle <tt> as textStyle/code
Also store the node name so we round-trip correctly.

Bug: 52352
Change-Id: Id1fc85540804f5724ac7ded649a2d3ed0eb26770
2013-08-02 23:07:40 +01:00
jenkins-bot 686e134b41 Merge "Split ve.ui.Toolbar and ve.ui.SurfaceToolbar" 2013-08-02 21:37:07 +00:00
Trevor Parscal a226716d70 Split ve.ui.Toolbar and ve.ui.SurfaceToolbar
Objective:

* Make it possible to make a toolbar without a surface

Changes:

*.php
* Links to new file

ve.ui.Toolbar.js, ve.ui.SurfaceToolbar.js
* Split toolbar into generic and surface specific classes

*.js
* Update symbol names

Change-Id: Ice063a2fb67b5ce5155cdc96a0d47af49eee48cb
2013-08-02 14:33:25 -07:00
jenkins-bot dbfe499d25 Merge "mw.ViewPageTarget.init: Setup "source" links even if VE is not available" 2013-08-02 21:02:40 +00:00
Timo Tijhof e1f8ee7890 mw.ViewPageTarget.init: Setup "source" links even if VE is not available
Follows-up ced2a8a which moved the tab layout to the server-side
and changed it to set up "source" tab and section links always
everywhere (even if VE would not be availabe in the namespace
or browser).

The JS logic (which continues to exist to take care of pages
cached before we moved it to PHP and/or to fix up pages cached
with a different configuration in the future) didn't do this yet
causing the "Edit source" tab to inconsistently appear on pages
for anonymous users viewing pages where VE is not available.

Change-Id: Ic575b3fcef17e636adaa338abc7748a4388ed9a9
2013-08-02 22:25:44 +02:00
jenkins-bot 31e3fe5ab6 Merge "Make the link to the user guide open in a new window" 2013-08-02 20:04:55 +00:00
James D. Forrester ceb62980ed Make the link to the user guide open in a new window
Bug: 52475
Change-Id: Ia83ec459edb730bbc2adf5712586fdac269b7e00
2013-08-02 12:53:09 -07:00
jenkins-bot cd9c38aa9a Merge "Remove inserted leading whitespace" 2013-08-02 19:03:52 +00:00
Ed Sanders f153f932a2 Remove inserted leading whitespace
This is bit of a hack, as leading whitespace could be
significant if styled with white-space:pre.

Long term VE shouldn't be editing the user's HTML, and
should just highlight potential formatting issues.

We avoid the stripping in preformatted elements as we
expect they will have that styling.

Bug: 51462
Change-Id: I654d98e17dd604cb2a192831ff3f3597f95b9962
2013-08-02 19:01:22 +00:00
jenkins-bot 48017b4225 Merge "Allow more things to be inserted into captions" 2013-08-02 18:57:39 +00:00
Ed Sanders 0fdd124a17 Allow more things to be inserted into captions
Specifically: transclusions, formulae & references.

Captions also allowed to contain other images and reference lists
but we should probably not encourage that.

Change-Id: Ia1c99e51640a3f9ee53281a1e3ebd67dc13c8990
2013-08-02 18:55:53 +00:00
jenkins-bot ca93347c75 Merge "Only skip past empty keyedNodes sets if key exists" 2013-08-02 18:55:44 +00:00
jenkins-bot ed0203f6d0 Merge "Include element HTML in QUnit summary for diff" 2013-08-02 18:53:37 +00:00
jenkins-bot b85fc12b7c Merge "doc: Add missing @static to static ve.Element methods" 2013-08-02 18:44:48 +00:00
Ed Sanders 926db97d64 Only skip past empty keyedNodes sets if key exists
Otherwise unkeyed references won't be listed!

Bug: 52427
Change-Id: I8bbce955f584cca046e23d07aab8440f1e733657
2013-08-02 17:32:42 +01:00
Ed Sanders 42f82cf15f Include element HTML in QUnit summary for diff
Because trying to work out how broken your test case is
by looking at two (potentially multi-page) serialisations
of the DOM summary is a pain in the arse. Diffing two
HTML strings may highlight the problem much more clearly.

TODO: Is it possible to defer the calculation of the HTML
infused summary object until we have determined the assertion
has failed. Otherwise we're slowing down our tests for no
reason.

Change-Id: I873bf2479ab81d15389792bd59d15580da63941a
2013-08-02 16:10:05 +01:00