Question:
Is there a possibility to configure links in the editor to only allow relative links (e.g. /index.php) or links from specific domains (e.g. https://www.example.com/index.php)?
Answer:
You could use the link.beforeInsert event that was added in V2.4.0. Here is a snippet that allows to insert only absolute links (those that start with /) inside the Froala WYSIWYG HTML Editor:
<script>
$(function(){
$('#edit').froalaEditor({
linkAutoPrefix: ''
})
.on('froalaEditor.link.beforeInsert', function (e, editor, link, text, attrs) {
if (link.indexOf('/') !== 0) {
alert ('Only absolute links are allowed!');
return false;
}
})
});
</script>
Do not forget to disable linkAutoPrefix option as well by setting it to an empty string.