| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/valence/components/com_community/assets/source/js/utils/ |
Upload File : |
(function( root, $, factory ) {
joms.util || (joms.util = {});
joms.util.wysiwyg = factory( root, $ );
define([ 'utils/loadlib' ], function() {
return joms.util.wysiwyg;
});
})( window, joms.jQuery, function( window, $ ) {
function start() {
var editor = $('textarea').filter('[data-wysiwyg=trumbowyg]');
if ( !editor.length ) {
return;
}
joms.util.loadLib( 'trumbowyg', function() {
trumbowygTranslate();
// Check RTL.
var isRTL = false;
if ( $('html').attr('dir') === 'rtl' ) {
isRTL = true;
}
// TODO: Set upload path.
$.extend( jQuery.trumbowyg, {
upload: {
serverPath: joms.BASE_URL + 'index.php?option=com_community&view=photos&task=ajaxPreviewComment&isEditor=1'
}
});
editor.each(function() {
var btns, config, instance;
btns = $( this ).data( 'btns' );
btns = btns || 'viewHTML,|,bold,italic,underline,|,unorderedList,orderedList,|,link,image';
btns = btns.split(',');
config = {
btnsDef: {
image: {
dropdown: [ 'insertImage', 'upload' ],
ico: 'insertImage'
}
},
btns: btns,
fullscreenable: false,
mobile: false,
tablet: false,
removeformatPasted: true,
autogrow: true
};
if ( isRTL ) {
config.dir = 'rtl';
}
instance = $( this ).trumbowyg( config )
.on('tbwblur', function() {
var t = $( this ).data('trumbowyg');
t.syncCode();
})
.data('trumbowyg');
// Override modal button render.
instance.buildModalBtn = trumbowygBuildModalBtn;
// Override modal input.
instance._openModalInsert = instance.openModalInsert;
instance.openModalInsert = function( title, fields, cmd ) {
var modBox = instance._openModalInsert( title, fields, cmd );
modBox.find('label').each(function() {
var label = $( this ),
input = label.find('input'),
name = input.attr('name'),
type = input.attr('type'),
html;
if ([ 'url', 'file', 'title', 'text', 'target', 'alt' ].indexOf( name ) >= 0 ) {
html = '<div class="joms-form__group" style="text-align:left">';
html += '<span style="width:90px;text-align:center">' + label.find('.trumbowyg-input-infos').text() + '</span>';
if ( type === 'file' ) {
html += '<input name="' + name + '" class="joms-input" value="' + ( input.val() || '' ) + '" type="file"';
html += ' accept="image/png,image/jpeg,image/gif,image/bmp">';
} else {
html += '<input name="' + name + '" class="joms-input" value="' + ( input.val() || '' ) + '" type="' + ( type || 'text' ) + '">';
}
html += '</div>';
label.replaceWith( $(html) );
}
});
return modBox;
};
});
});
}
function trumbowygBuildModalBtn( name, modal ) {
return $('<button/>', {
'class': 'joms-button--full-small joms-button--' + ( name === 'submit' ? 'primary' : 'neutral' ),
'type': name,
'text': this.lang[name] || name
}).appendTo( modal.find('form') );
}
function trumbowygTranslate() {
$.extend( jQuery.trumbowyg.langs.en, window.joms_lang.wysiwyg || {});
}
// Exports.
return {
start: start
};
});