mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
ce.BranchNode: Insert slugs based on CE children length, not DM
Due to Firefox' Ctrl-A creating an outer selection (0,len) as opposed to inner select like in Chrome (1,len-1), deleting leaves the document completely empty (with no cursor anywhere in the document). However, setupSlugs() wasn't inserting a slug because the internal list still existed (so this.model.length !== 0). Using this.$.children().length instead. Bug: 50947 Change-Id: I1517ebcc5b31e2544559b851174482b0c872b24b
This commit is contained in:
parent
7849be8ec0
commit
9b99962215
|
@ -227,7 +227,11 @@ ve.ce.BranchNode.prototype.setupSlugs = function () {
|
|||
slug = ve.ce.BranchNode.$inlineSlugTemplate[0];
|
||||
}
|
||||
|
||||
if ( this.getLength() === 0 ) {
|
||||
// If this content branch no longer has any rendered children, insert a slug to keep the node
|
||||
// from becoming invisible/unfocusable. In Firefox, backspace after Ctrl-A leaves the document
|
||||
// completely empty, so this ensures DocumentNode gets a slug.
|
||||
// Can't use this.getLength() because the internal list adds to the length but doesn't render.
|
||||
if ( this.$.children().length === 0 ) {
|
||||
this.slugs[0] = doc.importNode( slug, true );
|
||||
this.$[0].appendChild( this.slugs[0] );
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue