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

Checkbox for Open in new window in Problem Editor is not functioning correctly #1488

Closed
jutrembBDEB opened this issue Aug 26, 2021 · 1 comment

Comments

@jutrembBDEB
Copy link
Contributor

In Problem Editor, the is two checkboxes for "Open in new window", in the View and Save tabs, and both are given the ID "newWindow". This creates a problem because in the JavaScript, when it asks to see if the checkbox is checked in the Save tab, it is always looking at the checkbox in the View tab instead. So, in the Save tab, the checkbox is not behaving correctly. Here's the related code in pgproblemeditor.js.

if ((actionView && actionView.classList.contains('active')) || (actionSave && actionSave.classList.contains('active'))) {
			target = document.getElementById("newWindow").checked ? "WW_View" : "pg_editor_frame";

In the precedent versions of WeBWorK, there was only on checkbox for "Open in new window", that why it didn't have this problem. I think the solution is to give both checkbox different ID, like newViewWindow and newSaveWindow. Here's what I would do

if((actionView && actionView.classList.contains('active'))){
	target = document.getElementById("newViewWindow").checked ? "WW_View" : "pg_editor_frame";
} else if ((actionSave && actionSave.classList.contains('active'))) {
	target = document.getElementById("newSaveWindow").checked ? "WW_View" : "pg_editor_frame";
}
@drgrice1
Copy link
Member

drgrice1 commented Mar 2, 2022

This issue has been fixed. Closing...

@drgrice1 drgrice1 closed this as completed Mar 2, 2022
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

No branches or pull requests

2 participants