Commit graph

3981 commits

Author SHA1 Message Date
Inez Korczyński 2286259681 New static property - renderHtmlAttributes
It is going to be used at least for figure tags for which Parsoid gives as a lot of CSS class names that are useless for rendering purpose

Change-Id: I4b1e8084a6b7ab5294e0c3cf153fc6cffb3e8dac
2013-04-25 14:42:12 -07:00
Ed Sanders 09a90c1c7a Add method to ElementLinearData to get IVStore items in use
This is minimise the amount of data we need to serialise when
sending this over the wire.

The minimal IVStore data is added to the MW bug report, and
editedData fixed to only return the data array, not the full
LinearData object.

Documentation in AnnotationSet has finally been updated to
refelect the fact that it only stores Annotations
(was previous the generic OrderedHashSet).

getAnnotationFromOffset has been split out into a function
that just returns this indexes so that in cases where we
don't need the values we don't do an unneccesary store lookup.

Bug: 47318

Change-Id: I4819cf06d1bd0ae4f8b896052e278ca75c9551bf
2013-04-25 22:40:56 +01:00
jenkins-bot 13710a1ed4 Merge "Performance improvement for getRenderedContents" 2013-04-25 21:37:25 +00:00
Inez Korczyński 93357b8f34 Performance improvement for getRenderedContents
Instead of calling $.append for every single char - buffer and call $.append only when really needed.

Change-Id: I53acfa795ea5dc6a8ca39ce11017daa85c9151d2
2013-04-25 14:15:01 -07:00
jenkins-bot f56b83e07e Merge "Remove fixUpStack to fix blank paragraph insertion bug" 2013-04-25 21:14:53 +00:00
James D. Forrester f0181c8873 Move feedback link to the right list of messages
Whoops, I'm a complete fool.

Change-Id: I05115473dbb9cbd3ad055f2477005a5fb92fd384
2013-04-25 14:12:42 -07:00
Ed Sanders cd4ee24c0e Remove fixUpStack to fix blank paragraph insertion bug
The fixUpStack is actually redundant code and closingStack
and openingStack handle all our cases. It was causing the
insertion to try to correct balance itself in the middle
of inserting two paragraphs, causing the creation on an
empty paragraph between them.

Added a test case for the fix and other cases to make
sure removing fixUpStack hasn't caused problems.

Bug: 46800

Change-Id: I35e54165709ac56e8116359a7c3b487eecf08ff7
2013-04-25 14:04:51 -07:00
jenkins-bot e7ee9564e6 Merge "Improve resizable node rendering" 2013-04-25 20:47:10 +00:00
Trevor Parscal a64ceb74e0 Fix link inspector undefined madness
Reuse the existing internal link annotation builder instead of using a
constructor directly, and incorrectly (it's meant to be passed an
element, not an attributes object)

Change-Id: I4cda6a9c3442cb10ebbc0844630fedba403adc91
2013-04-25 19:43:39 +00:00
Trevor Parscal f8621f9ef8 Improve resizable node rendering
* Only place them in a high z-index while resizing so they don't render
  above dialogs and menus
* Add resize transition

ve.ce.ImageNode.js
* Switch from element attributes to CSS for setting dimensions

ve.ce.Node.css
* Add resizing class for resizable nodes for z-index
* Add transitioning class for resizable nodes for transitions
* Switch from border to inset box-shadow to not affect handle position
  calculation

ve.ce.ResizableNode.js
* Add/remove resizing class while resizing
* Switch from using $image to $resiable to make the class useful for
  non-image node
* Enable transition and set new dimensions before transaction processing
  which will cause re-rendering)
* Delay transaction processing for resize until after transition is
  complete
* Add hiding of context menu on resize start

ve.ce.Surface.js
* Add getSurface method so we can get to the context menu

Change-Id: I4667e394d0af4a80b651c2a0f6d11d30e196bf60
2013-04-25 11:45:11 -07:00
MatmaRex 7287c80293 Redo ve.createDocumentFromHTML() properly
Redone using document.implementation.createHTMLDocument instead of the
iframe trick. It's supported by all browsers we target, including IE9.

This also makes VE work on Opera using a nasty hack.
* Previously, for reasons I'm not even trying to understand, Opera
  would sometimes return an empty generic object from
  ve.createDocumentFromHTML() - but only if you weren't debugging it
  (Dragonfly was disabled). I have no idea what is it about the iframe
  hack that makes it not like it, but fact is, it doesn't work.
