1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00
This commit is contained in:
Ryan Cramer
2023-05-18 11:50:29 -04:00
parent 3598fb113b
commit a76e54193e
3 changed files with 26 additions and 22 deletions

View File

@@ -259,34 +259,38 @@ $(document).ready(function() {
var emailIcon = 'fa-envelope-o';
var anchorIcon = 'fa-flag-o';
var allIcons = primaryIcon + ' ' + extLinkIcon + ' ' + emailIcon + ' ' + anchorIcon;
var extLinkClass = cfg.extLinkClass;
var extLinkClassAll = extLinkClass.replace(' ', '_');
var extLinkClasses = extLinkClass.indexOf(' ') > -1 ? extLinkClass.split(' ') : [ extLinkClass ];
var extLinkRel = cfg.extLinkRel;
var extLinkTarget = cfg.extLinkTarget;
if(external) {
if (!$this.hasClass('external-link')) {
if(!$this.hasClass('external-link')) {
icon().removeClass(allIcons).addClass(extLinkIcon);
$this.addClass('external-link');
var extLinkTarget = cfg.extLinkTarget;
if(extLinkTarget.length > 0) {
$("#link_target").val(extLinkTarget);
}
var extLinkRel = cfg.extLinkRel;
if(extLinkRel.length > 0) {
$("#link_rel").val(extLinkRel);
}
var extLinkClass = cfg.extLinkClass;
if(extLinkClass.length > 0) {
if(extLinkClass.indexOf(' ') > -1) {
var extLinkClassAll = extLinkClass.replace(' ', '_');
if(extLinkTarget.length > 0) $("#link_target").val(extLinkTarget);
if(extLinkRel.length > 0) $("#link_rel").val(extLinkRel);
if(extLinkClasses.length > 0) {
if(extLinkClasses.length > 1) {
$("#link_class_" + extLinkClassAll).prop('checked', true); // all classes in 1 option
extLinkClass = extLinkClass.split(' ');
}
for(n = 0; n < extLinkClass.length; n++) {
// $("#link_class_" + extLinkClass[n]).attr('checked', 'checked'); // JQM
$("#link_class_" + extLinkClass[n]).prop('checked', true);
for(n = 0; n < extLinkClasses.length; n++) {
$("#link_class_" + extLinkClasses[n]).prop('checked', true);
}
}
}
} else {
$this.removeClass('external-link');
if($this.hasClass('external-link')) {
// was previously an external link but no longer is
$this.removeClass('external-link');
if(extLinkRel.length) $('#link_rel').val('');
if(extLinkTarget.length) $('#link_target').val('');
$("#link_class_" + extLinkClassAll).prop('checked', false); // all classes in 1 option
for(n = 0; n < extLinkClasses.length; n++) {
$("#link_class_" + extLinkClasses[n]).prop('checked', false);
}
}
var $icon = icon();
if($this.hasClass('email')) {
if(!$icon.hasClass(emailIcon)) $icon.removeClass(allIcons).addClass(emailIcon);

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,7 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
return array(
'title' => 'Page Edit Link',
'summary' => 'Provides a link capability as used by some Fieldtype modules (like rich text editors).',
'version' => 111,
'version' => 112,
'permanent' => true,
'permission' => 'page-edit',
'icon' => 'link',
@@ -662,7 +662,7 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
/** @var InputfieldFieldset $fieldset */
$fieldset = $modules->get('InputfieldFieldset');
$fieldset->label = $this->_('External link attributes');
$fieldset->description = $this->_('Specify the default selected attributed that will be automatically populated when an external link is detected.');
$fieldset->description = $this->_('Specify the default selected attributes that will be automatically populated when an external link is detected.');
$fieldset->description .= ' ' . $this->_('If used, the value must be one you have predefined above.');
$fieldset->icon = 'external-link';
$fieldset->collapsed = Inputfield::collapsedBlank;