博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

tinymce 图片管理器

Posted on 2012-03-23 17:10  ForXiXi  阅读(591)  评论(0编辑  收藏  举报
(function () {



tinymce.create('tinymce.plugins.netImageBrowser', {
init: function (ed, url) {
// Register commands
ed.addCommand('mcenetImageBrowser',
function () {
var mywindow = ed.getWin();
mywindow.callback = function (src,name) {
var html = "<img src='" + src + "' title='" + name + "' alt='" + name + "' />";
tinyMCE.activeEditor.execCommand("mceInsertContent", false, html);
}

ed.windowManager.open({
file: 'http://images.xxx.com/UserImageManager',
title: 'xxx-图片管理器',
width: 930,
height: 650,
inline: true,
resizable: true,
close_previous: false
}, {
window: mywindow
});
});

// Register buttons
ed.addButton('netImageBrowser', { title: '图片管理器', cmd: 'mcenetImageBrowser' });
},

getInfo: function () {
return {
longname: 'netImageBrowser',
author: '',
authorurl: '',
infourl: '',
version: tinymce.majorVersion + "." + tinymce.minorVersion
};
}

});

// Register plugin
tinymce.PluginManager.add('netImageBrowser', tinymce.plugins.netImageBrowser);
})();

http://images.xxx.com/UserImageManager 这个页面里面引入tiny_mce_popup.js
然后可以回调上面的callback函数了,如下

var win = tinyMCEPopup.getWindowArg("window");
win.callback(“url”, "filetitle");
tinyMCEPopup.close();