Merge branch 'private-issue880-chat_message_to_long' into develop
This commit is contained in:
commit
d668cfc705
5 changed files with 38 additions and 11 deletions
|
@ -474,9 +474,10 @@ class ChatWindow extends App.Controller
|
|||
event.data.callback()
|
||||
|
||||
@$('.js-customerChatInput').ce({
|
||||
mode: 'richtext'
|
||||
multiline: true
|
||||
maxlength: 40000
|
||||
mode: 'richtext'
|
||||
multiline: true
|
||||
maxlength: 40000
|
||||
imageWidth: 'relative'
|
||||
})
|
||||
|
||||
disconnect: =>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# maxlength: 123
|
||||
# multiline: true / disable enter + strip on paste
|
||||
# placeholder: 'some placeholder'
|
||||
# imageWidth: absolute (<img style="width: XXpx; height: XXXpx" src="">) || relative (<img style="width: 100%; max-width: XXpx;" src="">)
|
||||
*/
|
||||
|
||||
var pluginName = 'ce',
|
||||
|
@ -13,6 +14,7 @@
|
|||
debug: false,
|
||||
mode: 'richtext',
|
||||
multiline: true,
|
||||
imageWidth: 'absolute',
|
||||
allowKey: {
|
||||
8: true, // backspace
|
||||
9: true, // tab
|
||||
|
@ -284,7 +286,12 @@
|
|||
}
|
||||
_this.log('image inserted')
|
||||
result = dataUrl
|
||||
img = "<img style=\"width: " + width + "px; height: " + height + "px\" src=\"" + result + "\">"
|
||||
if (_this.options.imageWidth == 'absolute') {
|
||||
img = "<img style=\"width: " + width + "px; height: " + height + "px\" src=\"" + result + "\">"
|
||||
}
|
||||
else {
|
||||
img = "<img style=\"width: 100%; max-width: " + width + "px;\" src=\"" + result + "\">"
|
||||
}
|
||||
document.execCommand('insertHTML', false, img)
|
||||
}
|
||||
|
||||
|
@ -399,7 +406,12 @@
|
|||
//console.log('dataUrl', dataUrl)
|
||||
_this.log('image inserted')
|
||||
result = dataUrl
|
||||
img = $("<img style=\"width: " + width + "px; height: " + height + "px\" src=\"" + result + "\">")
|
||||
if (_this.options.imageWidth == 'absolute') {
|
||||
img = $("<img style=\"width: " + width + "px; height: " + height + "px\" src=\"" + result + "\">")
|
||||
}
|
||||
else {
|
||||
img = $("<img style=\"width: 100%; max-width: " + width + "px;\" src=\"" + result + "\">")
|
||||
}
|
||||
img = img.get(0)
|
||||
|
||||
if (document.caretPositionFromPoint) {
|
||||
|
|
|
@ -434,7 +434,7 @@ class CreateTicket < ActiveRecord::Migration
|
|||
|
||||
create_table :chat_messages do |t|
|
||||
t.integer :chat_session_id, null: false
|
||||
t.string :content, limit: 5000, null: false
|
||||
t.text :content, limit: 20.megabytes + 1, null: false
|
||||
t.integer :created_by_id, null: true
|
||||
t.timestamps limit: 3, null: false
|
||||
end
|
||||
|
|
10
db/migrate/20170420000001_chat_increase_message_size.rb
Normal file
10
db/migrate/20170420000001_chat_increase_message_size.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class ChatIncreaseMessageSize < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
change_column :chat_messages, :content, :text, limit: 20.megabytes + 1, null: false
|
||||
end
|
||||
|
||||
end
|
|
@ -7,13 +7,17 @@ class Sessions::Event
|
|||
begin
|
||||
backend = load_adapter(adapter)
|
||||
rescue => e
|
||||
return { error: "No such event #{params[:event]}" }
|
||||
return { event: 'error', data: { error: "No such event #{params[:event]}", payload: params[:payload] } }
|
||||
end
|
||||
|
||||
instance = backend.new(params)
|
||||
result = instance.run
|
||||
instance.destroy
|
||||
result
|
||||
begin
|
||||
instance = backend.new(params)
|
||||
result = instance.run
|
||||
instance.destroy
|
||||
result
|
||||
rescue => e
|
||||
return { event: 'error', data: { error: e.message, payload: params[:payload] } }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue