Feature: Allow images to be inserted as thumbnails or as linked thumbnails
This commit is contained in:
parent
8c4a6d8f9e
commit
c8e83737e0
8 changed files with 32 additions and 6 deletions
|
@ -108,6 +108,8 @@ function displayFiles(files, numberOfPages = <?= $numberOfPages ?>) {
|
||||||
'<div class="text-primary pb-2">'+filename+'<\/div>'+
|
'<div class="text-primary pb-2">'+filename+'<\/div>'+
|
||||||
'<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(\''+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="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>'+
|
'<a href="#" class="float-right text-danger" onClick="deleteMedia(\''+filename+'\')"><i class="fa fa-trash-o"></i><?php $L->p('Delete') ?><\/a>'+
|
||||||
'<\/div>'+
|
'<\/div>'+
|
||||||
|
|
|
@ -478,6 +478,11 @@ $(document).ready(function() {
|
||||||
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
|
$("#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
|
// Button switch
|
||||||
$("#jsswitchButton").on("click", function() {
|
$("#jsswitchButton").on("click", function() {
|
||||||
|
|
|
@ -434,6 +434,11 @@ $(document).ready(function() {
|
||||||
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
|
$("#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
|
// Button switch
|
||||||
$("#jsbuttonSwitch").on("click", function() {
|
$("#jsbuttonSwitch").on("click", function() {
|
||||||
|
|
|
@ -392,5 +392,7 @@
|
||||||
"custom-fields": "Benutzerdefinierte Felder",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,5 +392,7 @@
|
||||||
"custom-fields": "Benutzerdefinierte Felder",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,5 +392,7 @@
|
||||||
"custom-fields": "Benutzerdefinierte Felder",
|
"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.",
|
"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.",
|
"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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,5 +391,7 @@
|
||||||
"custom-fields": "Custom fields",
|
"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>.",
|
"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.",
|
"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"
|
||||||
|
}
|
||||||
|
|
|
@ -86,6 +86,12 @@ $html = <<<EOF
|
||||||
tinymce.activeEditor.insertContent("<img src=\""+filename+"\" alt=\"\">");
|
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
|
// Returns the content of the editor
|
||||||
// Function required for Bludit
|
// Function required for Bludit
|
||||||
function editorGetContent() {
|
function editorGetContent() {
|
||||||
|
@ -123,4 +129,4 @@ EOF;
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue