Commit graph

4334 commits

Author SHA1 Message Date
Ed Sanders 59bfc081df Store alien meta items' dom nodes only
We don't need to decompose and rebuild alien meta items
as they are uneditable, so just store the dom node and return that
in toDomElements.

Update test cases and several tests now need to use
assert.deepEqualWithDomElements.

Change-Id: I4d2eed267dac7855cb929a17d7aef566eaf0e287
2013-06-12 16:37:37 +01:00
jenkins-bot 75d36e5b32 Merge "Set sort keys on click-out too" 2013-06-11 21:16:55 +00:00
jenkins-bot 2573708132 Merge "Improve langlinks styling in meta dialog" 2013-06-11 21:16:02 +00:00
jenkins-bot 9e74da4f31 Merge "Add missing documentation for category widgets" 2013-06-11 21:14:54 +00:00
Trevor Parscal 0c935f69af Improve langlinks styling in meta dialog
Change-Id: I88d6d374d34dc08ecf46053cfc639c03ec23f8bf
2013-06-11 14:02:28 -07:00
Translation updater bot a8478b6fe7 Localisation updates from http://translatewiki.net.
Change-Id: Icd89869d643a9413d7f9230fad4a2b857cad5693
2013-06-11 20:57:43 +00:00
Roan Kattouw 9507b7767e Add missing documentation for category widgets
Change-Id: Idd01bb8d01363cb2eaf311abae8fa5ecf7b36f0e
2013-06-11 13:01:37 -07:00
jenkins-bot 2ce91bf4ca Merge "Text input widget enter event" 2013-06-11 19:59:33 +00:00
jenkins-bot 4d664cbeb6 Merge "Improve input widget value sanitization" 2013-06-11 19:47:34 +00:00
jenkins-bot f41045c51e Merge "Paged dialog upgrades" 2013-06-11 19:46:24 +00:00
Roan Kattouw 1be42c8fa6 Set sort keys on click-out too
Was previously only set on form submission, but there was no button so
you had to press the Enter key

Bug: 48555
Change-Id: I256d2b21bc2306959f6d6a0373386054b21dadfe
2013-06-11 12:41:22 -07:00
jenkins-bot ff48204896 Merge "Don't offer to move the very last category to the end" 2013-06-11 19:28:50 +00:00
jenkins-bot 0be4835151 Merge "Break words in the category dialog" 2013-06-11 19:28:09 +00:00
jenkins-bot 783a33624e Merge "Clean up incorrect use of regular expressions in CategoryInputWidget" 2013-06-11 19:27:22 +00:00
Roan Kattouw 514039b2ba Clean up incorrect use of regular expressions in CategoryInputWidget
getLookupMenuItemsFromData() constructed a regex from user input
without escaping. I don't *think* there are any injection
vulnerabilities here but at the very least it triggers exceptions
when the input is, say, a backslash. Instead, use .lastIndexOf() which
allows us to efficiently check whether a string starts with a certain
prefix.

getLookupCacheItemFromData() was stripping out the Category: prefix
using a regex that hardcoded Category: (so failed to detect localized
prefixes) and used global replacement, which meant that strings with
multiple occurrences of 'Category:' were handled incorrectly. Instead,
use mw.Title to strip the prefix. Also move away from .map() because we
may need to drop a result if it doesn't pass mw.Title validation.

this.categoryPrefix still has a few legitimate uses left, so keep it
around but set it to the localized namespace prefix rather than Category:

Change-Id: I6547f9df2e94fe81f6aefb9286e547425137344b
2013-06-11 12:25:41 -07:00
Trevor Parscal c32564f36d Text input widget enter event
Objective:

* Add an event to single line text input widgets to detect when the enter
  key has been pressed

Changes:

ve.ui.TextInputWidget.js
* Retain value of multiline config option
* Add key press handler to detect pressing of enter key
* Emit 'enter' event when enter key is pressed if input is single line

Bonus:

* Add missing documentation for multiline config option

Change-Id: Id9c64343f4a2ea8f0f45213fd2b59ca87c805b24
2013-06-11 19:21:32 +00:00
Trevor Parscal 6a3badfcc7 Improve input widget value sanitization
Objective:

