Skip to content

Commit

Permalink
Remove TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Sep 11, 2023
1 parent 4019e61 commit 121a228
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/h5phelpers/forms/interactionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export const createInteractionForm = (field, params, wrapper, parent) => {
});
};

// TODO: Why was removing fields done using DOM queries? Couldn't this be done on the instances?

const libraryWrapper = wrapper.querySelector('.field.library');

const hiddenSemanticsSelectors = [
Expand All @@ -69,15 +67,21 @@ export const createInteractionForm = (field, params, wrapper, parent) => {
'.h5peditor-copypaste-wrap',
];

// Remove fields in that we don't want to show when library is not AdvancedText
// Remove fields in that we don't want to show when library isn't AdvancedText
if (params.action.library.indexOf('H5P.AdvancedText') === -1) {
removeElements(wrapper, '.field-name-showAsOpenSceneContent', '');
}
else {
//If library is AdvancedText, then add a listener for dynamically removing the hotspot checkbox when opene scene content is checked.
//The hiding/removal of the openSceneContent checkbox when hotspot is toggle is handled by the showWhen widget declared in semantics.json
/*
* If library is AdvancedText, then add listener for dynamically removing
* hotspot checkbox when opene scene content is checked.
* The hiding/removal of the openSceneContent checkbox when hotspot is
* toggle is handled by the showWhen widget declared in semantics.json.
* Required, because showWhen cannot be chained.
*/
const hotSpotField = wrapper.querySelector('.field-name-showAsHotspot');
const openSceneContentToggle = wrapper.querySelector('.field-name-showAsOpenSceneContent input');
const openSceneContentToggle = wrapper
.querySelector('.field-name-showAsOpenSceneContent input');
hideElementsOnChecked(openSceneContentToggle, hotSpotField);
}

Expand Down

0 comments on commit 121a228

Please sign in to comment.