作者:没有你的日子1976_472 | 来源:互联网 | 2023-05-19 04:27
IhavesetuptheCloudinaryTinyMCEPluginandeverythingseemstobeworkingproperly,however,wh
I have set up the Cloudinary TinyMCE Plugin and everything seems to be working properly, however, when they popup loads, the Cloudinary CMS screen doesn't resize to the popup. I'm wondering if someone can take a look at the plugin and let me know if there is an easy fix. I can't seem to find anything. Here is a screenshot of the popup:
我已经设置了Cloudinary TinyMCE插件,一切似乎都正常工作,但是,当弹出窗口加载时,Cloudinary CMS屏幕不会调整大小。我想知道是否有人可以看看插件,让我知道是否有一个简单的解决方案。我似乎找不到任何东西。这是弹出窗口的截图:
There is a resize function in cloudinaryimage/js/image.js
:
在cloudinaryimage / js / image.js中有一个resize函数:
var CloudinaryImageDialog = {
preInit : function() {
tinyMCEPopup.requireLangPack();
},
init : function(ed) {
var base = location.href.replace(/\/[^\/]+$/, '');
var cOntroller= {
socket: new easyXDM.Socket({
name: base + "/easyXDM.name.html",
swf: base + "/easyxdm.swf",
remote: tinyMCE.settings.cloudinary_cms_url,
remoteHelper: "https://cloudinary.com/easyXDM.name.html",
container: "cldimage",
props: {style: {width: "100%", height: "99%"}},
onMessage: function(message, origin){
var json = JSON.parse(message);
switch (json.message) {
case "insert_into_post":
CloudinaryImageDialog.insert_into_post(json);
break;
case "done":
CloudinaryImageDialog.close();
break;
}
},
onReady: function() {
controller.resizeWatcher();
el = ed.selection.getNode();
if (el && el.nodeName == 'IMG') {
var html = ed.selection.getContent({format : 'html'});
controller.socket.postMessage(JSON.stringify({
message: "edit_image",
html: html
}));
}
}
}),
currentWidth: 0,
currentHeight: 0,
resizeWatcher: function() {
jQuery(window).resize(CloudinaryImageDialog.update_window_dimensions);
},
update_window_dimensions: function() {
}
};
},
insert_into_post : function(args) {
delete args.message;
delete args.href;
args["style"] = '';
if (args.align && args.align != '') {
if (args.align == 'left' || args.align == 'right')
args["style"] = "float: " + args.align;
else if (args.align == 'center')
args["style"] = "display: block; margin: auto";
else
args["style"] = "vertical-align: " + args.align;
delete args.align;
}
tinyMCEPopup.restoreSelection();
var ed = tinyMCEPopup.editor;
el = ed.selection.getNode();
// Fixes crash in Safari
if (tinymce.isWebKit) ed.getWin().focus();
if (el && el.nodeName == 'IMG') {
ed.dom.setAttribs(el, args);
} else {
tinymce.each(args, function(value, name) {
if (value === "") {
delete args[name];
}
});
ed.execCommand('mceInsertContent', false, ed.dom.createHTML('img', args), {skip_undo : 1});
ed.undoManager.add();
}
CloudinaryImageDialog.close();
},
close : function() {
tinyMCEPopup.editor.execCommand('mceRepaint');
tinyMCEPopup.editor.focus();
tinyMCEPopup.close();
}
};
CloudinaryImageDialog.preInit();
tinyMCEPopup.onInit.add(CloudinaryImageDialog.init, CloudinaryImageDialog);
1 个解决方案