Commit d95a3927 authored by Wim Leers's avatar Wim Leers Committed by John Svensson
Browse files

Issue #3288339 by Wim Leers, Project Update Bot, immaculatexavier: Drupal 10 compatibility

parent fcb5a582
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
    "source": "http://cgit.drupalcode.org/linkit"
  },
  "require" : {
    "drupal/core": "^8.7.7 || ^9"
    "drupal/core": "^9.4 || ^10"
  },
  "license": "GPL-2.0-or-later"
}
+13 −9
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Linkit Autocomplete based on jQuery UI.
 */

(function ($, Drupal, _) {
(function ($, Drupal, once) {

  'use strict';

@@ -118,9 +118,14 @@
  function renderMenu(ul, items) {
    var self = this.element.autocomplete('instance');

    var grouped_items = _.groupBy(items, function (item) {
      return item.hasOwnProperty('group') ? item.group : '';
    });
    var grouped_items = {};
    items.forEach(function (item) {
      const group = item.hasOwnProperty('group') ? item.group : '';
      if (!grouped_items.hasOwnProperty(group)) {
        grouped_items[group] = [];
      }
      grouped_items[group].push(item);
    })

    $.each(grouped_items, function (group, items) {
      if (group.length) {
@@ -156,7 +161,7 @@
  Drupal.behaviors.linkit_autocomplete = {
    attach: function (context) {
      // Act on textfields with the "form-linkit-autocomplete" class.
      var $autocomplete = $(context).find('input.form-linkit-autocomplete').once('linkit-autocomplete');
      var $autocomplete = $(once('linkit-autocomplete', 'input.form-linkit-autocomplete', context));
      if ($autocomplete.length) {
        $.widget('custom.autocomplete', $.ui.autocomplete, {
          _create: function () {
@@ -185,9 +190,8 @@
    },
    detach: function (context, settings, trigger) {
      if (trigger === 'unload') {
        $(context).find('input.form-linkit-autocomplete')
          .removeOnce('linkit-autocomplete')
          .autocomplete('destroy');
        once.remove('linkit-autocomplete', 'input.form-linkit-autocomplete', context)
          .forEach((autocomplete) => $(autocomplete).autocomplete('destroy'));
      }
    }
  };
@@ -212,4 +216,4 @@
    }
  };

})(jQuery, Drupal, _);
})(jQuery, Drupal, once);
+10 −7
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Send events to add or remove a tags to the filter_html allowed tags.
 */

(function ($, Drupal, document) {
(function ($, Drupal, document, once) {

  'use strict';

@@ -19,8 +19,11 @@
    attach: function (context) {
      var selector = '[data-drupal-selector="edit-filters-linkit-status"]';
      var feature = editorFeature();
      $(context).find(selector).once('filters-linkit-status').each(function () {
        $(this).on('click', function () {

      once('filters-linkit-status', selector, context)
        .forEach((checkbox) => {
          const $checkbox = $(checkbox);
          $checkbox.on('click', function () {
            var eventName = $(this).is(':checked') ? 'drupalEditorFeatureAdded' : 'drupalEditorFeatureRemoved';
            $(document).trigger(eventName, feature);
          });
@@ -48,4 +51,4 @@
    return linkitFeature;
  }

})(jQuery, Drupal, document);
})(jQuery, Drupal, document, once);
+2 −1
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@ name: Linkit
type: module
description: 'Provides an easy interface for internal and external linking with wysiwyg editors.'
package: User interface
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^9.4 || ^10
configure: entity.linkit_profile.collection
test_dependencies:
  - imce:imce
  - drupal:ckeditor
+6 −2
Original line number Diff line number Diff line
@@ -23,10 +23,14 @@ linkit.autocomplete:
  dependencies:
    - linkit/linkit.base
    - core/drupal.ajax
    - core/jquery.ui.autocomplete
    - core/underscore
    - core/drupal.autocomplete
    - core/once

linkit.filter_html.admin:
  version: VERSION
  js:
    js/linkit.filter_html.admin.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/once
Loading