* Calling .open(), .write() or .close() on the document returned by
  document.implementation.createHTMLDocument acts as if it was
  window.document - that is, the entire contents of the web page are
  replaced with new ones. That's probably a one-word bug somewhere
  deep in Opera's innards; I reported it (it got the identifier
  DSK-384486). Until it gets fixed, we work around it by using
  document.documentElement.innerHTML, which works reliably.

Change-Id: I90ea547c735edaba9f7ecb8f685351ac6499c53e
2013-04-25 20:08:21 +02:00
jenkins-bot 5ed4f15460 Merge "Make the feedback link language-variable for release" 2013-04-25 16:09:39 +00:00
James D. Forrester 73cb0c7506 Make the feedback link language-variable for release
This involves setting some i18n messages for the target languages based on the
translations already provided - I hope this doesn't break anything for TWN but
the need for this only just became apparent; apologies!

Longer-term we will need to come up with a better way of doing this, if we are
keeping the in-VisualEditor feedback link around.

Change-Id: Id6ed80cdcd4314e84e75fb718421767162d73ef3
2013-04-25 09:02:28 -07:00
Ed Sanders bdb4a116d9 Hack to escape angle brackets in data-parsoid attribute
Parsoid is sending us some unescaped HTML in the data-parsoid
attribute. When we try to rebuild ref nodes (inline aliens)
this confuses Firefox which tries to sanitise the HTML by converting
<ref/> to <ref></span>.

As a temporary fix we can manually escape <>'s inside the
data-parsoid attribute.

Also in this commit the new MWReference nodes have been moved
to experimental as they are incomplete.

Bug: 47417
Change-Id: Ib6a0cfb880e769f28b42c9fa63ddc1abc75c399d
2013-04-25 14:55:17 +01:00
jenkins-bot dfe4c1b98f Merge "Link inspector fixes" 2013-04-25 01:31:33 +00:00
Trevor Parscal 3f3c87ce24 Link inspector fixes
ve.ce.Node.css
* Added prefixes for use of box-sizing

ve.ui.MWLinkInspector.js
* Whitespace

ve.ui.Inspector.css
* Corrected input width, always 100% wide now by using box-sizing

ve.ui.DialogButtonTool.js, ve.ui.Context.js
* Updated use of getViewsForNode

ve.ui.ViewRegistry.js
* Added inheritance-based prioritization for matching views with annotations and nodes

Bug: 47413

Change-Id: I286a28002c1691e58bbd7de04ed08cceb8b3bb07
2013-04-24 18:29:55 -07:00
jenkins-bot dc37f3132e Merge "Create and process transaction only if the value of given attribute (width or height) really changed" 2013-04-25 00:27:04 +00:00
Inez Korczyński 6b7d62e4a4 Rename MWImageNode to MWInlineImageNode (get ready for adding MWBlockImageNode soon)
Change-Id: I617e2a17cb6fbd11e486c2981e361ae931ac1870
2013-04-24 16:49:07 -07:00
jenkins-bot 4d64b0bb8f Merge "Mixin tracking" 2013-04-24 23:23:00 +00:00
Inez Korczyński 939985ccd8 Create and process transaction only if the value of given attribute (width or height) really changed
Change-Id: I4177478171e1d417634adb06f3bf74af0c77c15e
2013-04-24 15:49:33 -07:00
jenkins-bot 22cd7cfe98 Merge "Selecting generated content with cursor keys" 2013-04-24 22:26:22 +00:00
Christian Williams f8f82c8eaa Selecting generated content with cursor keys
Using left and right arrow key to move to and over an image will
select the entire node.

Bug: 37870
Bug: 38129
Change-Id: I70deadd2c2707149ea33e3b8ee42fb0d8508aacc
2013-04-24 13:22:41 -07:00
Translation updater bot 4d0ca9a4f7 Localisation updates from http://translatewiki.net.
Change-Id: Ie342a495e66b207423ba3f6a8a84c53f3f172c92
2013-04-24 20:09:34 +00:00
Trevor Parscal 898866a598 Mixin tracking
Change-Id: Ic3e4472b9e69458f0797c17f72dbcd2ec5267893
2013-04-24 12:45:53 -07:00
Timo Tijhof c1383b8012 ve.init.mw.ViewPageTarget: Account for serialize error
This is showing a separate need for refactoring. We call
"this.serialize( ..., callback )" but if it failed callback
is never called and an event is emitter for the error.

