Depends on I1ba8978dd in core.
Bonus: remove not-allowed-cursor & highlight title (which was
broken) now that we can display this information properly.
Bug: T106810
Change-Id: I1800490ba1b8e10ff54b26372a8a78661c1c7d68
In clipboard mode we need the full body regardless of if the reference
has changed since load or not.
Bug: T104230
Change-Id: Ie59e04d381f2fd2680e8af0cf05a80df71052822
Starting with I21fbbd3247bf7801e5ef9bd5312f95777f4dd6ef, Parsoid
will emit a new HTML for its Cite extension, which enables CSS
styling. In I487095df8a7c4241a14f7b4480360f6774130bec the new
module 'ext.cite.style' is added to the Cite extension to style
this new HTML format.
This patch
* Loads the ext.cite.style module if the Cite extension is
present.
* Uses the new HTML format for the internal structure of
reference and reference list nodes, so they are correctly
styled.
Backwards compatibility: Only new HTML is used internally in VE,
so as long as ext.cite.style can be loaded the new styles will be
used. It does not depend on which format Parsoid returns, so this
patch only depends on the Cite extension patch, not on the Parsoid
one.
Note: The only way I've found of adding a ext.cite.style dependency
only if Cite is present is to register the whole
ext.visualEditor.mwreference module in the
onResourceLoaderRegisterModules hook. Maybe someone can point to
a better way?
Bug: T86782
Change-Id: Ibf333a502d64d2ed6e029221458b7c606554e414
New changes:
a6144f3 [BREAKING CHANGE] Allow models to specify which extra RDFa types they support
Local changes:
* Use new allowedTypes property in model registry
* For reference nodes, allow 'dc:references'.
* For transclusion nodes, allow any other types.
* For image nodes, allow 'mw:Error'.
Bug: T98999
Change-Id: I7eb2b61eb9336792535e9fd6d5a8dd2d57065f04
By removing from and re-inserting into the InternalList when the right
attributes change, rather than trying to hack it into the model's
updateInternalItem (which won't get run on undo).
Bug: T71119
Change-Id: Iaf7a3127576b94666e05691902d2782394d24afb
Also, fix @returns comments (should be @return) and remove unnecessary
@method comments from the documentation.
Change-Id: Icd303626ac745c7ab5bff164f9b8cac276de1523
We unconditionally retrieved originalHtml from itemNode,
even if there was no data-mw.body.id, so as long as
the reference itself wasn't edited, we would never overwrite
data-mw. This meant that if the <ref> with the contents
was deleted, the contents wouldn't be transfered to the
first <ref> tag with that name like they're supposed to be.
The solution is to only look at originalHtml from itemNode
if data-mw.body.id is set.
Change-Id: Ib87491b6fa6a77d62384158f8e8f7dcc2a36c23a
New changes:
0ceafd5 Fix V8 deopt for ve.ce.BranchNode#onSplice
01d2d4b [BREAKING CHANGE] Store originalDomElements instead of htmlAttributes
96005a7 Localisation updates from https://translatewiki.net.
42e672e ve.ui.Toolbar: Don't call #updateToolState from #initialize
373562d Localisation updates from https://translatewiki.net.
Local changes:
Update for htmlAttributes going away
Change-Id: I576a1e5d5883b03d1fff6666926f80a5682a280f
If data-mw.body.html is not set, search for the element
whose ID matches data-mw.body.id and use its contents.
.body.html is still used for new content: new references
use .body.html, and if a reference using .body.id is
changed, the changed HTML is output in .body.html.
Bug: T88650
Change-Id: I5d614927256d59a3ab20b0bd6e882b5cb8fcda20
Aside from the confusion and differences between substr() and
substring() and IE8 bugs with substr(), substr() was removed from
the spec as of ECMAScript 5. It's been standardised in the
optional Annex B section of ES5.
Change-Id: I221ef6ae6956ce20dd9bb74510500f747d04c3b1
New changes:
a047e72 [BREAKING CHANGE] Create ve.dm.Focusable and store focusable flag there
Local changes:
* Add new ve.dm.FocusableNode mixin where required
Change-Id: Ie9ee2de05acfe3c4c62c4864e65bd20397d6a069
Update DM node constructors for I81c60d4a in VE core.
New changes:
2587549 [BREAKING CHANGE] Fix Node construction arguments
Change-Id: I8d4f37b631fe85a78c72407937477963ac49f87a
For the benefit of pasting out of VE.
Use data-ve-ignore where necessary to avoid the HTML being
used on the way back in to VE.
Change-Id: Iabe678c4246c1d1f51abb058b6e750811fdf9bea
Also make available as a static method so it can be used by the
converter. We will need this for generated HTML for the external
clipboard.
Change-Id: Ief843ac10cd6c6e4b25e09a007625d363792adff
Allow pasting of rich (HTML) content.
ve.ce.Surface
* Use a sliced document clone for converting to DM HTML (copy)
* Add full context to pasteTarget before copying
* Add ve-pasteProtect class to spans to prevent them being dropped
* Implement external paste by converting HTML to data and inserting
with newFromDocumentInsertion
* Remove clipboard key placeholder after read so they aren't picked
up by rich paste. Hash no longer includes the placeholder.
* Detect the corruption of important spans and fallback to clipboard
data HTML if available.
ve.dm.LinearData
* Add clone method for copy
ve.dm.ElementLinearData
* Add compareUnannotated for use by context diffing.
* Add sanitize method for cleaning data according to a set of rules.
ve.dm.Transaction
* Add range parameter for inserting a range of a document only,
e.g. stripping the paste context.
ve.dm.Document
* Implement sliced document clone creation so that DM HTML
is generated correctly in onCopy
ve.dm.DocumentSlice
* Replaces LinearDataSlice. Now has two ranges for balanced data
and data with a full context.
ve.init.Target.js
* Define default, loose, paste rules (just remove aliens).
ve.init.mw.ViewPageTarget
* Define strict MW paste rules:
+ no links, spans, underlines
+ no images, divs, aliens
+ strip extra HTML attribues
ve.init.sa.Target, ve.init.mw.ViewPageTarget, ve.ui.Surface
* Pass through and store paste rules.
Bug: 41193
Bug: 48170
Bug: 50128
Bug: 53828
Change-Id: I38d63e31ee3e3ee11707e3fffed5174e1d633b42
This fixes some of the problems with pasting references.
It's a bit overzealous in that references get renumbered even when
replacing, which is unnecessary but doesn't actually have any
noticeable effect.
Unfortunately, the internal list state depends so much on the converter
having run that we now need to add yet another hack, to set the counter
to the appropriate value.
Change-Id: I3c6514ce600af4f4c037f419554d34b5a5c86a63
Simply generating ':3' as the "unique" name for the 4th reference
doesn't work. Even if getUniqueListKey() had been used, that only
checks for conflicts with names that have already been encountered
(i.e. occur in <ref> tags that precede the current one), not for
conflicts with names that first occur further down in the document.
The solution is to generate names at serialization time, when we
have full knowledge of which names are in use. Internally, we use
'literal/<name>' for names that literally appeared in the source,
and 'auto/<number>' for unnamed references. Then at serialization
time, we translate 'auto/<number>' to 'literal/:<number>' if needed
(i.e. if the reference was reused).
ve.dm.MWReferenceNode.js:
* toDataElement()
** Prefix listKey with literal/ or auto/ as appropriate
* toDomElements()
** Map auto/ listKeys to unique names
** Don't try to unset the name if not present (was unsetting a property
that didn't exist anyway)
ve.dm.InternalList.js:
* Remove now-unused isUniqueListKey()
* Rewrite getUniqueListKey()
** Make prefix configurable
** Take previously generated unique keys into account
** Map the same old key (auto/N) to the same generated key (literal/:M)
* Add getNextUniqueNumber() as a source for auto/N numbers: previously
used the length of the itemHtmlQueue, but that only works during
conversion, not from the UI dialog
ve.ui.MWReferenceDialog.js:
* For new references or conflicting names, generate an auto/N key and
let toDomElements() deal with actually mapping that to name
ve.dm.InternalList.test.js:
* Rename listKeys to new style
* Split the test case into two groups so we can test multi-group cases
* Add tests for getUniqueListKey()
ve.dm.mwExample.js:
* Rename things to new style
* Modify the test case so it attempts to trigger bug 54341
Bug: 54341
Change-Id: I726fb83e6fb66ffec643d996768a854ec9474b3d
This avoids problems when unnamed references were copy-pasted.
Knowing that key is always non-null simplifies a lot of logic
elsewhere.
Bug: 53365
Change-Id: I3a23123ae732d9583814d38dd880a0cdf691fd5d
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.
Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1
Added @return in a few places where it was easy to add.
Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
It's totally unnecessary, and actually caused a bug where new references
got about="undefined", which caused Parsoid to about-group adjacent
new references together.
Bug: 52228
Change-Id: Id40d53c72a35412d612ae9441ae3d561622c1bec
These have been pointing to the same method for a while now,
we can safely remove these obsolete aliases and just use it
as generic copy.
* Each file touched by my editor had its new line at EOF fixed
where absent
* Don't copy an otherwise unused empty object
(ve.dm.Converter)
* Use common ve#copy syntax instead to create a link
(ve.dm.Document, ve.dm.example)
* Remove redundant conditionals for isArray/copyArray/copyObject
(ve.dm.example)
Change-Id: If560e658dc1fb59bf01f702c97e3e82a50a8a255
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.
All MW-specific files were moved into a parallel directory structure
in modules/ve-mw . Files with both generic and MW-specific things were
split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than
ve-mw/init/mw ; they're still named ve.init.mw.* but we should change
that. Some of the test files for core classes had MW-specific test cases,
so those were split up and the test runner was duplicated; we should
refactor our tests to use data providers so we can add cases more easily.
Split files:
* ve.ce.Node.css
* ve.ce.ContentBranchNode.test.js (MWEntityNode)
* ve.ce.Document.test.js (some core test cases genericized)
* ve.dm.InternalList.test.js (uses mwReference test document)
* ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js
** Made core tests use heading instead of mwHeading
** Updated core tests because normal headings don't break out of lists
** Moved test runners into ve.test.utils.js
* ve.ui.Icons-*.css
* ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css)
* ve.ui.Tool.css
* ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css)
ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js
ve.dm.example.js:
* Refactored createExampleDocument so mwExample can use it
* Removed wgExtensionAssetsPath detection, moved into mw-preload.js
* Genericized withMeta example document (original version copied to mwExample)
* Moved references example document to mwExample
ve.dm.mwExample.js:
* Move withMeta and references example documents from ve.dm.example.js
* Add createExampleDocument function
ve-mw/test/index.php: Runner for MW-specific tests only
ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only
ve.ui.Window.js:
* Remove magic path interpolation in addLocalStyleSheets()
* Pass full(er) paths to addLocalStyleSheets(), here and in subclasses
ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets
ve.ui.MW*Dialog.js:
* Subclass MWDialog rather than Dialog
* Load both core and MW versions of stylesheets that have both
ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class
* Don't inherit ve.ui.Dialog
* Rather than overriding initialize(), provide initializePages() which the
host class is supposed to call from its initialize()
* Rename onOutlineSelect to onPageOutlineSelect
ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js:
* Use PagedDialog as a mixin rather than a base class, inherit MWDialog
bullet-icon.png: Unused, deleted
Stuff we should do later:
* Refactor tests to use data providers
* Write utility function for SVG compat check
* Separate omnibus CSS files such as ve.ui.Widget.css
* Separate omnibus RL modules
* Use icon classes in ViewPageTarget
Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
2013-07-02 20:51:38 -07:00
Renamed from modules/ve/dm/nodes/ve.dm.MWReferenceNode.js (Browse further)