@@ -72,14 +72,12 @@ export class Inline<T extends JWPluginConfig = JWPluginConfig> extends JWPlugin<
7272 const format = inline . modifiers . find ( FormatClass ) ;
7373 // Apply the attributes of the format we're about to remove to
7474 // the inline itself.
75- const attributes = inline . modifiers . find ( Attributes ) ;
75+ const attributes = inline . modifiers . get ( Attributes ) ;
7676 const matchingFormatAttributes = format . modifiers . find ( Attributes ) ;
77- if ( attributes && matchingFormatAttributes ) {
77+ if ( matchingFormatAttributes ) {
7878 for ( const key of matchingFormatAttributes . keys ( ) ) {
7979 attributes . set ( key , matchingFormatAttributes . get ( key ) ) ;
8080 }
81- } else if ( matchingFormatAttributes ) {
82- inline . modifiers . append ( matchingFormatAttributes . clone ( ) ) ;
8381 }
8482 // Remove the format.
8583 inline . modifiers . remove ( format ) ;
@@ -88,7 +86,7 @@ export class Inline<T extends JWPluginConfig = JWPluginConfig> extends JWPlugin<
8886 // If there is at least one char in the range without the format
8987 // `FormatClass`, set the format for all nodes.
9088 for ( const inline of selectedInlines ) {
91- if ( ! inline . modifiers . find ( f => f instanceof FormatClass ) ) {
89+ if ( ! inline . modifiers . find ( FormatClass ) ) {
9290 new FormatClass ( ) . applyTo ( inline ) ;
9391 }
9492 }
@@ -100,14 +98,12 @@ export class Inline<T extends JWPluginConfig = JWPluginConfig> extends JWPlugin<
10098 if ( ! this . cache . modifiers ) {
10199 this . cache . modifiers = this . getCurrentModifiers ( range ) ;
102100 }
103- return ! ! this . cache . modifiers . find ( format => format instanceof FormatClass ) ;
101+ return ! ! this . cache . modifiers . find ( FormatClass ) ;
104102 } else {
105103 const selectedInlines = range . selectedNodes ( InlineNode ) ;
106104 return (
107105 selectedInlines . length &&
108- selectedInlines . every (
109- char => ! ! char . modifiers . find ( format => format instanceof FormatClass ) ,
110- )
106+ selectedInlines . every ( char => ! ! char . modifiers . find ( FormatClass ) )
111107 ) ;
112108 }
113109 }
0 commit comments