-
+
+
+
+
diff --git a/static/css/filepicker.css b/static/css/filepicker.css
index a6a0d49..8b6c91c 100644
--- a/static/css/filepicker.css
+++ b/static/css/filepicker.css
@@ -7,4 +7,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
.filepicker-item {
cursor: pointer;
color: #2196F3;
+}
+
+#selectedimage {
+ max-height: 200px;
+ max-width: 200px;
}
\ No newline at end of file
diff --git a/static/js/editorparent.js b/static/js/editorparent.js
index d542f3e..cff93d3 100644
--- a/static/js/editorparent.js
+++ b/static/js/editorparent.js
@@ -37,6 +37,7 @@ function editComplex(json) {
var content = data.content;
}
$("#iconEdit").removeClass("d-none");
+ $("#imageEdit").removeClass("d-none");
$("#linkEdit").removeClass("d-none");
$("#textEdit").removeClass("d-none");
$("#linkPage").val("");
@@ -60,6 +61,32 @@ function editComplex(json) {
setSelectedIcon();
}
}
+ if (typeof content.image === 'undefined') {
+ $("#imageEdit").addClass("d-none");
+ } else {
+ $("#imageEdit").data("image", content.image);
+ if (content.image != "") {
+ $("#imageEdit #selectedimage").attr("src", "public/file.php?file=" + content.image);
+ }
+ function loadComplexImageBrowser(path) {
+ $.get("lib/filepicker.php", {
+ path: path,
+ type: "image"
+ }, function (data) {
+ $("#imagepicker").html(data);
+ $("#imagepicker .filepicker-item").click(function () {
+ if ($(this).data("type") == "dir") {
+ loadComplexImageBrowser($(this).data("path"));
+ } else {
+ var path = $(this).data("path");
+ $("#imageEdit").data("image", path);
+ $("#imageEdit #selectedimage").attr("src", "public/file.php?file=" + path);
+ }
+ })
+ });
+ }
+ loadComplexImageBrowser();
+ }
if (typeof content.link === 'undefined') {
$("#linkEdit").addClass("d-none");
} else {
@@ -93,7 +120,7 @@ function loadFilePickerFolder(path, type) {
type: ty
}, function (data) {
$("#fileBrowseModalBody").html(data);
- $(".filepicker-item").click(function () {
+ $("#fileBrowseModalBody .filepicker-item").click(function () {
if ($(this).data("type") == "dir") {
loadFilePickerFolder($(this).data("path"), type);
} else {
@@ -121,6 +148,7 @@ $("#editModalSave").on("click", function () {
data["component"] = $("#editModal").data("component");
var content = {};
content["icon"] = $('input[name="selectedicon"]:checked').val();
+ content["image"] = $("#imageEdit").data("image");
if ($("#linkBox").val() != "") {
content["link"] = $("#linkBox").val();
} else {