<div ng-class="{'chat-dialog-news-mine':{{item.isOwn}},'chat-dialog-news-other':{{!item.isOwn}},'chat-dialog-news-file':{{item.content_type == 6}},'chat-dialog-news-mine-file':{{item.isOwn}}&&{{item.content_type == 6}},'chat-dialog-news-other-file':{{!item.isOwn}}&&{{item.content_type == 6}}}" msgId="{{item.imdn_id}}">
<div contextmenu="supermenu" ng-right-click="decrement_right($event,item)">
<i class="icon warn-icon" ng-if="item.isWarn"></i>
<i ng-class="{true: 'icon {{item.status}}', false: ''}[{{item.isOwn && item.status !== ''}}]"></i>
<i ng-class="{true: 'bubble-icon right-icon', false: 'bubble-icon left-icon'}[{{item.isOwn}}]"></i>
<span compile='item.content|trustHtml' ng-click="newsClick($event, item)" ng-dblclick="newsDBClick($event, item)"></span>
</div>
<!--设置右键弹出样式-->
<div class="supermenus" id="supermenu" ng-show="iscontextMenus">
<ul>
<li ng-click="openRightClick($event)">打开</li>
<li ng-click="preserveRightClick($event)">保存</li>
</ul>
</div>
//点击任意出关闭右键弹窗
$(document).off('click').on('click', function(e) {
$scope.iscontextMenus = false;
if (!$scope.$$phase) {
$scope.$apply();
}
})
//二人会话和群会话消息,右键打开文件功能
$scope.openRightClick = function ($event) {
openRightFile ($event);
}
function openRightFile ($event) {
$event.stopPropagation();
$event.preventDefault();
$scope.iscontextMenus = false;
var content_type = items.content_type,//消息的类型是文本消息还是图片消息还是文档消息
$curTarget = angular.element($event.currentTarget);
switch (content_type){
case eucTypes.rcsTypes.ContentType.ContentTypePICTURE:
const exec = require('child_process').exec;
exec('"' + items.file_path + '"');
break;
case eucTypes.rcsTypes.ContentType.ContentTypeOTHER:
if ((messageService.FILE_STATE.RECEIVE_SUCCESS == items.file_state) ||
(messageService.FILE_STATE.SEND_SUCCESS == items.file_state)) {
const exec = require('child_process').exec;
exec('"' +items.file_path + '"');
}
break;
default :
break;
}
};
//二人会话和群会话消息,右键保存文件功能
const remote = require('electron').remote;
var fs = require('fs');
$scope.preserveRightClick = function($event){
$event.stopPropagation();
$event.preventDefault();
$scope.iscontextMenus = false;
        electron调用后返回的回调是一个文件的路径;
const saveFilePath = remote.dialog.showSaveDialog(remote.getCurrentWindow(), {defaultPath:items.file_name}
);
var fileReadStream = fs.createReadStream(items.file_path);
var fileWriteStream = fs.createWriteStream(saveFilePath);
fileReadStream.pipe(fileWriteStream);
fileWriteStream.on('close',function(){
console.log('copy over');
}); }
electron框架提供的应用;
const remote = require('electron').remote;
remote.dialog.showSaveDialog(remote.getCurrentWindow(), {defaultPath:"abc.txt"}); node.js fs模块文件的读入和写出
var fs = require('fs');
var fileReadStream = fs.createReadStream('./myjpg.jpg');
var fileWriteStream = fs.createWriteStream('./new_myjpg.jpg');
fileReadStream.pipe(fileWriteStream);
fileWriteStream.on('close',function(){
console.log('copy over');
});
上下文contenxmenu属性的应用;  id="supermenu"

