scrivito_editors 1.11.0 → 1.12.0.rc1

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: ec6c847c437f2ae3f592b781f75637acdd1e3f11
4
- data.tar.gz: 0fb978f3d3b9ec0c711245f05be66bc35f3241be
3
+ metadata.gz: a6f914ddf4d421537887c7714410ba84e7592704
4
+ data.tar.gz: ed4423c82f6d1ec8afbfbf8a971ad348f242464a
5
5
  SHA512:
6
- metadata.gz: bfc726a6f71620f370850d5a300cfac7698f06689b94db101bb2dee404d39af85bf0d3cda00b7cc317d2ff695ba51a11da537ac5755b15f3fee725bc8ca62398
7
- data.tar.gz: 3a69c87c061bb3c0a5e63d9409c1ca6f6e9d933d07610df30bc56f6344fca661ad17eefb1bba16db25c082b74f782e58b063997a0c42caeffbf85fd255a2f7e2
6
+ metadata.gz: fdd02d54714ef3c1a8f7ab6cbe4eea2afe0126d91b9f1bf8fb7b2f03ea8166a4ecbf4cf07db882a45188e80e0375a7ae58634d95ab6cd2a0ad31c532d2046a0c
7
+ data.tar.gz: 50230072a867d490d05f7e9d668d555458c98d40b23a0335a1fd953357c078363fb2a01753e75f26f8f434055fb00e30e727acaef70c2d650c24fccd8bd307f6
@@ -44,7 +44,7 @@
44
44
  selection = (id = _this.proxy.idFromPath(input.val())) ? [id] : [];
45
45
  cmsField = $(_this.base.origElements);
