mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-24 15:28:41 -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:
parent
edfd35ccec
commit
5a46d51671
3 changed files with 12 additions and 4 deletions
|
@ -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
|
// 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
|
// to apply when the user types something in the block, which is
|
||||||
// presumably what was intended.
|
// 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(
|
walker = new TreeWalker(
|
||||||
range.commonAncestorContainer,
|
range.commonAncestorContainer,
|
||||||
SHOW_TEXT|SHOW_ELEMENT,
|
SHOW_TEXT|SHOW_ELEMENT,
|
||||||
function ( node ) {
|
function ( node ) {
|
||||||
return ( node.nodeType === TEXT_NODE ||
|
return ( node.nodeType === TEXT_NODE ||
|
||||||
node.nodeName === 'BR' ) &&
|
node.nodeName === 'BR'||
|
||||||
|
node.nodeName === 'IMG' ) &&
|
||||||
isNodeContainedInRange( range, node, true );
|
isNodeContainedInRange( range, node, true );
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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
|
// 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
|
// to apply when the user types something in the block, which is
|
||||||
// presumably what was intended.
|
// 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(
|
walker = new TreeWalker(
|
||||||
range.commonAncestorContainer,
|
range.commonAncestorContainer,
|
||||||
SHOW_TEXT|SHOW_ELEMENT,
|
SHOW_TEXT|SHOW_ELEMENT,
|
||||||
function ( node ) {
|
function ( node ) {
|
||||||
return ( node.nodeType === TEXT_NODE ||
|
return ( node.nodeType === TEXT_NODE ||
|
||||||
node.nodeName === 'BR' ) &&
|
node.nodeName === 'BR'||
|
||||||
|
node.nodeName === 'IMG' ) &&
|
||||||
isNodeContainedInRange( range, node, true );
|
isNodeContainedInRange( range, node, true );
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
|
Loading…
Add table
Reference in a new issue