Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File right click menu #209

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0df54cc
js2coffee.js library was added
dinukadesilva Aug 10, 2015
4ab660c
Changes to auto reflect the code once the language settings are updated
dinukadesilva Aug 10, 2015
ce060c8
js2coffee module was added
dinukadesilva Aug 10, 2015
4391a0c
js2coffee bower package was added
dinukadesilva Aug 10, 2015
1ec460a
js2coffee.js file was mapped to the build
dinukadesilva Aug 10, 2015
2fd0c2a
Merge branch 'master' of https://github.com/PencilCode/pencilcode
dinukadesilva Aug 10, 2015
216b891
micro DB
dinukadesilva Aug 30, 2015
d2cf500
micro DB
dinukadesilva Aug 30, 2015
6b08966
Micro DB
dinukadesilva Aug 30, 2015
4bcf3ee
Merge pull request #6 from PencilCode/master
Aug 30, 2015
048c81d
Merge origin/master
dinukadesilva Aug 30, 2015
e59e5f1
Micro DB server has integrated as a separate express node
dinukadesilva Sep 6, 2015
162d7aa
Micro DB palates have been added only for JavaScript
dinukadesilva Sep 6, 2015
3f59cc5
Micro DB has been added as a npm module
dinukadesilva Sep 6, 2015
c0e95b9
Micro DB has been added as a npm module
dinukadesilva Sep 6, 2015
affe89d
Micro DB has been added as a npm module
dinukadesilva Sep 6, 2015
a54feb6
Merge pull request #8 from PencilCode/master
Sep 17, 2015
d843dc8
Revert changes
dinukadesilva Sep 17, 2015
183f43d
Revert changes
dinukadesilva Sep 17, 2015
a2c59b5
Revert changes
dinukadesilva Sep 17, 2015
e9a6eb0
Ui changes for right click menu
dinukadesilva Oct 5, 2015
c359cb1
Delete function of file right click menu
dinukadesilva Dec 16, 2015
949ffdb
checnges to right click menu and preview pane when the file is deleted
dinukadesilva Dec 17, 2015
cb79944
linked the stylesheet of pencilcode-contextmenu
dinukadesilva Dec 19, 2015
82d455c
added pencilcode-contextmenu to the package.json
dinukadesilva Dec 19, 2015
abf7c7f
Moved styles related to the contextmenu to pencilcode-contextmenu
dinukadesilva Dec 19, 2015
879a787
Updated
dinukadesilva Dec 19, 2015
f48dae1
pencilcode-contextmenu library
dinukadesilva Dec 19, 2015
eb0aacc
pencilcode-contextmenu library
dinukadesilva Dec 19, 2015
99685ca
Item renaming
dinukadesilva Dec 31, 2015
af90bc3
[file-right-click-menu]: Rename and delete features of the right clic…
dinukadesilva Jan 17, 2016
a93b976
[file-right-click-menu]: Updated
dinukadesilva Jan 17, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link rel="stylesheet" type="text/css" href="//<!--#echo var="site"-->/lib/droplet.css">
<link rel="stylesheet" type="text/css" href="//<!--#echo var="site"-->/lib/font-awesome.css">
<link rel="stylesheet" type="text/css" href="//<!--#echo var="site"-->/lib/tooltipster/css/tooltipster.css">
<link rel="stylesheet" type="text/css" href="//<!--#echo var="site"-->/lib/pencilcode-contextmenu/src/dist/pencilcode-contextmenu.css">
</head>
<body id="pencildoc">
<div id="overflow">
Expand Down
41 changes: 41 additions & 0 deletions content/lib/pencilcode-contextmenu/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

