mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
23 lines
1,003 B
JavaScript
23 lines
1,003 B
JavaScript
|
(function($){
|
||
|
$(function(){
|
||
|
$('body').on('grav-editor-ready', function() {
|
||
|
var Instance = Grav.default.Forms.Fields.EditorField.Instance;
|
||
|
Instance.addButton({
|
||
|
'shortcodes-presentation': {
|
||
|
identifier: 'shortcodes-presentation',
|
||
|
title: 'Presentation',
|
||
|
label: '<i class="fa fa-file-powerpoint-o"></i>',
|
||
|
modes: ['gfm', 'markdown'],
|
||
|
action: function(_ref) {
|
||
|
var codemirror = _ref.codemirror, button = _ref.button;
|
||
|
button.on('click.editor.shortcodes-presentation', function() {
|
||
|
Instance.buttonStrategies.replaceSelections({ token: '$1', template: '[presentation="presentations/"]$1', codemirror: codemirror});
|
||
|
codemirror.setCursor(codemirror.getCursor().line,codemirror.getCursor().ch-2);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
})(jQuery);
|