effective_ckeditor 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24eb6f94fd67d054d3e8e10b986d19ceeaf68cf4
4
- data.tar.gz: c544576322688c611814560223946415759a00f2
3
+ metadata.gz: b22b0341285f50bf1bba6fa6e07a04339cb7140f
4
+ data.tar.gz: feb17db6574f8451258e88fcfe0b8e70391a61a7
5
5
  SHA512:
6
- metadata.gz: 1632da4ff2f7d762d43c51236cfcd737345ea70447eb2792823161804ebc6870bfb4101974397179326418dd6e734d4efb6c2e61ca8db68e3d12811dec04c504
7
- data.tar.gz: 1fe654c60ddcdbfec1f8f2fa7b78f1113e6dfb36aae4a92b300bb293b50cca4d651f619fa17f29ac9bf53b1b28b16a154f74f348689b51203ef63ad092c9693d
6
+ metadata.gz: d3fb6b41d9162903d27458077136d2b151684703f0fb961eb5bbeac4678a9276b90c838a3d62f4e3a16bca88f8c24e38ea33d9c02ba8ce11bf004ce454971540
7
+ data.tar.gz: f05e9bab1af03913bb47e799652f147f9b434b0145e238de360f185c38a49ec642382e7ec8bf502d805c1899a994a1f4ece8472110128cd2aef21a6d1803cfbb
@@ -19,7 +19,8 @@ init = ->
19
19
  if ckeditors.length
20
20
  $('body').prepend("<div id='effective-ckeditor-top'></div>").addClass('effective-ckeditor-editting')
21
21
 
22
- $(window).on 'beforeunload', (event) -> promptToSaveIfDirty(event)
22
+ $(window).on 'beforeunload', (event) -> promptToSaveIfDirtyWindow(event)
23
+ $(document).on 'click', 'a', (event) -> promptToSaveIfDirtyLink(event)
23
24
  $(window).on 'unload', (event) -> $.cookie('effective_regions_editting', '', {path: '/', expires: -1})
24
25
 
25
26
  ckeditors.each ->
@@ -120,7 +121,7 @@ initTemplates = ->
120
121
  imagesPath: CKEDITOR.getUrl( window.location.protocol + '//' + window.location.host + '/assets/effective/templates/' ),
121
122
  templates: template for template in templates
122
123
 
123
- promptToSaveIfDirty = (event) ->
124
+ promptToSaveIfDirtyWindow = (event) ->
124
125
  dirty = false
125
126
 
126
127
  for name, instance of CKEDITOR.instances
@@ -133,6 +134,17 @@ promptToSaveIfDirty = (event) ->
133
134
  else
134
135
  event.stopPropagation()
135
136
 
137
+ promptToSaveIfDirtyLink = (event) ->
138
+ dirty = false
139
+
140
+ for name, instance of CKEDITOR.instances
141
+ if instance.checkDirty()
142
+ dirty = true
143
+ break
144
+
145
+ if dirty && !confirm('You have unsaved changes. Really leave page?')
146
+ event.preventDefault()
147
+
136
148
  affixBootstrapMenu = (editor_div) ->
137
149
  dropdown_menu = editor_div.closest('.dropdown-menu')
138
150
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveCkeditor
2
- VERSION = '1.9.1'.freeze
2
+ VERSION = '1.9.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_ckeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect