Skip to content

Commit

Permalink
Check the link format segment to turnoff (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanValverdeU authored Jun 30, 2023
1 parent 5be7a7d commit cf85be5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export default function toggleUnderline(editor: IContentModelEditor) {
segment.link.format.underline = !!isTurningOn;
}
},
format => !!format.underline
(format, segment) => !!format.underline || !!segment?.link?.format?.underline
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,64 @@ describe('toggleUnderline', () => {
1
);
});

it('Turn off link', () => {
runTest(
{
blockGroupType: 'Document',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'Test',
format: {},
isSelected: true,
link: {
format: {
href: 'https://microsoft.github.io/roosterjs/index.html',
anchorTitle: 'asd',
underline: true,
},
dataset: {},
},
},
],
format: {},
},
],
format: {},
},
{
blockGroupType: 'Document',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'Test',
format: {
underline: false,
},
isSelected: true,
link: {
format: {
href: 'https://microsoft.github.io/roosterjs/index.html',
anchorTitle: 'asd',
underline: false,
},
dataset: {},
},
},
],
format: {},
},
],
format: {},
},
1
);
});
});

0 comments on commit cf85be5

Please sign in to comment.