* Prevent undefined and null from being converted to 'undefined' and
  'null' when given to setValue by converting them to empty string instead

Changes:

ve.ui.InputWidget.js
* Move all sanitization to one place
* Improve sanitization by adding cases for undefined and null

Change-Id: I8817a8fcac271e560a9e49887c68a035293866d4
2013-06-11 19:21:27 +00:00
Trevor Parscal 252e9b3d12 Paged dialog upgrades
Objective:

* Add functionality to paged dialogs to work with the pages and select
  them programmatically

Changes:

ve.ui.PagedDialog.js
* Keep track of the current page name
* Add setPage method, which is can be used publicly and is also used
  internally when items in the outline are selected
* Add a page content config option which auto-appends to the inside of
  the page
* Add removePage method for removing pages by name
* Add getPageName method which gets the current page name

Change-Id: I2a2f0c329d274796b8c9e7572ecff8294f472f7f
2013-06-11 19:20:57 +00:00
Roan Kattouw 73c393e3ab Use the correct $$ in the meta dialog
Change-Id: Id23228c67eb4e50b3912b6148374e459b0f59b34
2013-06-11 10:49:53 -07:00
jenkins-bot a61adfea45 Merge "Fix conversion of byte to grapheme offsets/lengths" 2013-06-11 16:46:13 +00:00
Ed Sanders 348d2355c6 Fix conversion of byte to grapheme offsets/lengths
Missed one case in ve.ce.Docuemnt#getNodeAndOffset.

Bug: 49246

Change-Id: Iff1dfb90130685bb710821f8386cfa2f296f2f95
2013-06-11 13:39:11 +01:00
jenkins-bot 9972fa86ea Merge "When editing meta items, modify them rather than rebuiding them" 2013-06-11 11:12:52 +00:00
Roan Kattouw b2fbe35962 Break words in the category dialog
Of course CSS is perfectly standardized and wonderful, so we need a bunch
of duplicative and non-standard rules.

Also fix the mixin in MWCategoryWidget

Change-Id: I24da0ddb29d2886c450da362fee47d22da8e631d
2013-06-10 16:49:01 -07:00
Roan Kattouw ad3a0ba1a2 Don't offer to move the very last category to the end
Bug: 48556
Change-Id: I93ce05f7cbb28313a3f0827539f0528c366aeb7e
2013-06-10 16:00:25 -07:00
Roan Kattouw 8e8ddd9cad Fix exception in InputWidget when config.value isn't set
Change-Id: I0d41d8b39aa6777f206ec47b8ceefff012e2b00b
2013-06-10 15:52:25 -07:00
Gabriel Wicke 0b558e0d09 Disable the 'cache' query parameter too
With explicit cache management on the Parsoid side there is no need to send
this explicitly any more.

Change-Id: I34bf3a6ffe631d3350c05ec4c21563f8a734effc
2013-06-10 15:41:49 -07:00
jenkins-bot fcfaa4c832 Merge "Wrap inline images in spans with display: inline-block." 2013-06-10 22:36:30 +00:00
Inez Korczyński 4d880cb28d Wrap inline images in spans with display: inline-block.
Change-Id: I8daac35c752ad33691955b2493191be990c78f58
2013-06-10 15:34:53 -07:00
jenkins-bot 03ed1a5a7f Merge "Match non-BMP characters in wordbreak regexes" 2013-06-10 22:19:15 +00:00
David Chan 6dacf615c0 Match non-BMP characters in wordbreak regexes
unicodejs.js:
* charRangeArrayRegexp to write surrogate-aware regexps
* private helper functions

unicodejs.wordbreak.test.js:
* test charRangeArrayRegexp
* corrected tests for non-BMP wordbreaks

unicodejs.wordbreak.js:
* use new surrogate-aware regexps

unicodejs.wordbreakproperties.js:
* generated from Unicode data

unicodejs.graphemebreakproperties.js:
* generated from Unicode data

unicodejs.wordbreak.groups.js:
* delete as no longer used

