santized_message = santized_message.replace(/<strong>/g, '');
santized_message = santized_message.replace(/<\/strong>/g, '');
// replace sanitized with
santized_message = santized_message.replace(/<p>/g, '
');
santized_message = santized_message.replace(/<\/p>/g, '
');
let h = '';
// icon
h += `
`;
// message
h += `${santized_message}
`;
// buttons
if(options.buttons && options.buttons.length > 0){
h += ``;
for(let y=0; y${html_encode(options.buttons[y].label)}`;
}
h += `
`;
}
const el_window = await UIWindow({
title: null,
icon: null,
uid: null,
is_dir: false,
message: options.message,
body_icon: options.body_icon,
backdrop: options.backdrop ?? false,
is_resizable: false,
is_droppable: false,
has_head: false,
stay_on_top: options.stay_on_top ?? false,
selectable_body: false,
draggable_body: options.draggable_body ?? true,
allow_context_menu: false,
show_in_taskbar: false,
window_class: 'window-alert',
dominant: true,
body_content: h,
width: 350,
parent_uuid: options.parent_uuid,
...options.window_options,
window_css:{
height: 'initial',
},
body_css: {
width: 'initial',
padding: '20px',
'background-color': 'rgba(231, 238, 245, .95)',
'backdrop-filter': 'blur(3px)',
}
});
// focus to primary btn
$(el_window).find('.button-primary').focus();
// --------------------------------------------------------
// Button pressed
// --------------------------------------------------------
$(el_window).find('.alert-resp-button').on('click', async function(event){
event.preventDefault();
event.stopPropagation();
resolve($(this).attr('data-value'));
$(el_window).close();
return false;
})
})
}
def(UIAlert, 'ui.window.UIAlert');
export default UIAlert;