Commit graph

6119 commits

Author SHA1 Message Date
Ed Sanders 519e54d463 ve.ce.Surface.handleEnter tests
Change-Id: Ic30cd4e116029be85822f73dcb84938e641bc4b9
2013-12-02 15:57:41 +00:00
Ed Sanders 96e2313e6e Genericise runSurfaceHandleDeleteTest to work with other 'handle' methods
We will want to reuse this test runner for handleEnter and handleInsertion.

Change-Id: I7489bf2d20fa17b1c164ff20e0cfcd9b9d5102d2
2013-12-02 15:52:44 +00:00
jenkins-bot 97adcc2103 Merge "Tear down the save dialog and remove it from memory on surface teardown" 2013-12-01 22:23:06 +00:00
Translation updater bot b8ff6dac4d Localisation updates from https://translatewiki.net.
Change-Id: Iba1328c19f95b6fe3cfad87c1e4752a2074ec844
2013-12-01 19:58:00 +00:00
jenkins-bot 10f745932e Merge "Render MW extension node wikitext with XML" 2013-12-01 19:06:30 +00:00
Ed Sanders 7982ecf2c3 Render MW extension node wikitext with XML
MW extensions are XML not HTML, so we shouldn't build them as XML
to prevent HTML specific rules being applied, such as <source>
always being self closing.

Bug: 54577
Change-Id: I84af4a29cd1c4ae4d1db4f70a4012a8ad0f98bf6
2013-12-01 17:13:39 +00:00
Translation updater bot 8786486289 Localisation updates from https://translatewiki.net.
Change-Id: I976bfc2217745b29ff5b7778077dda89bc8f2bf9
2013-11-30 19:55:33 +00:00
jenkins-bot 2cf336b958 Merge changes Icb404af8,Ib6efc2a5,I6d48f8ee
* changes:
  Make autonumbered external links inspectable
  Always remove the annotation when the remove button is clicked
  Add abstract getAnnotation() method to AnnotationInspector
