Verified Commit 449f6fbf authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3239139 by shubh_, Theresa.Grannum, alexpott: Refactor (if feasible)...

Issue #3239139 by shubh_, Theresa.Grannum, alexpott: Refactor (if feasible) uses of the jQuery animate function to use Vanilla/native
parent d128b456
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
  "rules": {
    "jquery/no-ajax": 0,
    "jquery/no-ajax-events": 2,
    "jquery/no-animate": 0,
    "jquery/no-animate": 2,
    "jquery/no-attr": 0,
    "jquery/no-bind": 2,
    "jquery/no-class": 0,
+5 −1
Original line number Diff line number Diff line
@@ -1852,9 +1852,13 @@
      while ($(scrollTarget).scrollTop() === 0 && $(scrollTarget).parent()) {
        scrollTarget = $(scrollTarget).parent();
      }

      // Only scroll upward.
      if (offset.top - 10 < $(scrollTarget).scrollTop()) {
        $(scrollTarget).animate({ scrollTop: offset.top - 10 }, 500);
        scrollTarget.get(0).scrollTo({
          top: offset.top - 10,
          behavior: 'smooth',
        });
      }
    },
  };
+7 −11
Original line number Diff line number Diff line
@@ -91,17 +91,13 @@
          context,
        ).forEach((container) => {
          const $container = $(container);
          // Just scrolling the document.body will not work in Firefox. The html
          // element is needed as well.
          $('html, body').animate(
            {
              scrollTop:
          window.scrollTo({
            top:
              $('.js-block-placed').offset().top -
              $container.offset().top +
              $container.scrollTop(),
            },
            500,
          );
            behavior: 'smooth',
          });
        });
      }
    },
+12 −6
Original line number Diff line number Diff line
@@ -651,12 +651,18 @@

  // Respond to new dialogs that are opened by CKEditor, closing the AJAX loader.
  $(window).on('dialog:beforecreate', () => {
    $('.ckeditor5-dialog-loading').animate(
      { top: '-40px' },
    const dialogLoading = document.querySelector('.ckeditor5-dialog-loading');

    if (dialogLoading) {
      dialogLoading.addEventListener(
        'transitionend',
        function removeDialogLoading() {
        $(this).remove();
          dialogLoading.remove();
        },
      );
      dialogLoading.style.transition = 'top 0.5s ease';
      dialogLoading.style.top = '-40px';
    }
  });

  // Respond to dialogs that are saved, sending data back to CKEditor.