|
|
|
@ -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
|
|
|
|
|
|
|
|
|
|