mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-06 15:15:27 +02:00
(refs #585) Fix issue in markdown preview
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
@(repository: service.RepositoryService.RepositoryInfo, content: String, enableWikiLink: Boolean, enableRefsLink: Boolean, enableTaskList: Boolean, hasWritePermission: Boolean,
|
||||
style: String = "", placeholder: String = "Leave a comment", elastic: Boolean = false)(implicit context: app.Context)
|
||||
style: String = "", placeholder: String = "Leave a comment", elastic: Boolean = false, uid: Long = new java.util.Date().getTime())(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" style="height: 37px;">
|
||||
<li class="active"><a href="#tab1" data-toggle="tab">Write</a></li>
|
||||
<li><a href="#tab2" data-toggle="tab" id="preview">Preview</a></li>
|
||||
<li class="active"><a href="#tab@uid" data-toggle="tab">Write</a></li>
|
||||
<li><a href="#tab@(uid+1)" data-toggle="tab" id="preview@uid">Preview</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab1">
|
||||
<div class="tab-pane active" id="tab@uid">
|
||||
<span id="error-content" class="error"></span>
|
||||
@textarea = {
|
||||
<textarea id="content" name="content"@if(style.nonEmpty){ style="@style"} placeholder="@placeholder">@content</textarea>
|
||||
<textarea id="content@uid" name="content"@if(style.nonEmpty){ style="@style"} placeholder="@placeholder">@content</textarea>
|
||||
}
|
||||
@if(enableWikiLink){
|
||||
@textarea
|
||||
@@ -19,8 +19,8 @@
|
||||
@helper.html.attached(repository.owner, repository.name)(textarea)
|
||||
}
|
||||
</div>
|
||||
<div class="tab-pane" id="tab2">
|
||||
<div class="markdown-body" id="preview-area">
|
||||
<div class="tab-pane" id="tab@(uid+1)">
|
||||
<div class="markdown-body" id="preview-area@uid">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,18 +30,18 @@
|
||||
<script>
|
||||
$(function(){
|
||||
@if(elastic){
|
||||
$('#content').elastic();
|
||||
$('#content@uid').elastic();
|
||||
}
|
||||
|
||||
$('#preview').click(function(){
|
||||
$(this).closest('#preview-area').html('<img src="@assets/common/images/indicator.gif"> Previewing...');
|
||||
$('#preview@uid').click(function(){
|
||||
$('#preview-area@uid').html('<img src="@assets/common/images/indicator.gif"> Previewing...');
|
||||
$.post('@url(repository)/_preview', {
|
||||
content : $('#content').val(),
|
||||
content : $('#content@uid').val(),
|
||||
enableWikiLink : @enableWikiLink,
|
||||
enableRefsLink : @enableRefsLink,
|
||||
enableTaskList : @enableTaskList
|
||||
}, function(data){
|
||||
$('#preview-area').html(data);
|
||||
$('#preview-area@uid').html(data);
|
||||
prettyPrint();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user