Skip to content

Commit

Permalink
Check if pasted content is an image.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangmm committed May 16, 2016
1 parent a4e3050 commit 9c6d5df
Show file tree
Hide file tree
Showing 3 changed files with 391 additions and 23 deletions.
46 changes: 23 additions & 23 deletions resources/scripts/atomic/markup-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,29 +213,29 @@ Atomic.Editor = (function () {
});
this.container.on("paste", function(event) {
var items = event.originalEvent.clipboardData.items;
console.log(JSON.stringify(items)); // will give you the mime types
var blob = items[0].getAsFile();
var reader = new FileReader();
reader.onload = function(event)
{
var dataURL = event.target.result;
console.log(dataURL);
var collection = $("input[name='collection']").val();
$.ajax({
type: "POST",
url: "modules/upload-image.xql",
data: {
data: dataURL,
collection: collection
},
success: function (data) {
if (data.name) {
$this.markup("![untitled image](" + data.name + ")");
}
}
});
}; // data url
reader.readAsDataURL(blob);
if (items[0].type.indexOf("image") != -1) {
var blob = items[0].getAsFile();
var reader = new FileReader();
reader.onload = function(event)
{
var dataURL = event.target.result;
var collection = $("input[name='collection']").val();
$.ajax({
type: "POST",
url: "modules/upload-image.xql",
data: {
data: dataURL,
collection: collection
},
success: function (data) {
if (data.name) {
$this.markup("![untitled image](" + data.name + ")");
}
}
});
}; // data url
reader.readAsDataURL(blob);
}
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
/* Galleria Classic Theme 2012-08-07 | https://raw.github.com/aino/galleria/master/LICENSE | (c) Aino */

#galleria-loader{height:1px!important}

.galleria-container {
position: relative;
overflow: hidden;
background: #000;
}
.galleria-container img {
-moz-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
}

.galleria-stage {
position: absolute;
top: 10px;
bottom: 10px;
left: 10px;
right: 10px;
overflow:hidden;
}


.galleria-thumbnails-list { height: 90px; }

/*
.galleria-thumbnails-container:hover .galleria-thumbnails-list {
height: 90px;
}
*/
.galleria-thumbnails-container {
height: 90px;
bottom: 0px;
position: absolute;
left: 20px;
right: 20px;
z-index: 2;
}
.galleria-carousel .galleria-thumbnails-list {
margin-left: 30px;
margin-right: 30px;
}
.galleria-thumbnails .galleria-image {
height: 80px;
width: 60px;
background: #000;
margin: 0 5px 0 0;
border: 1px solid #000;
float: left;
cursor: pointer;
}
.galleria-counter {
position: absolute;
bottom: 10px;
left: 10px;
text-align: right;
color: #fff;
font: normal 11px/1 arial,sans-serif;
z-index: 1;
}
.galleria-loader {
background: #000;
width: 20px;
height: 20px;
position: absolute;
top: 10px;
right: 10px;
z-index: 2;
display: none;
background: url(classic-loader.gif) no-repeat 2px 2px;
}
.galleria-info {
width: 30%;
top: 15px;
left: 15px;
z-index: 2;
opacity: .5;
filter: alpha(opacity=50);
position: absolute;
height: 300px;
overflow-y: auto;
}
.galleria-info-text {
background-color: #000;
padding: 12px;
display: none;
/* IE7 */ zoom:1;
}
.galleria-info-title {
font: bold 12px/1.1 arial,sans-serif;
margin: 0;
color: #fff;
margin-bottom: 7px;
}
.galleria-info-description {
font: italic 16px/1.4 georgia,serif;
margin: 0;
color: #bbb;
}
.galleria-info-close {
width: 9px;
height: 9px;
position: absolute;
top: 5px;
right: 5px;
background-position: -753px -11px;
opacity: .5;
filter: alpha(opacity=50);
cursor: pointer;
display: none;
}
.notouch .galleria-info-close:hover{
opacity:1;
filter: alpha(opacity=100);
}
.touch .galleria-info-close:active{
opacity:1;
filter: alpha(opacity=100);
}
.galleria-info-link {
background-position: -669px -5px;
opacity: .7;
filter: alpha(opacity=70);
position: absolute;
width: 20px;
height: 20px;
cursor: pointer;
background-color: #000;
}
.notouch .galleria-info-link:hover {
opacity: 1;
filter: alpha(opacity=100);
}
.touch .galleria-info-link:active {
opacity: 1;
filter: alpha(opacity=100);
}
.galleria-image-nav {
position: absolute;
top: 50%;
margin-top: -62px;
width: 100%;
height: 62px;
left: 0;
}
.galleria-image-nav-left,
.galleria-image-nav-right {
opacity: .3;
filter: alpha(opacity=30);
cursor: pointer;
width: 62px;
height: 124px;
position: absolute;
left: 10px;
z-index: 2;
background-position: 0 46px;
}
.galleria-image-nav-right {
left: auto;
right: 10px;
background-position: -254px 46px;
z-index: 2;
}
.notouch .galleria-image-nav-left:hover,
.notouch .galleria-image-nav-right:hover {
opacity: 1;
filter: alpha(opacity=100);
}
.touch .galleria-image-nav-left:active,
.touch .galleria-image-nav-right:active {
opacity: 1;
filter: alpha(opacity=100);
}
.galleria-thumb-nav-left,
.galleria-thumb-nav-right {
cursor: pointer;
display: none;
background-position: -495px 5px;
position: absolute;
left: 0;
top: 0;
height: 40px;
width: 23px;
z-index: 3;
opacity: .8;
filter: alpha(opacity=80);
}
.galleria-thumb-nav-right {
background-position: -578px 5px;
border-right: none;
right: 0;
left: auto;
}
.galleria-thumbnails-container .disabled {
opacity: .2;
filter: alpha(opacity=20);
cursor: default;
}
.notouch .galleria-thumb-nav-left:hover,
.notouch .galleria-thumb-nav-right:hover {
opacity: 1;
filter: alpha(opacity=100);
background-color: #111;
}
.touch .galleria-thumb-nav-left:active,
.touch .galleria-thumb-nav-right:active {
opacity: 1;
filter: alpha(opacity=100);
background-color: #111;
}
.notouch .galleria-thumbnails-container .disabled:hover {
opacity: .2;
filter: alpha(opacity=20);
background-color: transparent;
}

.galleria-carousel .galleria-thumb-nav-left,
.galleria-carousel .galleria-thumb-nav-right {
display: block;
}
.galleria-thumb-nav-left,
.galleria-thumb-nav-right,
.galleria-info-link,
.galleria-info-close,
.galleria-image-nav-left,
.galleria-image-nav-right {
background-image: url(classic-map.png);
background-repeat: no-repeat;
}


.galleria-fscr{
width:22px;
height:22px;
position:absolute;
top:10px;
right:10px;

background:url('fullscreen_256_w.png');
background-size: 100% 100%;
z-index:5;
cursor: pointer;
opacity: .6;
}
.galleria-fscr:hover{
opacity:1;
}

.galleria-splay{
width:48px;
height:48px;
position:absolute;
margin:auto;
left:0;
right:0;
top:50%;
background-image:url('play_w.png');
background-size: 100% 100%;
z-index:6;
cursor: pointer;
opacity: .6;
}

.galleria-splay:hover{
opacity:1;
}
Loading

0 comments on commit 9c6d5df

Please sign in to comment.