0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 23:40:35 -05:00

Merge pull request #126 from gertsonderby/include-img-in-addFormat

Allow IMG tags to be made into links
This commit is contained in:
Neil Jenkins 2015-08-27 11:11:48 +01:00
commit ed7bb2736f
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