That makes it rather disconnected from each other.

In this case we're lucky that all calls to serialize are similar
in nature and need the same kind of error callback but other
wise this would be pretty messed up. It obviously needs to be
untangled and get rid of this akward eventemitter dance.

This doesn't fix bug 47581, but it does fix the "Infinite loader
with no error" problem as a result of it by handling the error
in a more intuitive way.

Bug: 47581
Change-Id: Icdf64a792c13a326f494e051be47f2946928d142
2013-04-24 02:06:12 +02:00
jenkins-bot 7a75e6309d Merge "Added unit tests for getRelativeOffset method" 2013-04-23 23:57:26 +00:00
Inez Korczyński f21a385bd9 Refactor renderContents() deduplication code
Change-Id: Ib8672b51fc236cac805b88a99d07b3c496548cbd
2013-04-23 16:10:18 -07:00
Raimond Spekking f00da336a5 Revert "Localisation updates from http://translatewiki.net."
Overwrites If598552fac639da645a8b1273c5fc6028695fcc1

This reverts commit d53bb3a578

Change-Id: I2ab4f72058d3e42a3f380aaebdf1f9730c659a4a
2013-04-23 20:27:00 +00:00
Translation updater bot d53bb3a578 Localisation updates from http://translatewiki.net.
Change-Id: Ie746cd3269a47233b43f6eed6bd825622a4890fc
2013-04-23 20:15:18 +00:00
jenkins-bot c762dced66 Merge "Add menu icon" 2013-04-23 19:32:40 +00:00
jenkins-bot bb34823cbb Merge "ViewPageTarget: Refactor 'replace' tabLayout" 2013-04-23 19:11:14 +00:00
jenkins-bot 599ad7e7f5 Merge "Add data model support for MediaWiki references" 2013-04-23 14:05:26 +00:00
Ed Sanders 6ad61d4ddb Add data model support for MediaWiki references
So far just read-only.

Bug: 39599
Change-Id: I6daff5c5969e5fdc871f8f346cf790b4302ae080
2013-04-23 10:17:42 +01:00
jenkins-bot 65602e1b84 Merge "Minor logic fix in ve.createDocumentFromHTML()" 2013-04-23 05:09:36 +00:00
jenkins-bot f5529dbabd Merge "Fix ve.ui.get$$'s handling of jQuery selection" 2013-04-23 03:10:01 +00:00
MatmaRex f4d28243a2 Minor logic fix in ve.createDocumentFromHTML()
iframe.contentDocument doesn't seem to have a key called 'document' at
all; I assume a different nesting was intended.

Change-Id: Ia37e3719d5247408bac2dfad1717d9193fb84c06
2013-04-23 00:41:41 +02:00
jenkins-bot e7fb5d9cce Merge "AnnotationSet optimisations." 2013-04-22 21:20:15 +00:00
jenkins-bot 196123e7a5 Merge "MWTemplateNode should serialise original HTML if unchanged" 2013-04-22 21:15:41 +00:00
Inez Korczyński 390f884aed Added unit tests for getRelativeOffset method
Change-Id: I45538f3e698229c003097c84edceac7ae4e4eb05
2013-04-22 14:12:56 -07:00
Ed Sanders 2bd6f8576a MWTemplateNode should serialise original HTML if unchanged
To help the selective serialiser we can return the original
HTML for generated content if it is unmodified.

As the output of toDomElements now depends on changes
to the dataElement we now have a 'modify' function in
the some test cases.

We also now have 'storeItems' to assert that the index-value
store is correctly populated and for loading values back
into the store for toDomElements tests.

Also make 'mw' an attribute and remove 'about' property.

Bug: 47394
Change-Id: I2bbb5d2d6a90c4eb87fa129671112c92a9b931e7
2013-04-22 20:44:21 +00:00
Trevor Parscal 3bcac07aab Fix ve.ui.get$$'s handling of jQuery selection
Turns out, the context property of a jQuery selection isn't always
there.

For example:

$( 'body' ).context === document
$( '<div>' ).context === undefined

