Skip to content

Commit

Permalink
Merge branch 'master' into u/juliaroldi/image-editing-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaroldi authored Oct 21, 2022
2 parents 7fe3b15 + cdf5eca commit 709e22a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export const handleSegment: ContentModelHandler<ContentModelSegment> = (
break;

case 'Br':
element = doc.createElement('br');
regularSelection.current.segment = element;
const br = doc.createElement('br');
element = doc.createElement('span');
element.appendChild(br);
regularSelection.current.segment = br;

applyFormat(element, context.formatAppliers.segment, segment.format, context);
break;

case 'General':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('handleSegment', () => {
segmentType: 'Br',
format: {},
},
'<br>',
'<span><br></span>',
0
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/roosterjs-editor-api/lib/format/changeFontSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function changeFontSize(
let pt = parseFloat(getComputedStyle(element, 'font-size') || element.style.fontSize);
element.style.fontSize = getNewFontSize(pt, changeBase, fontSizes) + 'pt';
let lineHeight = getComputedStyle(element, 'line-height');
if (lineHeight != 'normal') {
if (lineHeight && lineHeight != 'normal') {
element.style.lineHeight = 'normal';
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/roosterjs-editor-api/lib/format/setFontSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function setFontSize(editor: IEditor, fontSize: string) {
(element, isInnerNode) => {
element.style.fontSize = isInnerNode ? '' : fontSize;
let lineHeight = getComputedStyle(element, 'line-height');
if (lineHeight != 'normal') {
if (lineHeight && lineHeight != 'normal') {
element.style.lineHeight = 'normal';
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default class PendingFormatStatePlugin
isCharacterValue(event.rawEvent) &&
this.state.pendableFormatSpan
) {
this.state.pendableFormatSpan.removeAttribute('contentEditable');
this.editor.insertNode(this.state.pendableFormatSpan);
this.editor.select(
this.state.pendableFormatSpan,
Expand Down

0 comments on commit 709e22a

Please sign in to comment.