mirror of
https://github.com/go-gitea/gitea
synced 2024-11-17 23:41:49 +01:00
Fix images in wiki edit preview (#11546)
Make sure wiki editor sets wiki to true so gitea renders it as a wiki page. Also change the context data attr for edit form. This looks wrong but everywhere else in our code assumes the urlPrefix to be just the repo url when rendering and manually adds /wiki to the rendered url regardless. Fixes #11540
This commit is contained in:
parent
814ca9ffea
commit
ae55dc7a6b
2 changed files with 3 additions and 2 deletions
|
@ -21,7 +21,7 @@
|
||||||
<a class="item" data-tab="preview">{{.i18n.Tr "preview"}}</a>
|
<a class="item" data-tab="preview">{{.i18n.Tr "preview"}}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{.Repository.APIURL}}/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="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}" 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"}}">
|
||||||
|
|
|
@ -1323,7 +1323,8 @@ function initWikiForm() {
|
||||||
_csrf: csrf,
|
_csrf: csrf,
|
||||||
mode: 'gfm',
|
mode: 'gfm',
|
||||||
context: $editArea.data('context'),
|
context: $editArea.data('context'),
|
||||||
text: plainText
|
text: plainText,
|
||||||
|
wiki: true
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`;
|
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`;
|
||||||
$(preview).find('pre code').each((_, e) => {
|
$(preview).find('pre code').each((_, e) => {
|
||||||
|
|
Loading…
Reference in a new issue