Allow annotation creation without a prior selection#7952
Draft
david-yz-liu wants to merge 1 commit into
Draft
Conversation
When grading, the context menu previously disabled all annotation creation options if no region was selected. Graders can now create annotations at any time; a fallback selection is synthesized automatically: - Text/code: first character of the first non-empty line - HTML/Jupyter: first character of the first text node in the iframe - Image: 40×40 px box centred at the right-click position - PDF: 40×40 box centred at the right-click position (with rotation correction), in COORDINATE_MULTIPLIER-scaled percentage space If no fallback can be synthesized (empty file, no text content, etc.) an I18n alert is shown instead of silently failing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2ae2eb0 to
261eec1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Enables graders to create annotations in MarkUs even when no region has been explicitly selected in the file viewer. Previously, all annotation creation options in the right-click context menu were disabled unless the grader had first highlighted text, dragged a box on an image, or drawn a region on a PDF.
When a grader right-clicks without a selection, the context menu now enables all annotation creation items. If the grader proceeds to create an annotation, a fallback selection is synthesized automatically:
If no fallback can be synthesized (empty file, HTML with no text content, PDF with no loaded pages, image with no dimensions), an alert is shown: "Cannot create annotation: the file has no content to annotate."
This change also fixes a pre-existing crash:
window.annotation_managerisnullfor HTML files, causing the originalbeforeOpenhandler to throwTypeErrorevery time the context menu was opened on an HTML file.Screenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)
Type of Change
Checklist
Before opening your pull request:
After opening your pull request:
Questions and Comments