scrivito_sdk 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/scrivito_editing.js +27 -6
- data/lib/scrivito/configuration.rb +1 -1
- data/lib/scrivito/editing_context.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c030fbcf0bc0a148de95658bca6192dee2581ab
|
4
|
+
data.tar.gz: 39191bc79378d57f092ea53d88169e20ea5eb307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a499b690ae3fad215f5a58772d8e80c3333e04f33db13deca5ea78d45eeb9dacf7988da7da16fbaa07ca8d020a333fa372614286c0b0092df6e8dd11e08eaa5
|
7
|
+
data.tar.gz: bd110df0b0c3bd1b83c1192d8c267e662f10a096433e89a674df38c1c693dd484858ee46df4b7362aa10063057448defc7a52e0d60f1d44829fea2e694a3e2c1
|
@@ -14431,6 +14431,29 @@ var scrivito = {};
|
|
14431
14431
|
return scrivito.bypass_throttle ? fn : _.throttle(fn, ms);
|
14432
14432
|
},
|
14433
14433
|
|
14434
|
+
// window.atob does not handle encoded UTF8 strings. See http://mzl.la/1p1zI9k.
|
14435
|
+
base64_to_utf8: function(base64_string) {
|
14436
|
+
return decodeURIComponent(window.escape(atob(base64_string)));
|
14437
|
+
},
|
14438
|
+
|
14439
|
+
// window.btoa does not handle encoded UTF8 strings. See http://mzl.la/1p1zI9k.
|
14440
|
+
utf8_to_base64: function(utf8_string) {
|
14441
|
+
return btoa(window.unescape(encodeURIComponent(utf8_string)));
|
14442
|
+
},
|
14443
|
+
|
14444
|
+
json_parse_base64: function(base64_string) {
|
14445
|
+
var utf8_string = scrivito.base64_to_utf8(base64_string);
|
14446
|
+
// The server escapes non-unicode characters (e.g. '<') when encoding JSON.
|
14447
|
+
utf8_string = utf8_string.replace(/\\u([\d\w]{4})/gi, function(match, grp) {
|
14448
|
+
return String.fromCharCode(parseInt(grp, 16));
|
14449
|
+
});
|
14450
|
+
return JSON.parse(utf8_string);
|
14451
|
+
},
|
14452
|
+
|
14453
|
+
json_stringify_base64: function(object) {
|
14454
|
+
return scrivito.utf8_to_base64(JSON.stringify(object));
|
14455
|
+
},
|
14456
|
+
|
14434
14457
|
init: function(config) {
|
14435
14458
|
scrivito.config = config;
|
14436
14459
|
|
@@ -15821,9 +15844,8 @@ $(function() {
|
|
15821
15844
|
assert_valid_workspace_id();
|
15822
15845
|
|
15823
15846
|
if (has_original_content(that.field_type())) {
|
15824
|
-
|
15825
|
-
.attr('data-scrivito-private-field-original-content');
|
15826
|
-
return JSON.parse(atob(encoded_content));
|
15847
|
+
return scrivito.json_parse_base64(
|
15848
|
+
that.dom_element().attr('data-scrivito-private-field-original-content'));
|
15827
15849
|
} else {
|
15828
15850
|
$.error('Fields of type ' + that.field_type() + ' do not support original content');
|
15829
15851
|
}
|
@@ -15831,9 +15853,8 @@ $(function() {
|
|
15831
15853
|
|
15832
15854
|
set_original_content: function(content) {
|
15833
15855
|
if (has_original_content(that.field_type())) {
|
15834
|
-
|
15835
|
-
|
15836
|
-
.attr('data-scrivito-private-field-original-content', encoded_content);
|
15856
|
+
that.dom_element().attr('data-scrivito-private-field-original-content',
|
15857
|
+
scrivito.json_stringify_base64(content));
|
15837
15858
|
}
|
15838
15859
|
}
|
15839
15860
|
});
|
@@ -39,7 +39,7 @@ module Scrivito
|
|
39
39
|
# Default is <code>false</code>.
|
40
40
|
#
|
41
41
|
# Example Usage:
|
42
|
-
# Scrivito::
|
42
|
+
# Scrivito::Configuration.editing_auth do |env|
|
43
43
|
# request = Rack::Request.new(env)
|
44
44
|
# # return truey if current visitor is permitted to edit content, falsy otherwise
|
45
45
|
# end
|
@@ -4,7 +4,7 @@ class EditingContext
|
|
4
4
|
# +options+:
|
5
5
|
# +:selected_workspace_id+: The id of the selected workspace. If empty +published+ workspace is used.
|
6
6
|
# +:display_mode+: Can be +view+, +editing+, +added+ or +deleted+. If empty +view+ is used.
|
7
|
-
# +:editor+: A block, which is lazy evaluated on first access, to determine the editor (details see {Scrivito::
|
7
|
+
# +:editor+: A block, which is lazy evaluated on first access, to determine the editor (details see {Scrivito::Configuration.editing_auth})
|
8
8
|
# @param [Hash] options
|
9
9
|
def initialize(options = {})
|
10
10
|
@selected_workspace_id = options[:selected_workspace_id]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|