module.exports = function(grunt) {
'use strict';

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

uglify: {
all: {
files: {
"src/dist/pencilcode-contextmenu.js": [
"src/dev/pencilcode-contextmenu.js"
]
},
options: {
preserveComments: false,
screwIE8: true,
report: 'min',
beautify: {
beautify: true
}
}
}
},
less: {
all: {
options: { compress: true },
files: {
"src/dist/pencilcode-contextmenu.css": "src/dev/pencilcode-contextmenu.less"
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');


grunt.registerTask('build',['uglify', 'less']);
};

25 changes: 25 additions & 0 deletions content/lib/pencilcode-contextmenu/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "pencilcode-contextmenu",
"description": "",
"main": "index.js",
"authors": [
"Dinuka De Silva <[email protected]>"
],
"license": "ISC",
"homepage": "https://github.com/Dinuka2013513/pencilcode",
"moduleType": [
"amd",
"globals"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~2.1.4",
"font-awesome": "~4.5.0"
}
}
20 changes: 20 additions & 0 deletions content/lib/pencilcode-contextmenu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "pencilcode-contextmenu",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Dinuka De Silva <[email protected]>",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-less": "^1.1.0",
"grunt-contrib-uglify": "^0.11.0"
}
}
167 changes: 167 additions & 0 deletions content/lib/pencilcode-contextmenu/src/dev/pencilcode-contextmenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
(function($) {

function clearRightClickMenus(){
$('.right-click-menu').css('display','none');
$('.right-click-active').removeClass('right-click-active');
}



//Listeners tomanage Right CLick Menu
(function (){
function clickInsideElement( e, className ) {
var el = e.srcElement || e.target;

if ( el.classList.contains(className) ) {
return el;
} else {
while ( el = el.parentNode ) {
if ( el.classList && el.classList.contains(className) ) {
return el;
}
}
}

return false;
}

//Listens for click events.
(function () {
document.addEventListener( "click", function(e) {
var clickeElIsLink = clickInsideElement( e, 'right-click-menu' );

if ( !clickeElIsLink ) {
clearRightClickMenus();
}
});
})();

//Listens for keyup events.
(function () {
window.onkeyup = function(e) {
if ( e.keyCode === 27 ) {
clearRightClickMenus();
}
}
})();

//Window resize event listener
(function () {
window.onresize = function(e) {
clearRightClickMenus();
};
})();
})();


/* $(document).ready(function () {
$('.right-click-menu').on('mouseenter', function(){
console.log("Mouse enter");
//mouseOverActiveElement = true;
}).on('mouseleave', function(){
console.log("Mouse leave");
//mouseOverActiveElement = false;
//clearRightClickMenus();
}).on('focus', function(){
console.log("Mouse focus");
//mouseOverActiveElement = false;
//clearRightClickMenus();
}).on('focusout', function(){
console.log("Mouse focusout");
//mouseOverActiveElement = false;
//clearRightClickMenus();
}).on('blur', function(){
console.log("Mouse blur");
//mouseOverActiveElement = false;
//clearRightClickMenus();
}).on('click', function(){
console.log("Mouse click");
//mouseOverActiveElement = false;
//clearRightClickMenus();
})
});*/

$.fn.extend({
closeRightClickMenu: function () {
clearRightClickMenus();
},
addRightClickMenu:function (menus) {
this.each(function() {
function getMenu(menus) {
var menu=$('<ul/>', {class: 'menu-list'});
menus.forEach(function(m) {
var li=$('<li/>',{class:'menu-item'}).appendTo(menu);
var menuContent = $('<div/>', {class:'menu-item-content'}).appendTo(li);
var menuLink=$('<a/>',{text:m.name}).appendTo(menuContent);
li.on('click',function(e){
e.stopPropagation();
e.preventDefault();
m.action(e);
});

if(m.options) {
menuContent.append(getMenu(m.options));
menuContent.append(
$('<span/>', {class: "left-icon"}).append(
$('<a/>',{class:"more-options-icon"}).append(
$('<i/>',{class:"fa fa-caret-right"})
)
)
);
}
});
return menu;
}

function getRightClickMenuDiv(){
var rightClickMenuDiv = $('.right-click-menu');
if(rightClickMenuDiv.length==0){
rightClickMenuDiv=$('<div/>',{class:"right-click-menu"}).appendTo($('body'));
}
rightClickMenuDiv.on('mouseleave', function(){
//console.log("Mouse leave");
clearRightClickMenus();
});
return rightClickMenuDiv;
}

$(this).on('contextmenu', function(e) {
e.stopPropagation();
e.preventDefault();

clearRightClickMenus();
var left, top;

$(this).addClass('right-click-active');
var menu=getRightClickMenuDiv();
menu.html(getMenu(menus));

var clickCoordsX = e.pageX;
var clickCoordsY = e.pageY;
var menuWidth = menu.offsetWidth + 4;
var menuHeight = menu.offsetHeight + 4;
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;

if ( (windowWidth - clickCoordsX) < menuWidth) {
left = windowWidth - menuWidth + "px";
} else {
left = clickCoordsX + "px";
}

if ((windowHeight - clickCoordsY) < menuHeight) {
top = windowHeight - menuHeight + "px";
} else {
top = clickCoordsY + "px";
}

$(menu).css('display', 'block')
.css('left',left)
.css('top',top);

e.preventDefault();
});
});
}
});
})(jQuery);
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.right-click-menu,.directory .item div.right-click-menu{
display: none;
z-index: 50;
position: fixed;
padding: 0px;
ul.menu-list{
position: relative;
list-style-type: none;
line-height: 20px;
margin: 0px;
padding: 0px;
width: 100px;
box-shadow: rgb(100, 100, 100) 1px 1px 10px 1px;
border-top: #D7D6D6 solid 5px;
border-bottom: #D7D6D6 solid 5px;

& > li.menu-item {

& > .menu-item-content ul.menu-list{
display: none;
}
&:hover {

& > .menu-item-content ul.menu-list{
display: inline-block;
left: 100%;
position: absolute;
}
}

.menu-item-content {
padding-left: 5px;
padding-right: 5px;
color: rgb(112, 112, 114);
background-color: white;
font-size: 12px;
border-left: 3px solid white;

&:hover {
background-color: #D7D6D6;
border-left: 3px solid #736f6f;
}

.left-icon {
padding-left: 20px;
padding-right: 5px;
a.more-options-icon {
float: right;
padding-left: 5px;
}
}


}

}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading