keep things event-driven
This commit is contained in:
@@ -79,6 +79,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $.GollumEditor.Dialog
|
||||||
|
* Used in exec() to display dialogs with dynamic fields.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$.GollumEditor.Dialog = function( argObject ) {
|
||||||
|
return Dialog.init( argObject );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* debug
|
* debug
|
||||||
* Prints debug information to console.log if debug output is enabled.
|
* Prints debug information to console.log if debug output is enabled.
|
||||||
@@ -385,15 +396,27 @@
|
|||||||
|
|
||||||
$field.val( fullStr.substring(0, selPos.start) + replaceText +
|
$field.val( fullStr.substring(0, selPos.start) + replaceText +
|
||||||
fullStr.substring(selPos.end));
|
fullStr.substring(selPos.end));
|
||||||
|
$field[0].focus();
|
||||||
|
|
||||||
if ( selectNew && $field[0].setSelectionRange ) {
|
if ( selectNew && $field[0].setSelectionRange ) {
|
||||||
$field[0].focus();
|
|
||||||
$field[0].setSelectionRange( selPos.start,
|
$field[0].setSelectionRange( selPos.start,
|
||||||
selPos.start + replaceText.length );
|
selPos.start + replaceText.length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dialog
|
||||||
|
* Used by FunctionBar & internally to display editor-specific messages,
|
||||||
|
* inputs and more.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
var Dialog = {
|
||||||
|
//TODO
|
||||||
|
};
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ var MarkDown = {
|
|||||||
'function-link' : {
|
'function-link' : {
|
||||||
exec: function( txt, selText, $field ) {
|
exec: function( txt, selText, $field ) {
|
||||||
var results = null;
|
var results = null;
|
||||||
res = $.GollumEditor.Dialog({
|
$.GollumEditor.Dialog({
|
||||||
title: '',
|
title: '',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
@@ -73,15 +73,18 @@ var MarkDown = {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
help: 'The URL to link to.'
|
help: 'The URL to link to.'
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
});
|
OK: function( res ) {
|
||||||
|
|
||||||
if ( res['text'] && res['href'] ) {
|
if ( res['text'] && res['href'] ) {
|
||||||
return '[' + res['text'] + ']('
|
return '[' + res['text'] + ']('
|
||||||
+ res['href'] + ')';
|
+ res['href'] + ')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user