(function($){
$(function(){
$('body').on('grav-editor-ready', function() {
var Instance = Grav.default.Forms.Fields.EditorField.Instance;
Instance.addButton({
notices: {
identifier: 'notices',
title: 'Notices',
label: '',
modes: ['gfm', 'markdown'],
children: [
{
'notice-info': {
identifier: 'notice-info',
title: 'Info Notice',
label: '',
modes: ['gfm', 'markdown'],
action: function(_ref) {
var codemirror = _ref.codemirror, button = _ref.button;
button.on('click.editor.notice-info', function() {
Instance.buttonStrategies.replaceLine({ token: '$1', template: '! $1', codemirror: codemirror });
codemirror.focus();
});
}
}
},
{
'notice-warning': {
identifier: 'notice-warning',
title: 'Warning Notice',
label: '',
modes: ['gfm', 'markdown'],
action: function(_ref) {
var codemirror = _ref.codemirror, button = _ref.button;
button.on('click.editor.notice-warning', function() {
Instance.buttonStrategies.replaceLine({ token: '$1', template: '!! $1', codemirror: codemirror });
codemirror.focus();
});
}
}
},
{
'notice-note': {
identifier: 'notice-note',
title: 'Note Notice',
label: '',
modes: ['gfm', 'markdown'],
action: function(_ref) {
var codemirror = _ref.codemirror, button = _ref.button;
button.on('click.editor.notice-note', function() {
Instance.buttonStrategies.replaceLine({ token: '$1', template: '!!! $1', codemirror: codemirror });
codemirror.focus();
});
}
}
},
{
'notice-tip': {
identifier: 'notice-tip',
title: 'Tip Notice',
label: '',
modes: ['gfm', 'markdown'],
action: function(_ref) {
var codemirror = _ref.codemirror, button = _ref.button;
button.on('click.editor.notice-tip', function() {
Instance.buttonStrategies.replaceLine({ token: '$1', template: '!!!! $1', codemirror: codemirror });
codemirror.focus();
});
}
}
}
]
}
});
});
});
})(jQuery);