Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuqingSong committed Jun 6, 2024
1 parent 6077ae6 commit a8e46cd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createDomToModelContextForSanitizing } from '../createModelFromHtml/createDomToModelContextForSanitizing';
import { EmptySegmentFormat } from '../../corePlugin/cache/EmptySegmentFormat';
import {
ChangeSource,
EmptySegmentFormat,
cloneModel,
domToContentModel,
getSegmentTextFormat,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EmptySegmentFormat } from './EmptySegmentFormat';
import {
EmptySegmentFormat,
createSelectionMarker,
createText,
getObjectKeys,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ContentModelSegmentFormat } from 'roosterjs-content-model-types';

/**
* @internal
* Provide a default empty instance of segment format with all its properties
*/
export const EmptySegmentFormat: Required<ContentModelSegmentFormat> = {
export const EmptySegmentFormat: Readonly<Required<ContentModelSegmentFormat>> = {
backgroundColor: '',
fontFamily: '',
fontSize: '',
Expand Down
1 change: 1 addition & 0 deletions packages/roosterjs-content-model-dom/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@ export { NumberingListType } from './constants/NumberingListType';
export { TableBorderFormat } from './constants/TableBorderFormat';
export { OrderedListStyleMap } from './constants/OrderedListStyleMap';
export { UnorderedListStyleMap } from './constants/UnorderedListStyleMap';
export { EmptySegmentFormat } from './constants/EmptySegmentFormat';
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { createParagraph } from '../creators/createParagraph';
import { createSelectionMarker } from '../creators/createSelectionMarker';
import { createTableCell } from '../creators/createTableCell';
import { deleteSelection } from './deleteSelection';
import { EmptySegmentFormat } from '../../constants/EmptySegmentFormat';
import { getClosestAncestorBlockGroupIndex } from './getClosestAncestorBlockGroupIndex';
import { getObjectKeys } from '../..//domUtils/getObjectKeys';
import { mutateBlock } from '../common/mutate';
Expand All @@ -29,21 +30,7 @@ import type {
} from 'roosterjs-content-model-types';

const HeadingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
// An object to provide keys of required properties of segment format, do NOT use any of its values
const RequiredEmptySegmentFormat: Required<ContentModelSegmentFormat> = {
backgroundColor: null!,
fontFamily: null!,
fontSize: null!,
fontWeight: null!,
italic: null!,
letterSpacing: null!,
lineHeight: null!,
strikethrough: null!,
superOrSubScriptSequence: null!,
textColor: null!,
underline: null!,
};
const KeysOfSegmentFormat = getObjectKeys(RequiredEmptySegmentFormat);
const KeysOfSegmentFormat = getObjectKeys(EmptySegmentFormat);

/**
* Merge source model into target mode
Expand Down

0 comments on commit a8e46cd

Please sign in to comment.