Skip to content

Commit

Permalink
fix: add new option in content transform callback (#939)
Browse files Browse the repository at this point in the history
* fix: add new option in content transform callback

* fix: image schema
  • Loading branch information
NikitaCG authored May 14, 2024
1 parent f09355e commit 42a1665
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/components/Image/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ export const ImageProps = {
...ImageDeviceProps,
optionName: 'device options',
}),
{
type: 'array',
items: filteredItem({
...ImageObjectProps,
}),
optionName: 'options list',
},
{
type: 'array',
items: filteredItem({
...ImageDeviceProps,
}),
optionName: 'device options list',
},
],
};

Expand Down
4 changes: 2 additions & 2 deletions src/editor/containers/Editor/hooks/useEditorState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export const useEditorState = ({
const isCodeOnlyMode = codeFullscreeModeOn && isCodeEditMode;

const transformedContent = useMemo(
() => (transformContent ? transformContent(content, {viewMode}) : content),
[content, transformContent, viewMode],
() => (transformContent ? transformContent(content, {viewMode, editMode}) : content),
[content, transformContent, viewMode, editMode],
);
const schema = useMemo(() => generateDefaultSchema(customSchema), [customSchema]);
const codeValidator = useCodeValidator(schema);
Expand Down
3 changes: 2 additions & 1 deletion src/editor/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {EditBlockActions} from '../components/EditBlock/EditBlock';
export type EditorBlockId = number | string;

interface ContentTransformersOptions {
viewMode: ViewModeItem;
viewMode?: ViewModeItem;
editMode?: EditModeItem;
}

export type ContentTransformer = (
Expand Down

0 comments on commit 42a1665

Please sign in to comment.