Skip to content

Commit

Permalink
Fix nitely#153. Also support external link image.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptogun committed Nov 3, 2017
1 parent b46207e commit a662801
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion spirit/comment/templates/spirit/comment/_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
--><li><a class="js-box-italic" href="#" title="{% trans "Italic" %}"><i class="fa fa-italic"></i></a></li><!--
--><li><a class="js-box-list" href="#" title="{% trans "List" %}"><i class="fa fa-list"></i></a></li><!--
--><li><a class="js-box-url" href="#" title="{% trans "URL" %}"><i class="fa fa-link"></i></a></li><!--
--><li><a class="js-box-image" href="#" title="{% trans "Image" %}"><i class="fa fa-picture-o"></i></a></li><!--
--><li><a class="js-box-url-image" href="#" title="{% trans "Image" %}"><i class="fa fa-external-link-square"></i></a></li><!--
--><li><a class="js-box-image" href="#" title="{% trans "Image" %}"><i class="fa fa-file-image-o"></i></a></li><!--
-->{% if st_settings.ST_UPLOAD_FILE_ENABLED %}<li>
<a class="js-box-file" href="#" title="{% trans "File" %}"><i class="fa fa-file"></i></a>
</li>{% endif %}<!--
Expand Down
7 changes: 7 additions & 0 deletions spirit/core/static/spirit/scripts/src/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Editor
$('.js-box-list').on('click', @addList)
$('.js-box-url').on('click', @addUrl)
$('.js-box-image').on('click', @addImage)
$('.js-box-url-image').on('click', @addUrlImage)
$('.js-box-poll').on('click', @addPoll)
$('.js-box-preview').on('click', @togglePreview)

Expand Down Expand Up @@ -70,6 +71,12 @@ class Editor
@wrapSelection("[", "](#{ @options.linkUrlText })", @options.linkText)
return false

addUrlImage: (e) =>
e.preventDefault()
@wrapSelection("![", "](#{ @options.imageUrlText })", @options.imageText)
$('#id_comment').focus()
return false

addImage: =>
@wrapSelection("![", "](#{ @options.imageUrlText })", @options.imageText)
return false
Expand Down
3 changes: 2 additions & 1 deletion spirit/core/static/spirit/stylesheets/mockups/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ <h1 class="headline">Topic title here</h1>
--><li><a class="js-box-italic" href="#" title="Italic"><i class="fa fa-italic"></i></a></li><!--
--><li><a class="js-box-list" href="#" title="List"><i class="fa fa-list"></i></a></li><!--
--><li><a class="js-box-url" href="#" title="URL"><i class="fa fa-link"></i></a></li><!--
--><li><a class="js-box-image" href="#" title="Image"><i class="fa fa-picture-o"></i></a></li><!--
--><li><a class="js-box-url-image" href="#" title="Image"><i class="fa fa-external-link-square"></i></a></li><!--
--><li><a class="js-box-image" href="#" title="Image"><i class="fa fa-file-image-o"></i></a></li><!--
--><li><a class="js-box-preview" href="#" title="Preview"><i class="fa fa-eye"></i></a></li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ <h1 class="headline">Topic title here</h1>
--><li><a class="js-box-italic" href="#" title="Italic"><i class="fa fa-italic"></i></a></li><!--
--><li><a class="js-box-list" href="#" title="List"><i class="fa fa-list"></i></a></li><!--
--><li><a class="js-box-url" href="#" title="URL"><i class="fa fa-link"></i></a></li><!--
--><li><a class="js-box-image" href="./image/upload/" title="Image"><i class="fa fa-picture-o"></i></a></li><!--
--><li><a class="js-box-url-image" href="#" title="Image"><i class="fa fa-link"></i></a></li><!--
--><li><a class="js-box-image" href="./image/upload/" title="Image"><i class="fa fa-external-link-square"></i></a></li><!--
--><li><a class="js-box-preview" href="#" title="Preview"><i class="fa fa-eye"></i></a></li>
</ul>

Expand Down

0 comments on commit a662801

Please sign in to comment.