Nuevo plugin Additionals 2.0.20
This commit is contained in:
parent
a2a901b71b
commit
93e1e28683
354 changed files with 40514 additions and 0 deletions
33
plugins/additionals/assets/javascripts/additionals_macro_button.js
Executable file
33
plugins/additionals/assets/javascripts/additionals_macro_button.js
Executable file
|
@ -0,0 +1,33 @@
|
|||
/* global jsToolBar */
|
||||
jsToolBar.prototype.elements.macros = {
|
||||
type: 'button',
|
||||
title: 'Macro',
|
||||
fn: {
|
||||
wiki: function() {
|
||||
var This = this;
|
||||
this.macroMenu(function(macro){
|
||||
This.encloseLineSelection('{{' + macro + '(', ')}}');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Macro menu buttons */
|
||||
jsToolBar.prototype.macroMenu = function(fn){
|
||||
var menu = $('<ul style="position:absolute;"></ul>');
|
||||
for (var i = 0; i < this.macroList.length; i++) {
|
||||
$('<li></li>').text(this.macroList[i]).appendTo(menu).mousedown(function(){
|
||||
fn($(this).text());
|
||||
});
|
||||
}
|
||||
$('body').append(menu);
|
||||
menu.menu().width(170).position({
|
||||
my: 'left top',
|
||||
at: 'left bottom',
|
||||
of: this.toolNodes['precode']
|
||||
});
|
||||
$(document).on('mousedown', function() {
|
||||
menu.remove();
|
||||
});
|
||||
return false;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue