mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
b1e6dfcda6
Register ctrl/cmd+shift+v as a trigger which sets a flag for the next paste event. When the paste special flag is set, modify the sanitizeData method to strip all annotations, and any elements other than paragraphs. Bug: 53781 Change-Id: If814e1786ffa805b52ab32f4a06f52da743fd9af
78 lines
1.4 KiB
JavaScript
78 lines
1.4 KiB
JavaScript
/*!
|
|
* VisualEditor Initialization Target class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Generic Initialization target.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
* @mixins OO.EventEmitter
|
|
*
|
|
* @constructor
|
|
* @param {jQuery} $container Conainter to render target into
|
|
*/
|
|
ve.init.Target = function VeInitTarget( $container ) {
|
|
// Mixin constructors
|
|
OO.EventEmitter.call( this );
|
|
|
|
// Properties
|
|
this.$element = $container;
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.mixinClass( ve.init.Target, OO.EventEmitter );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.init.Target.static.toolbarGroups = [
|
|
{ 'include': [ 'undo', 'redo' ] },
|
|
{
|
|
'type': 'menu',
|
|
'include': [ { 'group': 'format' } ],
|
|
'promote': [ 'paragraph' ],
|
|
'demote': [ 'preformatted', 'heading1' ]
|
|
},
|
|
{ 'include': [ 'bold', 'italic', 'link', 'clear' ] },
|
|
{ 'include': [ 'number', 'bullet', 'outdent', 'indent' ] },
|
|
{ 'include': '*' }
|
|
];
|
|
|
|
ve.init.Target.static.surfaceCommands = [
|
|
'undo',
|
|
'redo',
|
|
'bold',
|
|
'italic',
|
|
'link',
|
|
'clear',
|
|
'underline',
|
|
'subscript',
|
|
'superscript',
|
|
'indent',
|
|
'outdent',
|
|
'paragraph',
|
|
'heading1',
|
|
'heading2',
|
|
'heading3',
|
|
'heading4',
|
|
'heading5',
|
|
'heading6',
|
|
'preformatted',
|
|
'pasteSpecial'
|
|
];
|
|
|
|
ve.init.Target.static.pasteRules = {
|
|
'blacklist': [
|
|
// Annotations
|
|
// TODO: allow spans
|
|
'textStyle/span',
|
|
// Nodes
|
|
'alienInline', 'alienBlock'
|
|
],
|
|
'removeHtmlAttributes': false
|
|
};
|