* Use plain text rather than HTML in TextNode
** Bypasses HTML parsing, and doesn't cause regeneration of nodes like
appending to .innerHTML does
** We were only using HTML so we could use entities, so replace those
with \uNNNN sequences
* Use native DOM functionality rather than jQuery
* Inline flushBuffer()
Change-Id: I7c6376b55cc0f1420a01a77b365b073fe1636263
Better for performance (lower level, #get calls #toArray when
called without arguments) and more semantically correct.
Change-Id: I8e615674e51fd148367fd397bd169fa203a240ad
HTML5's drag and drop has a ton of benefits and a couple of
limitations. To achieve a native drag marker, an image tag helper
is used to indicate the size of the relocatable node. Chrome
shades the marker gray natively, Firefox is styled to match.
Change-Id: I755b698a3d968cc7e6ff125109d68ac83fd8a8a2
jQuery's implementation does some sort of traversal, so on large pages
it took 300-400ms just to focus the document node.
Change-Id: I0de95d8800a1aedeb19b27d204dfd8fd08cec533
This is a waste of time, because we hide it anyway. This took
quite a bit of time for long articles.
Change-Id: I1bcfd5b908c89dc2e08d5520e8870b145177ca10
* changes:
Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only
Fix for rendering block images
Follows-up I99acbd1699:
* "Parent method" comment
* Remove redundant slice() call to convert arguments to array,
native JavaScript methods that take array-like arguments such
as Function#apply and Array#slice are both compatible with
the Arguments objects, no need to convert it. Most invocations
already did this right but a few were recently introduced again.
* Removed silly "Document dialog." descriptions.
* Removed a few redundant "@method" tags in the near vicinity
of code I changed.
* Fixed function invocation to be either on one line or
one parameter per line. Having all arguments on one line
but the name + "(" looks confusing as it suggest there
is only 1 parameter. Same as object literals:
so:
{ foo: 1, bar }
or:
{
foo: 1,
bar: 2,
}
not:
{
foo: 1, bar: 2
}
Change-Id: I379bc2b32603bcf90aba9b4cd0112e7f027d070e
* Optimise initialisation by building the tree from the bottom up
and applying the class last.
* Actually document the dialog. Documenting it as "Document dialog"
is useless and confusing. If there is no documentation yet, leave it
empty so it is included in jsduck's optional "no_doc" warning list.
* Remove the redundant "Call" prefix in the parent method description,
we don't do this else where either.
Change-Id: I99acbd1699b2c99a2c9b58f34dc1e07bea58203d
Objectives:
* Introduce new icon for a reference
* Repurpose existing reference icon for references block
Change-Id: I1bfcdbeda3b9730d62d6b264ef72921e93623f7e
At the moment we create an alien meta item if an annotation
wraps contents of zero length, however we also need to handle
nested empty annotations, i.e. where the contents is other
empty annotations (i.e. alien meta items).
As alien meta items simply preserve DOM elements we don't
mind what type of alien meta items they are, so this also fixes
the case of an annotation wrapping another alien meta
e.g. a comment or <meta> tag.
Bug: 48605
Change-Id: I98d88b341efcd6384ee1fda5d6d7e1e1acb107aa
Previously pageExists thought matchingPages was an indexed object when
in fact it was an array. This didn't manifest as a bug as we subsequently
check the normalised URL in the correct manner (using indexOf), but it
did remove the optimisation of not running mw.Title if there was an exact match.
Change-Id: Ic616cbfa0d7ed5447e032dd1f772779db2dc19e5
Until this is fixed by Parsoid, this is a dirty hack that compares
HTML attributes on annotations, excluding data-parsoid. Obviously
we shouldn't have any parsoid specific code so this should be removed
as soon as it is fixed properly.
Bug: 48194
Change-Id: Ibb18b4f653c664e8ab7876498dc8395d878f7aaa
Was previously doing the text slicing before the cluster split
using substring, instead of after using splice.
Bug: 49233
Change-Id: If9c0860e2fe7b01eb0b27aae67c671062799a0fa
The API gives us normalisation information about all titles,
including titles of which it couldn't provide any template data.
Spec storage should only have properties with valid values
(has property means to have a valid value, like database). The
absence of this check was causing it to turn this:
{
pages: {
'Template:Unsigned': { params: { .. } }
},
normalised: [
{ from: 'foo bar', to: 'Foo_bar' },
{ from: 'template: unsigned', to: 'Template:Unsigned' }
]
}
into:
{
pages: {
'foo bar': undefined
},
normalised: [
{ from: 'foo bar', to: 'Foo_bar' }
]
}
Bug: 49493
Change-Id: I0b661744d0388345561897c9631f15e691737031
Previous condition was put in as part of I9ed6f9fb as a
temporary fix for bug 42842. However this code was causing
the popup widget to not appear for items at the start of
the document. It appears the bug it was put in to fix
has since been fixed elsewhere.
Bug: 49421
Change-Id: I8bcdea0f7a6951216bf8368865d23ef6246880ea
The transclusion dialog lets you completely delete all templates
within it. If this happens we should delete the node completely, or
not insert it if it's a new instance.
Bug: 49831
Change-Id: Ic5d4fbf73f3d1be9cf877bc8b98096de9e98991a
This function builds a transaction that takes a document slice and
inserts it back into the document it came from, applying any changes
that were made.
This makes editing document slices simple:
slicedDoc = doc.getDocumentSlice( captionNode );
// Edit slicedDoc using a surface
tx = ve.dm.Transaction.newFromDocumentInsertion( doc, captionNode, slicedDoc );
surface.change( tx );
Specifically, newFromDocumentInsertion replaces the node's contents
with the document's contents (meaning any changes made to the node in
the meantime are lost). It also merges the stores internal lists
of the two documents and remaps indexes accordingly. This means editing
of references inside of references is supported.
This functionality is not specific to slices, and can also be used to
safely insert data from a paste buffer, with internal list data being
transplanted correctly.
ve.dm.MetaLinearData:
* Make merge( [ undefined, undefined, ... ] ) return undefined rather
than [].
ve.dm.Document:
* In getDocumentSlice, store a pointer to the original dm.Document in
the new one, and also store the length of the internal list. This
allows us to figure out which internal list items the two documents
have in common when we insert the modified slice back into the main
document.
* In getMetadataReplace, optionally take the inserted metadata as a
parameter, to allow for operations that insert both data and metadata.
Per Ed's review, rewrite this function to return null rather than {}
if no metadata needs to be replaced.
ve.dm.InternalList:
* Add method to merge two internal lists
ve.dm.Transaction:
* Remove newFromNodeReplacement and replace it with newFromDocumentInsertion.
* In pushReplace, optionally take the inserted metadata as a parameter.
Change-Id: I786ee7bad796aa54bc242993b4de3ad18ad0773e
Without these properties set, the layout is collapsed into a 0x0px square due to the
parent having overflow-x: auto; and no width/height set.
Change-Id: I77aef8afa3327b11f453196badcdfad3f51f7c3d
The check for the toolbar not overlapping the last branch node
'fixes' an edge case where the user has scrolled too far, and
the viewport is shorter than the last branch. A more common
problem caused by this is that if the last branch is very tall
the toolbar disappears whenever you scroll past it.
Bug: 48662
Change-Id: I1c7662f2b6f1ced6f80dec16c6ed69a8cc0c06c8
Removed inherited (and often wrong) documentation, replaced direct
usage of onApplyButtonClick with more standard onClose handling,
and one case of calling the wrong parent method.
Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
"Template" parts should be labeled with a normalized version of what you would actually write inside a set of curly brackets.
Change-Id: I4b9c541a01da86cb078d38012e5a9fead2fa233c
Objectives:
* Clear this.titles when resetting, otherwise results are shown once and
then blacklisted forever.
* Attach done() before always(), so done() gets called first and not
after always() has dereferenced the request object.
* Remove use of imaginary variables like this.loading, which were never
set, and were referencing even more imaginary methods on other imaginary
objects like this.request.abort()...
Change-Id: Ifbe74346f68b6a91f425b56a2696fd1e46b61e02
If the query is cleared, we should still clear all items and abort any
loading that may be going on. We should still not try and load results
for an empty query though.
Change-Id: If23c6e0469247b1c1c47ab85b9a5a010e8a4fe26
Only remove the namespace prefix if it's in the template namespace,
and prepend a colon for main namespace titles.
Change-Id: Ie910bae172274e36c7c9a675a631a0876ff13ed1
1. It's redundant and ugly.
2. We already have an icon.
3. It's unnatural for anyone used to working with templates.
Change-Id: I821e124158a14679e411324620dc9d7c40252383
Objectives:
* Allow adding content or templates within a transclusion
* Add template placeholder to model and view which resolves to nothing
when saving (thus disappearing if not resolved)
Changes:
*.php
* Add links to new messages and files
ve.ui.OutlineControlsWidget.js
* Organize controls into "adders" and "movers"
ve.ui.Widget.css
* Add styles for adders/movers sections of outline controls
* Make adders appear on hover to reduce clutter
ve.ui.Icons-*.css
* Add icon for "add item"
ve.ui.Dialog.css
* Add styles for add template fieldsets
* Make placeholder items in the outline italic
ve.ui.PagedDialog.js
* Pass adders config to outline controls
ve.ui.MWTransclusionDialog.js
* Add support for adding content and templates
ve.dm.MWTransclusionModel.js
* Add addPlaceholder method
ve.dm.MWTemplatePlaceholderModel.js
* New class, pretty much an empty part
* Using this makes the UI much easier to work with - no need to special
case the outline control for new items
* Because it's not supported specifically in
ve.dm.MWTransclusionModel.getPlainObject, it produces nothing and goes
away naturally on apply
Change-Id: I3478560fb53ba2ccd3fb26bafb6a61e6415565eb
* Fix bug in MWTransclusionNode sometimes passing a NodeList rather
than an array (caused an error because NodeLists can't be .map()ped)
* Use copyDomElements in ce.AlienNode as well
Change-Id: I11c6483d3c062047be80f75a3fac03f13bff9662
* Provide a utility for copying an array of DOM elements into a
different document
* Copy the DOM elements returned in toDomElements(), otherwise weird
issues arise when the same data is converted to DOM twice
Change-Id: Ie927420624f0d4af0692e18d1bc6f952c8013d61
In aaa5ad2 we introduced a feature test. However though we do require
ES5, we don't (yet) use strict mode. It is an easy and solid one to
feature test, but it the unfortunate reality is that IE9 does not fully
support ES5. Strict mode is among the features it didn't (correctly)
implement. As a result commit aaa5ad2 locked out IE9 completely.
Replacing it with a more explicit (and harder to maintain) test that
does pass in IE9. We now need to be very careful about using ES5
features in our code. It has to be in this list here to avoid breaking
in a browser that doesn't support it.
Change-Id: I77b623e15a0791bfaa2cd835e43107cefb3c25f5
Objectives:
* Make get$$ work with empty jQuery selections
* Reset the $items selection when clearing a group
Changes:
ve.Element.js
* Add existing context property to possible solutions
ve.GroupElement.js
* Reset this.$items after detaching them
Change-Id: I73b46649d7ecd5045941086c4e1bb3241c8f4ef3
Added return boolean to ve.dm.Surface#breakpoint to indicate if
and transactions were pushed to the big stack. Use this value in
MWMetaDialog to see if we need to undo on close.
Added tests for ve.dm.Surface#breakpoint.
Bug: 49630
Change-Id: Ieb2e9e361afe057af93c4d374acc85df58bfb4c3
Slightly more efficient way of seeing if the template has changed,
and results in a cleaner set of data element attributes.
Change-Id: I1507520005bfb8a88bfa6038dac5c3b15506425d