contextmenu="supermenu" 属性的应用 右键菜单打开和保存功能的更多相关文章

  1. 目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd

    目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd

  2. wpf datagrid设置右键菜单打开时选中项的背景色

    原文:wpf datagrid设置右键菜单打开时选中项的背景色 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/huangli321456/artic ...

  3. DevExpress的TreeList实现自定义右键菜单打开文件选择对话框

    场景 DevExpress的TreeList实现节点上添加自定义右键菜单并实现删除节点功能: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/det ...

  4. arcengine实现右键菜单打开/关闭所有图层

    参考资料:  http://developer.51cto.com/art/201104/256774.htm 参照后自己做的: 关于右键菜单的几个有价值的网址: http://blog.csdn.n ...

  5. 解决Windows资源管理器右键菜单打开EditPlus容易导致资源管理器无响应问题

    这个问题确实很烦人,经常导致 资源管理器无响应,关闭后整个资源管理器彻底崩溃,原因未知.本着折腾和强迫症精神,这个问题一定要解决.方法如下: 1.不要用EditPlus自带的添加到系统右键菜单选项. ...

  6. Linux学习笔记-Ubuntu添加右键菜单打开终端

    1.进入个人目录(如/home/batsing,下文缩写成 ~ ):设置显示隐藏文件,或使用命令行:2.进入 ~/.gnome2/nautilus-scripts 文件夹,新建一个文件,名为 term ...

  7. ubuntu环境配置------增加右键菜单打开terminal

    直接安装一个软件包nautilus-open-terminal 终端输入:sudo apt-get install nautilus-open-terminal 重启系统!

  8. [xPlugins] jQuery Contextmenu右键菜单

    [2012-04-12] Contextmenu 右键菜单 v0.1 版本发布 [功能] 在特定区域弹出右键菜单 [功能] 可以在弹出右键菜单区域内,再屏蔽某个小区域. [功能] 有两种方式添加右键菜 ...

  9. ASP.NET SignalR 与 LayIM2.0 配合轻松实现Web聊天室(六) 之 Layim源码改造右键菜单--好友、组管理功能的实现。

    前言 上一篇中讲解了加好友的流程,本篇将介绍好友管理,群组管理的右键菜单功能.当然由于菜单项目太多,都实现也得花费时间.只讲解一下我是如何从不知道怎么实现右键菜单到会自定义菜单的一个过程.另外呢,针对 ...

随机推荐

  1. 【Oracle】存储过程之完整篇

    1.语法 create [or replace] procedure pro_name[(parameter1,parameter2,...)] is|as begin plsql_sentences ...

  2. java 多态的好处

    /* 对象的多态性. class 动物{} class 猫 extends 动物{} class 狗 extends 动物{} 猫 x = new 猫(); 动物 x = new 猫();//一个对象 ...

  3. java中的 public protected friendly private

    1.public:public表明该数据成员.成员函数是对所有用户开放的,所有用户都可以直接进行调用 2.private:private表示私有,私有的意思就是除了class自己之外,任何人都不可以直 ...

  4. java Map Set遍历

    Map是java中的接口,Map.Entry是Map的一个内部接口. Map提供了一些常用方法,如keySet().entrySet()等方法,keySet()方法返回值是Map中key值的集合:en ...

  5. WPF基础学习第一天

    格式 1.XAML格式: <Button x:Name="btnClick" Content="按钮" HorizontalAlignment=" ...

  6. poj----Maximum sum(poj 2479)

    Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30704   Accepted: 9408 Desc ...

  7. Web前端开发笔试&面试_01(mi:)

    —— (al_me16041719002000) begin—— 1.(单选)下面哪个方法是String对象和Array对象都有的? A.splice B.split C.replace D.conc ...

  8. CocoaPods的ruby问题 Error fetching http://ruby.taobao.org/:

    今天安装了一个CocoaPods,在安装淘宝ruby是遇到了问题 bogon:~ zhch$ gem sources -a http://ruby.taobao.org/ Error fetching ...

  9. Eclipse,以及tomcat使用时可能会遇到的几个问题

    http://blog.sina.com.cn/s/blog_56b0cb2d01000a7r.html Eclipse,以及tomcat有几个问题.说明如下 1, 工程不编译的问题 . 有时候,项目 ...

  10. LINUX创建本地yum源

    .创建一个文件夹,把光盘中所有的RPM安装包都拷贝进来 # mkdir /rpms_yum .把光盘上的RPM包全部复制到rpms_yum中 # cd /mnt/cdrom/Packages/ # c ...