File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,14 +147,28 @@ export const transactions: IStyleTransactions = {
147147 const suit = suitableClosest ( style , element , jodit . editor ) ;
148148 assert ( suit , 'This place should have an element' ) ;
149149
150- if ( ! style . elementIsBlock ) {
151- extractSelectedPart ( suit , element , jodit ) ;
150+ // If we're applying inline styles to a block element, don't split the block
151+ const isApplyingInlineStyle =
152+ ! style . elementIsBlock && style . options . attributes ?. style ;
153+ const shouldNotSplitBlock =
154+ isApplyingInlineStyle && Dom . isBlock ( suit ) ;
155+
156+ if ( ! shouldNotSplitBlock ) {
157+ if ( ! style . elementIsBlock ) {
158+ extractSelectedPart ( suit , element , jodit ) ;
159+ }
160+
161+ return {
162+ ...value ,
163+ element : suit ,
164+ next : states . ELEMENT
165+ } ;
152166 }
153167
168+ // Create a new wrapper instead of splitting the block
154169 return {
155170 ...value ,
156- element : suit ,
157- next : states . ELEMENT
171+ next : states . WRAP
158172 } ;
159173 }
160174 } ,
You can’t perform that action at this time.
0 commit comments