-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Content Model: Paste plain text applies current format (#2057)
* Content Model: Paste plain text applies current format * fix build
- Loading branch information
1 parent
f3f6831
commit bf80705
Showing
4 changed files
with
75 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...tent-model/roosterjs-content-model-dom/lib/modelApi/common/applySegmentFormatToElement.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { applyFormat } from '../../modelToDom/utils/applyFormat'; | ||
import { ContentModelSegmentFormat } from 'roosterjs-content-model-types'; | ||
import { createModelToDomContext } from '../../modelToDom/context/createModelToDomContext'; | ||
|
||
/** | ||
* Format an existing HTML element using Segment Format | ||
* @param element The element to format | ||
* @param format The format to apply | ||
*/ | ||
export function applySegmentFormatToElement( | ||
element: HTMLElement, | ||
format: ContentModelSegmentFormat | ||
) { | ||
const context = createModelToDomContext(); | ||
applyFormat(element, context.formatAppliers.segment, format, context); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters