-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly create Content Model editor (#2206)
- Loading branch information
1 parent
6cec1cc
commit 32280bf
Showing
46 changed files
with
762 additions
and
1,423 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
28 changes: 0 additions & 28 deletions
28
...nt-model/roosterjs-content-model-core/lib/corePlugin/ContentModelTypeInContainerPlugin.ts
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...nt-model/roosterjs-content-model-core/lib/corePlugin/createStandaloneEditorCorePlugins.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,22 @@ | ||
import { createContentModelCachePlugin } from './ContentModelCachePlugin'; | ||
import { createContentModelCopyPastePlugin } from './ContentModelCopyPastePlugin'; | ||
import { createContentModelFormatPlugin } from './ContentModelFormatPlugin'; | ||
import type { | ||
StandaloneEditorCorePlugins, | ||
StandaloneEditorOptions, | ||
} from 'roosterjs-content-model-types'; | ||
|
||
/** | ||
* Create core plugins for standalone editor | ||
* @param options Options of editor | ||
*/ | ||
export function createStandaloneEditorCorePlugins( | ||
options: StandaloneEditorOptions | ||
): StandaloneEditorCorePlugins { | ||
return { | ||
cache: createContentModelCachePlugin(options), | ||
format: createContentModelFormatPlugin(options), | ||
copyPaste: createContentModelCopyPastePlugin(options), | ||
typeInContainer: null!, // TODO: remove this plugin since we don't need it any more | ||
}; | ||
} |
70 changes: 0 additions & 70 deletions
70
...ges-content-model/roosterjs-content-model-core/lib/editor/createContentModelEditorCore.ts
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...nt-model/roosterjs-content-model-core/lib/editor/createStandaloneEditorDefaultSettings.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,42 @@ | ||
import { createDomToModelConfig, createModelToDomConfig } from 'roosterjs-content-model-dom'; | ||
import { listItemMetadataApplier, listLevelMetadataApplier } from '../metadata/updateListMetadata'; | ||
import { tablePreProcessor } from '../override/tablePreProcessor'; | ||
import type { | ||
DomToModelOption, | ||
ModelToDomOption, | ||
StandaloneEditorDefaultSettings, | ||
StandaloneEditorOptions, | ||
} from 'roosterjs-content-model-types'; | ||
|
||
/** | ||
* Create default DOM and Content Model conversion settings for a standalone editor | ||
* @param options The editor options | ||
*/ | ||
export function createStandaloneEditorDefaultSettings( | ||
options: StandaloneEditorOptions | ||
): StandaloneEditorDefaultSettings { | ||
const defaultDomToModelOptions: (DomToModelOption | undefined)[] = [ | ||
{ | ||
processorOverride: { | ||
table: tablePreProcessor, | ||
}, | ||
}, | ||
options.defaultDomToModelOptions, | ||
]; | ||
const defaultModelToDomOptions: (ModelToDomOption | undefined)[] = [ | ||
{ | ||
metadataAppliers: { | ||
listItem: listItemMetadataApplier, | ||
listLevel: listLevelMetadataApplier, | ||
}, | ||
}, | ||
options.defaultModelToDomOptions, | ||
]; | ||
|
||
return { | ||
defaultDomToModelOptions, | ||
defaultModelToDomOptions, | ||
defaultDomToModelConfig: createDomToModelConfig(defaultDomToModelOptions), | ||
defaultModelToDomConfig: createModelToDomConfig(defaultModelToDomOptions), | ||
}; | ||
} |
Oops, something went wrong.