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源码改造右键菜单--好友、组管理功能的实现。
前言 上一篇中讲解了加好友的流程,本篇将介绍好友管理,群组管理的右键菜单功能.当然由于菜单项目太多,都实现也得花费时间.只讲解一下我是如何从不知道怎么实现右键菜单到会自定义菜单的一个过程.另外呢,针对 ...
随机推荐
- Phpcms没有找到网址列表
今天在搞phpcms的采集遇到了这个问题. 没有找到网址列表,请先进行网址采集. 百度,google了好久: 网上答案: 方案1 1.尝试清除 v9_collection_history 表里的内容 ...
- 1z0-052 q209_1
1: You perform differential incremental level 1 backups of your database on each working day and lev ...
- TopCoder SRM624 BuildingHeightEasy 题解
本题题意就是求有一组建筑物,问把这些建筑物的M个都统一到同一高度.须要的最小改动高度是多少? 题意隐含的意思就是由于是建筑物,所以不能降低,仅仅能添加了. 本题能够使用暴力搜索,由于数据量少. 可是事 ...
- Redis学习(8)-redis其他特性
消息订阅与发布 subscribe Channel:订阅频道 psubscribe channel*:批量订阅频道:例如:psubscribe S*,订阅以S开头的频道. publish channe ...
- CAS连接微软活动目录的配置方法
原文地址:http://blog.csdn.net/baozhengw/article/details/3857669在微软活动目录中建立一个用户节点,帐号为wangzhenyu,cn为zhenyu ...
- hosts.allow hosts.deny
简单控制访问ip,hosts.allow/hsots.deny a simple access control language that is based on client (host name ...
- Nginx的HTTPS 301重定向到另一个TLD(托管在同一服务器上)没有显示出SSL警告
我自己 example.com, .com.au, .net, .net.au, ... (8 in total). 我想所有的这些顶级域名以301的域名重定向到安全.COM域 https://www ...
- static不实现多态
class Father { public static String getName() { return "father"; } } class Children extend ...
- HDUOJ------1058 Humble Numbers
Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- HDUOJ------Lovekey
Lovekey Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...