Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing images not in CKBox #15423

Merged
merged 10 commits into from
Dec 5, 2023
Merged

Conversation

arkflpc
Copy link
Contributor

@arkflpc arkflpc commented Nov 28, 2023

Suggested merge commit message (convention)

Feature (ckbox): Integration with CKBox editing of images not from CKBox.


Closes https://github.com/cksource/ckeditor5-commercial/issues/5746#.

Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@arkflpc arkflpc marked this pull request as ready for review December 2, 2023 15:53
Copy link
Contributor

@pszczesniak pszczesniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nice 🎉 just few small things:

  1. In manual test i suggest to remove data-ckbox-resource-id="example-id-for-image" from example image (throws an error while we want to edit it cause it's not a real CKBox image).
  2. After adding an image from imgur i can click edit but if i resign (back arrow button) the edit button is still active (video)
Screen.Recording.2023-12-04.at.15.04.54.mov

*/
private _canEdit: ( element: ModelElement ) => boolean;

private _prepareOptions: AbortableFunc<[ ProcessingState ], Promise<Record<string, unknown>>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function description.

Copy link
Contributor

@pszczesniak pszczesniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

One thing (not a blocker) - would be good to add some explanation in manual test about possibilities in image editing.

I like how you made code cleaner and more readable! 👏

@arkflpc arkflpc merged commit 448210c into master Dec 5, 2023
7 checks passed
@arkflpc arkflpc deleted the cc/5746-editing-images-not-in-ckbox branch December 5, 2023 08:34
Comment on lines +26 to +27
* The CKBox editing feature. It introduces the {@link module:ckbox/ckboxcommand~CKBoxCommand CKBox command} and
* {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment requires fixing. It does not describe this plugin.

'image/tiff': 'tiff'
};

export function convertMimeTypeToExtension( mimeType: string ): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs.

return MIME_TO_EXTENSION[ mimeType ];
}

export async function getContentTypeOfUrl( url: string, options: { signal: AbortSignal } ): Promise<string> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs.

if ( allowExternalImagesEditing == 'origin' ) {
const origin = global.window.location.origin;

return src => src.startsWith( origin + '/' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work correctly with relative URLs?

@@ -169,6 +210,16 @@ export default class CKBoxImageEditCommand extends Command {
return states;
}

private _checkIfElementIsBeingProcessed( selectedElement: ModelElement ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's private and the name is long enough.

Copy link
Contributor

@mmotyczynska mmotyczynska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature works as expected 👍
Some docs missing (I added comments).


/**
* Initializes the `ckbox` editor configuration.
* Checks if the at least one image plugin is loaded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Checks if the at least one image plugin is loaded.
* Checks if at least one image plugin is loaded.

@@ -169,6 +210,16 @@ export default class CKBoxImageEditCommand extends Command {
return states;
}

private _checkIfElementIsBeingProcessed( selectedElement: ModelElement ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing jsdoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's private and the name is long enough.

Comment on lines +15 to +18
/**
* @internal
*/
export function createEditabilityChecker(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function description.

};
}

function createUrlChecker(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function description.

Comment on lines +207 to +211
export function convertMimeTypeToExtension( mimeType: string ): string {
return MIME_TO_EXTENSION[ mimeType ];
}

export async function getContentTypeOfUrl( url: string, options: { signal: AbortSignal } ): Promise<string> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing functions descriptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants