Editor rewritten !

- right click menu (copy/cut/paste/delete)
- code splitted
- using event delegation
- many little improvements
- still looks a bit messy...
This commit is contained in:
bordun 2016-03-04 19:45:56 +01:00
parent 91250b068a
commit 2d0c548fee
15 changed files with 760 additions and 621 deletions

View file

@ -99,8 +99,6 @@ input {
html, body {
height:100%;
overflow:hidden;
@ -133,6 +131,7 @@ body {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
cursor: pointer;
&:hover {
box-shadow: 0 0 0 1rem $color-border, 0 0 0 100rem rgba($color-text,.05) inset;
}
@ -140,6 +139,9 @@ body {
padding:8rem;
padding-right: 15rem;
}
&.warning {
background:firebrick;
}
&.disabled {
pointer-events: none;
color:$color-text-fade;
@ -239,6 +241,8 @@ body {
}
}
#sidepanel {
position:absolute;
z-index: 999999;
@ -268,45 +272,20 @@ body {
li {
display:block;
margin-bottom:5rem;
position: relative;
background:$color-fg;
position: relative;
&:last-child {
margin-bottom: 0
}
.title {
padding-bottom:15rem;
}
.actions {
display: flex;
align-items: stretch;
flex-wrap:wrap;
a {
min-width:33.33%;
flex-grow:3;
padding:10rem;
display: block;
text-align: center;
&.on {
pointer-events: none;
&:after {
content:"";
position: absolute;
top:0;
left:0;
right:0;
border-top:2rem solid $color-accent;
}
}
}
}
.btn + span {
position: absolute;
right:0rem;
top:0rem;
padding:8rem;
color:$color-text-fade;
cursor: pointer;
&:hover {
color:$color-text;
}
@ -328,8 +307,33 @@ body {
}
}
}
.actions {
display: flex;
align-items: stretch;
flex-wrap:wrap;
a {
min-width:33.33%;
flex-grow:3;
padding:10rem;
display: block;
text-align: center;
&.on {
pointer-events: none;
.editing {
&:after {
content:"";
position: absolute;
top:0;
left:0;
right:0;
border-top:2rem solid $color-accent;
}
}
}
}
.widget.editing {
z-index: 11!important;
}
.widget.editing:after, a.editing:before {
@ -343,6 +347,113 @@ body {
pointer-events: none;
}
.context-menu {
position:fixed;
z-index: 999999999;
background: $color-raised-top;
box-shadow: 0 0 4rem 0 $color-border;
.context-menu {
position: absolute;
left:100%;
top:0;
opacity:0;
pointer-events: none;
margin-left: 2rem;
&:before {
content:"";
position: absolute;
top:0;
bottom:0;
left:-2rem;
width:2rem;
}
}
> .item {
padding: 10rem 15rem 10rem 10rem;
position:relative;
cursor: pointer;
i {
margin-right:5rem;
width: 15rem;
text-align: center;
}
&:hover, &:focus {
> .context-menu {
pointer-events: auto;
opacity: 1;
}
background:$color-raised;
}
&.has-sub:before {
content:"\f105";
display: block;
font-family: FontAwseome;
float:right;
margin-top: 1rem;
margin-right:-10rem;
padding-left: 10rem;
font-size:17rem;
}
}
}
.ui-resizable-handle {
position: absolute;
z-index: 1000000;
&.ui-resizable-se {
bottom: 5rem;
right: 5rem;
width:15rem;
height:15rem;
border-right: 1rem solid $color-accent;
border-bottom: 1rem solid $color-accent;
cursor: se-resize;
}
&.ui-resizable-e {
top: 50%;
margin-top:-7.5rem;
right: 5rem;
width:15rem;
height:15rem;
border-right: 1rem solid $color-accent;
cursor: e-resize;
}
&.ui-resizable-s {
bottom: 5rem;
left: 50%;
margin-left:-7.5rem;
width:15rem;
height:15rem;
border-bottom: 1rem solid $color-accent;
cursor: s-resize;
}
}
.ui-helper {
border: 1rem dashed $color-accent;
background: rgba($color-accent,.25);
min-width:30rem!important;
min-height:30rem!important;
z-index: 12!important;
opacity: 1!important;
}
.ui-draggable-handle {
position: absolute;
position: absolute;
top: 5rem;
left: 5rem;
right: 5rem;
z-index: 100000;
cursor: -webkit-grab;
height:25rem;
border:1rem solid $color-accent;
border-radius: 3rem;
&:active {
cursor:-webkit-grabbing
}
}
a {
@ -518,7 +629,7 @@ a {
padding:10%;
display: flex;
align-items: center;
background:rgba($color-text,.5);
background:rgba($color-bg,.5);
z-index:1000000;
.popup-title {
position: relative;
@ -538,7 +649,7 @@ a {
flex-direction: column;
align-items: stretch;
background:$color-fg;
width:100%;
width:auto;
max-width:600rem;
margin:0 auto;
position: relative;
@ -548,7 +659,7 @@ a {
height:100%;
width:100%;
padding:10rem;
overflow-y:scroll;
overflow-y:auto;
white-space: normal;
}
}
@ -760,61 +871,6 @@ a {
}
}
.ui-resizable-handle {
position: absolute;
z-index: 1000000;
&.ui-resizable-se {
bottom: 5rem;
right: 5rem;
width:15rem;
height:15rem;
border-right: 1rem solid $color-accent;
border-bottom: 1rem solid $color-accent;
cursor: se-resize;
}
&.ui-resizable-e {
top: 50%;
margin-top:-7.5rem;
right: 5rem;
width:15rem;
height:15rem;
border-right: 1rem solid $color-accent;
cursor: e-resize;
}
&.ui-resizable-s {
bottom: 5rem;
left: 50%;
margin-left:-7.5rem;
width:15rem;
height:15rem;
border-bottom: 1rem solid $color-accent;
cursor: s-resize;
}
}
.ui-helper {
border: 1rem dashed $color-accent;
background: rgba($color-accent,.25);
min-width:30rem!important;
min-height:30rem!important;
z-index: 12!important;
opacity: 1!important;
}
.ui-draggable-handle {
position: absolute;
position: absolute;
top: 5rem;
left: 5rem;
right:5rem;
z-index: 100000;
cursor: -webkit-grab;
height:25rem;
border:1rem solid $color-accent;
&:active {
cursor:-webkit-grabbing
}
}
/* STRIP (contains any widgets) */