first commit

This commit is contained in:
2020-06-11 16:42:43 +02:00
commit 449ca1d987
5099 changed files with 622034 additions and 0 deletions
@@ -0,0 +1,32 @@
(($) ->
$ ->
$('body').on 'grav-editor-ready', ->
Instance = Grav.default.Forms.Fields.EditorField.Instance
Instance.addButton vimeo:
identifier: 'vimeo-video'
title: GravVimeoPlugin.translations.EDITOR_BUTTON_TOOLTIP
label: '<i class="fa fa-fw fa-vimeo"></i>'
modes: [
'gfm',
'markdown'
]
action: (e) ->
e.button.on 'click.editor.vimeo', ->
videoId = prompt(GravVimeoPlugin.translations.EDITOR_BUTTON_PROMPT);
if videoId
text = "[plugin:vimeo](https://vimeo.com/#{videoId})"
pos = e.codemirror.getDoc().getCursor(true)
posend = e.codemirror.getDoc().getCursor(false)
for l in [pos.line..posend.line]
e.codemirror.replaceRange( text + e.codemirror.getLine(l), { line: l, ch: 0 }, { line: l, ch: e.codemirror.getLine(l).length })
e.codemirror.setCursor({ line: posend.line, ch: e.codemirror.getLine(posend.line).length })
e.codemirror.focus()
return
return
return
return
return
) jQuery
@@ -0,0 +1,42 @@
// Generated by CoffeeScript 1.11.1
(function($) {
$(function() {
$('body').on('grav-editor-ready', function() {
var Instance;
Instance = Grav["default"].Forms.Fields.EditorField.Instance;
Instance.addButton({
vimeo: {
identifier: 'vimeo-video',
title: GravVimeoPlugin.translations.EDITOR_BUTTON_TOOLTIP,
label: '<i class="fa fa-fw fa-vimeo"></i>',
modes: ['gfm', 'markdown'],
action: function(e) {
e.button.on('click.editor.vimeo', function() {
var i, l, pos, posend, ref, ref1, text, videoId;
videoId = prompt(GravVimeoPlugin.translations.EDITOR_BUTTON_PROMPT);
if (videoId) {
text = "[plugin:vimeo](https://vimeo.com/" + videoId + ")";
pos = e.codemirror.getDoc().getCursor(true);
posend = e.codemirror.getDoc().getCursor(false);
for (l = i = ref = pos.line, ref1 = posend.line; ref <= ref1 ? i <= ref1 : i >= ref1; l = ref <= ref1 ? ++i : --i) {
e.codemirror.replaceRange(text + e.codemirror.getLine(l), {
line: l,
ch: 0
}, {
line: l,
ch: e.codemirror.getLine(l).length
});
}
e.codemirror.setCursor({
line: posend.line,
ch: e.codemirror.getLine(posend.line).length
});
e.codemirror.focus();
}
});
}
}
});
});
});
})(jQuery);