The dom elements in the IV store are used for rendering, so if they
are sent by reference to the converter they get re-attached, causing
all templates to disappear from the page whenever you press 'review
and save'.
Fix is to run it through ve.copyArray, which clones all the nodes.
Change-Id: I1b03351a28ac82e0fdb7e94e761cf65d6548e501
Shields were being added twice. Switched the blank png to gif
because the red IE background couldn't be replicated. Changed
some styles from Alien to Protected.
Change-Id: I9c62665e4e0dc54b8511749b9d2a629db7990a16
init.mw.Target#serialize is an odd one because it is the only
target method that has a callback parameter (instead of
emitting the event on Target and having ViewPageTarget get
the event through that).
This line from onShowChanges needed to be added to onSerialize
// Invalidate the viewer wikitext on next change
this.surface.getModel().connect( this, { 'transact': 'onSurfaceModelTransact' } );
Though onSerialize is currently bound manually from the
serialize callback, it should be refactored to be like the others.
Bug: 44446
Change-Id: I9eddebbdf9294ee3d46286bdf1b157e00252d300
Factored the parsing of html/* attributes out into a static function.
Factored attribute (re)rendering out into ce.View, attribute updates
are much simpler now.
Change-Id: I4caa6d5e1e2c21c28ddff61c3c864e47f66cc6b2
For nodes that handle their own children (as well as leaf nodes and
meta items), store the first child's attributes in html/0-0/*, the
second child's attributes in html/0-1/*, the second element's third
child's fourth child's attributes in html/1-2-3/* , etc.
This obsoletes the ad-hoc code that basically did the same thing in
MWInlineImageNode.
Change-Id: If5abd2d5d9c361b359617ff4b0f3d6ba4c9b0142
We already do this in unit test so moving getDomElementSummary
and convertDomElements from ve.qunit.js to ve.js.
Apply ve.convertDomElements to report data before serialising.
Bug: 47948
Change-Id: Id807ccc6ff31d063be815ed4988cb35684adb76a
Store the HTML as a domElements array like everywhere else, rather than
as a string. Also disable HTML attribute preservation because there's
no point doing that when we're already preserving all of the HTML.
Also fixed a misnamed attribute (<li li="foo"> --> <li id="foo">) in
the test case.
Change-Id: I36bf8bade8118e07a75eb6f3a2427a00ef4915d7
We've housed these utilities for a while and changed some of
them quite a bit. Importing them to avoid regressions and
ensure we keep them in sync with our fork of it.
Removed references back through `@source`. They are sufficiently
different that the reference no longer adds any value.
Imported from https://github.com/Krinkle/K-js/blob/v0.1.2/test/K.test.js.
Change-Id: I9e71297246b7c248c1f032ba6b6ae1123519f3c1
It now allows you to specify which attributes to preserve in various
ways rather than just setting true or false.
Removed unused factory methods that exposed the old value.
Change-Id: I914164adcf1f0e48fa3fa85277e68c72dbad393e
The constructor doesn't use any parameter named "$resizable".
And the one usage of it (ve.ce.ImageNode) doesn't pass any
arguments.
Follows-up 3fe3032.
Change-Id: I30530f4199a7c8383933be286b7b7a705c05c26c
* It returned undefined instead of false if the subject
didn't have a 'mixins' property. This is because '&&'
is a DEFAULT operator, not an AND operator, it returns the
value, not a boolean per se.
* The logic of traversing to the constructor property was
broken since all objects in javascript have a constructor
property, and functions/constructors are also objects.
Follows-up Ic3e4472b9e694.
Change-Id: I462e7ce270c8cfc7e1970e359894ee4b7d90b881
Objective:
Generalize the shield and phantom magic, so we can use it for pretty much
any node we like. Usually this will be used with generated content nodes,
but also with aliens (of course) and possible other stuff in the future.
Bonus:
Also fixes a bug in DM that would crash VE when you selected to the end
and hit backspace.
Changes:
*.php
* Added links to files
aliens.html
* Added attributes to aliens to make them aliens again
ve.ce.AlienNode.js
* Moved shield and phantom functionality to ve.ce.ProtectedNode
ve.ce.AlienNode.js, ve.ce.MWReferenceListNode.js,
ve.ce.MWReferenceNode.js, ve.ce.MWTemplateNode.js
* Mixed in ve.ce.ProtectedNode
ve.ce.Node.css
* Reorganized styles and updated class names
* Added simple light blue hover with outline (using inset box shadow) for
protected nodes, same style as before for aliens
ve.ce.Surface.css
* Moved phantom styles to ve.ce.Node.css
ve.ce.BranchNode.js
* Moved call to setLive(false) to happen before detach() so that the
surface object is still available and events can be disconnected
ve.ce.BranchNode.js, ve.ce.Document.js, ve.ce.js, ve.ce.Surface.js, ve.ce.SurfaceObserver.js
* Adjusted CSS class names
ve.ce.Node.js
* Moved shield template to ve.ce.ProtectedNode
ve.ce.ProtectedNode.js
* New class, mix into another class to protect it from editing
ve.ce.RelocatableNode.js
* Renamed temporary surface property to relocatingSurface to avoid
confusion when debugging
ve.ce.Surface.js
* Moved phantom template to ve.ce.ProtectedNode
ve.dm.Transaction.js
* Fixed bug where most of the internal list was being deleted when the
end of the document was selected and the user pressed backspace
Change-Id: I2468b16e1ba6785ad298e38190e33493135719c3
A bug in I4bad882d1d6fb83bcdcfd0de3bfc9af52960c2ff caused the vertical
position to sometimes be NaN, and thus make the context in the wrong
place (but only vertically).
Change-Id: I5216af5c432caaa0fb400d8d006647b9f2488619
This makes it possible to use a static property to configure whether an
annotation should be applied to content added after it. This makes it
possible to do this for normal style stuff, but not for links.
TODO: Inez is going to add IE support for this since it inverts the
problem where the UI gets out of sync in all non-IE browsers to now make
it so it only gets out of sync in IE.
Bug: 48171
Change-Id: I5f279b06b098960be7bd4ad3f5e6f74b67e31d1a
Now comparing annotations in surface to insertionAnnotations
by comparable object to trigger pawn trick. Adding annotations
correctly to placeholder.
dm.Surface change method now uses setInsertionAnnotations()
and passes the AnnotationSet from offset-1. The set is cloned.
Added ve.ce.Surface.areAnnotationsCorrect() to compare either
annotations to the left or right to the insertionAnnotations.
Also use compareTo() and getComparableAnnotations() rather than
comparing by name, and fix SurfaceFragment.annotateContent() to
actually be selective when clearing rather than clearing everything.
Change-Id: I6116afa2e176daa0a0f2103a551501426829e2a6
Currently we just compare by store index, but a bold annotation
with data-parsoid attributes set should merge with a new clean bold
annotation. Similar rules apply to link annotations.
Bug: 48110
Change-Id: I93586919002c78732228e08b134e67e1a94f8ad7
For extension-specific types such as mw: , we require that all
types be matched. But we want MWTemplateNode to match
anything with an mw:Object/Template type, even if it also has
other types (like mw:WikiLink/Category in our test case).
Hack this into MWTemplate by matching on /^mw:/ then using
a matchFunction to assert that mw:Object/Template is in the
typeof attribute.
Update the test case. Because it's now a template, there's a bunch
of store stuff involved. Remove the other test case for about
group forcing because it's now a duplicate of this one.
Change-Id: Iacbe952a66d610c19b46bd76b84c50488857ac29
When converting an element that starts an about group with at
least one other element in it, we now only consider models that
support about grouping. This prevents the first node from being
converted to something else and leaving the others hanging.
In practical terms, this means that elements like
<link rel="mw:WikiLink/Category" typeof="mw:Object/Template">
get alienated and pull in the rest of their about group, rather than
being converted to a category or alienMeta or whatever and
leaving the other elements to be converted normally.
Added a test case that asserts this. Really the result should be an
MWtemplate rather than an alien, but that's a separate issue.
Also removed superfluous mustMatchAll checks; we've already
filtered the array by the time we get there.
Change-Id: I522ba4c56d5bc52c7e9aab1e2535385540c1315d
This was broken for both normal elements, where the meta item is
inside the element, and wrapper paragraphs, where the meta item
gets moved outside the wrapper.
Bug: 47712
Change-Id: I42daaf142e548e5b221ff0a52df0ad24ec6a4fd0
New ID is now passed from the API to the save event, to the onSave
handler. Empty diffs won't generate a newrevid.
Bug: 47420
Change-Id: I12ce27c8dc57f7aa753bcf5840635d5fea6b4e80
VE recreates the tab from scratch and deletes the old one
so as not to copy over access key settings. This fix
copies over classes from the old tab.
Bug: 47452
Change-Id: Ic2d42bb3034be25f388b587a00c3f523cfcc163c
Currently this code is unreachable as line 27 of the hooks file
checks the user's options for 'visualeditor-enable' before allowing
VE to load. For testing just comment out that line.
Bug: 47842
Change-Id: Ib5c3284c646ebcc0a8cad0b02de559d7820e05a0