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

fix/AUT-2673/inline-figure-img #528

Merged
merged 12 commits into from
Nov 28, 2022
Merged

Conversation

marpesia
Copy link
Contributor

@marpesia marpesia commented Nov 15, 2022

Related to: AUT-2673

Parent Extension

Changes:

  • Trigger re-build Figure widger on inline alignment.
  • Add param to Widget panel to show a message on the inline case that prevents the use of FigCaption

@github-actions
Copy link

github-actions bot commented Nov 15, 2022

Coverage Report

Totals Coverage
Statements: 82.63% ( 9118 / 11035 )
Methods: 81.62% ( 1941 / 2378 )

@marpesia marpesia requested a review from bziondik November 15, 2022 22:40
@marpesia marpesia changed the title Fix/aut 2673/inline figure img fix/AUT-2673/inline-figure-img Nov 16, 2022
Copy link
Contributor

@jsconan jsconan left a comment

Choose a reason for hiding this comment

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

Code check only.
It looks okayish. But I have a few concerns :)

Comment on lines 178 to 182
const $editableContainer = widget.$original.parents('[data-qti-class="_container"]');
htmlEditor.buildEditor($editableContainer, {});
_.defer(() => {
htmlEditor.destroyEditor($editableContainer);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why building then destroying the editor immediately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CKEditor reads the Figure HTML tag, and if it is inside a block, it moves out of it.
To achieve this effect, I must rebuild the editor, but I don't want to have it active, so I destroy it afterwards. Otherwise, I will have an error in the XML structure.

@@ -125,7 +127,7 @@ const initForm = ({ widget, formElement, formTpl, mediaEditor, togglePlaceholder
);
};

export default function (stateFactory, ActiveState, formTpl, formElement, inlineHelper) {
export default function (stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor) {
Copy link
Contributor

Choose a reason for hiding this comment

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

quibble: The signatures becomes heavier and heavier. Maybe it is the right time to think about simplifying it. If the API is not used in too many places, it could be simplified with a config object, allowing to addition of more entries without breaking the signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

@marpesia marpesia marked this pull request as ready for review November 21, 2022 14:19
Copy link
Contributor

@jsconan jsconan left a comment

Choose a reason for hiding this comment

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

Code check only.

It looks good.

if (className) {
widget.element.attr('class', className);
} else {
widget.element.removeAttr('class');
}


if ((prevClassName || className.length) && prevClassName !== className) {
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why test the value only for one variable and the length only for the other variable? Both are string, so it could be tested by value for both...

suggestion:

Suggested change
if ((prevClassName || className.length) && prevClassName !== className) {
if ((prevClassName || className) && prevClassName !== className) {

* @param {Object} config.htmlEditor
* @returns
*/
export default function (config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: It could also have been turned into a restructured declaration as mentioned in the coding guide

Suggested change
export default function (config) {
export default function ({ stateFactory, ActiveState, formTpl, formElement, inlineHelper, htmlEditor }) {

If some parameters are mandatory and need to be given anyway, it could also be split into groups:

Suggested change
export default function (config) {
export default function (stateFactory, ActiveState, { formTpl, formElement, inlineHelper, htmlEditor }) {

Copy link
Contributor

@bziondik bziondik left a comment

Choose a reason for hiding this comment

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

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on playground (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

Copy link
Contributor

@Silvia-loza Silvia-loza left a comment

Choose a reason for hiding this comment

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

Great job! 🎉🎉🎉

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • Pull request's target is not master
  • Feature is working correctly on kitchen env (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

@github-actions
Copy link

Version

Target Version 1.63.1
Last version 1.63.0

There are 0 BREAKING CHANGE, 0 feature, 12 fixes

@bziondik bziondik merged commit 9b5dd40 into develop Nov 28, 2022
@bziondik bziondik deleted the fix/AUT-2673/inline-figure-img branch November 28, 2022 11:39
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