插入头像 , 粘贴图片 ,插入图片,都要加入域名。防止邮件中出现图片不显示的问题

This commit is contained in:
lizanle 2015-10-10 11:37:58 +08:00
parent 11abbca1cf
commit 94bffb5458
4 changed files with 12 additions and 5 deletions

View File

@ -13,7 +13,7 @@ class Kindeditor::AssetsController < ApplicationController
logger.warn '========= Warning: the owner_id is 0, "delete uploaded files automatically" will not work. =========' if defined?(logger) && @asset.owner_id == 0
@asset.asset_type = @dir
if @asset.save
render :text => ({:error => 0, :url => @asset.asset.url,:asset_id => @asset.id}.to_json)
render :text => ({:error => 0, :url => "http://"+Setting.host_name + "/" + @asset.asset.url,:asset_id => @asset.id}.to_json)
else
show_error(@asset.errors.full_messages)
end

View File

@ -9,7 +9,8 @@ module RailsKindeditor
output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})',
emotionsBasePath: 'http://' + Setting.host_name
)))
end
@ -21,7 +22,8 @@ module RailsKindeditor
output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})',
emotionsBasePath: 'http://' + Setting.host_name
)))
end

View File

@ -243,6 +243,7 @@ K.options = {
shadowMode : true,
loadStyleMode : true,
basePath : K.basePath,
emotionsBasePath: 'http://forge.trustie.net', //TODO
themesPath : K.basePath + 'themes/',
langPath : K.basePath + 'lang/',
pluginsPath : K.basePath + 'plugins/',
@ -5459,6 +5460,7 @@ function _editor(options) {
_instances = [];
function _create(expr, options) {
options = options || {};
options.emotionsBasePath = _undef(options.emotionsBasePath,'http://forge.trustie.net') // TODO
options.basePath = _undef(options.basePath, K.basePath);
options.themesPath = _undef(options.themesPath, options.basePath + 'themes/');
options.langPath = _undef(options.langPath, options.basePath + 'lang/');
@ -5623,7 +5625,9 @@ _plugin('core', function(K) {
url:K.addParam('/kindeditor/upload', 'dir=image'),
afterUpload : function(data) {
if (data.error === 0) {
var url = K.formatUrl(data.url, 'absolute');
var url = data.url//K.formatUrl(data.url, 'absolute');
// console.log(url)
self.exec('insertimage', url, 'image','','','1','');
//self.exec('insertimage', url, 'image','','','1','left');
//self.insertHtml('<img src="'+url+'"/>');

View File

@ -9,7 +9,8 @@
KindEditor.plugin('emoticons', function(K) {
var self = this, name = 'emoticons',
path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'),
path = self.emotionsBasePath + (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'),
allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons,
currentPageNum = 1;
self.clickToolbar(name, function() {