mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Githook highlighter (#8932)
* Add code highlighter to GitHook edit Signed-off-by: Konctantin <gawrilyako@gmail.com> * Fix indentation Signed-off-by: Konctantin <gawrilyako@gmail.com> * Resolve merge conflict Signed-off-by: gawrilyako@gmail.com <Konctantin> * Resolve merge conflict Signed-off-by: gawrilyako@gmail.com <Konctantin> * Fix pre-build drone event Signed-off-by: Konctantin <gawrilyako@gmail.com>
This commit is contained in:
		@@ -707,6 +707,7 @@ func GitHooks(ctx *context.Context) {
 | 
			
		||||
func GitHooksEdit(ctx *context.Context) {
 | 
			
		||||
	ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
 | 
			
		||||
	ctx.Data["PageIsSettingsGitHooks"] = true
 | 
			
		||||
	ctx.Data["RequireSimpleMDE"] = true
 | 
			
		||||
 | 
			
		||||
	name := ctx.Params(":name")
 | 
			
		||||
	hook, err := ctx.Repo.GitRepo.GetHook(name)
 | 
			
		||||
 
 | 
			
		||||
@@ -1499,6 +1499,17 @@ function initUserSettings() {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function initGithook() {
 | 
			
		||||
  if ($('.edit.githook').length === 0) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  CodeMirror.autoLoadMode(CodeMirror.fromTextArea($('#content')[0], {
 | 
			
		||||
    lineNumbers: true,
 | 
			
		||||
    mode: 'shell'
 | 
			
		||||
  }), 'shell');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function initWebhook() {
 | 
			
		||||
  if ($('.new.webhook').length === 0) {
 | 
			
		||||
    return;
 | 
			
		||||
@@ -2296,6 +2307,7 @@ $(document).ready(() => {
 | 
			
		||||
  initEditForm();
 | 
			
		||||
  initEditor();
 | 
			
		||||
  initOrganization();
 | 
			
		||||
  initGithook();
 | 
			
		||||
  initWebhook();
 | 
			
		||||
  initAdmin();
 | 
			
		||||
  initCodeView();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user