46
46
  scrivito.content_browser.open({
47
- filter: cmsField.data('scrivitoEditorsFilter'),
47
+ filters: cmsField.data('scrivitoEditorsFilter'),
48
48
  filter_context: cmsField.data('scrivitoEditorsFilterContext'),
49
49
  selection: selection,
50
50
  selection_mode: 'single'
@@ -78,6 +78,9 @@
78
78
 
79
79
  defaultOptions = function() {
80
80
  return {
81
+ anchor: {
82
+ targetCheckbox: true
83
+ },
81
84
  anchorPreview: false,
82
85
  extensions: {
83
86
  scrivito_anchor: new ScrivitoAnchor,
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- var DOUBLE_CLICK_MS, activate, cleanUp, cmsFieldAndPastedContent, finishEditing, getCurrentContent, isNewlineAllowed, onBlur, onFocus, onInput, onKey, prepareForEditing, save;
2
+ var DOUBLE_CLICK_MS, activate, cleanUp, cmsFieldAndPastedContent, finishEditing, fixSelectionForFirefox, getCurrentContent, isNewlineAllowed, onBlur, onClick, onFocus, onInput, onKey, prepareForEditing, save;
3
3
 
4
4
  onKey = function(event, proxy) {
5
5
  var cmsField, key;
@@ -26,11 +26,16 @@
26
26
  return prepareForEditing(proxy.jQueryElement());
27
27
  };
28
28
 
29
+ onClick = function(proxy) {
30
+ return fixSelectionForFirefox(proxy.jQueryElement());
31
+ };
32
+
29
33
  onBlur = function(proxy) {
30
34
  save(proxy).done(function() {
31
35
  return proxy.trigger('scrivito_editors:blur');
32
36
  });
33
- return finishEditing(proxy);
37
+ finishEditing(proxy);
38
+ return prepareForEditing(proxy.jQueryElement());
34
39
  };
35
40
 
36
41
  save = function(proxy) {
@@ -42,17 +47,8 @@
42
47
  };
43
48
 
44
49
  getCurrentContent = function(cmsField) {
45
- var clone, content;
46
50
  cleanUp(cmsField);
47
- clone = cmsFieldAndPastedContent(cmsField).clone();
48
- clone.find('div:not(:has(br)),p:not(:first)').before('\n');
49
- clone.find('br').replaceWith('\n');
50
- content = clone.text();
51
- clone.remove();
52
- if (!isNewlineAllowed(cmsField)) {
53
- content = content.replace(/\n$/, '');
54
- }
55
- return content;
51
+ return cmsField[0].innerText.replace(/\r\n/g, '\n').replace(/\n+$/, '');
56
52
  };
57
53
 
58
54
  cleanUp = function(cmsField) {
@@ -92,7 +88,7 @@
92
88
  if (isNewlineAllowed(cmsField) && !cmsField.data('scrivito_editors_prepared_for_editing')) {
93
89
  cmsField.data('scrivito_editors_prepared_for_editing', true);
94
90
  html = cmsField.html();
95
- htmlNl2Br = html.replace(/\n/g, '<br />');
91
+ htmlNl2Br = html.replace(/\r?\n/g, '<br />');
96
92
  if (html !== htmlNl2Br) {
97
93
  return cmsField.html(htmlNl2Br);
98
94
  }
@@ -108,12 +104,25 @@
108
104
 
109
105
  DOUBLE_CLICK_MS = 300;
110
106
 
107
+ fixSelectionForFirefox = function(cmsField) {
108
+ var sel;
109
+ sel = document.getSelection();
110
+ if (!sel.anchorNode || !sel.focusNode) {
111
+ return;
112
+ }
113
+ if (!cmsField.find(sel.anchorNode).addBack(sel.anchorNode).length || !cmsField.find(sel.focusNode).addBack(sel.focusNode).length) {
114
+ return sel.selectAllChildren(cmsField[0]);
115
+ }
116
+ };
117
+
111
118
  activate = function(proxy) {
112
119
  var cmsField;
113
120
  cmsField = proxy.jQueryElement();
114
121
  scrivito.editors.applyPlaceholder(cmsField);
115
122
  cmsField.attr('contenteditable', true).blur(function() {
116
123
  return onBlur(proxy);
124
+ }).click(function() {
125
+ return onClick(proxy);
117
126
  }).focus(function() {
118
127
  return onFocus(proxy);
119
128
  }).keypress(function(event) {
@@ -544,6 +544,9 @@ MediumEditor.extensions = {};
544
544
  Util.moveTextRangeIntoElement(textNodes[0], textNodes[textNodes.length - 1], anchor);
545
545
  anchor.setAttribute('href', href);
546
546
  if (target) {
547
+ if (target === '_blank') {
548
+ anchor.setAttribute('rel', 'noopener noreferrer');
549
+ }
547
550
  anchor.setAttribute('target', target);
548
551
  }
549
552
  return anchor;
@@ -989,12 +992,14 @@ MediumEditor.extensions = {};
989
992
  var i, url = anchorUrl || false;
990
993
  if (el.nodeName.toLowerCase() === 'a') {
991
994
  el.target = '_blank';
995
+ el.rel = 'noopener noreferrer';
992
996
  } else {
993
997
  el = el.getElementsByTagName('a');
994
998
 
995
999
  for (i = 0; i < el.length; i += 1) {
996
1000
  if (false === url || url === el[i].attributes.href.value) {
997
1001
  el[i].target = '_blank';
1002
+ el[i].rel = 'noopener noreferrer';
998
1003
  }
999
1004
  }
1000
1005
  }
@@ -1008,12 +1013,14 @@ MediumEditor.extensions = {};
1008
1013
  var i;
1009
1014
  if (el.nodeName.toLowerCase() === 'a') {
1010
1015
  el.removeAttribute('target');
1016
+ el.removeAttribute('rel');
1011
1017
  } else {
1012
1018
  el = el.getElementsByTagName('a');
1013
1019
 
1014
1020
  for (i = 0; i < el.length; i += 1) {
1015
1021
  if (anchorUrl === el[i].attributes.href.value) {
1016
1022
  el[i].removeAttribute('target');
1023
+ el[i].removeAttribute('rel');
1017
1024
  }
1018
1025
  }
1019
1026
  }
@@ -3764,8 +3771,8 @@ MediumEditor.extensions = {};
3764
3771
  // figure out how to deprecate? also consider `fa-` icon default implcations.
3765
3772
  template.push(
3766
3773
  '<div class="medium-editor-toolbar-form-row">',
3767
- '<input type="checkbox" class="medium-editor-toolbar-anchor-target">',
3768
- '<label>',
3774
+ '<input type="checkbox" class="medium-editor-toolbar-anchor-target" id="medium-editor-toolbar-anchor-target-field-' + this.getEditorId() + '">',
3775
+ '<label for="medium-editor-toolbar-anchor-target-field-' + this.getEditorId() + '">',
3769
3776
  this.targetCheckboxText,
3770
3777
  '</label>',
3771
3778
  '</div>'
@@ -5430,8 +5437,10 @@ MediumEditor.extensions = {};
5430
5437
  // on empty line, rects is empty so we grab information from the first container of the range
5431
5438
  if (rects.length) {
5432
5439
  top += rects[0].top;
5433
- } else {
5440
+ } else if (range.startContainer.getBoundingClientRect !== undefined) {
5434
5441
  top += range.startContainer.getBoundingClientRect().top;
5442
+ } else {
5443
+ top += range.getBoundingClientRect().top;
5435
5444
  }
5436
5445
  }
5437
5446
 
@@ -7869,7 +7878,7 @@ MediumEditor.parseVersionString = function (release) {
7869
7878
 
7870
7879
  MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
7871
7880
  // grunt-bump looks for this:
7872
- 'version': '5.23.0'
7881
+ 'version': '5.23.2'
7873
7882
  }).version);
7874
7883
 
7875
7884
  return MediumEditor;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_editors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-25 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-ui-rails
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 1.11.0
53
+ version: 1.12.0.rc1
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 1.11.0
60
+ version: 1.12.0.rc1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: scrivito_sdk
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 1.11.0
67
+ version: 1.12.0.rc1
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 1.11.0
74
+ version: 1.12.0.rc1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: coffee-rails
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
330
  version: '1.8'
331
331
  requirements: []
332
332
  rubyforge_project:
333
- rubygems_version: 2.4.8
333
+ rubygems_version: 2.6.14
334
334
  signing_key:
335
335
  specification_version: 4
336
336
  summary: Scrivito Editors