Merge pull request #20189 from timvandermeij/null-signal

[Editor] Don't use a null signal for the comment button
This commit is contained in:
Tim van der Meij 2025-08-24 20:43:36 +02:00 committed by GitHub
commit 649a03f817
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,12 +39,17 @@ class Comment {
if (!this.#editor._uiManager.hasCommentManager()) { if (!this.#editor._uiManager.hasCommentManager()) {
return null; return null;
} }
const comment = (this.#commentButton = document.createElement("button")); const comment = (this.#commentButton = document.createElement("button"));
comment.className = "comment"; comment.className = "comment";
comment.tabIndex = "0"; comment.tabIndex = "0";
comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button"); comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button");
const signal = this.#editor._uiManager._signal; const signal = this.#editor._uiManager._signal;
if (!(signal instanceof AbortSignal) || signal.aborted) {
return comment;
}
comment.addEventListener("contextmenu", noContextMenu, { signal }); comment.addEventListener("contextmenu", noContextMenu, { signal });
comment.addEventListener("pointerdown", event => event.stopPropagation(), { comment.addEventListener("pointerdown", event => event.stopPropagation(), {
signal, signal,