From 06b17581b1339c357a92b4023bb43218f7ff8f56 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 14 May 2015 17:45:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=92=91=E5=87=BA=E5=9C=A8fi?= =?UTF-8?q?refox=E4=B8=8A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rails_kindeditor/lib/rails_kindeditor/helper.rb | 10 +++++----- public/stylesheets/application.css | 2 +- public/stylesheets/public.css | 1 + spec/requests/zipdown_request_spec.rb | 0 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 spec/requests/zipdown_request_spec.rb diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index f5c85677f..c3252ed1c 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -6,7 +6,7 @@ module RailsKindeditor input_html = { :id => id }.merge(options.delete(:input_html) || {}) output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) - output << javascript_tag(js_replace(id, options)) + output << javascript_tag(js_replace(id, options.merge(window_onload: 'true'))) end def kindeditor(name, method, options = {}) @@ -14,7 +14,7 @@ module RailsKindeditor input_html = (options.delete(:input_html) || {}).stringify_keys output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, options, input_html) - output_buffer << javascript_tag(js_replace(input_html['id'], options)) + output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true'))) end def kindeditor_upload_json_path(*args) @@ -50,13 +50,13 @@ module RailsKindeditor "var old_onload_#{random_name}; if(typeof window.onload == 'function') old_onload_#{random_name} = window.onload; window.onload = function() { - #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}); + #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); if(old_onload_#{random_name}) old_onload_#{random_name}(); }" else - "$(function(){KindEditor.ready(function(K){ + "KindEditor.ready(function(K){ #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); - });});" + });" end end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 1d7b9293a..8a651b863 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2773,4 +2773,4 @@ div.repos_explain{ padding-top: 20px; padding-bottom: 20px; } -img{max-width: 100%;} +.upload_img img{max-width: 580px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 3e8dbb641..4624b26c9 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -423,3 +423,4 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} /*文本左对齐*/ .tl{text-align: left;} img{max-width: 100%;} +.attachments {clear: both;} diff --git a/spec/requests/zipdown_request_spec.rb b/spec/requests/zipdown_request_spec.rb new file mode 100644 index 000000000..e69de29bb