2013-11-30 08:58:09 +00:00
Roan Kattouw 93b645a453 Make autonumbered external links inspectable
When the target of an autonumbered link is changed to a URL, it's kept
as an autonumbered link and its target is updated. When the target is
changed to a MediaWiki page, the autonumbered link is removed and
replaced with an internal link with the text set to the target.
So for instance, if you inspect [http://www.example.com] and change
its target to "Foo", the result will be [[Foo]].

The core of this commit adds support for inspecting nodes to
ve.ui.LinkInspector. This support should probably move into a
class in between AnnotationInspector and LinkInspector, perhaps
called HybridInspector or something, but I'm deferring that for now.

LinkInspector allows changes to inspected nodes to be reflected either
as attribute changes on the node, or by replacing the node with something
else. MWLinkInspector uses this feature to replace the autonumbered
external link node with an internal link annotation when the target is
set to an external link.

Bug: 53505
Change-Id: Icb404af84c24574438e4de3ef05bbd1993b593f7
2013-11-30 00:14:41 -08:00
Translation updater bot ee7eb817ec Localisation updates from https://translatewiki.net.
Change-Id: Ieac5d8326e80acf72160b4a3a60f295c1577f86f
2013-11-29 19:32:18 +00:00
Translation updater bot 4d76d9382b Localisation updates from https://translatewiki.net.
Change-Id: Iae9280bb9373b27f0764afbc19da57f7de280ea6
2013-11-27 19:28:46 +00:00
cmcmahon c65a683ecf [browser test] more shuffling of elements among iframes
Change-Id: I1a60e2370fc436702d983705d7360563f5483242
2013-11-27 09:05:58 -07:00
Roan Kattouw e41cb61814 Always remove the annotation when the remove button is clicked
Remove weird check that prevented a removal from happening if the
subclass's getAnnotation() method returned null.

This caused a bug where if you inspected a link, typed an invalid
link target (e.g. '|'), then clicked the remove button (trash can icon),
the inspector would close but the link wouldn't be removed.
However, if you typed something that was a valid link target (or didn't
touch the input at all), the remove button would work as expected.

Change-Id: Ib6efc2a5827b109c6b38185e6d89b7bb29b13a75
2013-11-27 14:55:33 +00:00
Roan Kattouw 0fe4a7778e Add abstract getAnnotation() method to AnnotationInspector
It was relied on, and all subclasses had one, but for some reason
it wasn't defined as an abstract method.

Change-Id: I6d48f8ee666bd339be87744840c6edb4abb56dbf
2013-11-27 14:52:18 +00:00
Ed Sanders 5b9231d49d Tear down the save dialog and remove it from memory on surface teardown
Otherwise the old save dialog will still be around if the user sets up
another surface (e.g. a second edit), but won't be attached to the DOM.

Bug: 57654
Change-Id: I23c10849a212534bdd0600637d8ad4fa3ebc4fb7
2013-11-27 14:00:16 +00:00
cmcmahon 0a091193f9 [browser test] elements moved among iframes
Change-Id: Icc9f3f4422dfed063073724f8b610e75fd967b2d
2013-11-26 18:55:21 -07:00
Timo Tijhof c852bf6000 ve.js: Coding style fixup for 6f2090aac6
Change-Id: I5ef9d590b5cc573df64f1c9099c79207c471cfb6
2013-11-26 23:00:24 +00:00
jenkins-bot 96cace53bc Merge "Note language links need to be edited on Wikidata" 2013-11-26 22:54:00 +00:00
jenkins-bot 91f00b0eaf Merge "Revert model to use simple UTF-16 code units" 2013-11-26 22:53:06 +00:00
jenkins-bot af9e6dd263 Merge "mw.ViewPageTarget: Use ve-activated class on the html element" 2013-11-26 22:52:14 +00:00
jenkins-bot c18534bcad Merge changes If814e178,Id133431e,I38d63e31,I16d575b6
* changes:
  Plain text paste with paste special
  Use rare unicode characters for paste placeholders
  Rich paste
  Add fixUpInsertion to newFromDocumentReplace
2013-11-26 21:07:46 +00:00
Rob Moen b37fbf9ba9 mw.ViewPageTarget: Use ve-activated class on the html element
This allows things outside of VisualEditor to style themselves
differently while the editor is active.

Bug: 57555
Change-Id: Ief6b5f53096dd5eeb43a72a7bb182a2c04ec97ca
2013-11-26 20:41:27 +00:00
Translation updater bot 1e77fad405 Localisation updates from https://translatewiki.net.
Change-Id: I20b98ddc532ac32388cabd63c9125b71cb7399b3
2013-11-26 20:24:29 +00:00
jenkins-bot 3b63e332b5 Merge "Also apply autonumbering CSS to links in generated content" 2013-11-26 20:13:24 +00:00
jenkins-bot 29d33c4528 Merge "Fix moving over an image with the arrow keys in Firefox" 2013-11-26 19:51:27 +00:00
David Chan 6f2090aac6 Revert model to use simple UTF-16 code units
This is a prerequisite to browser-based grapheme cluster handling, which
is needed so left/right cursoring and backspace behave as users expect.

modules/ve/ve.js
modules/ve/ce/ve.ce.Document.js
modules/ve/ce/ve.ce.js
* Revert cluster-aware splitting to trivial javascript code unit splitting
* Rewrite ve.splitClusters as a trivial compatibility method (remove soon)
* getClusterOffset/getByteOffset use unicodeJS.graphemebreak.splitClusters

modules/unicodejs/tools/unicodejs-properties.py
modules/unicodejs/unicodejs.graphemebreakproperties.js
modules/unicodejs/unicodejs.js
* Allow grapheme break tests to work with surrogate pairs

demos/ve/pages/minimal.html
demos/ve/pages/multibyte.html
demos/ve/pages/unicode.html
* replace file with more precise tests

modules/ve/test/ve.test.js
* Remove reference to grapheme-based splitting (which is no longer used)
* Correct typo

Bug: 53757
Bug: 51472
Bug: 51596
Bug: 51846
Change-Id: Ife34c87ebe40bc1689298b592eec5c0cdc2f7589
2013-11-26 19:38:14 +00:00
Ed Sanders b1e6dfcda6 Plain text paste with paste special
Register ctrl/cmd+shift+v as a trigger which sets a flag for the
next paste event.

When the paste special flag is set, modify the sanitizeData method
to strip all annotations, and any elements other than paragraphs.

Bug: 53781
Change-Id: If814e1786ffa805b52ab32f4a06f52da743fd9af
2013-11-26 18:23:58 +00:00
Thalia 65aab78d3b Use rare unicode characters for paste placeholders
Helps with bug reporting, like the snowman and pawn.

Change-Id: Id133431eea987442c8b50a05821ebd54649b26b9
2013-11-26 18:23:58 +00:00
Ed Sanders 7cec9ae04a Rich paste
Allow pasting of rich (HTML) content.

ve.ce.Surface
* Use a sliced document clone for converting to DM HTML (copy)
* Add full context to pasteTarget before copying
* Add ve-pasteProtect class to spans to prevent them being dropped
* Implement external paste by converting HTML to data and inserting
  with newFromDocumentInsertion
* Remove clipboard key placeholder after read so they aren't picked
  up by rich paste. Hash no longer includes the placeholder.
* Detect the corruption of important spans and fallback to clipboard
  data HTML if available.

ve.dm.LinearData
* Add clone method for copy

ve.dm.ElementLinearData
* Add compareUnannotated for use by context diffing.
* Add sanitize method for cleaning data according to a set of rules.

ve.dm.Transaction
* Add range parameter for inserting a range of a document only,
  e.g. stripping the paste context.

ve.dm.Document
* Implement sliced document clone creation so that DM HTML
  is generated correctly in onCopy

ve.dm.DocumentSlice
* Replaces LinearDataSlice. Now has two ranges for balanced data
  and data with a full context.

ve.init.Target.js
* Define default, loose, paste rules (just remove aliens).

ve.init.mw.ViewPageTarget
* Define strict MW paste rules:
  + no links, spans, underlines
  + no images, divs, aliens
  + strip extra HTML attribues

ve.init.sa.Target, ve.init.mw.ViewPageTarget, ve.ui.Surface
* Pass through and store paste rules.

Bug: 41193
Bug: 48170
Bug: 50128
Bug: 53828
Change-Id: I38d63e31ee3e3ee11707e3fffed5174e1d633b42
2013-11-26 18:23:12 +00:00
Roan Kattouw 21c72a553a Fix moving over an image with the arrow keys in Firefox
There was a bug when you moved over an image with the arrow keys:
if your selection was on an image and you pressed an arrow key, the
selection would move but focus would remain with the paste target
rather than going back to the document node, which caused strange
symptoms (immobilizing the arrow keys and scrolling horizontally)
in Firefox.

Bug: 57600
Change-Id: Iaf6a49787dd2fd2f3f88abd0d1f5ae512fd3fd68
2013-11-26 17:09:30 +00:00
Roan Kattouw f4bb62b9d7 Also apply autonumbering CSS to links in generated content
We had CSS that applied to our rendering of autonumbered links,
but not for raw <a rel="mw:ExtLink"></a> tags appearing in
generated content like templates.

Bug: 57420
Change-Id: Ic1585ecb1a133d16b7393ce0ce38a11b76cc2239
2013-11-26 16:53:31 +00:00
Rob Moen 07464e20a5 Remove the toolbar tracker
We were using it for the pop-out save dialog, but now that the save
dialog is real dialog, we don't need it any more.

Change-Id: I72697b5502d5f3fd19f2369a754a62d614af715b
2013-11-26 13:37:50 +00:00
jenkins-bot ef7152ff91 Merge "Use InputWidget facilities in byte limit counter" 2013-11-26 13:21:18 +00:00
jenkins-bot bb983c88d4 Merge "Don't build out save dialog when initializing editor" 2013-11-26 12:13:49 +00:00
jenkins-bot 4bfe1885c3 Merge "Share code between conflict resolution and the edit source switch" 2013-11-26 10:42:15 +00:00
Translation updater bot fda7482cde Localisation updates from https://translatewiki.net.
Change-Id: I70d8a96d3babae153047a263df0a77bd22711be0
2013-11-25 21:18:36 +00:00
jenkins-bot ea5a28e487 Merge "Move setting of minor/watch defaults from MWSaveDialog to Target" 2013-11-25 17:38:20 +00:00
Roan Kattouw 620e0e21ef Use InputWidget facilities in byte limit counter
* Don't use setTimeout() within a change event, because change fires
  after the text has already changed
* Don't use .$input.val(), use .getValue() instead
* Don't use .placeholder()
** Reaching into .$input is bad
** Any use of .placeholder() is TextInputWidget's responsibility
** All browsers we support also support placeholder natively
* Remove .editSummaryByteLimit from ViewPageTarget, unused
* Remove ve.bind() wrapping, we already have var saveDialog = this;

Change-Id: I380575fec8d02d1191bfc1f3f235b94c64cd23b6
2013-11-25 17:23:35 +00:00
Roan Kattouw 080b4380fa Don't build out save dialog when initializing editor
The save dialog DOM is pretty big, so building it on demand
like every other dialog out there seems like a good idea.

Change-Id: I02077c3e45f01d3467d41616eb879bd1d608a82b
2013-11-25 17:23:29 +00:00
Roan Kattouw 35e20d954f Share code between conflict resolution and the edit source switch
Each used their own implementation of building a form and submitting it.
The edit source one wasn't passing in the oldid, which caused edit
conflicts.

Also introduced a separation between form fields (for the action=edit UI)
and API options, building one from the other.

Bug: 56835
Change-Id: I38547b4ba1827f4028a2255109cba2a57cd59e8a
2013-11-25 17:23:20 +00:00
Roan Kattouw 72b0d2a19c Move setting of minor/watch defaults from MWSaveDialog to Target
It looks like it also came from there originally, because it uses
this.pageExists which doesn't even exist in MWSaveDialog. This caused
all pages, even existing pages, to be watched when 'watchcreations'
was set.

This logic really belongs server-side, though.

Bug: 56206
Change-Id: Idf500383b27a93136dc0cfdd60a2e7b2607af95c
2013-11-25 17:20:29 +00:00
David Chan b4f4eeb4b6 Event Logger: collect IME functionality info
ve/ce/SurfaceObserver.js
* Do not setTimeout if frequency === null

demos/ve/eventLogger.html
* Standalone event logging script

ve/test/ce/imetests/*.js
* JSON event logs for various tests/browsers/IMEs

ve/test/ce/ve.ce.test.js
* Add an IME test

VisualEditor.hooks.php
* Add test files

Change-Id: I50e89d5a289f3fcb4fe2a6835a2ec96fb497242c
2013-11-25 16:56:09 +00:00
David Chan addd1d7b23 Test Surface with IME-like event sequences
* modules/ve/test/ce/ve.ce.TestRunner.js
Class to interact with the CE Surface and document in tests

* modules/ve/ve.EventSequencer.js
Wrap setTimeout/clearTimeout calls (for easy replacement in tests)

Change-Id: I2e2407e2b169ae77237c87bf8857b3026cc7efce
2013-11-25 16:49:49 +00:00
Timo Tijhof c9b31e2d7e doc: Add Node to the list of built-in types
https://github.com/senchalabs/jsduck/issues/502

Change-Id: I4463f512849c7b21bc88e085c078079f50dffe6b
2013-11-25 16:13:32 +00:00
James D. Forrester eaa574e05a Note language links need to be edited on Wikidata
It wasn't true when we wrote this message, but now most of the language
links on most of the wikis are edited via Wikidata, rather than source
editing mode, so tweak the message accordingly.

Bug: 51816
Change-Id: Id11d1af397314030c3c74aa029974fcdfd9e10df
2013-11-25 15:14:33 +00:00
jenkins-bot 95358bb7a3 Merge "Consolidate edit section handling code in ViewPageTarget" 2013-11-25 13:47:20 +00:00
Roan Kattouw cf486e011a Consolidate edit section handling code in ViewPageTarget
Move generation of initial edit summary from setupSaveDialog() to
restoreEditSection().

This allows us to get rid of the properties tracking whether both
halves of the edit section handling had happened, because they're
now in the same method.

Moving setupSaveDialog() down so it runs after restoreEditSection();
this is needed for the communication via this.initialEditSummary
to work correctly.

Change-Id: I06a9c5cf5c752acea8a2ac25d0ffb6ac61cfe986
2013-11-25 13:40:05 +00:00
Roan Kattouw 9724bf939d Fix 1919fffc: forgot to add getInnerWhitespace() in one place
Change-Id: Ia90d671100ae445ef414c6aff7b27d078ba82ffc
2013-11-25 13:39:54 +00:00
Roan Kattouw 68426a948a Update OOJS UI to v0.1.0-pre (e5ef1e5b28)
Change-Id: I07c911756b6247d9d541841fb4bab3ac09b2d8d3
2013-11-25 10:47:49 +00:00
Translation updater bot 76d89342fc Localisation updates from https://translatewiki.net.
Change-Id: Ic5d686274996eb4ec2682f428c2c7464d5460071
2013-11-24 20:37:02 +00:00