mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Fix for Bug 37913
* Strips the first paragraph tag in a list item or table cell context if there are no attributes on it and stx:html is not set Change-Id: I74988645fe505c662f86488e32d0f11d464ffe41
This commit is contained in:
parent
604aae2f3f
commit
166e7a75c9
|
@ -228,13 +228,14 @@ var id = function(v) {
|
|||
};
|
||||
};
|
||||
|
||||
WSP._listHandler = function( handler, bullet, state, token ) {
|
||||
function isListItem(token) {
|
||||
if (token.constructor !== TagTk) return false;
|
||||
function isListItem(token) {
|
||||
if (token.constructor !== TagTk) return false;
|
||||
|
||||
var tokenName = token.name;
|
||||
return (tokenName === 'li' || tokenName === 'dt' || tokenName === 'dd');
|
||||
}
|
||||
var tokenName = token.name;
|
||||
return (tokenName === 'li' || tokenName === 'dt' || tokenName === 'dd');
|
||||
}
|
||||
|
||||
WSP._listHandler = function( handler, bullet, state, token ) {
|
||||
if ( state.singleLineMode ) {
|
||||
state.singleLineMode--;
|
||||
}
|
||||
|
@ -636,9 +637,22 @@ WSP.tagHandlers = {
|
|||
},
|
||||
p: {
|
||||
make: function(state, token) {
|
||||
// "stx": "html" tags never get here
|
||||
// Special case handling in a list context
|
||||
// VE embeds list content in paragraph tags
|
||||
return state.singleLineMode ? WSP.defaultHTMLTagHandler : this;
|
||||
// VE embeds list content in paragraph tags.
|
||||
//
|
||||
// SSS FIXME: This will *NOT* work if the list item has nested paragraph tags!
|
||||
var prevToken = state.prevToken;
|
||||
if ( token.attribs.length === 0
|
||||
&& ( (state.listStack.length > 0 && isListItem(prevToken))
|
||||
|| (prevToken.constructor === TagTk && prevToken.name === 'td')
|
||||
|| (state.ignorePTag && token.constructor === EndTagTk)))
|
||||
{
|
||||
state.ignorePTag = !state.ignorePTag;
|
||||
return { start: { ignore: true }, end: { ignore: true } };
|
||||
} else {
|
||||
return state.singleLineMode ? WSP.defaultHTMLTagHandler : this;
|
||||
}
|
||||
},
|
||||
start: {
|
||||
startsNewline : true,
|
||||
|
|
Loading…
Reference in a new issue