From 5ba9cb1791cee195c84569b8dddfbfc31efcd9b1 Mon Sep 17 00:00:00 2001
From: Brian Canini <canini.16@osu.edu>
Date: Mon, 15 Jun 2020 13:39:42 -0400
Subject: [PATCH] Updating drupal/editor_advanced_link (1.4.0 => 1.8.0)

---
 composer.json                                 |  2 +-
 composer.lock                                 | 23 +++---
 vendor/composer/installed.json                | 23 +++---
 web/modules/editor_advanced_link/README.txt   | 77 +++++++++++++++++++
 .../editor_advanced_link.info.yml             | 10 +--
 .../editor_advanced_link.libraries.yml        |  8 ++
 .../editor_advanced_link.module               | 17 +++-
 .../js/editor_advanced_link.js                | 21 +++++
 8 files changed, 147 insertions(+), 34 deletions(-)
 create mode 100644 web/modules/editor_advanced_link/README.txt
 create mode 100644 web/modules/editor_advanced_link/editor_advanced_link.libraries.yml
 create mode 100644 web/modules/editor_advanced_link/js/editor_advanced_link.js

diff --git a/composer.json b/composer.json
index fcdc5f8e2e..74e3f38c18 100644
--- a/composer.json
+++ b/composer.json
@@ -111,7 +111,7 @@
         "drupal/devel": "2.0",
         "drupal/draggableviews": "1.0",
         "drupal/dropzonejs": "2.1",
-        "drupal/editor_advanced_link": "1.4",
+        "drupal/editor_advanced_link": "1.8",
         "drupal/embed": "1.0",
         "drupal/entity": "1.0-beta1",
         "drupal/entity_browser": "1.10",
