Move all files to 2017/
This commit is contained in:
parent
ac7370f67f
commit
2875863330
15717 changed files with 0 additions and 0 deletions
46
2017/web/core/modules/text/text.js
Normal file
46
2017/web/core/modules/text/text.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function ($, Drupal) {
|
||||
Drupal.behaviors.textSummary = {
|
||||
attach: function attach(context, settings) {
|
||||
$(context).find('.js-text-summary').once('text-summary').each(function () {
|
||||
var $widget = $(this).closest('.js-text-format-wrapper');
|
||||
|
||||
var $summary = $widget.find('.js-text-summary-wrapper');
|
||||
var $summaryLabel = $summary.find('label').eq(0);
|
||||
var $full = $widget.children('.js-form-type-textarea');
|
||||
var $fullLabel = $full.find('label').eq(0);
|
||||
|
||||
if ($fullLabel.length === 0) {
|
||||
$fullLabel = $('<label></label>').prependTo($full);
|
||||
}
|
||||
|
||||
var $link = $('<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">' + Drupal.t('Hide summary') + '</button>)</span>');
|
||||
var $button = $link.find('button');
|
||||
var toggleClick = true;
|
||||
$link.on('click', function (e) {
|
||||
if (toggleClick) {
|
||||
$summary.hide();
|
||||
$button.html(Drupal.t('Edit summary'));
|
||||
$link.appendTo($fullLabel);
|
||||
} else {
|
||||
$summary.show();
|
||||
$button.html(Drupal.t('Hide summary'));
|
||||
$link.appendTo($summaryLabel);
|
||||
}
|
||||
e.preventDefault();
|
||||
toggleClick = !toggleClick;
|
||||
}).appendTo($summaryLabel);
|
||||
|
||||
if ($widget.find('.js-text-summary').val() === '') {
|
||||
$link.trigger('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery, Drupal);
|
Reference in a new issue