Commit d0c5ac4a authored by Florent Baldino's avatar Florent Baldino

Cache only last response in markdown preview

parent af24645d
...@@ -25,7 +25,7 @@ class @MarkdownPreview ...@@ -25,7 +25,7 @@ class @MarkdownPreview
renderMarkdown: (text, success) -> renderMarkdown: (text, success) ->
return unless window.markdown_preview_path return unless window.markdown_preview_path
return success(@ajaxCache[text]) if @ajaxCache[text] return success(@ajaxCache.response) if text == @ajaxCache.text
$.ajax $.ajax
type: 'POST' type: 'POST'
...@@ -33,7 +33,7 @@ class @MarkdownPreview ...@@ -33,7 +33,7 @@ class @MarkdownPreview
data: { text: text } data: { text: text }
dataType: 'json' dataType: 'json'
success: (response) => success: (response) =>
@ajaxCache[text] = response @ajaxCache = text: text, response: response
success(response) success(response)
hideReferencedUsers: (form) -> hideReferencedUsers: (form) ->
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
%td Show this dialog %td Show this dialog
%tr %tr
%td.shortcut %td.shortcut
.key ctrl shift p - if browser.mac?
.key ctrl ⌘ p
- else
.key ctrl shift p
%td Toggle Markdown preview %td Toggle Markdown preview
%tbody %tbody
%tr %tr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment