mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 21:16:23 +05:30
Cleaning up
This commit is contained in:
parent
ce4d6e4b93
commit
2ab20034db
4 changed files with 76 additions and 75 deletions
|
|
@ -1,66 +1,66 @@
|
|||
(function () {
|
||||
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog({
|
||||
buttons : {
|
||||
"Insert" : {
|
||||
text: "Insert",
|
||||
id: "insert",
|
||||
click: function(){
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
}
|
||||
},
|
||||
"Cancel" : {
|
||||
text: "Cancel",
|
||||
id: "cancel",
|
||||
click: function(){
|
||||
dialogClose();
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$dialog.dialog({
|
||||
buttons : {
|
||||
"Insert" : {
|
||||
text: "Insert",
|
||||
id: "insert",
|
||||
click: function(){
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
}
|
||||
},
|
||||
"Cancel" : {
|
||||
text: "Cancel",
|
||||
id: "cancel",
|
||||
click: function(){
|
||||
dialogClose();
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base_path + response.path);
|
||||
$("#insert").trigger('click');
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base_path + response.path);
|
||||
$("#insert").trigger('click');
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': base_path + 'upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
$file.ajaxfileupload({
|
||||
'action': base_path + 'upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue