Skip to content

Commit 70eb07c

Browse files
committed
image edit
1 parent eedfc20 commit 70eb07c

File tree

4 files changed

+140
-200
lines changed

4 files changed

+140
-200
lines changed

demo/scripts/controlsV2/mainPane/MainPane.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ export class MainPane extends React.Component<{}, MainPaneState> {
236236

237237
resetEditorPlugin(pluginState: OptionState) {
238238
this.updateContentPlugin.update();
239+
this.imageEditPlugin = new ImageEditPlugin({
240+
disableSideResize: pluginState.disableSideResize,
241+
});
239242
this.setState({
240243
initState: pluginState,
241244
});
@@ -552,7 +555,7 @@ export class MainPane extends React.Component<{}, MainPaneState> {
552555
pluginList.tableEdit && new TableEditPlugin(),
553556
pluginList.watermark && new WatermarkPlugin(watermarkText),
554557
pluginList.markdown && new MarkdownPlugin(markdownOptions),
555-
imageEditPlugin,
558+
pluginList.imageEditPlugin && imageEditPlugin,
556559
pluginList.emoji && createEmojiPlugin(),
557560
pluginList.pasteOption && createPasteOptionPlugin(),
558561
pluginList.sampleEntity && new SampleEntityPlugin(),

packages/roosterjs-content-model-plugins/lib/imageEdit/ImageEditPlugin.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
4141
return 'ImageEdit';
4242
}
4343

44+
/**
45+
* @deprecated
46+
* When ImageEditV2 is enabled, this will always be false
47+
*/
48+
protected get isEditing() {
49+
return this.imageEditPlugin?.isEditing;
50+
}
51+
52+
protected get editor() {
53+
return this.imageEditPlugin?.editor;
54+
}
55+
4456
/**
4557
* The first method that editor will call to a plugin when editor is initializing.
4658
* It will pass in the editor instance, plugin should take this chance to save the
@@ -93,4 +105,18 @@ export class ImageEditPlugin implements ImageEditor, EditorPlugin {
93105
isOperationAllowed(operation: ImageEditOperation): boolean {
94106
return !!this.imageEditPlugin?.isOperationAllowed(operation);
95107
}
108+
109+
protected applyFormatWithContentModel(
110+
editor: IEditor,
111+
isCropMode: boolean,
112+
shouldSelectImage?: boolean,
113+
isApiOperation?: boolean
114+
) {
115+
this.imageEditPlugin?.applyFormatWithContentModel(
116+
editor,
117+
isCropMode,
118+
shouldSelectImage,
119+
isApiOperation
120+
);
121+
}
96122
}

0 commit comments

Comments
 (0)