From 3392086ecad8a8a4796157b560a1cacdf6e9bd1d Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 3 Jul 2019 13:05:48 +0000 Subject: [PATCH] Dialog for images plugin git-svn-id: https://svn.libreccm.org/ccm/trunk@6144 8810af33-2d31-482b-a856-94f89814c4df --- .../plugins/ccm-cms-images/plugin.js | 80 +++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/ccm-cms-tinymce/plugins/ccm-cms-images/plugin.js b/ccm-cms-tinymce/plugins/ccm-cms-images/plugin.js index 1867d9e76..d38fc6438 100644 --- a/ccm-cms-tinymce/plugins/ccm-cms-images/plugin.js +++ b/ccm-cms-tinymce/plugins/ccm-cms-images/plugin.js @@ -32,11 +32,81 @@ const ImageDialog = function (editor) { type: "panel", items: [ { - type: "input", - name: "file", - label: "File", - disabled: true - } + type: "bar", + items: [ + { + type: "input", + name: "file", + label: "File", + disabled: true + }, + { + type: "button", + name: "browse_images", + text: "Browse images", + onAction: function() { + let baseUrl = window.location.href; + let offset = baseUrl.lastIndexOf("/"); + let destUrl = baseUrl.slice(0, offset + 1) + "image_select.jsp"; + let selectWindow = window.open( + destUrl, + "_blank", + "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no" + ); + window.openCcm = new Object(); + window.openCcm.imageSet = (selectedImage) => { + win + .find("#file") + .value(selectedImage.src) + .fire("change"); + win + .find("#width") + .value(selectedImage.width) + .fire("change"); + win + .find("#height") + .value(selectedImage.height) + .fire("change"); + image_name = selectedImage.name; + return true; + }; + } + }, + { + type: "input", + name: "alternate", + label: "Alternate" + }, + { + type: "input", + name: "title", + label: "Title" + }, + { + type: "selectbox", + name: "alignment", + label: "Alignment", + size: 1, + items: [ + { text: "Not set", value: "" }, + { text: "Left", value: "left" }, + { text: "Center", value: "center" }, + { text: "Right", value: "right" } + ] + }, + { + type: "selectbox", + name: "fancybox", + label: "Fancybox", + size: 1, + items: [ + { text: "None", value: "" }, + { text: "Zoom", value: "imageZoom" }, + { text: "Gallery", value: "imageGallery" } + ] + } + ] + }, ] }, buttons: []