diff --git a/composer.lock b/composer.lock
index 6a9667cf32..e9c852f421 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "f108b03d13affee27b523a0310a3f20f",
+    "content-hash": "0fe6f0e03b27ef59ca6ff1bb1b4899c5",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -4157,29 +4157,26 @@
         },
         {
             "name": "drupal/editor_advanced_link",
-            "version": "1.4.0",
+            "version": "1.8.0",
             "source": {
                 "type": "git",
                 "url": "https://git.drupalcode.org/project/editor_advanced_link.git",
-                "reference": "8.x-1.4"
+                "reference": "8.x-1.8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://ftp.drupal.org/files/projects/editor_advanced_link-8.x-1.4.zip",
-                "reference": "8.x-1.4",
-                "shasum": "52cf139a313d5fa6a461a25a1ba36ae987bc403d"
+                "url": "https://ftp.drupal.org/files/projects/editor_advanced_link-8.x-1.8.zip",
+                "reference": "8.x-1.8",
+                "shasum": "510c3abff415933a34f4b8284d1440aaec2b95d9"
             },
             "require": {
-                "drupal/core": "*"
+                "drupal/core": "^8 || ^9"
             },
             "type": "drupal-module",
             "extra": {
-                "branch-alias": {
-                    "dev-1.x": "1.x-dev"
-                },
                 "drupal": {
-                    "version": "8.x-1.4",
-                    "datestamp": "1490108883",
+                    "version": "8.x-1.8",
+                    "datestamp": "1588757015",
                     "security-coverage": {
                         "status": "covered",
                         "message": "Covered by Drupal's security advisory policy"
@@ -4199,7 +4196,7 @@
             "description": "Add title, target etc. attributes to Text Editor's link dialog if the text format allows them.",
             "homepage": "https://www.drupal.org/project/editor_advanced_link",
             "support": {
-                "source": "http://cgit.drupalcode.org/editor_advanced_link"
+                "source": "https://git.drupalcode.org/project/editor_advanced_link"
             }
         },
         {
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index bcbbfd79f6..f0cff289f6 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -4280,30 +4280,27 @@
     },
     {
         "name": "drupal/editor_advanced_link",
-        "version": "1.4.0",
-        "version_normalized": "1.4.0.0",
+        "version": "1.8.0",
+        "version_normalized": "1.8.0.0",
         "source": {
             "type": "git",
             "url": "https://git.drupalcode.org/project/editor_advanced_link.git",
-            "reference": "8.x-1.4"
+            "reference": "8.x-1.8"
         },
         "dist": {
             "type": "zip",
-            "url": "https://ftp.drupal.org/files/projects/editor_advanced_link-8.x-1.4.zip",
-            "reference": "8.x-1.4",
-            "shasum": "52cf139a313d5fa6a461a25a1ba36ae987bc403d"
+            "url": "https://ftp.drupal.org/files/projects/editor_advanced_link-8.x-1.8.zip",
+            "reference": "8.x-1.8",
+            "shasum": "510c3abff415933a34f4b8284d1440aaec2b95d9"
         },
         "require": {
-            "drupal/core": "*"
+            "drupal/core": "^8 || ^9"
         },
         "type": "drupal-module",
         "extra": {
-            "branch-alias": {
-                "dev-1.x": "1.x-dev"
-            },
             "drupal": {
-                "version": "8.x-1.4",
-                "datestamp": "1490108883",
+                "version": "8.x-1.8",
+                "datestamp": "1588757015",
                 "security-coverage": {
                     "status": "covered",
                     "message": "Covered by Drupal's security advisory policy"
@@ -4324,7 +4321,7 @@
         "description": "Add title, target etc. attributes to Text Editor's link dialog if the text format allows them.",
         "homepage": "https://www.drupal.org/project/editor_advanced_link",
         "support": {
-            "source": "http://cgit.drupalcode.org/editor_advanced_link"
+            "source": "https://git.drupalcode.org/project/editor_advanced_link"
         }
     },
     {
diff --git a/web/modules/editor_advanced_link/README.txt b/web/modules/editor_advanced_link/README.txt
new file mode 100644
index 0000000000..0dab159675
--- /dev/null
+++ b/web/modules/editor_advanced_link/README.txt
@@ -0,0 +1,77 @@
+CONTENTS OF THIS FILE
+---------------------
+
+ * Introduction
+ * Requirements
+ * Recommended modules
+ * Installation
+ * Configuration
+ * Maintainers
+
+
+INTRODUCTION
+------------
+
+Enhances the link Dialog in CKEditor.
+Allows to define the following attributes:
+- title
+- class
+- id
+- target
+- rel
+
+ * For a full description of the module, visit the project page:
+   https://www.drupal.org/project/editor_advanced_link
+
+ * To submit bug reports and feature suggestions, or track changes:
+   https://www.drupal.org/project/issues/editor_advanced_link
+
+
+REQUIREMENTS
+------------
+
+This module requires no modules outside of Drupal core.
+
+
+RECOMMENDED MODULES
+-------------------
+
+ * Editor File upload (https://www.drupal.org/project/editor_file):
+   Allows to create link to uploaded files in the text editor easily.
+ * Linkit (https://www.drupal.org/project/linkit):
+   Provides an easy interface for internal and external linking with WYSIWYG
+   editors by using an autocomplete field.
+ * CKEditor Entity Link (https://www.drupal.org/project/ckeditor_entity_link):
+   It is an alternative to Linkit that also provides an easy interface for
+   internal linking within the editor.
+
+
+INSTALLATION
+------------
+
+Install the module as you would normally install a contributed Drupal module.
+Visit https://www.drupal.org/node/1897420 for further information.
+
+
+CONFIGURATION
+-------------
+
+Install as usual then:
+
+    - go to the "Text formats and editor" admin page (admin/config/content/formats)
+    - configure your text format
+    - if the "Limit allowed HTML tags and correct faulty HTML" filter is disabled
+      you dont have anything to do with this text format
+    - else, add the "title", "class", "id", "target" and/or the "rel" attributes to
+      the "allowed HTML tags" field (only those whitelisted will show up in the dialog)
+
+
+MAINTAINERS
+-----------
+
+Current maintainers:
+
+ * Edouard Cunibil (DuaelFr) - https://www.drupal.org/u/duaelfr
+
+This project has been sponsored by:
+ * Happyculture (paid contribution time) - https://happyculture.coop
diff --git a/web/modules/editor_advanced_link/editor_advanced_link.info.yml b/web/modules/editor_advanced_link/editor_advanced_link.info.yml
index a78e20695b..d028cd125d 100644
--- a/web/modules/editor_advanced_link/editor_advanced_link.info.yml
+++ b/web/modules/editor_advanced_link/editor_advanced_link.info.yml
@@ -1,12 +1,12 @@
 name: 'Advanced Link'
 description: 'Add title, target etc. attributes to Text Editor''s link dialog if the text format allows them.'
 type: module
-# core: 8.x
+core: 8.x
+core_version_requirement: ^8 || ^9
 dependencies:
   - drupal:editor
 
-# Information added by Drupal.org packaging script on 2017-03-21
-version: '8.x-1.4'
-core: '8.x'
+# Information added by Drupal.org packaging script on 2020-05-06
+version: '8.x-1.8'
 project: 'editor_advanced_link'
-datestamp: 1490108886
+datestamp: 1588757017
diff --git a/web/modules/editor_advanced_link/editor_advanced_link.libraries.yml b/web/modules/editor_advanced_link/editor_advanced_link.libraries.yml
new file mode 100644
index 0000000000..4f14f1ce72
--- /dev/null
+++ b/web/modules/editor_advanced_link/editor_advanced_link.libraries.yml
@@ -0,0 +1,8 @@
+editor_advanced_link:
+  version: VERSION
+  js:
+    js/editor_advanced_link.js: {}
+  dependencies:
+    - core/drupal
+    - core/jquery
+    - core/jquery.once
diff --git a/web/modules/editor_advanced_link/editor_advanced_link.module b/web/modules/editor_advanced_link/editor_advanced_link.module
index 324a5fa76c..5959e6e94c 100644
--- a/web/modules/editor_advanced_link/editor_advanced_link.module
+++ b/web/modules/editor_advanced_link/editor_advanced_link.module
@@ -61,6 +61,9 @@ function editor_advanced_link_form_editor_link_dialog_alter(&$form, FormStateInt
     return $restrictions === FALSE || $restrictions['allowed']['a'] === TRUE || !empty($restrictions['allowed']['a'][$attribute_name]);
   };
 
+  // Load the library.
+  $form['#attached']['library'][] = 'editor_advanced_link/editor_advanced_link';
+
   $form['attributes']['href']['#weight'] = 0;
 
   $form['attributes']['title'] = [
@@ -93,7 +96,7 @@ function editor_advanced_link_form_editor_link_dialog_alter(&$form, FormStateInt
   $form['attributes']['id'] = [
     '#type' => 'textfield',
     '#title' => t('ID'),
-    '#description' => t('Allows linking to this content using a <a href="https://en.wikipedia.org/wiki/Fragment_identifier">URL fragment</a>). Must be unique.'),
+    '#description' => t('Allows linking to this content using a <a href="https://en.wikipedia.org/wiki/Fragment_identifier" target="_blank">URL fragment</a>. Must be unique.'),
     '#default_value' => $get_default_value('id'),
     '#maxlength' => 512,
     '#access' => $is_accessible('id'),
@@ -101,8 +104,9 @@ function editor_advanced_link_form_editor_link_dialog_alter(&$form, FormStateInt
   ];
 
   $form['attributes']['target'] = [
-    '#title' => t('Open in new window'),
+    '#title' => t('Open in new window/tab'),
     '#type' => 'checkbox',
+    '#description' => t('See WCAG guidance on <a href="https://www.w3.org/WAI/WCAG21/Techniques/general/G200" target="_blank">opening links in new windows/tabs</a>.'),
     '#default_value' => $get_default_value('target', FALSE),
     '#return_value' => '_blank',
     '#access' => $is_accessible('target'),
@@ -131,6 +135,15 @@ function editor_advanced_link_form_editor_link_dialog_alter(&$form, FormStateInt
   array_unshift($form['#validate'], '_editor_advanced_link_attributes_validate');
 }
 
+/**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * LinkIt 5.x module compatibility.
+ */
+function editor_advanced_link_form_linkit_editor_dialog_form_alter(&$form, FormStateInterface $form_state, $form_id) {
+  editor_advanced_link_form_editor_link_dialog_alter($form, $form_state, $form_id);
+}
+
 /**
  * Filter empty attributes to avoid empty HTML output.
  */
diff --git a/web/modules/editor_advanced_link/js/editor_advanced_link.js b/web/modules/editor_advanced_link/js/editor_advanced_link.js
new file mode 100644
index 0000000000..d4d34465c8
--- /dev/null
+++ b/web/modules/editor_advanced_link/js/editor_advanced_link.js
@@ -0,0 +1,21 @@
+
+(function (Drupal, $) {
+
+  'use strict';
+
+  Drupal.behaviors.editor_advanced_link = {
+    attach: function (context, settings) {
+      // Reset modal window position when advanced details element is opened or
+      // closed to prevent the element content to be out of the screen.
+      $('.editor-link-dialog details[data-drupal-selector="edit-advanced"]').once('editor_advanced_link')
+        .on('toggle', function () {
+          $("#drupal-modal").dialog({
+            position: {
+              of: window
+            }
+          });
+      });
+    }
+  };
+
+}(Drupal, jQuery));
-- 
GitLab