-
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.
- Loading branch information
1 parent
82d4ce3
commit aaa58f6
Showing
8 changed files
with
55 additions
and
49 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
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
25 changes: 25 additions & 0 deletions
25
packages/roosterjs-content-model-dom/lib/modelApi/editing/runEditSteps.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,25 @@ | ||
import type { | ||
DeleteSelectionContext, | ||
DeleteSelectionResult, | ||
DeleteSelectionStep, | ||
ValidDeleteSelectionContext, | ||
} from 'roosterjs-content-model-types'; | ||
|
||
/** | ||
* Run editing steps on top of a given context object which includes current insert point and previous editing result | ||
* @param steps The editing steps to run | ||
* @param context Context for the editing steps. | ||
*/ | ||
export function runEditSteps(steps: DeleteSelectionStep[], context: DeleteSelectionResult) { | ||
steps.forEach(step => { | ||
if (step && isValidDeleteSelectionContext(context)) { | ||
step(context); | ||
} | ||
}); | ||
} | ||
|
||
function isValidDeleteSelectionContext( | ||
context: DeleteSelectionContext | ||
): context is ValidDeleteSelectionContext { | ||
return !!context.insertPoint; | ||
} |
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
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
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