mediawiki-extensions-Visual.../modules/ve/ui/tools/buttons/ve.ui.MWReferenceListButtonTool.js
Timo Tijhof 8a2c9431e6 Create ref list insertion tool
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
  of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
  object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
  in a detached tree.
* Fix deep property access that can fail. mwData is set to
  either JSON parse of data-mw attr or empty object.
  Accessing mwData.attrs.group needs to be guarded by whether
  mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
  (especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
  data element (similar to what MWReferenceNode already has).

Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
2013-06-22 20:23:22 -07:00

39 lines
1 KiB
JavaScript

/*!
* VisualEditor UserInterface MWReferenceListButtonTool class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Reference button tool.
*
* @class
* @extends ve.ui.DialogButtonTool
* @constructor
* @param {ve.ui.Toolbar} toolbar
* @param {Object} [config] Config options
*/
ve.ui.MWReferenceListButtonTool = function VeUiMwReferenceListButtonTool( toolbar, config ) {
// Parent constructor
ve.ui.DialogButtonTool.call( this, toolbar, config );
};
/* Inheritance */
ve.inheritClass( ve.ui.MWReferenceListButtonTool, ve.ui.DialogButtonTool );
/* Static Properties */
ve.ui.MWReferenceListButtonTool.static.name = 'mwReferenceList';
ve.ui.MWReferenceListButtonTool.static.icon = 'references';
ve.ui.MWReferenceListButtonTool.static.titleMessage = 'visualeditor-dialogbutton-referencelist-tooltip';
ve.ui.MWReferenceListButtonTool.static.dialog = 'mwReferenceList';
/* Registration */
ve.ui.toolFactory.register( 'mwReferenceList', ve.ui.MWReferenceListButtonTool );