unicodejs-properties.py:
* generate unicodejs.wordbreakproperties.js from Unicode data
* generate unicodejs.graphemebreakproperties.js from Unicode data

index.php:
* update script tag links

/VisualEditor.php:
* update script tag links

/demos/ve/index.php:
* update script tag links

/maintenance/makeStaticLoader.php:
* update script tag links

Change-Id: I39c0386a85b0cf21d68d3385b84018a5d7648de5
2013-06-10 23:16:23 +01:00
jenkins-bot c41ee66ac7 Merge "Fix selection and hover for MW inline images." 2013-06-10 22:06:50 +00:00
Inez Korczyński 435b61303c Fix selection and hover for MW inline images.
Change-Id: I82444157a2f57739dc81039dd919233201041634
2013-06-10 15:03:38 -07:00
Ed Sanders e67b4030f3 Remove Parsoid hack and fix new references.
Now that I797b2bd87 is in we can remove the data-parsoid hack
for new references. Also fix the converter to always insert content
for keyless references.

Change-Id: Ia42907feb8f64637189eba15139177c7eb5e8899
2013-06-10 23:01:17 +01:00
Roan Kattouw 983d9287e9 When editing meta items, modify them rather than rebuiding them
When editing the default sort key or a category's sort key, we would just
build a brand new meta item and replace the original item with it. This
destroys whitespace information tracked in the .internal property though,
so the resulting diffs looked pretty bad.

Instead, use ve.extendObject() to base the new meta item on the old one,
changing only what we need to change and keeping .internal (and
htmlAttributes and anything else that may be hiding in there) intact.

Change-Id: I40f4403ea2f2d13542d2e3c8c53e2d7f79515381
2013-06-10 14:36:35 -07:00
Trevor Parscal 8039b1c2f8 Insert Reference
Objective:

* Allow opening reference dialog with arbitrary selection
* Auto-insert reference when selection is not a reference node

Changes:

ve.init.mw.ViewPageTarget.js
* Added reference button to toolbar

ve.init.Target.js
* Add getToolbarSubset so we can exclude the reference button from
  the toolbar in the reference dialog (nested references are not
  allowed).

ve.ui.MWReferenceDialog.js
* Stop storing referenceNode (not needed)
* Only store internalItem on open if there's a focused node that's a
  reference
* Use wrapper paragraph when creating a new reference
* Create new reference on dialog close if required

ve.dm.InternalList.js
* Major rewrite to support key less references.
* Add new method for creating a transaction to insert a new iternal
  item. Also returns the index of the new item to be passed to the
  reference node.

Change-Id: I839ae165c299248484ce93d4ab087318a95fbb94
2013-06-10 20:14:08 +01:00
Translation updater bot 863fe70098 Localisation updates from http://translatewiki.net.
Change-Id: I531e6caedacd3be2fac25b972aa3e3a0a59c9c56
2013-06-10 07:32:31 +00:00
Ed Sanders 1a86cb9c61 Preserve location of reference body within key
Previously we populated the reference body into all <ref> tags
with the same key. Now we store an internal attribute marking
which element originally had the data.

If that tag is deleted the body is moved to the first <ref> tag
with that name.

Change-Id: If9f12bfb699e6ce85bb8f7d2ea9e6df528610a3d
2013-06-10 02:54:26 +00:00
jenkins-bot b910f135ad Merge "Disable Parsoid URL cache busting with touched ts" 2013-06-08 01:00:37 +00:00
Christian Williams babaa4118d FocusedNode Selection
Introduction of fake selection for single focused nodes. This
change specifically makes the selection much nicer in appearance
for Chrome users selecting floated FocusableNodes (block images)
for example.

Added ve-ce-surface-highlights DOM element to contain styled
highlight elements.

Made adjustments to getSelectionRect to return fake selection
bounds if necessary.

Replaced old uses of showSelection with model.change().

Change-Id: I96e66567cdce6455ef3eb77568e72f23140448ff
2013-06-07 17:49:35 -07:00
Gabriel Wicke e655c80bc0 Disable Parsoid URL cache busting with touched ts
The Parsoid extension now keeps the cache for the current oldid up to date.
Removing the touched parameter lets VE use the cached HTML.

