Spring boot 环境下配置CKEditor添加google map
本文档基于已经搭建好基础ckeditor的环境上。如:http://www.cnblogs.com/daxin/p/3553865.html
使用leaflet的ckeditor的google map插件;
1、下载、解压插件
下载地址:
http://ckeditor.com/addon/leaflet
下面是leaflet依赖的插件
http://ckeditor.com/addon/widgetselection
http://ckeditor.com/addon/widget
http://ckeditor.com/addon/lineutils
将以上包下载,解压到ckeditor/plugins目录下。
2、配置ckeditor/config.js
config.extraPlugins+="widgetselection,lineutils,widget,leaflet,"; config.leaflet_maps_google_api_key = 'AIzaSyA9ySM6msnGm0qQB1L1cLTMBdKEUKPySmQ';
这个google map key建议自己再申请一个哦,代码中的是原开发者的,可能不能用了。
查看一下效果:
3、在java环境中可能会遇到以下错误:
in a frame because it set 'x-frame-options' to 'deny'.
4、那么别着急,添加一下java配置代码和xml配置即可。
4.1、使用spring xml文件配置
<http> <headers> <frame-options policy="SAMEORIGIN"/><!-- 相同域名下允许加载 --> </headers> </http>
4.2、使用spring boot代码配置
@Override
protected void configure(HttpSecurity http) throws Exception {
//直接关闭frameOptions功能
http.headers().frameOptions().disable();
}
5、验证一下。
转载自:https://blog.csdn.net/conkeyn/article/details/84903344