Attaches qTip2 library.

This commit is contained in:
2021-02-18 09:58:23 +00:00
parent f1c8ff03f6
commit 01c01ed99c
4 changed files with 44 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
qTip2:
remote: https://github.com/qTip2/qTip2
version: 3.0.3
license:
name: MIT
url: https://github.com/qTip2/qTip2/blob/master/LICENSE
gpl-compatible: true
js:
https://cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.js: { type: external, minified: true }
js/tooltip.js: { }
css:
theme:
https://cdnjs.cloudflare.com/ajax/libs/qtip2/3.0.3/jquery.qtip.min.css: { type: external, minified: true }
css/tooltip.css: { }
dependencies:
- core/jquery
+4
View File
@@ -0,0 +1,4 @@
.cdesai-tff-tooltip {
margin: 1em 0;
cursor: crosshair;
}
+19
View File
@@ -0,0 +1,19 @@
(function ($, Drupal, drupalSettings) {
'use strict';
Drupal.behaviors.cdesai_tff_tooltip = {
attach: function (context, settings) {
$('body', context).once('cdesai_tff_tooltip').each(function () {
$('[data-tooltip!=""]').qtip({
content: {
attr: 'data-tooltip'
}
});
});
}
};
})(jQuery, Drupal, drupalSettings);
@@ -45,6 +45,11 @@ class TooltipTextFormatter extends DesaiTextFormatterBase {
'class' => [$this->getCssClassId()],
'data-tooltip' => $random->sentences(self::$MIN_WORDS),
],
'#attached' => [
'library' => [
'cdesai_tff/qTip2'
],
],
];
}