Change-Id: Id025c69060cb9a0bc2478ec49e2c436022049d97
2013-06-07 16:57:48 -07:00
jenkins-bot 7a75f74ab2 Merge "mw: Remove 'Report problem' feature" 2013-06-07 23:23:29 +00:00
jenkins-bot b2c298774a Merge "mw.ViewPageTarget: Make 'review' step optional in save flow" 2013-06-07 23:22:36 +00:00
jenkins-bot cd2f411a93 Merge "Support for inline images" 2013-06-07 23:13:19 +00:00
Timo Tijhof a0d764b8ee mw: Remove 'Report problem' feature
Removed the "report" slide from the mw.ViewPageTarget save
dialog and everything that becomes obsolete as a result of it:

* JS saveDialogReviewWrongButton, which pointed to the report
     slide (was already hidden as of I90de95f6337ee).
* JS ve.init.mw.Target#reportProblem.
* JS ve.init.mw.ViewPageTarget#diffHtml.
* JS ve.dm.ElementLinearData#getUsedStoreValues.
* PHP mw.config wgVisualEditorConfig.reportProblemURL.
* PHP $wgVisualEditorParsoidProblemReportURL.
* I18N visualeditor-savedialog-title-report.
* I18N visualeditor-savedialog-label-review-wrong

Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
2013-06-08 01:11:27 +02:00
Inez Korczyński 2f15cb0067 Support for inline images
Handles typeof mw:Image and mw:Image/Frameless

Change-Id: Ie2fbd4a3e12fb6faa4ab8e6dd0aa8d1334ff6498
2013-06-07 23:09:32 +00:00
jenkins-bot 8a614ae395 Merge "Use blacklist instead of whitelist for storeHtmlAttributes of MWBlockImageNode." 2013-06-07 23:09:17 +00:00
Timo Tijhof d5868a0f13 mw.ViewPageTarget: Make 'review' step optional in save flow
Summary:

Instead of having a button "Review and save" that opens with a
diff and leads the user to the "Report a bug" and "Save page"
slides respectively, make it more like the default EditPage.

There is now a "Save page" button that opens with the save
form with a button to "Review changes" (diff) or "Save page".

The "Report a bug" slide has been unlinked from the UI and is
no longer accessible for now.

As a result of the UI no longer requesting a diff upfront this
also means we will no longer detect "nochanges" event (when it
turns out the submittted revision matches the latest version).

This is unfortunate as it was a nice feature to detect it
before the user spends time writing the edit summary) but it
is the same as how the default EditPage works.

Changes:

Improved interface messages.

Adapted "nochanges" caption to the new context (it is no
longer shown when clicking "Save page", it is now shown as a
result of clicking "Show changes").

Now that the "save" slide is accessible from multiple paths
it is needed to keep track of slide changes in a history
array. Previously the slide tree was 1 level deep with
everything descending from "review". Now it starts at "save"
and can go in multiple directions including a loop from
save>review>save. We also need to toggle the "Prev" button
based on history instead of based on whether or not we are
on the "first" slide.

Hid the "saveDialogReviewWrongButton" from the review slide.
We're approaching wider launches and this will not scale to
a wider audience.

Bug: 49258
Change-Id: I90de95f6337eeddd794b75d56543d8d152421a6f
2013-06-08 01:05:05 +02:00
Inez Korczyński b6b4855434 Use blacklist instead of whitelist for storeHtmlAttributes of MWBlockImageNode.
Change-Id: Ief029005b3326a94a8432a3bd6de50669bd3a3b2
2013-06-07 16:04:45 -07:00
Catrope 10d415e63a Render block templates as <div>s and inline ones as <span>s
Right now block templates are rendered as <span>s

Change-Id: I4c941a03e0e34a435990f0392080a3a8bf3e2835
2013-06-07 20:04:01 +00:00
Trevor Parscal 5aac2f756c Block Image Resizing
Allow block images to be resized by mixing in ResizableNode.

Made transitioning optional, and disabled it for block image nodes.

Change-Id: If89948d285ffb5efb104c44cbc9553a3d56f52e7
2013-06-07 10:52:04 -07:00