Added Insert link from within the images

This commit is contained in:
Djamil Legato
2014-10-02 21:03:14 -07:00
parent 949d414acc
commit 08e86bbc3f
5 changed files with 26 additions and 6 deletions

View File

@@ -1634,9 +1634,9 @@ body.remodal_active .remodal {
display: none; }
.dropzone .dz-preview:hover.dz-error .dz-error-message {
display: block; }
.dropzone .dz-preview .dz-remove {
.dropzone .dz-preview .dz-remove, .dropzone .dz-preview .dz-insert {
display: none; }
.dropzone .dz-preview:hover .dz-remove {
.dropzone .dz-preview:hover .dz-remove, .dropzone .dz-preview:hover .dz-insert {
display: block;
position: absolute;
left: 0;
@@ -1645,6 +1645,10 @@ body.remodal_active .remodal {
text-align: center;
cursor: pointer;
font-size: 0.8rem; }
.dropzone .dz-preview:hover .dz-remove {
right: inherit; }
.dropzone .dz-preview:hover .dz-insert {
left: inherit; }
.dropzone .dz-preview .dz-details {
width: 150px;
height: 100px;

File diff suppressed because one or more lines are too long

View File

@@ -58,6 +58,13 @@
this.editor.on('change', function() { $this.editor.save(); });
this.code.find('.CodeMirror').css('height', this.options.height);
var editor = this.editor;
$("#gravDropzone").delegate('[data-dz-insert]', 'click', function(e) {
var target = $(e.currentTarget).parent('.dz-preview').find('.dz-filename');
editor.focus();
editor.doc.replaceSelection('![](' + target.text() + ')');
});
// iframe mode?
if (this.options.iframe) {

View File

@@ -133,11 +133,11 @@ $error-color: #D55A4E;
display: block;
}
.dz-remove {
.dz-remove, .dz-insert {
display: none;
}
&:hover .dz-remove {
&:hover .dz-remove, &:hover .dz-insert {
display: block;
position: absolute;
left: 0;
@@ -148,6 +148,14 @@ $error-color: #D55A4E;
font-size: 0.8rem;
}
&:hover .dz-remove {
right: inherit;
}
&:hover .dz-insert {
left: inherit;
}
.dz-details {
width: $preview-width;
height: $preview-height;

View File

@@ -31,8 +31,9 @@
};
Dropzone.autoDiscover = false;
Dropzone.options.gravDropzone = {
addRemoveLinks: true,
addRemoveLinks: false,
acceptedFiles: $('[data-media-types]').data('media-types'),
previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>Delete</a>\n<a class=\"dz-insert\" href=\"javascript:undefined;\" data-dz-insert>Insert</a>\n</div>",
init: function() {
thisDropzone = this;
$.get(URI + '/task:listmedia', function(data) {