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
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
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
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
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
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
iframe.contentDocument doesn't seem to have a key called 'document' at
all; I assume a different nesting was intended.
Change-Id: Ia37e3719d5247408bac2dfad1717d9193fb84c06
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
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
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
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
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
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
VisualEditor did not send an oldid on POST so far, which disabled
selective serialization in production.
Bug: 47434
Change-Id: Ib1b7079a7fd3357903e5a14795ed0d2f2bdc5d16
Actually really resizing the image
Show bounding box on mouseover with 4 handles. Bounding box is resizable. Image resizes to match bounding box on mouse up.
Change-Id: I1f3dac64eb86dd1f258937e4915af101b3ac19d8
*.php
* Added links to new file
ve.ce.ImageNode.js
* Added relocatable node mixin
* Added $image reference to the actual img element, so if it's wrapped
in a sub class the functionality in the parent class doesn't break.
* Moved drag start event handling to relocatable node
* Removed drag end binding, not needed.
ve.ce.MWImageNode.js
* Moved addClass to initialization section of constructor.
* Copied 'view' data prop from image element to keep stuff working after
the wrapping.
ve.ce.Node.css
* Switched to default (arrow) cursor for images.
ve.ce.RelocatableNode.js
* New mixing for nodes that should be relocatable
* Added implementation for drag start, which tells the surface to allow
dragging this node.
ve.ce.Surface.js
* Added relocation support, which is used by relocatable nodes
* Split onDocumentDragDrop into onDocumentDragOver and onDocumentDrop
which now have implementations that support relocation of nodes
ve.ui.Context.js
* Added relocation tracking to prevent context being shown while
relocating
Change-Id: I8703adfb707af2c3224431afc3418356ac2c686c
Currently some issues, probably with loading nodes
after factories.
Toggled by global $wgVisualEditorEnableExperimentalCode.
Change-Id: Idab3dd68572c037289c6742d03fd327285110f67
Current set up leaves us with restoring when we're not and vice
versa. Not good. :-) (Partial fix of change 59968.)
Change-Id: Ia33a2f3318cf2e46b7469b2c773e91c5ee8fdefa