-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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.
Code check only.
It looks okayish. But I have a few concerns :)
src/figure/FigureStateActive.js
Outdated
const $editableContainer = widget.$original.parents('[data-qti-class="_container"]'); | ||
htmlEditor.buildEditor($editableContainer, {}); | ||
_.defer(() => { | ||
htmlEditor.destroyEditor($editableContainer); | ||
}); |
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.
question: Why building then destroying the editor immediately?
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 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.
src/figure/FigureStateActive.js
Outdated
@@ -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) { |
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.
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.
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.
Good point!
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.
Code check only.
It looks good.
if (className) { | ||
widget.element.attr('class', className); | ||
} else { | ||
widget.element.removeAttr('class'); | ||
} | ||
|
||
|
||
if ((prevClassName || className.length) && prevClassName !== className) { |
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.
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:
if ((prevClassName || className.length) && prevClassName !== className) { | |
if ((prevClassName || className) && prevClassName !== className) { |
src/figure/FigureStateActive.js
Outdated
* @param {Object} config.htmlEditor | ||
* @returns | ||
*/ | ||
export default function (config) { |
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.
suggestion: It could also have been turned into a restructured declaration as mentioned in the coding guide
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:
export default function (config) { | |
export default function (stateFactory, ActiveState, { formTpl, formElement, inlineHelper, htmlEditor }) { |
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.
- 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
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.
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
Version
There are 0 BREAKING CHANGE, 0 feature, 12 fixes |
Related to: AUT-2673
Parent Extension
Changes: