fix: image and paste insert (#490)

* fix: pasting and images only insert at beginning

* fix: add image click not showing gallery

* chore: increase code coverage
This commit is contained in:
Kristin Aoki
2024-07-01 12:29:05 -04:00
committed by GitHub
parent 267823414e
commit fc3cd9a9ce
4 changed files with 47 additions and 37 deletions

View File

@@ -87,6 +87,7 @@ export const hooks = {
updateReactState({ settings, ...args });
close();
args.setSelection(null);
},
onClose: ({ clearSelection, close }) => () => {
clearSelection();
@@ -130,7 +131,7 @@ export const ImageUploadModal = ({
<ImageSettingsModal
{...{
isOpen,
close: module.hooks.onClose({ editorRef, clearSelection, close }),
close: module.hooks.onClose({ clearSelection, close }),
selection,
images,
saveToEditor: module.hooks.createSaveCallback({
@@ -141,6 +142,7 @@ export const ImageUploadModal = ({
selection,
setSelection,
lmsEndpointUrl,
clearSelection,
}),
returnToSelection: clearSelection,
}}

View File

@@ -128,6 +128,7 @@ describe('ImageUploadModal', () => {
expect(updateImageDimensionsSpy.mock.results[0].value.foundMatch).toBe(false);
expect(images.current).toEqual([mockImage, newImage]);
expect(close).toBeCalled();
expect(setSelection).toBeCalledWith(null);
},
);
});