From 942dbd20db6486bd73e155a2d0c645cf78b922d4 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 13 Feb 2024 19:31:09 +0100 Subject: [PATCH] Fix display of custom annotations in ACE Editor With these changes, we no longer need our custom changes previously restored with 1013903. --- app/assets/javascripts/request_for_comments.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/request_for_comments.js b/app/assets/javascripts/request_for_comments.js index 54900fd5..0c9c07db 100644 --- a/app/assets/javascripts/request_for_comments.js +++ b/app/assets/javascripts/request_for_comments.js @@ -159,6 +159,7 @@ $(document).on('turbolinks:load', function () { jqrequest.done(function (response) { $.each(response, function (index, comment) { comment.className = 'code-ocean_comment'; + comment.type = 'info'; // Required for the annotation to be rendered correctly (besides being hidden through CSS). }); session.setAnnotations(response); }); @@ -267,10 +268,10 @@ $(document).on('turbolinks:load', function () { let lastTarget = null; function showPopover(e) { - const target = e.domEvent.target; + const target = e.domEvent.target.closest('.ace_gutter-cell'); const row = e.getDocumentPosition().row; - if (target.className.indexOf('ace_gutter-cell') === -1 || lastRow === row) { + if (target?.className?.indexOf('ace_gutter-cell') === -1 || lastRow === row) { return; } if (lastTarget === target) { @@ -297,8 +298,9 @@ $(document).on('turbolinks:load', function () { }); function handleSidebarClick(e) { - const target = e.domEvent.target; - if (target.className.indexOf('ace_gutter-cell') === -1) return; + const target = e.domEvent.target.closest('.ace_gutter-cell'); + if (target === null) return; + if (target?.className?.indexOf('ace_gutter-cell') === -1) return; const editor = e.editor; const fileid = $(editor.container).data('file-id');