Skip to content

Commit

Permalink
Added click() on default submit button.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsharman committed Mar 21, 2024
1 parent 5e6bb24 commit df43308
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/module-Extensions_Authoring_ssmlEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1 class="page-title">Extensions/Authoring/ssmlEditor</h1>
&quot;customButtons&quot;: [
{
&quot;func&quot;: &quot;launchSsmlEditor&quot;,
&quot;icon&quot;: &quot;/path/to/images/text-to-speech.svg&quot;,
&quot;icon&quot;: &quot;/path/to/images/dist/3d863d117b67171f55e8.svg&quot;,
&quot;label&quot;: &quot;Add SSML&quot;,
&quot;name&quot;: &quot;addSsml&quot;,
&quot;attributes&quot;: [&quot;content&quot;,&quot;stimulus&quot;,&quot;template&quot;,&quot;options&quot;]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caspingus/lt",
"version": "2.8.1",
"version": "2.8.2",
"description": "A utility library of helpers and tools for working with Learnosity APIs.",
"main": "src/index.js",
"author": "michael@learnosity.com",
Expand Down
35 changes: 23 additions & 12 deletions src/assessment/extensions/validation/essayLimitByCharacter.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,25 +514,36 @@ function loadErrorDialog(itemReferences) {

/**
* Because we are using a custom submit button, we need
* to submit manually when the button is clicked.
* to submit manually when the button is clicked. However,
* we do this by sending a click through the (hidden)
* default submit button. This way we get the player behaviour
* for submission that isn't available using the submit() method.
* If for some reason there is no default submit button, we
* submit using the method, with no default checks.
* @since 1.1.0
* @ignore
*/
function submit() {
const settings = {
show_submit_confirmation: true,
show_submit_ui: true,
const elDefaultSubmit = document.getElementById('lrn_assess_next_btn');

success: function (response_ids) {
logger.info('Submit was successful', response_ids);
},
if (elDefaultSubmit) {
elDefaultSubmit.click();
} else {
const settings = {
show_submit_confirmation: true,
show_submit_ui: true,

error: function (event) {
logger.error('Submit has failed', event);
},
};
success: function (response_ids) {
logger.info('Submit was successful', response_ids);
},

app.appInstance().submit(settings);
error: function (event) {
logger.error('Submit has failed', event);
},
};

app.appInstance().submit(settings);
}
}

/**
Expand Down

0 comments on commit df43308

Please sign in to comment.