This repository was archived by the owner on May 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-1
lines changed
Expand file tree Collapse file tree 4 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export interface Modifier {
88 constructor : ModifierConstructor & this;
99}
1010export class Modifier {
11+ preserve = true ;
1112 get name ( ) : string {
1213 return '' ;
1314 }
Original file line number Diff line number Diff line change @@ -47,7 +47,12 @@ export class Char<T extends JWPluginConfig = JWPluginConfig> extends JWPlugin<T>
4747 const range = params . context . range ;
4848 const text = params . text ;
4949 const inline = this . editor . plugins . get ( Inline ) ;
50- const modifiers = inline . getCurrentModifiers ( range ) ;
50+ let modifiers = inline . getCurrentModifiers ( range ) ;
51+ // Ony preserved modifiers are applied at the start of a container.
52+ const previousSibling = range . start . previousSibling ( ) ;
53+ if ( ! previousSibling ) {
54+ modifiers = new Modifiers ( ...modifiers . filter ( mod => mod . preserve ) ) ;
55+ }
5156 if ( params . formats ) {
5257 modifiers . set ( ...params . formats . map ( format => format . clone ( ) ) ) ;
5358 }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Attributes } from '../../plugin-xml/src/Attributes';
44export class LinkFormat extends Format {
55 constructor ( url = '#' , target = '' ) {
66 super ( 'A' ) ;
7+ this . preserve = false ;
78 this . url = url ;
89 this . target = target ;
910 }
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import { ClassList } from './ClassList';
55export class Attributes extends Modifier {
66 private _record : Record < string , string > = { } ;
77 style = new CssStyle ( ) ;
8+ // Avoid copiying FontAwesome classes on paragraph break.
9+ // TODO : need to be improved to better take care of color classes, etc.
10+ preserve = false ;
811 classList = new ClassList ( ) ;
912 constructor ( attributes ?: Attributes | NamedNodeMap | Record < string , string > ) {
1013 super ( ) ;
You can’t perform that action at this time.
0 commit comments