Blacklist/convert tables and headings in VE target

Change-Id: I5e58fb1da1cb793bad5fb9640ef2dbf14c96d082
This commit is contained in:
Ed Sanders 2020-02-06 15:48:26 -08:00
parent 2fcc23ae61
commit 97cf4e8440
2 changed files with 37 additions and 4 deletions

View file

@ -42,9 +42,30 @@ CommentTarget.static.toolbarGroups = [
// Mention?
];
// Allow pasting links
CommentTarget.static.importRules = ve.copy( CommentTarget.static.importRules );
CommentTarget.static.importRules.external.blacklist[ 'link/mwExternal' ] = false;
CommentTarget.static.importRules.external.conversions = ve.extendObject(
{},
CommentTarget.static.importRules.external.conversions,
{
mwHeading: 'paragraph'
}
);
CommentTarget.static.importRules.external.blacklist = ve.extendObject(
{},
CommentTarget.static.importRules.external.blacklist,
{
// Annotations
// Allow pasting external links
'link/mwExternal': false,
// Strip all table structure
mwTable: true,
tableSection: true,
tableRow: true,
tableCell: true
}
);
// TODO Add edit switcher actionGroup

View file

@ -9,9 +9,21 @@ var CommentTarget = require( './CommentTarget.js' );
* @constructor
* @param {Object} [config] Configuration options
*/
function CommentTargetWidget() {
function CommentTargetWidget( config ) {
config = $.extend( {}, {
excludeCommands: [
'heading1',
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
'insertTable'
]
}, config );
// Parent constructor
CommentTargetWidget.super.apply( this, arguments );
CommentTargetWidget.super.call( this, config );
// Initialization
this.$element.addClass( 'dt-ui-targetWidget' );