From c8e83737e0efbc1f1d09b3fb6f57903203d735dc Mon Sep 17 00:00:00 2001 From: Jens Rey Date: Fri, 30 Oct 2020 16:06:14 +0100 Subject: [PATCH] Feature: Allow images to be inserted as thumbnails or as linked thumbnails --- bl-kernel/admin/themes/booty/html/media.php | 2 ++ bl-kernel/admin/views/edit-content.php | 5 +++++ bl-kernel/admin/views/new-content.php | 5 +++++ bl-languages/de_AT.json | 4 +++- bl-languages/de_CH.json | 4 +++- bl-languages/de_DE.json | 4 +++- bl-languages/en.json | 6 ++++-- bl-plugins/tinymce/plugin.php | 8 +++++++- 8 files changed, 32 insertions(+), 6 deletions(-) diff --git a/bl-kernel/admin/themes/booty/html/media.php b/bl-kernel/admin/themes/booty/html/media.php index 0b51f14d..0b61bf20 100644 --- a/bl-kernel/admin/themes/booty/html/media.php +++ b/bl-kernel/admin/themes/booty/html/media.php @@ -108,6 +108,8 @@ function displayFiles(files, numberOfPages = ) { '
'+filename+'<\/div>'+ '
'+ 'p('Insert') ?><\/a>'+ + 'p('Insert thumbnail') ?><\/a>'+ + 'p('Insert linked thumbnail') ?><\/a>'+ 'p('Set as cover image') ?><\/button>'+ 'p('Delete') ?><\/a>'+ '<\/div>'+ diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index 2df24251..0818ff89 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -478,6 +478,11 @@ $(document).ready(function() { $("#jseditor").val($('#jseditor').val()+''); }; } + if (typeof editorInsertLinkedMedia != "function") { + window.editorInsertLinkedMedia = function(filename, link){ + $("#jseditor").val($('#jseditor').val()+''); + }; + } // Button switch $("#jsswitchButton").on("click", function() { diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index 002d7a7b..a565236c 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -434,6 +434,11 @@ $(document).ready(function() { $("#jseditor").val($('#jseditor').val()+''); }; } + if (typeof editorInsertLinkedMedia != "function") { + window.editorInsertLinkedMedia = function(filename, link){ + $("#jseditor").val($('#jseditor').val()+''); + }; + } // Button switch $("#jsbuttonSwitch").on("click", function() { diff --git a/bl-languages/de_AT.json b/bl-languages/de_AT.json index d72e0438..2ddca4ab 100644 --- a/bl-languages/de_AT.json +++ b/bl-languages/de_AT.json @@ -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 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" } diff --git a/bl-languages/de_CH.json b/bl-languages/de_CH.json index db800a81..f600f726 100644 --- a/bl-languages/de_CH.json +++ b/bl-languages/de_CH.json @@ -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 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" } diff --git a/bl-languages/de_DE.json b/bl-languages/de_DE.json index 47ea994c..321127f1 100644 --- a/bl-languages/de_DE.json +++ b/bl-languages/de_DE.json @@ -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 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" } diff --git a/bl-languages/en.json b/bl-languages/en.json index 86d4d0ec..b9a34543 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -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 documentation<\/a>.", "start-typing-to-see-a-list-of-suggestions": "Start typing to see a list of suggestions.", - "view": "View" -} \ No newline at end of file + "view": "View", + "insert-thumbnail": "Insert thumbnail", + "insert-linked-thumbnail": "Insert linked thumbnail" +} diff --git a/bl-plugins/tinymce/plugin.php b/bl-plugins/tinymce/plugin.php index 003e64e3..45e7314a 100644 --- a/bl-plugins/tinymce/plugin.php +++ b/bl-plugins/tinymce/plugin.php @@ -86,6 +86,12 @@ $html = <<"); } + // Insert a linked image in the editor at the cursor position + // Function required for Bludit + function editorInsertLinkedMedia(filename, link) { + tinymce.activeEditor.insertContent("\"\""); + } + // Returns the content of the editor // Function required for Bludit function editorGetContent() { @@ -123,4 +129,4 @@ EOF; return $html; } -} \ No newline at end of file +}