0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-09 08:20:08 -05:00

Lone IMG tags in a range will be accepted by _addFormat, so that they can be made into links.

This commit is contained in:
Gert K. Sønderby 2015-08-26 15:00:50 +02:00
parent edfd35ccec
commit 5a46d51671
3 changed files with 12 additions and 4 deletions

View file

@ -2859,12 +2859,16 @@ proto._addFormat = function ( tag, attributes, range ) {
// Therefore we wrap this in the tag as well, as this will then cause it
// to apply when the user types something in the block, which is
// presumably what was intended.
//
// IMG tags are included because we may want to create a link around them,
// and adding other styles is harmless.
walker = new TreeWalker(
range.commonAncestorContainer,
SHOW_TEXT|SHOW_ELEMENT,
function ( node ) {
return ( node.nodeType === TEXT_NODE ||
node.nodeName === 'BR' ) &&
node.nodeName === 'BR'||
node.nodeName === 'IMG' ) &&
isNodeContainedInRange( range, node, true );
},
false

File diff suppressed because one or more lines are too long

View file

@ -734,12 +734,16 @@ proto._addFormat = function ( tag, attributes, range ) {
// Therefore we wrap this in the tag as well, as this will then cause it
// to apply when the user types something in the block, which is
// presumably what was intended.
//
// IMG tags are included because we may want to create a link around them,
// and adding other styles is harmless.
walker = new TreeWalker(
range.commonAncestorContainer,
SHOW_TEXT|SHOW_ELEMENT,
function ( node ) {
return ( node.nodeType === TEXT_NODE ||
node.nodeName === 'BR' ) &&
node.nodeName === 'BR'||
node.nodeName === 'IMG' ) &&
isNodeContainedInRange( range, node, true );
},
false