Add shortcut to save wiki page (#4452)

This allows saving the wiki page with Ctrl-Enter.
This commit is contained in:
Michael Kuhn 2018-07-24 12:20:52 +02:00 committed by Jonas Franz
parent ba358ecbf5
commit 344dc07239
2 changed files with 3 additions and 2 deletions

View file

@ -790,7 +790,7 @@ function initTeamSettings() {
function initWikiForm() { function initWikiForm() {
var $editArea = $('.repository.wiki textarea#edit_area'); var $editArea = $('.repository.wiki textarea#edit_area');
if ($editArea.length > 0) { if ($editArea.length > 0) {
new SimpleMDE({ var simplemde = new SimpleMDE({
autoDownloadFontAwesome: false, autoDownloadFontAwesome: false,
element: $editArea[0], element: $editArea[0],
forceSync: true, forceSync: true,
@ -825,6 +825,7 @@ function initWikiForm() {
"link", "image", "table", "horizontal-rule", "|", "link", "image", "table", "horizontal-rule", "|",
"clean-block", "preview", "fullscreen"] "clean-block", "preview", "fullscreen"]
}) })
$(simplemde.codemirror.getInputField()).addClass("js-quick-submit");
} }
} }

View file

@ -17,7 +17,7 @@
<input name="title" value="{{.title}}" autofocus required> <input name="title" value="{{.title}}" autofocus required>
</div> </div>
<div class="field"> <div class="field">
<textarea id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/wiki" required>{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea> <textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/wiki" required>{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
</div> </div>
<div class="field"> <div class="field">
<input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}"> <input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}">