Feature: Allow images to be inserted as thumbnails or as linked thumbnails

This commit is contained in:
Jens Rey 2020-10-30 16:06:14 +01:00
parent 8c4a6d8f9e
commit c8e83737e0
8 changed files with 32 additions and 6 deletions

View file

@ -108,6 +108,8 @@ function displayFiles(files, numberOfPages = <?= $numberOfPages ?>) {
'<div class="text-primary pb-2">'+filename+'<\/div>'+
'<div>'+
'<a href="#" class="mr-3 text-secondary" onClick="editorInsertMedia(\''+image+'\'); closeMediaManager();"><i class="fa fa-plus"></i><?php $L->p('Insert') ?><\/a>'+
'<a href="#" class="mr-3 text-secondary" onClick="editorInsertMedia(\''+thumbnail+'\'); closeMediaManager();"><i class="fa fa-search"></i><?php $L->p('Insert thumbnail') ?><\/a>'+
'<a href="#" class="mr-3 text-secondary" onClick="editorInsertLinkedMedia(\''+thumbnail+'\',\''+image+'\'); closeMediaManager();"><i class="fa fa-link"></i><?php $L->p('Insert linked thumbnail') ?><\/a>'+
'<a href="#" class="text-secondary" onClick="setCoverImage(\''+filename+'\'); closeMediaManager();"><i class="fa fa-square-o"></i><?php $L->p('Set as cover image') ?><\/button>'+
'<a href="#" class="float-right text-danger" onClick="deleteMedia(\''+filename+'\')"><i class="fa fa-trash-o"></i><?php $L->p('Delete') ?><\/a>'+
'<\/div>'+

View file

@ -478,6 +478,11 @@ $(document).ready(function() {
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link){
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
};
}
// Button switch
$("#jsswitchButton").on("click", function() {

View file

@ -434,6 +434,11 @@ $(document).ready(function() {
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link){
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
};
}
// Button switch
$("#jsbuttonSwitch").on("click", function() {

View file

@ -392,5 +392,7 @@
"custom-fields": "Benutzerdefinierte Felder",
"define-custom-fields-for-the-content": "Benutzerdefinierte Felder für Inhalte anlegen. Informationen darüber sind in der <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>Dokumentation<\/a> zu finden.",
"start-typing-to-see-a-list-of-suggestions": "Beginne mit dem Tippen für eine Liste mit Vorschlägen.",
"view": "Anschauen"
"view": "Anschauen",
"insert-thumbnail": "Vorschau einfügen",
"insert-linked-thumbnail": "Verlinkte Vorschau einfügen"
}

View file

@ -392,5 +392,7 @@
"custom-fields": "Benutzerdefinierte Felder",
"define-custom-fields-for-the-content": "Benutzerdefinierte Felder für Inhalte anlegen. Informationen darüber sind in der <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>Dokumentation<\/a> zu finden.",
"start-typing-to-see-a-list-of-suggestions": "Beginne mit dem Tippen für eine Liste mit Vorschlägen.",
"view": "Anschauen"
"view": "Anschauen",
"insert-thumbnail": "Vorschau einfügen",
"insert-linked-thumbnail": "Verlinkte Vorschau einfügen"
}

View file

@ -392,5 +392,7 @@
"custom-fields": "Benutzerdefinierte Felder",
"define-custom-fields-for-the-content": "Benutzerdefinierte Felder für Inhalte anlegen. Informationen darüber sind in der <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>Dokumentation<\/a> zu finden.",
"start-typing-to-see-a-list-of-suggestions": "Beginne mit dem Tippen für eine Liste mit Vorschlägen.",
"view": "Anschauen"
"view": "Anschauen",
"insert-thumbnail": "Vorschau einfügen",
"insert-linked-thumbnail": "Verlinkte Vorschau einfügen"
}

View file

@ -391,5 +391,7 @@
"custom-fields": "Custom fields",
"define-custom-fields-for-the-content": "Define custom fields for the content. Learn more about custom fields in the <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>documentation<\/a>.",
"start-typing-to-see-a-list-of-suggestions": "Start typing to see a list of suggestions.",
"view": "View"
}
"view": "View",
"insert-thumbnail": "Insert thumbnail",
"insert-linked-thumbnail": "Insert linked thumbnail"
}

View file

@ -86,6 +86,12 @@ $html = <<<EOF
tinymce.activeEditor.insertContent("<img src=\""+filename+"\" alt=\"\">");
}
// Insert a linked image in the editor at the cursor position
// Function required for Bludit
function editorInsertLinkedMedia(filename, link) {
tinymce.activeEditor.insertContent("<a href=\""+link+"\"><img src=\""+filename+"\" alt=\"\"></a>");
}
// Returns the content of the editor
// Function required for Bludit
function editorGetContent() {
@ -123,4 +129,4 @@ EOF;
return $html;
}
}
}