Commit ae552ec3 authored by Stan Hu's avatar Stan Hu
Browse files

Fix Markdown preview not working in Edit Milestone page

Closes #1687
Closes https://github.com/gitlabhq/gitlabhq/issues/9325
parent a26d5372b3e6
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 7.12.0 (unreleased) v 7.12.0 (unreleased)
- Fix Markdown preview not working in Edit Milestone page (Stan Hu)
- Add web hook support for note events (Stan Hu) - Add web hook support for note events (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu) - Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka) - Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
......
class @ZenMode class @ZenMode
@fullscreen_prefix = 'fullscreen_'
constructor: -> constructor: ->
@active_zen_area = null @active_zen_area = null
@active_checkbox = null @active_checkbox = null
...@@ -23,7 +21,7 @@ class @ZenMode ...@@ -23,7 +21,7 @@ class @ZenMode
if checkbox.checked if checkbox.checked
# Disable other keyboard shortcuts in ZEN mode # Disable other keyboard shortcuts in ZEN mode
Mousetrap.pause() Mousetrap.pause()
@udpateActiveZenArea(checkbox) @updateActiveZenArea(checkbox)
else else
@exitZenMode() @exitZenMode()
...@@ -32,14 +30,11 @@ class @ZenMode ...@@ -32,14 +30,11 @@ class @ZenMode
@exitZenMode() @exitZenMode()
e.preventDefault() e.preventDefault()
$(window).on 'hashchange', @updateZenModeFromLocationHash updateActiveZenArea: (checkbox) =>
udpateActiveZenArea: (checkbox) =>
@active_checkbox = $(checkbox) @active_checkbox = $(checkbox)
@active_checkbox.prop('checked', true) @active_checkbox.prop('checked', true)
@active_zen_area = @active_checkbox.parent().find('textarea') @active_zen_area = @active_checkbox.parent().find('textarea')
@active_zen_area.focus() @active_zen_area.focus()
window.location.hash = ZenMode.fullscreen_prefix + @active_checkbox.prop('id')
exitZenMode: => exitZenMode: =>
if @active_zen_area isnt null if @active_zen_area isnt null
...@@ -51,17 +46,3 @@ class @ZenMode ...@@ -51,17 +46,3 @@ class @ZenMode
window.scrollTo(window.pageXOffset, @scroll_position) window.scrollTo(window.pageXOffset, @scroll_position)
# Enable dropzone when leaving ZEN mode # Enable dropzone when leaving ZEN mode
Dropzone.forElement('.div-dropzone').enable() Dropzone.forElement('.div-dropzone').enable()
checkboxFromLocationHash: (e) ->
id = $.trim(window.location.hash.replace('#' + ZenMode.fullscreen_prefix, ''))
if id
return $('.zennable input[type=checkbox]#' + id)[0]
else
return null
updateZenModeFromLocationHash: (e) =>
checkbox = @checkboxFromLocationHash()
if checkbox
@udpateActiveZenArea(checkbox)
else
@exitZenMode()
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