scrivito_editors 1.15.0 → 1.16.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
  SHA256:
3
- metadata.gz: 19dcf4bce3ab292aa553dfc4ca22ff6d0b11d61bf62290f13b803528714faf57
4
- data.tar.gz: e96e95d48e58847413bb3c86696b40b24729f5d887a72a3203579f1710b562ad
3
+ metadata.gz: b95f8752ade372a8507f858d86373400373ae0f978082e653ec21748cba5400f
4
+ data.tar.gz: f8deff3d249d8578e8f3929079fbc70abb7ed5a826b2c49ffdbc953ac07521b1
5
5
  SHA512:
6
- metadata.gz: 9bf580c25a50fc6bec987d5c33e74fa64ee53849eaf12d4b175bc98bdb9562aa520c2c169a557d59800d760913f0315395bd63cc29b9c6d7498f9aa1e035eadf
7
- data.tar.gz: 51400b1401af4559984b368cc9ab34045ac73dd0929e8b797dd8e32345f0a643d99305ba95d7f0b77f936fb5da9a271a36f7c1499c4d821f715e4725b35851b3
6
+ metadata.gz: 0db15e034691d18e65a2e81f4b122f938875188734e211c19d38ca8232294c93cda53dea243dccae136f9a2ffe53432783c0f4955ee0a9c215a3efe696c7d98e
7
+ data.tar.gz: 65a634deed5423b047bfaf3de78e518c4dd484e59458ff36a5c135583dd97ae0ce134a3c2009d3a7bf173c52539cc8de80439f3f82a60a6de09a64aac3d711f3
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 - 2018 Infopark AG (http://www.infopark.com)
1
+ Copyright (c) 2009 - 2019 Infopark AG (http://www.infopark.com)
2
2
 
3
3
  This software can be used and modified under the LGPL-3.0. Please refer to
4
4
  http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
data/README.md CHANGED
@@ -12,7 +12,7 @@ Please refer to the
12
12
  [latest installation and usage instructions](https://scrivito.com/editors).
13
13
 
14
14
  ## License
15
- Copyright (c) 2009 - 2018 Infopark AG (http://www.infopark.com)
15
+ Copyright (c) 2009 - 2019 Infopark AG (http://www.infopark.com)
16
16
 
17
17
  This software can be used and modified under the LGPL-3.0. Please refer to
18
18
  http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
@@ -10,54 +10,62 @@
10
10
  MediumEditor.extensions.anchor.prototype.init.apply(this, arguments);
11
11
  return this.targetCheckbox = (ref = this.getEditorOption('anchor')) != null ? ref.targetCheckbox : void 0;
12
12
  },
13
+ showForm: function(opts) {
14
+ MediumEditor.extensions.anchor.prototype.showForm.call(this, opts);
15
+ return this.updateRelUi(opts);
16
+ },
13
17
  handleClick: function(event) {
14
- var linkElement, selectedParent, selectionRange;
18
+ var href, linkElement, rel, selectedParent, selectionRange, target;
15
19
  event.preventDefault();
16
20
  event.stopPropagation();
21
+ $('.scrivito_medium_link_collapse').removeClass('show');
17
22
  if (!this.isDisplayed()) {
18
23
  selectionRange = MediumEditor.selection.getSelectionRange(this.document);
19
24
  selectedParent = MediumEditor.selection.getSelectedParentElement(selectionRange);
20
25
  linkElement = MediumEditor.util.getClosestTag(selectedParent, 'a');
26
+ href = target = rel = null;
27
+ if (linkElement) {
28
+ linkElement = $(linkElement);
29
+ href = linkElement.attr('href') || null;
30
+ target = linkElement.attr('target') || null;
31
+ rel = linkElement.attr('rel') || null;
32
+ }
21
33
  this.showForm({
22
- value: $(linkElement).attr('href') || null,
23
- target: $(linkElement).attr('target') || null
34
+ value: href,
35
+ target: target,
36
+ rel: rel
24
37
  });
25
38
  }
26
39
  return false;
27
40
  },
28
41
  getTemplate: function() {
29
- var targetCheckboxTemplate;
42
+ var classTargetCheckboxNA, targetCheckboxTemplate;
30
43
  targetCheckboxTemplate = "";
44
+ classTargetCheckboxNA = "scrivito_target_checkbox_not_available";
31
45
  if (this.targetCheckbox) {
32
- targetCheckboxTemplate = "<div class='medium-editor-toolbar-form-row medium-editor-toolbar-anchor-target-toggle'>\n <label>\n <input type='checkbox' class='medium-editor-toolbar-anchor-target'>\n <i class='scrivito_customer_icon sci_inv_check'></i>\n <i class='scrivito_customer_icon sci_rounded_square'></i>\n " + this.targetCheckboxText + "\n </label>\n</div>";
46
+ targetCheckboxTemplate = "<div class='medium-editor-toolbar-form-row medium-editor-toolbar-anchor-target-toggle'>\n <label>\n <input type='checkbox' class='medium-editor-toolbar-anchor-target'>\n <i class='scrivito_icon scrivito_link_icon scrivito_icon_new_window scrivito_active_open_in_new_tab ' title='Open link in new tab'></i>\n <i class='scrivito_icon scrivito_link_icon scrivito_icon_new_window' title='Open link in new tab'></i>\n </label>\n</div>";
47
+ classTargetCheckboxNA = "";
33
48
  }
34
- return ("<i class='medium-editor-toolbar-browse scrivito_customer_icon sci_collection'></i>\n<input type='text' class='medium-editor-toolbar-input' placeholder='" + this.placeholderText + "'>\n<i class='medium-editor-toolbar-save scrivito_customer_icon sci_check'></i>\n<i class='medium-editor-toolbar-close scrivito_customer_icon sci_cross'></i>\n" + targetCheckboxTemplate).replace(/\n\s*/g, "");
49
+ return ("<i class='medium-editor-toolbar-browse scrivito_customer_icon sci_collection' title='Open Content Browser'></i>\n<input type='text' class='medium-editor-toolbar-input " + classTargetCheckboxNA + "' placeholder='" + this.placeholderText + "'>\n<div class='medium-editor-toolbar-form-wrapper'>\n " + targetCheckboxTemplate + "\n <i class='scrivito_icon scrivito_icon_gear' data-scrivito-medium-editor=\"rel_button\" title='SEO settings'></i>\n <span class='medium-editor-toolbar-save'>Save</span>\n <i class='medium-editor-toolbar-close scrivito_customer_icon sci_cross' style='display: none'></i>\n</div>\n<div class='scrivito_medium_link_collapse'>\n <div class='scrivito_medium_link_collapse_body'>\n <div class='scrivito_medium_detail_label'>Rel attribute value</div>\n <div class='scrivito_medium_notice_body'>\n Search engines use a link's rel attribute to determine how to handle the linked document or resource.\n </div>\n <ul class='scrivito_enum_attribute scrivito_multi'>\n <li data-scrivito-rel=\"noindex\">noindex</li>\n <li data-scrivito-rel=\"nofollow\">nofollow</li>\n <li data-scrivito-rel=\"noarchive\">noarchive</li>\n <li data-scrivito-rel=\"nosnippet\">nosnippet</li>\n <li data-scrivito-rel=\"noopener\">noopener</li>\n <li data-scrivito-rel=\"noreferrer\">noreferrer</li>\n <li data-scrivito-rel=\"notranslate\">notranslate</li>\n </ul>\n </div>\n</div>").replace(/\n\s*/g, "");
35
50
  },
36
51
  attachFormEvents: function(form) {
37
52
  var input;
38
53
  MediumEditor.extensions.anchor.prototype.attachFormEvents.call(this, form);
39
54
  form = $(form);
40
55
  input = form.find('.medium-editor-toolbar-input');
56
+ form.find('[data-scrivito-rel]').on('click', (function(_this) {
57
+ return function(event) {
58
+ return _this.onRelSelectionButtonClick(event);
59
+ };
60
+ })(this));
61
+ form.find('.scrivito_icon_gear').on('click', (function(_this) {
62
+ return function() {
63
+ return _this.onToggleRelPanelButtonClick(form);
64
+ };
65
+ })(this));
41
66
  return form.find('.medium-editor-toolbar-browse').on('click', (function(_this) {
42
67
  return function() {
43
- var cmsField, id, selection;
44
- selection = (id = _this.proxy.idFromPath(input.val())) ? [id] : [];
45
- cmsField = $(_this.base.origElements);
46
- scrivito.content_browser.open({
47
- filters: cmsField.data('scrivitoEditorsFilter'),
48
- filter_context: cmsField.data('scrivitoEditorsFilterContext'),
49
- selection: selection,
50
- selection_mode: 'single'
51
- }).always(function() {
52
- return input.focus();
53
- }).done(function(selection) {
54
- if (selection.length) {
55
- return input.val(_this.proxy.pathForId(selection[0]));
56
- } else {
57
- return input.val('');
58
- }
59
- });
60
- return false;
68
+ return _this.onContentBrowserButtonClick(input);
61
69
  };
62
70
  })(this));
63
71
  },
@@ -65,10 +73,93 @@
65
73
  this.base.restoreSelection();
66
74
  if (opts.value) {
67
75
  this.execAction(this.action, opts);
76
+ this.updateRelAttribute(opts);
68
77
  } else {
69
78
  this.execAction('unlink');
70
79
  }
71
80
  return this.base.checkSelection();
81
+ },
82
+ getFormOpts: function() {
83
+ var opts;
84
+ opts = MediumEditor.extensions.anchor.prototype.getFormOpts.call(this);
85
+ opts.rel = this.selectedRelValues();
86
+ return opts;
87
+ },
88
+ relButtons: function() {
89
+ return $(this.getForm()).find('.scrivito_enum_attribute.scrivito_multi [data-scrivito-rel]');
90
+ },
91
+ selectedRelValues: function() {
92
+ return this.relButtons().filter('.scrivito_enum_attribute_active').toArray().map(function(button) {
93
+ return button.attributes['data-scrivito-rel'].value;
94
+ }).join(' ');
95
+ },
96
+ updateRelIndicator: function() {
97
+ var selectedClass, toggleRelPanelButton;
98
+ toggleRelPanelButton = $(this.getForm().querySelector('.scrivito_icon_gear'));
99
+ selectedClass = 'scrivito_active_rel_selected';
100
+ if (this.relButtons().hasClass('scrivito_enum_attribute_active')) {
101
+ return toggleRelPanelButton.addClass(selectedClass);
102
+ } else {
103
+ return toggleRelPanelButton.removeClass(selectedClass);
104
+ }
105
+ },
106
+ updateRelAttribute: function(opts) {
107
+ var elem, linkElement, selectedParent, selectionRange;
108
+ selectionRange = MediumEditor.selection.getSelectionRange(this.document);
109
+ selectedParent = MediumEditor.selection.getSelectedParentElement(selectionRange);
110
+ linkElement = $(MediumEditor.util.getClosestTag(selectedParent, 'a'));
111
+ if (opts.rel) {
112
+ linkElement.attr('rel', opts.rel);
113
+ } else {
114
+ linkElement.removeAttr('rel');
115
+ }
116
+ elem = this.getEditorElements()[0];
117
+ return this.base.trigger('editableInput', {}, elem);
118
+ },
119
+ updateRelUi: function(opts) {
120
+ var ref, rel;
121
+ rel = (ref = opts.rel) != null ? ref.split(/\s+/) : void 0;
122
+ this.relButtons().each(function(_, button) {
123
+ if (rel && rel.indexOf(button.getAttribute('data-scrivito-rel')) !== -1) {
124
+ return button.className = 'scrivito_enum_attribute_active';
125
+ } else {
126
+ return button.className = '';
127
+ }
128
+ });
129
+ return this.updateRelIndicator();
130
+ },
131
+ onToggleRelPanelButtonClick: function(form) {
132
+ return $(form.find('.scrivito_medium_link_collapse')).toggleClass('show');
133
+ },
134
+ onRelSelectionButtonClick: function(event) {
135
+ var relButton;
136
+ relButton = $(event.target);
137
+ relButton.toggleClass('scrivito_enum_attribute_active');
138
+ return this.updateRelIndicator();
139
+ },
140
+ onContentBrowserButtonClick: function(input) {
141
+ var cmsField, id, selection;
142
+ selection = (id = this.proxy.idFromPath(input.val())) ? [id] : [];
143
+ cmsField = $(this.base.origElements);
144
+ scrivito.content_browser.open({
145
+ filters: cmsField.data('scrivitoEditorsFilter'),
146
+ filter_context: cmsField.data('scrivitoEditorsFilterContext'),
147
+ selection: selection,
148
+ selection_mode: 'single'
149
+ }).always((function(_this) {
150
+ return function() {
151
+ return input.focus();
152
+ };
153
+ })(this)).done((function(_this) {
154
+ return function(selection) {
155
+ if (selection.length) {
156
+ return input.val(_this.proxy.pathForId(selection[0]));
157
+ } else {
158
+ return input.val('');
159
+ }
160
+ };
161
+ })(this));
162
+ return false;
72
163
  }
73
164
  });
74
165
 
@@ -42,11 +42,11 @@
42
42
  border-bottom-left-radius: 0;
43
43
  }
44
44
 
45
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li {
45
+ [data-scrivito-editing] [data-scrivito-field-type="referencelist"] ul li {
46
46
  padding-left: 28px;
47
47
  }
48
48
 
49
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li:before {
49
+ [data-scrivito-editing] [data-scrivito-field-type="referencelist"] ul li:before {
50
50
  content: "↕";
51
51
  color: #999;
52
52
  font-size: 19px;
@@ -56,12 +56,12 @@
56
56
  top: 50%;
57
57
  }
58
58
 
59
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li:hover {
59
+ [data-scrivito-editing] [data-scrivito-field-type="referencelist"] ul li:hover {
60
60
  background-color: #e6f3f7;
61
61
  cursor: move;
62
62
  }
63
63
 
64
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li.scrivito-sortable-placeholder {
64
+ [data-scrivito-editing] [data-scrivito-field-type="referencelist"] ul li.scrivito-sortable-placeholder {
65
65
  background: #f3f3f3;
66
66
  border: 2px dashed #9bc2cf;
67
67
  height: 36px;
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.15.0
4
+ version: 1.16.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: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2019-04-10 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.15.0
53
+ version: 1.16.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.15.0
60
+ version: 1.16.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.15.0
67
+ version: 1.16.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.15.0
74
+ version: 1.16.0.rc1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: coffee-rails
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -330,8 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
330
  - !ruby/object:Gem::Version
331
331
  version: '1.8'
332
332
  requirements: []
333
- rubyforge_project:
334
- rubygems_version: 2.7.8
333
+ rubygems_version: 3.0.3
335
334
  signing_key:
336
335
  specification_version: 4
337
336
  summary: Scrivito Editors