Skip to content
Snippets Groups Projects
Commit 3dd84d94 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Sascha Grossenbacher
Browse files

Issue #3277779 by Berdir, nod_: Replace jquery once with once()

parent 1b13d724
No related branches found
No related tags found
No related merge requests found
......@@ -5,9 +5,7 @@
Drupal.behaviors.tokenTree = {
attach: function (context, settings) {
$('table.token-tree', context).once('token-tree').each(function () {
$(this).treetable({ expandable: true });
});
$(once('token-tree', 'table.token-tree', context)).treetable({ expandable: true});
}
};
......@@ -18,8 +16,8 @@
drupalSettings.tokenFocusedField = this;
});
$('.token-click-insert .token-key', context).once('token-click-insert').each(function () {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function () {
once('token-click-insert', '.token-click-insert .token-key', context).forEach(function (token) {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(token).html() + '</a>').click(function () {
var content = this.text;
// Always work in normal text areas that currently have focus.
......@@ -58,7 +56,7 @@
return false;
});
$(this).html(newThis);
$(token).html(newThis);
});
function insertAtCursor(editor, content) {
......
type: module
name: Token
description: Provides a user interface for the Token API and some missing core tokens.
core_version_requirement: ^9.1 || ^10
core_version_requirement: ^9.2 || ^10
......@@ -23,3 +23,4 @@ token:
dependencies:
- core/jquery
- core/drupal
- core/once
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment