Firefox fires key press events for arrow keys - but we handle them
already in keydown - so the solution is to just ignore those
key presses in the handler.
Change-Id: I1aff295a0958b75697c4d362e0d6095283f37fe8
Previously, they were only being deduplicated based on the transaction,
which meant that an undo was seen as a duplicate (but then if you undid
again, that wasn't a duplicate).
Change-Id: If432ea28e6c206a2ad5562e529e2d3ed808c20e4
Parsoid switched from <!doctype> to <!DOCTYPE>, which exposed the fact
that our dirty regex to detect whether we're dealing with a full
document or a fragment was case-sensitive. Made it case-insensitive.
Change-Id: Ia8a38488e06ca7d7a6fb9a9699b5d9b5c5eb03f2
Clearing by type in SurfaceFragment didn't actually work. Instead,
it followed a code path intended for setting and created an annotation
of that type with no data, then tried to clear that. What we really
want to do there is clear anything with that type.
This fixes the bug where unbolding of text that was already bold in
the article didn't work.
Bug: 47680
Change-Id: I77f00e63c8732420063b0453fede7f453083c913
In most places we call .contains we already know the index, so we
can avoid store lookups by using .containsIndex.
Change-Id: I45a9a421473f9bec479ab8ccceceb162b7004c3a
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
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
Instead of calling $.append for every single char - buffer and call $.append only when really needed.
Change-Id: I53acfa795ea5dc6a8ca39ce11017daa85c9151d2
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
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
* 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
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