-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Editing images not in CKBox #15423
Conversation
packages/ckeditor5-ckbox/src/ckboximageedit/ckboximageeditcommand.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ckbox/src/ckboximageedit/ckboximageeditcommand.ts
Outdated
Show resolved
Hide resolved
packages/ckeditor5-ckbox/src/ckboximageedit/ckboximageeditcommand.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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:
- 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). - After adding an image from
imgur
i can clickedit
but if i resign (back arrow button) theedit
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>>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing function description.
There was a problem hiding this 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! 👏
* The CKBox editing feature. It introduces the {@link module:ckbox/ckboxcommand~CKBoxCommand CKBox command} and | ||
* {@link module:ckbox/ckboxuploadadapter~CKBoxUploadAdapter CKBox upload adapter}. |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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 + '/' ); |
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docs.
There was a problem hiding this comment.
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing jsdoc.
There was a problem hiding this comment.
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.
/** | ||
* @internal | ||
*/ | ||
export function createEditabilityChecker( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing function description.
export function convertMimeTypeToExtension( mimeType: string ): string { | ||
return MIME_TO_EXTENSION[ mimeType ]; | ||
} | ||
|
||
export async function getContentTypeOfUrl( url: string, options: { signal: AbortSignal } ): Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing functions descriptions.
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.