From 92fb486a71145a16026c0a2ad2c250444a3bbe09 Mon Sep 17 00:00:00 2001 From: Rael Gugelmin Cunha Date: Tue, 18 Apr 2017 22:41:37 -0300 Subject: [PATCH] Fixing image pasting in qt5 (#563) --- scudcloud/resources/scudcloud.js | 2 +- sources/scudcloud.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scudcloud/resources/scudcloud.js b/scudcloud/resources/scudcloud.js index f5082c9..6ae0935 100644 --- a/scudcloud/resources/scudcloud.js +++ b/scudcloud/resources/scudcloud.js @@ -1 +1 @@ -ScudCloud={unloaded:!0,env:{mac_ssb_version:1},hasPreference:function(a){return!1},getPreference:function(a){return!1},setPreference:function(a,b){return!1},canShowHtmlNotifications:function(){return!1},app:{getModifierKeys:function(){}},call:function(a,b){switch(ScudCloud.log(a,b),a){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(b);case"notify":return ScudCloud.notify(b);case"setBadgeCount":return ScudCloud.setBadgeCount(b);case"displayTeam":return ScudCloud.displayTeam(b);case"signInTeam":return ScudCloud.signInTeam()}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){TS.ui.banner.close(),ScudCloud.populate(),ScudCloud.unloaded=!1},setConnectionStatus:function(a){switch(a){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(a){desktop.sendMessage(a.title,a.content)},setBadgeCount:function(a){desktop.count(a.all_unread_highlights_cnt,a.all_unread_cnt)},signInTeam:function(){desktop.addTeam()},displayTeam:function(a){},log:function(a,b){try{"object"==typeof b&&(b=JSON.stringify(b))}catch(a){b=""}console.log("ScudCloud."+a+", args: "+b)},populate:function(){if("undefined"!=TS&&TS.model&&TS.model.team&&TS.model.team.icon&&TS.model.team.icon.image_44)desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44}));else{var a=1e3,b=100,c=Math.round(Math.random()*(a-b))+b;setTimeout(ScudCloud.populate,c)}},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){var a=TS.channels.getUnarchivedChannelsForUser();return a.push(TS.channels.getChannelById(TS.model.active_channel_id)),a},listTeams:function(){var a={id:TS.boot_data.user_id,team_color:null,team_icon:TS.model.team.icon,team_id:TS.model.team.id,team_name:TS.model.team.name,team_url:"https://"+TS.model.team.domain+".slack.com/"},b=[a];for(var c in TS.boot_data.other_accounts)b.push(TS.boot_data.other_accounts[c]);return b},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(a){return TS.channels.join(a)},setClipboard:function(a){TS.client.ui.file_pasted_sig.dispatch(a,TS.model.shift_key_pressed)},sendTickle:function(){return TS.ms.sendTickle()},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){return TS.boot_data.user_id?TS.boot_data.user_id:""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_modal.start()}},document.onpaste=function(a){desktop.pasted(!1)},$("body").delegate("#channel_calls_button","click",function(){desktop.open(TS.boot_data.team_url+"call/"+TS.model.active_cid)}),window.winssb=TSSSB=ScudCloud,ScudCloud.unloaded&&ScudCloud.didFinishLoading(); \ No newline at end of file +ScudCloud={unloaded:!0,env:{mac_ssb_version:1},hasPreference:function(a){return!1},getPreference:function(a){return!1},setPreference:function(a,b){return!1},canShowHtmlNotifications:function(){return!1},app:{getModifierKeys:function(){}},call:function(a,b){switch(ScudCloud.log(a,b),a){case"reload":return ScudCloud.reload();case"didStartLoading":return ScudCloud.didStartLoading();case"didFinishLoading":return ScudCloud.didFinishLoading();case"setConnectionStatus":return ScudCloud.setConnectionStatus(b);case"notify":return ScudCloud.notify(b);case"setBadgeCount":return ScudCloud.setBadgeCount(b);case"displayTeam":return ScudCloud.displayTeam(b);case"signInTeam":return ScudCloud.signInTeam()}return!1},reload:function(){window.location.reload()},didStartLoading:function(){},didFinishLoading:function(){TS.ui.banner.close(),ScudCloud.populate(),ScudCloud.unloaded=!1},setConnectionStatus:function(a){switch(a){case"online":desktop.enableMenus(!0);break;default:desktop.enableMenus(!1)}},notify:function(a){desktop.sendMessage(a.title,a.content)},setBadgeCount:function(a){desktop.count(a.all_unread_highlights_cnt,a.all_unread_cnt)},signInTeam:function(){desktop.addTeam()},displayTeam:function(a){},log:function(a,b){try{"object"==typeof b&&(b=JSON.stringify(b))}catch(a){b=""}console.log("ScudCloud."+a+", args: "+b)},populate:function(){if("undefined"!=TS&&TS.model&&TS.model.team&&TS.model.team.icon&&TS.model.team.icon.image_44)desktop.populate(JSON.stringify({channels:ScudCloud.listChannels(),teams:ScudCloud.listTeams(),icon:TS.model.team.icon.image_44})),document.querySelector(".ql-editor").addEventListener("paste",desktop.pasted);else{var a=1e3,b=100,c=Math.round(Math.random()*(a-b))+b;setTimeout(ScudCloud.populate,c)}},createSnippet:function(){return TS.ui.snippet_dialog.start()},listChannels:function(){var a=TS.channels.getUnarchivedChannelsForUser();return a.push(TS.channels.getChannelById(TS.model.active_channel_id)),a},listTeams:function(){var a={id:TS.boot_data.user_id,team_color:null,team_icon:TS.model.team.icon,team_id:TS.model.team.id,team_name:TS.model.team.name,team_url:"https://"+TS.model.team.domain+".slack.com/"},b=[a];for(var c in TS.boot_data.other_accounts)b.push(TS.boot_data.other_accounts[c]);return b},quicklist:function(){desktop.quicklist(ScudCloud.listChannels())},join:function(a){return TS.channels.join(a)},setClipboard:function(a){TS.client.ui.file_pasted_sig.dispatch(a,TS.model.shift_key_pressed)},sendTickle:function(){return TS.ms.sendTickle()},preferences:function(){return TS.ui.prefs_dialog.start()},addTeam:function(){document.location=TS.boot_data.signin_url},getCurrentTeam:function(){return TS.boot_data.user_id?TS.boot_data.user_id:""},logout:function(){document.location=TS.boot_data.logout_url},help:function(){return TS.help_modal.start()}},document.onpaste=function(a){desktop.pasted(!1)},$("body").delegate("#channel_calls_button","click",function(){desktop.open(TS.boot_data.team_url+"call/"+TS.model.active_cid)}),window.winssb=TSSSB=ScudCloud,ScudCloud.unloaded&&ScudCloud.didFinishLoading(); \ No newline at end of file diff --git a/sources/scudcloud.js b/sources/scudcloud.js index 3c5769a..c178da6 100644 --- a/sources/scudcloud.js +++ b/sources/scudcloud.js @@ -89,6 +89,8 @@ ScudCloud = { // Let's really check if image_44 is ready (Fixes #554) if('undefined'!= TS && TS.model && TS.model.team && TS.model.team.icon && TS.model.team.icon.image_44){ desktop.populate(JSON.stringify({'channels': ScudCloud.listChannels(), 'teams': ScudCloud.listTeams(), 'icon': TS.model.team.icon.image_44})); + // Restoring image pasting into message input (Fixes #563) + document.querySelector(".ql-editor").addEventListener('paste', desktop.pasted); } else { var max = 1000; var min = 100;