-
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: Advanced cache (#2083)
* Content Model Customization refactor * fix build * improve * Content Model Customization refactor 2: Add default config * fix build * Content Model: Persist cache 1 * fix build * improve * Content Model: Cache 2 * Fix test * Fix build * improve * Improve * improve * Improve * fix test * Do not restore cached selection when call select * Content Model: Add model into ContentChangedEvent * fix build * add demo site page * Improve * Content Model: pass out segment nodes * cache 8 * fix build * fix test * Improve * improve * fix test * Improve * fix test * Improve "checkDependency" * Content Model: Clear table selection fix * fix build * Content Model: Improve adjustWordSelection * add test * add test * fix test * Improve * retrigger check step * retrigger check step
- Loading branch information
1 parent
d9e8e89
commit 00558e8
Showing
50 changed files
with
3,140 additions
and
150 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
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
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
28 changes: 28 additions & 0 deletions
28
packages-content-model/roosterjs-content-model-dom/lib/modelApi/common/ensureParagraph.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,28 @@ | ||
import { addBlock } from './addBlock'; | ||
import { createParagraph } from '../creators/createParagraph'; | ||
import { | ||
ContentModelBlockFormat, | ||
ContentModelBlockGroup, | ||
ContentModelParagraph, | ||
} from 'roosterjs-content-model-types'; | ||
|
||
/** | ||
* Ensure there is a Paragraph that can insert segments in a Content Model Block Group | ||
* @param group The parent block group of the target paragraph | ||
* @param blockFormat Format of the paragraph. This is only used if we need to create a new paragraph | ||
*/ | ||
export function ensureParagraph( | ||
group: ContentModelBlockGroup, | ||
blockFormat?: ContentModelBlockFormat | ||
): ContentModelParagraph { | ||
const lastBlock = group.blocks[group.blocks.length - 1]; | ||
|
||
if (lastBlock?.blockType == 'Paragraph') { | ||
return lastBlock; | ||
} else { | ||
const paragraph = createParagraph(true, blockFormat); | ||
addBlock(group, paragraph); | ||
|
||
return paragraph; | ||
} | ||
} |
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
Oops, something went wrong.