contextmenu="supermenu" 属性的应用 右键菜单打开和保存功能
<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" 属性的应用 右键菜单打开和保存功能的更多相关文章
- 目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd
目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd
- wpf datagrid设置右键菜单打开时选中项的背景色
原文:wpf datagrid设置右键菜单打开时选中项的背景色 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/huangli321456/artic ...
- DevExpress的TreeList实现自定义右键菜单打开文件选择对话框
场景 DevExpress的TreeList实现节点上添加自定义右键菜单并实现删除节点功能: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/det ...
- arcengine实现右键菜单打开/关闭所有图层
参考资料: http://developer.51cto.com/art/201104/256774.htm 参照后自己做的: 关于右键菜单的几个有价值的网址: http://blog.csdn.n ...
- 解决Windows资源管理器右键菜单打开EditPlus容易导致资源管理器无响应问题
这个问题确实很烦人,经常导致 资源管理器无响应,关闭后整个资源管理器彻底崩溃,原因未知.本着折腾和强迫症精神,这个问题一定要解决.方法如下: 1.不要用EditPlus自带的添加到系统右键菜单选项. ...
- Linux学习笔记-Ubuntu添加右键菜单打开终端
1.进入个人目录(如/home/batsing,下文缩写成 ~ ):设置显示隐藏文件,或使用命令行:2.进入 ~/.gnome2/nautilus-scripts 文件夹,新建一个文件,名为 term ...
- ubuntu环境配置------增加右键菜单打开terminal
直接安装一个软件包nautilus-open-terminal 终端输入:sudo apt-get install nautilus-open-terminal 重启系统!
- [xPlugins] jQuery Contextmenu右键菜单
[2012-04-12] Contextmenu 右键菜单 v0.1 版本发布 [功能] 在特定区域弹出右键菜单 [功能] 可以在弹出右键菜单区域内,再屏蔽某个小区域. [功能] 有两种方式添加右键菜 ...
- ASP.NET SignalR 与 LayIM2.0 配合轻松实现Web聊天室(六) 之 Layim源码改造右键菜单--好友、组管理功能的实现。
前言 上一篇中讲解了加好友的流程,本篇将介绍好友管理,群组管理的右键菜单功能.当然由于菜单项目太多,都实现也得花费时间.只讲解一下我是如何从不知道怎么实现右键菜单到会自定义菜单的一个过程.另外呢,针对 ...
随机推荐
- Linux的网卡由eth0变成了eth1怎么办?
Linux的网卡由eth0变成了eth1怎么办? Linux的网卡由eth0变成了eth1,如何修复 使用wmware安装了linux,安装成功后,使用的网卡是eth0,没有eth1.但是用过一段时间 ...
- Storm简述及集群安装
Storm 集群类似于一个 Hadoop 集群.然而你在 Hadoop 的执行"MapReduce job", 在storm 上你执行 "topologies (不好翻译 ...
- eclipse 如何运行mavenWeb项目
1.使用maven 首先,在eclipse中,使用maven对项目进行打包: 其次,将项目发布到Tomcat服务器上 说明: demo_WebService2-0.0.1-SNAPSHOT文件夹存 ...
- Python之对象的属性
# -*- coding: utf-8 -*- #python 27 #xiaodeng #Python之对象的属性 #http://python.jobbole.com/82622/ #对象的属性 ...
- 统计一个文件中出现字符'a'的次数
# -*- coding: utf-8 -*- #python 27 #xiaodeng #统计一个文件中出现字符'a'的次数 #http://www.cnblogs.com/hongten/p/ho ...
- 用jquery写的校验用户名
$(function(){ $("input[name='username']").blur(function(){ var uname = $(this).val(); cons ...
- 转:Windows消息机制要点
Windows消息机制要点 1. 窗口过程 每个窗口会有一个称为窗口过程的回调函数(WndProc),它带有四个参数,分别为:窗口句柄(Window Handle),消息ID(Message ...
- ArchLinux安装 LXDE
http://wiki.lxde.org/zh/index.php?title=ArchLinux&variant=zh-cn 透过 pacman 安装 LXDE 大多数的最新 LXDE 套件 ...
- VC++6.0 IDE的工程用Code::Blocks来打开、编译、调试终极配置方案
本篇文章转自 CSDN blog,转载请注明出处! 原文地址: http://blog.csdn.net/liquanhai/article/details/6618300 引子:竟然可以用Code: ...
- Pandas中DataFrame修改列名
Pandas中DataFrame修改列名:使用 rename df = pd.read_csv('I:/Papers/consumer/codeandpaper/TmallData/result01- ...