scrivito_editors 1.10.0 → 1.11.0.rc1
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/app/assets/javascripts/scrivito_editors/medium_editor.js +22 -8
- data/vendor/assets/javascripts/medium-editor.js +73 -30
- metadata +6 -10
- data/app/assets/javascripts/scrivito_editors/controller_api/controller_content_proxy.js +0 -54
- data/app/assets/javascripts/scrivito_editors/controller_api/html_editor.js +0 -50
- data/app/assets/javascripts/scrivito_editors/controller_api/reference_editor.js +0 -66
- data/app/assets/javascripts/scrivito_editors/controller_api/string_editor.js +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c79b5a6725986a1b71d9ffa0e43e49600c699f
|
4
|
+
data.tar.gz: d6029ce733ed0b6608667aa8eb0417591aadd0ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2057de1a15aea733100af026ab0043c228a04ca9e1a227e310559b3c1a782e1c8451d372a2d0055036bc59f67f4d60ff75495c4b20fa563254705f84809811a2
|
7
|
+
data.tar.gz: 8cf0536e14483ba4704da98f9923e1f77e4dba2be51f1c36902b4af9e491e47584656b09fd367892cbd0ac6bb6db6364d0690bfe1956eabaea847cb91f745914
|
@@ -5,20 +5,33 @@
|
|
5
5
|
name: 'scrivito_anchor',
|
6
6
|
proxy: null,
|
7
7
|
contentDefault: '<i class="scrivito_customer_icon sci_link"></i>',
|
8
|
+
init: function() {
|
9
|
+
var ref;
|
10
|
+
MediumEditor.extensions.anchor.prototype.init.apply(this, arguments);
|
11
|
+
return this.targetCheckbox = (ref = this.getEditorOption('anchor')) != null ? ref.targetCheckbox : void 0;
|
12
|
+
},
|
8
13
|
handleClick: function(event) {
|
9
|
-
var
|
14
|
+
var linkElement, selectedParent, selectionRange;
|
15
|
+
event.preventDefault();
|
16
|
+
event.stopPropagation();
|
10
17
|
if (!this.isDisplayed()) {
|
11
18
|
selectionRange = MediumEditor.selection.getSelectionRange(this.document);
|
12
19
|
selectedParent = MediumEditor.selection.getSelectedParentElement(selectionRange);
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
linkElement = MediumEditor.util.getClosestTag(selectedParent, 'a');
|
21
|
+
this.showForm({
|
22
|
+
value: $(linkElement).attr('href') || null,
|
23
|
+
target: $(linkElement).attr('target') || null
|
24
|
+
});
|
17
25
|
}
|
18
26
|
return false;
|
19
27
|
},
|
20
28
|
getTemplate: function() {
|
21
|
-
|
29
|
+
var targetCheckboxTemplate;
|
30
|
+
targetCheckboxTemplate = "";
|
31
|
+
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>";
|
33
|
+
}
|
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, "");
|
22
35
|
},
|
23
36
|
attachFormEvents: function(form) {
|
24
37
|
var input;
|
@@ -79,10 +92,11 @@
|
|
79
92
|
};
|
80
93
|
|
81
94
|
customOptions = function() {
|
82
|
-
|
95
|
+
var ref, ref1, ref2, ref3;
|
96
|
+
if (typeof (typeof scrivito !== "undefined" && scrivito !== null ? (ref = scrivito.editors) != null ? (ref1 = ref.medium_editor) != null ? ref1.options : void 0 : void 0 : void 0) === 'function') {
|
83
97
|
return scrivito.editors.medium_editor.options();
|
84
98
|
} else {
|
85
|
-
return scrivito.editors.medium_editor.options;
|
99
|
+
return (typeof scrivito !== "undefined" && scrivito !== null ? (ref2 = scrivito.editors) != null ? (ref3 = ref2.medium_editor) != null ? ref3.options : void 0 : void 0 : void 0) || {};
|
86
100
|
}
|
87
101
|
};
|
88
102
|
|
@@ -629,11 +629,10 @@ MediumEditor.extensions = {};
|
|
629
629
|
splitEndNodeIfNeeded: function (currentNode, newNode, matchEndIndex, currentTextIndex) {
|
630
630
|
var textIndexOfEndOfFarthestNode,
|
631
631
|
endSplitPoint;
|
632
|
-
textIndexOfEndOfFarthestNode = currentTextIndex +
|
633
|
-
(newNode ?
|
634
|
-
|
635
|
-
|
636
|
-
(textIndexOfEndOfFarthestNode + 1 - matchEndIndex);
|
632
|
+
textIndexOfEndOfFarthestNode = currentTextIndex + currentNode.nodeValue.length +
|
633
|
+
(newNode ? newNode.nodeValue.length : 0) - 1;
|
634
|
+
endSplitPoint = matchEndIndex - currentTextIndex -
|
635
|
+
(newNode ? currentNode.nodeValue.length : 0);
|
637
636
|
if (textIndexOfEndOfFarthestNode >= matchEndIndex &&
|
638
637
|
currentTextIndex !== textIndexOfEndOfFarthestNode &&
|
639
638
|
endSplitPoint !== 0) {
|
@@ -1020,6 +1019,11 @@ MediumEditor.extensions = {};
|
|
1020
1019
|
}
|
1021
1020
|
},
|
1022
1021
|
|
1022
|
+
/*
|
1023
|
+
* this function adds one or several classes on an a element.
|
1024
|
+
* if el parameter is not an a, it will look for a children of el.
|
1025
|
+
* if no a children are found, it will look for the a parent.
|
1026
|
+
*/
|
1023
1027
|
addClassToAnchors: function (el, buttonClass) {
|
1024
1028
|
var classes = buttonClass.split(' '),
|
1025
1029
|
i,
|
@@ -1029,7 +1033,13 @@ MediumEditor.extensions = {};
|
|
1029
1033
|
el.classList.add(classes[j]);
|
1030
1034
|
}
|
1031
1035
|
} else {
|
1032
|
-
|
1036
|
+
var aChildren = el.getElementsByTagName('a');
|
1037
|
+
if (aChildren.length === 0) {
|
1038
|
+
var parentAnchor = Util.getClosestTag(el, 'a');
|
1039
|
+
el = parentAnchor ? [parentAnchor] : [];
|
1040
|
+
} else {
|
1041
|
+
el = aChildren;
|
1042
|
+
}
|
1033
1043
|
for (i = 0; i < el.length; i += 1) {
|
1034
1044
|
for (j = 0; j < classes.length; j += 1) {
|
1035
1045
|
el[i].classList.add(classes[j]);
|
@@ -2485,15 +2495,17 @@ MediumEditor.extensions = {};
|
|
2485
2495
|
win = this.base.options.contentWindow,
|
2486
2496
|
doc = this.base.options.ownerDocument;
|
2487
2497
|
|
2488
|
-
|
2498
|
+
if (targets !== null) {
|
2499
|
+
targets = MediumEditor.util.isElement(targets) || [win, doc].indexOf(targets) > -1 ? [targets] : targets;
|
2489
2500
|
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2501
|
+
Array.prototype.forEach.call(targets, function (target) {
|
2502
|
+
index = this.indexOfListener(target, event, listener, useCapture);
|
2503
|
+
if (index !== -1) {
|
2504
|
+
e = this.events.splice(index, 1)[0];
|
2505
|
+
e[0].removeEventListener(e[1], e[2], e[3]);
|
2506
|
+
}
|
2507
|
+
}.bind(this));
|
2508
|
+
}
|
2497
2509
|
},
|
2498
2510
|
|
2499
2511
|
indexOfListener: function (target, event, listener, useCapture) {
|
@@ -3350,6 +3362,14 @@ MediumEditor.extensions = {};
|
|
3350
3362
|
contentDefault: '<b>image</b>',
|
3351
3363
|
contentFA: '<i class="fa fa-picture-o"></i>'
|
3352
3364
|
},
|
3365
|
+
'html': {
|
3366
|
+
name: 'html',
|
3367
|
+
action: 'html',
|
3368
|
+
aria: 'evaluate html',
|
3369
|
+
tagNames: ['iframe', 'object'],
|
3370
|
+
contentDefault: '<b>html</b>',
|
3371
|
+
contentFA: '<i class="fa fa-code"></i>'
|
3372
|
+
},
|
3353
3373
|
'orderedlist': {
|
3354
3374
|
name: 'orderedlist',
|
3355
3375
|
action: 'insertorderedlist',
|
@@ -3511,6 +3531,7 @@ MediumEditor.extensions = {};
|
|
3511
3531
|
};
|
3512
3532
|
|
3513
3533
|
})();
|
3534
|
+
|
3514
3535
|
(function () {
|
3515
3536
|
'use strict';
|
3516
3537
|
|
@@ -3890,22 +3911,35 @@ MediumEditor.extensions = {};
|
|
3890
3911
|
// Matches common external protocols "mailto:" "tel:" "maps:"
|
3891
3912
|
// Matches relative hash link, begins with "#"
|
3892
3913
|
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#/i,
|
3914
|
+
hasScheme = urlSchemeRegex.test(value),
|
3915
|
+
scheme = '',
|
3893
3916
|
// telRegex is a regex for checking if the string is a telephone number
|
3894
3917
|
telRegex = /^\+?\s?\(?(?:\d\s?\-?\)?){3,20}$/,
|
3895
|
-
|
3896
|
-
path =
|
3897
|
-
query =
|
3918
|
+
urlParts = value.match(/^(.*?)(?:\?(.*?))?(?:#(.*))?$/),
|
3919
|
+
path = urlParts[1],
|
3920
|
+
query = urlParts[2],
|
3921
|
+
fragment = urlParts[3];
|
3898
3922
|
|
3899
3923
|
if (telRegex.test(value)) {
|
3900
3924
|
return 'tel:' + value;
|
3901
|
-
} else {
|
3902
|
-
// Check for URL scheme and default to http:// if none found
|
3903
|
-
return (urlSchemeRegex.test(value) ? '' : 'http://') +
|
3904
|
-
// Ensure path is encoded
|
3905
|
-
this.ensureEncodedUri(path) +
|
3906
|
-
// Ensure query is encoded
|
3907
|
-
(query === undefined ? '' : '?' + this.ensureEncodedQuery(query));
|
3908
3925
|
}
|
3926
|
+
|
3927
|
+
if (!hasScheme) {
|
3928
|
+
var host = path.split('/')[0];
|
3929
|
+
// if the host part of the path looks like a hostname
|
3930
|
+
if (host.match(/.+(\.|:).+/) || host === 'localhost') {
|
3931
|
+
scheme = 'http://';
|
3932
|
+
}
|
3933
|
+
}
|
3934
|
+
|
3935
|
+
return scheme +
|
3936
|
+
// Ensure path is encoded
|
3937
|
+
this.ensureEncodedUri(path) +
|
3938
|
+
// Ensure query is encoded
|
3939
|
+
(query === undefined ? '' : '?' + this.ensureEncodedQuery(query)) +
|
3940
|
+
// Include fragment unencoded as encodeUriComponent is too
|
3941
|
+
// heavy handed for the many characters allowed in a fragment
|
3942
|
+
(fragment === undefined ? '' : '#' + fragment);
|
3909
3943
|
},
|
3910
3944
|
|
3911
3945
|
doFormCancel: function () {
|
@@ -4067,7 +4101,9 @@ MediumEditor.extensions = {};
|
|
4067
4101
|
},
|
4068
4102
|
|
4069
4103
|
hidePreview: function () {
|
4070
|
-
this.anchorPreview
|
4104
|
+
if (this.anchorPreview) {
|
4105
|
+
this.anchorPreview.classList.remove('medium-editor-anchor-preview-active');
|
4106
|
+
}
|
4071
4107
|
this.activeAnchor = null;
|
4072
4108
|
},
|
4073
4109
|
|
@@ -4305,7 +4341,8 @@ MediumEditor.extensions = {};
|
|
4305
4341
|
var WHITESPACE_CHARS,
|
4306
4342
|
KNOWN_TLDS_FRAGMENT,
|
4307
4343
|
LINK_REGEXP_TEXT,
|
4308
|
-
KNOWN_TLDS_REGEXP
|
4344
|
+
KNOWN_TLDS_REGEXP,
|
4345
|
+
LINK_REGEXP;
|
4309
4346
|
|
4310
4347
|
WHITESPACE_CHARS = [' ', '\t', '\n', '\r', '\u00A0', '\u2000', '\u2001', '\u2002', '\u2003',
|
4311
4348
|
'\u2028', '\u2029'];
|
@@ -4327,6 +4364,8 @@ MediumEditor.extensions = {};
|
|
4327
4364
|
|
4328
4365
|
KNOWN_TLDS_REGEXP = new RegExp('^(' + KNOWN_TLDS_FRAGMENT + ')$', 'i');
|
4329
4366
|
|
4367
|
+
LINK_REGEXP = new RegExp(LINK_REGEXP_TEXT, 'gi');
|
4368
|
+
|
4330
4369
|
function nodeIsNotInsideAnchorTag(node) {
|
4331
4370
|
return !MediumEditor.util.getClosestTag(node, 'a');
|
4332
4371
|
}
|
@@ -4508,12 +4547,11 @@ MediumEditor.extensions = {};
|
|
4508
4547
|
},
|
4509
4548
|
|
4510
4549
|
findLinkableText: function (contenteditable) {
|
4511
|
-
var
|
4512
|
-
textContent = contenteditable.textContent,
|
4550
|
+
var textContent = contenteditable.textContent,
|
4513
4551
|
match = null,
|
4514
4552
|
matches = [];
|
4515
4553
|
|
4516
|
-
while ((match =
|
4554
|
+
while ((match = LINK_REGEXP.exec(textContent)) !== null) {
|
4517
4555
|
var matchOk = true,
|
4518
4556
|
matchEnd = match.index + match[0].length;
|
4519
4557
|
// If the regexp detected something as a link that has text immediately preceding/following it, bail out.
|
@@ -7111,6 +7149,11 @@ MediumEditor.extensions = {};
|
|
7111
7149
|
return this.options.ownerDocument.execCommand('insertImage', false, src);
|
7112
7150
|
}
|
7113
7151
|
|
7152
|
+
if (action === 'html') {
|
7153
|
+
var html = this.options.contentWindow.getSelection().toString().trim();
|
7154
|
+
return MediumEditor.util.insertHTMLCommand(this.options.ownerDocument, html);
|
7155
|
+
}
|
7156
|
+
|
7114
7157
|
/* Issue: https://github.com/yabwe/medium-editor/issues/595
|
7115
7158
|
* If the action is to justify the text */
|
7116
7159
|
if (justifyAction.exec(action)) {
|
@@ -7826,7 +7869,7 @@ MediumEditor.parseVersionString = function (release) {
|
|
7826
7869
|
|
7827
7870
|
MediumEditor.version = MediumEditor.parseVersionString.call(this, ({
|
7828
7871
|
// grunt-bump looks for this:
|
7829
|
-
'version': '5.
|
7872
|
+
'version': '5.23.0'
|
7830
7873
|
}).version);
|
7831
7874
|
|
7832
7875
|
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.
|
4
|
+
version: 1.11.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-
|
11
|
+
date: 2017-07-14 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.
|
53
|
+
version: 1.11.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.
|
60
|
+
version: 1.11.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.
|
67
|
+
version: 1.11.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.
|
74
|
+
version: 1.11.0.rc1
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: coffee-rails
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,10 +184,6 @@ files:
|
|
184
184
|
- app/assets/fonts/editing_icons-webfont.woff
|
185
185
|
- app/assets/javascripts/scrivito_editors.js
|
186
186
|
- app/assets/javascripts/scrivito_editors/binary_editor.js
|
187
|
-
- app/assets/javascripts/scrivito_editors/controller_api/controller_content_proxy.js
|
188
|
-
- app/assets/javascripts/scrivito_editors/controller_api/html_editor.js
|
189
|
-
- app/assets/javascripts/scrivito_editors/controller_api/reference_editor.js
|
190
|
-
- app/assets/javascripts/scrivito_editors/controller_api/string_editor.js
|
191
187
|
- app/assets/javascripts/scrivito_editors/date_editor.js
|
192
188
|
- app/assets/javascripts/scrivito_editors/default_editor.js
|
193
189
|
- app/assets/javascripts/scrivito_editors/dependencies/jquery_ui.js.erb
|
@@ -1,54 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
4
|
-
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
6
|
-
|
7
|
-
scrivito.editors.ControllerContentProxy = (function () {
|
8
|
-
function ControllerContentProxy(domNode, controller) {
|
9
|
-
_classCallCheck(this, ControllerContentProxy);
|
10
|
-
|
11
|
-
this.domNode = domNode;
|
12
|
-
this.controller = controller;
|
13
|
-
}
|
14
|
-
|
15
|
-
_createClass(ControllerContentProxy, [{
|
16
|
-
key: 'content',
|
17
|
-
value: function content() {
|
18
|
-
return this.controller.content;
|
19
|
-
}
|
20
|
-
}, {
|
21
|
-
key: 'idFromPath',
|
22
|
-
value: function idFromPath(path) {
|
23
|
-
if (path.match(/^objid:/)) {
|
24
|
-
return path.replace(/^objid:/, '');
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}, {
|
28
|
-
key: 'jQueryElement',
|
29
|
-
value: function jQueryElement() {
|
30
|
-
return $(this.domNode);
|
31
|
-
}
|
32
|
-
}, {
|
33
|
-
key: 'pathForId',
|
34
|
-
value: function pathForId(id) {
|
35
|
-
return 'objid:' + id;
|
36
|
-
}
|
37
|
-
}, {
|
38
|
-
key: 'save',
|
39
|
-
value: function save(content) {
|
40
|
-
this.controller.content = content;
|
41
|
-
var promise = { done: function done(callback) {
|
42
|
-
callback();return promise;
|
43
|
-
} };
|
44
|
-
return promise;
|
45
|
-
}
|
46
|
-
}, {
|
47
|
-
key: 'trigger',
|
48
|
-
value: function trigger(event) {
|
49
|
-
// ignore
|
50
|
-
}
|
51
|
-
}]);
|
52
|
-
|
53
|
-
return ControllerContentProxy;
|
54
|
-
})();
|
@@ -1,50 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
4
|
-
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
-
|
7
|
-
scrivito.editors.HtmlEditor = (function () {
|
8
|
-
_createClass(HtmlEditor, null, [{
|
9
|
-
key: "canEdit",
|
10
|
-
value: function canEdit(_ref) {
|
11
|
-
var type = _ref.type;
|
12
|
-
|
13
|
-
return type == "html";
|
14
|
-
}
|
15
|
-
}]);
|
16
|
-
|
17
|
-
function HtmlEditor(_ref2) {
|
18
|
-
var controller = _ref2.controller;
|
19
|
-
|
20
|
-
_classCallCheck(this, HtmlEditor);
|
21
|
-
|
22
|
-
this.controller = controller;
|
23
|
-
}
|
24
|
-
|
25
|
-
_createClass(HtmlEditor, [{
|
26
|
-
key: "editorWillBeActivated",
|
27
|
-
value: function editorWillBeActivated() {
|
28
|
-
this.controller.setDomMode('Replace');
|
29
|
-
}
|
30
|
-
}, {
|
31
|
-
key: "editorWillBeDeactivated",
|
32
|
-
value: function editorWillBeDeactivated() {
|
33
|
-
// empty
|
34
|
-
}
|
35
|
-
}, {
|
36
|
-
key: "editorDomWasMounted",
|
37
|
-
value: function editorDomWasMounted(domNode) {
|
38
|
-
scrivito.editors._applyPlaceholderToElement(domNode);
|
39
|
-
$(domNode).html(this.controller.content);
|
40
|
-
var editorProxy = new scrivito.editors.ControllerContentProxy(domNode, this.controller);
|
41
|
-
scrivito.editors.medium_editor._activateWithProxy(editorProxy);
|
42
|
-
}
|
43
|
-
}]);
|
44
|
-
|
45
|
-
return HtmlEditor;
|
46
|
-
})();
|
47
|
-
|
48
|
-
if (scrivito.registerEditor) {
|
49
|
-
scrivito.registerEditor(scrivito.editors.HtmlEditor);
|
50
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
4
|
-
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
-
|
7
|
-
scrivito.editors.ReferenceEditor = (function () {
|
8
|
-
_createClass(ReferenceEditor, null, [{
|
9
|
-
key: "canEdit",
|
10
|
-
value: function canEdit(_ref) {
|
11
|
-
var type = _ref.type;
|
12
|
-
|
13
|
-
return type == "reference";
|
14
|
-
}
|
15
|
-
}]);
|
16
|
-
|
17
|
-
function ReferenceEditor(_ref2) {
|
18
|
-
var controller = _ref2.controller;
|
19
|
-
|
20
|
-
_classCallCheck(this, ReferenceEditor);
|
21
|
-
|
22
|
-
this.controller = controller;
|
23
|
-
}
|
24
|
-
|
25
|
-
_createClass(ReferenceEditor, [{
|
26
|
-
key: "editorWillBeActivated",
|
27
|
-
value: function editorWillBeActivated() {
|
28
|
-
// empty
|
29
|
-
}
|
30
|
-
}, {
|
31
|
-
key: "editorWillBeDeactivated",
|
32
|
-
value: function editorWillBeDeactivated() {
|
33
|
-
// empty
|
34
|
-
}
|
35
|
-
}, {
|
36
|
-
key: "onClick",
|
37
|
-
value: function onClick(_ref3) {
|
38
|
-
var _this = this;
|
39
|
-
|
40
|
-
var event = _ref3.event;
|
41
|
-
|
42
|
-
scrivito.content_browser.open({
|
43
|
-
selection: this._currentSelection(),
|
44
|
-
selection_mode: 'single'
|
45
|
-
}).done(function (ids) {
|
46
|
-
return _this._saveContentBrowserSelection(ids);
|
47
|
-
});
|
48
|
-
}
|
49
|
-
}, {
|
50
|
-
key: "_currentSelection",
|
51
|
-
value: function _currentSelection() {
|
52
|
-
return this.controller.content ? [this.controller.content.id] : [];
|
53
|
-
}
|
54
|
-
}, {
|
55
|
-
key: "_saveContentBrowserSelection",
|
56
|
-
value: function _saveContentBrowserSelection(ids) {
|
57
|
-
this.controller.content = ids[0] || null;
|
58
|
-
}
|
59
|
-
}]);
|
60
|
-
|
61
|
-
return ReferenceEditor;
|
62
|
-
})();
|
63
|
-
|
64
|
-
if (scrivito.registerEditor) {
|
65
|
-
scrivito.registerEditor(scrivito.editors.ReferenceEditor);
|
66
|
-
}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
4
|
-
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
-
|
7
|
-
scrivito.editors.StringEditor = (function () {
|
8
|
-
_createClass(StringEditor, null, [{
|
9
|
-
key: "canEdit",
|
10
|
-
value: function canEdit(_ref) {
|
11
|
-
var type = _ref.type;
|
12
|
-
var tag = _ref.tag;
|
13
|
-
|
14
|
-
return type == "string";
|
15
|
-
}
|
16
|
-
}]);
|
17
|
-
|
18
|
-
function StringEditor(_ref2) {
|
19
|
-
var attributeInfo = _ref2.attributeInfo;
|
20
|
-
var controller = _ref2.controller;
|
21
|
-
|
22
|
-
_classCallCheck(this, StringEditor);
|
23
|
-
|
24
|
-
this.attributeInfo = attributeInfo;
|
25
|
-
this.controller = controller;
|
26
|
-
}
|
27
|
-
|
28
|
-
_createClass(StringEditor, [{
|
29
|
-
key: "editorWillBeActivated",
|
30
|
-
value: function editorWillBeActivated() {
|
31
|
-
this.controller.setDomMode('Replace');
|
32
|
-
}
|
33
|
-
}, {
|
34
|
-
key: "editorWillBeDeactivated",
|
35
|
-
value: function editorWillBeDeactivated() {}
|
36
|
-
}, {
|
37
|
-
key: "editorDomWasMounted",
|
38
|
-
value: function editorDomWasMounted(domNode) {
|
39
|
-
scrivito.editors._applyPlaceholderToElement(domNode);
|
40
|
-
$(domNode).text(this.controller.content);
|
41
|
-
var editorProxy = new scrivito.editors.ControllerContentProxy(domNode, this.controller);
|
42
|
-
scrivito.editors.string_editor._activateWithProxy(editorProxy);
|
43
|
-
}
|
44
|
-
}, {
|
45
|
-
key: "onClick",
|
46
|
-
value: function onClick() {}
|
47
|
-
}]);
|
48
|
-
|
49
|
-
return StringEditor;
|
50
|
-
})();
|
51
|
-
|
52
|
-
if (scrivito.registerEditor) {
|
53
|
-
scrivito.registerEditor(scrivito.editors.StringEditor);
|
54
|
-
}
|