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

When typing in a MathQuill input, update positions of all feedback popovers. #1131

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions htdocs/js/MathQuill/mqeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if (input.classList.contains('partially-correct')) answerQuill.classList.add('partially-correct');

// Find the feedback button for this input if there is one on the page.
const feedbackBtn = Array.from(document.querySelectorAll(`button[data-answer-labels]`)).find((btn) =>
answerQuill.feedbackBtn = Array.from(document.querySelectorAll(`button[data-answer-labels]`)).find((btn) =>
JSON.parse(btn.dataset.answerLabels).includes(answerLabel)
);

Expand Down Expand Up @@ -269,8 +269,11 @@
answerQuill.latexInput.value = '';
}

// If the feedback popover is open, then update its position.
if (feedbackBtn) bootstrap.Popover.getInstance(feedbackBtn)?.update();
// If any feedback popovers are open, then update their positions.
for (const quill of Object.keys(window.answerQuills)) {
if (window.answerQuills[quill].feedbackBtn)
bootstrap.Popover.getInstance(window.answerQuills[quill].feedbackBtn)?.update();
}
};

input.after(answerQuill);
Expand Down