Even if you later attach that div, so long as you have the old
selection around, the cached `context` property won't magically be
updated. This makes sense (although it's poorly documented in the
jQuery API) but causes issues for us, and pretty much makes the
context property useless.

Instead, we can just use the standard `ownerDocument` property,
available on all DOM elements.

This change also add support for passing in a DOM element directly, in
addition to the existing support of passing jQuery or Document objects
in.

Change-Id: Ib8a31b74f2a4f455b1318be9f5c7805a2a193c79
2013-04-22 20:36:42 +00:00
Timo Tijhof cc37ba242b ViewPageTarget: Refactor 'replace' tabLayout
The 'add' tabLayout path is pretty basic and up to date. The
older (now active again) tabLayout 'replace' was fairly outdated
and unmaintained.

Fixes:
* Attributes copied from the original (except for the 'id'
  attribute) were not actually beinged copied over because they
  don't exist on the ca-edit list item, but on the anchor link
  inside that list item.
* Clean up messages from the module registry that were unused.
  Keys 'accesskey-ca-edit' and 'tooltip-ca-edit' were also inexistant.
* Add message keys for tooltip and accesskey of editsource tab.

Depends on I0bde1a228983c58b in mediawiki/core.

Bug: 47396
Change-Id: If598552fac639da645a8b1273c5fc6028695fcc1
2013-04-22 20:09:46 +00:00
Catrope 3848c3f220 Factor the <pre> newline hack out of the converter into ve.properInnerHTML()
Also add detection for whether the browser is actually broken (most are,
but some, like Opera, aren't), treat <textarea> and <listing> in addition
to <pre>, and fix a bug where the function would crash if the <pre> was
empty (because .firstChild was undefined/null).

Change-Id: I541b57e9fd5c9c42d19d0a59f6e29fb43d35c9b6
2013-04-22 20:09:52 +01:00
jenkins-bot b3850a65e3 Merge "The resurrection" 2013-04-22 18:38:12 +00:00
Ed Sanders 1998496e49 AnnotationSet optimisations.
addSet:
* Instead of indexing items in the store, just union the indexStore arrays

removeSet/removeNotInSet:
* difference or intersect the indexStore arrays

filter:
* push indices into the result set instead of values

simpleArrayUnion/Intersect/Difference have been created as utilities
in ve. They are prefixed 'simple' because they use object keys to
do fast in-array comparisons. This means they are limited to string
values or values which will compare as strings (e.g. numbers).

Change-Id: I079cbdfece4f6d80ec0afd61959913f13217fcb3
2013-04-22 19:37:19 +01:00
Trevor Parscal 66afffa685 Add menu icon
Also fix reference icon class name

Change-Id: I3ace9644c74687047995f8c896d4133bbb59ede2
2013-04-22 10:51:10 -07:00
jenkins-bot dc57d8a3d2 Merge "Move config vars that are global in nature to the startup module" 2013-04-22 15:06:07 +00:00
Ed Sanders 8b09dd7650 The resurrection
By removing the transaction listeners from surface fragments we
no longer have to make sure they are always manually destroyed.

In order to retain the functionality of having fragments update
with transactions elsewhere we keep a pointer to a place in the
new complete history stack in the surface. The complete history
stack records all transactions, even undone ones.

Whenever getRange is called we replay all transactions in the
complete history (in the correct order) since the fragment was
last updated.

Also in this commit:
* Updated Format/IndentationAction to test undo(). This increases
  coverage of surface fragment behaviour.
* .range is always accessed by .getRange now, although as an
  optimisation we can use the noCopy mode when we a sure the
  returned range will not be modified.
* Added undo test to .update (previously .onTransact)

Bug: 47343
Change-Id: I9e9818da1baa8319a3002f6d74fd1aad6732a8f5
2013-04-22 12:50:23 +01:00
Translation updater bot e2ea207bf4 Localisation updates from http://translatewiki.net.
Change-Id: I4e44b9415dd16b10b2354c0049e1cbfd53a137e5
2013-04-20 22:44:05 +00:00
Gabriel Wicke 1d27c3cd26 Actually send oldid on POST like we promised Parsoid we would
VisualEditor did not send an oldid on POST so far, which disabled
selective serialization in production.

Bug: 47434
Change-Id: Ib1b7079a7fd3357903e5a14795ed0d2f2bdc5d16
2013-04-19 22:24:31 +00:00