diff --git a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb index 0e1177563..d7d5948d4 100644 --- a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb +++ b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb @@ -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 diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index f30ee2236..eef2eb576 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -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 diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 448585376..da7434d9b 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -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(''); diff --git a/public/assets/kindeditor/plugins/emoticons/emoticons.js b/public/assets/kindeditor/plugins/emoticons/emoticons.js index b9dfec431..7884f53fb 100644 --- a/public/assets/kindeditor/plugins/emoticons/emoticons.js +++ b/public/assets/kindeditor/plugins/emoticons/emoticons.js @@ -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() {