-
Notifications
You must be signed in to change notification settings - Fork 166
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
- Loading branch information
1 parent
2fc7830
commit 96e64f6
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 'roosterjs-content-model-dom/lib/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