tinymce 图片上传插件

Tinymce 版本:tinymce_4.1.9

AjaxFileUpload 下载地址 https://github.com/davgothic/AjaxFileUpload


1.首先在tinymce的 plugins目录新建目录advimage

2.创建image.html和plugin.min.js文件




	
	我爱1和0-选择图片


	

其中

action:     fsTinymce.documentBaseUrl + "imagesave.php",
设置为图片保存url
plugin.min.js文件
tinymce.PluginManager.add("advimage", function(a) {
	
	function d(e) {
		
		//返回按钮点击函数
		return function() {
			window.fsTinymce = a;
			var OpenWindow = window.open("js/tinymce/plugins/advimage/image.html","_blank",
			"toolbar=no, menubar=yes, scrollbars=yes,resizable=yes, location=no, status=no, width=400, height=100");
			
		}
	}
	
	function e() {
	}
	
	a.addButton("advimage", {
		icon: "image",
		tooltip: "upload image",
		onclick: d(e),
		stateSelector: "img:not([data-mce-object],[data-mce-placeholder])"
	}), a.addMenuItem("advimage", {
		icon: "image",
		text: "upload image",
		onclick: d(e),
		context: "insert",
		prependToContext: !0
	}), a.addCommand("advimage", d(e))
	
});

效果图




你可能感兴趣的:(js,html)