-
Notifications
You must be signed in to change notification settings - Fork 617
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
Showing
4 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
27 changes: 19 additions & 8 deletions
27
packages/app-page-builder/src/plugins/PbEditorPageElementPlugin.tsx
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 |
---|---|---|
@@ -1,24 +1,35 @@ | ||
import type { PbEditorPageElementPlugin as BasePbEditorPageElementPlugin } from "~/types"; | ||
import type { Renderer } from "@webiny/app-page-builder-elements/types"; | ||
|
||
import { legacyPluginToReactComponent } from "@webiny/app/utils"; | ||
|
||
export const PbEditorPageElementPlugin = legacyPluginToReactComponent< | ||
Pick< | ||
export interface PbEditorPageElementPluginProps | ||
extends Pick< | ||
BasePbEditorPageElementPlugin, | ||
| "elementType" | ||
| "toolbar" | ||
| "help" | ||
| "target" | ||
| "settings" | ||
| "create" | ||
| "render" | ||
| "canDelete" | ||
| "canReceiveChildren" | ||
| "onReceived" | ||
| "onChildDeleted" | ||
| "onCreate" | ||
| "renderElementPreview" | ||
> | ||
>({ | ||
pluginType: "pb-editor-page-element", | ||
componentDisplayName: "PbEditorPageElementPlugin" | ||
}); | ||
> { | ||
renderer: Renderer; | ||
} | ||
|
||
export const PbEditorPageElementPlugin = | ||
legacyPluginToReactComponent<PbEditorPageElementPluginProps>({ | ||
pluginType: "pb-editor-page-element", | ||
componentDisplayName: "PbEditorPageElementPlugin", | ||
mapProps: props => { | ||
return { | ||
...props, | ||
render: props.renderer | ||
}; | ||
} | ||
}); |
16 changes: 12 additions & 4 deletions
16
packages/app-page-builder/src/plugins/PbRenderElementPlugin.tsx
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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import type { PbRenderElementPlugin as BasePbRenderElementPlugin } from "~/types"; | ||
import { legacyPluginToReactComponent } from "@webiny/app/utils"; | ||
|
||
export const PbRenderElementPlugin = legacyPluginToReactComponent< | ||
Pick<BasePbRenderElementPlugin, "elementType" | "render"> | ||
>({ | ||
interface PbRenderElementPluginProps extends Pick<BasePbRenderElementPlugin, "elementType"> { | ||
renderer: BasePbRenderElementPlugin["render"]; | ||
} | ||
|
||
export const PbRenderElementPlugin = legacyPluginToReactComponent<PbRenderElementPluginProps>({ | ||
pluginType: "pb-render-page-element", | ||
componentDisplayName: "PbRenderElementPlugin" | ||
componentDisplayName: "PbRenderElementPlugin", | ||
mapProps: props => { | ||
return { | ||
...props, | ||
render: props.renderer | ||
}; | ||
} | ||
}); |
16 changes: 12 additions & 4 deletions
16
packages/app-website/src/plugins/PbRenderElementPlugin.tsx
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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import type { PbRenderElementPlugin as BasePbRenderElementPlugin } from "@webiny/app-page-builder/types"; | ||
import { legacyPluginToReactComponent } from "@webiny/app/utils"; | ||
|
||
export const PbRenderElementPlugin = legacyPluginToReactComponent< | ||
Pick<BasePbRenderElementPlugin, "elementType" | "render"> | ||
>({ | ||
interface PbRenderElementPluginProps extends Pick<BasePbRenderElementPlugin, "elementType"> { | ||
renderer: BasePbRenderElementPlugin["render"]; | ||
} | ||
|
||
export const PbRenderElementPlugin = legacyPluginToReactComponent<PbRenderElementPluginProps>({ | ||
pluginType: "pb-render-page-element", | ||
componentDisplayName: "PbRenderElementPlugin" | ||
componentDisplayName: "PbRenderElementPlugin", | ||
mapProps: props => { | ||
return { | ||
...props, | ||
render: props.renderer | ||
}; | ||
} | ||
}); |
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