@kubik-cms/wysiwyg 0.1.21 → 0.1.24
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.
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +8 -0
- package/README.md +13 -0
- package/dist/wysiwyg.es.js +445 -171
- package/dist/wysiwyg.umd.js +33 -26
- package/package.json +1 -2
package/dist/wysiwyg.es.js
CHANGED
|
@@ -5,6 +5,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { Controller } from "@hotwired/stimulus";
|
|
8
|
+
import Header from "@editorjs/header";
|
|
9
|
+
import NestedList from "@editorjs/nested-list";
|
|
10
|
+
import Underline from "@editorjs/underline";
|
|
11
|
+
import Embed from "@editorjs/embed";
|
|
12
|
+
import Paragraph from "@editorjs/paragraph";
|
|
13
|
+
import Quote from "@editorjs/quote";
|
|
14
|
+
import Hyperlink from "editorjs-hyperlink";
|
|
8
15
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
9
16
|
function getAugmentedNamespace(n) {
|
|
10
17
|
if (n.__esModule)
|
|
@@ -25,18 +32,18 @@ var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && common
|
|
|
25
32
|
var _freeGlobal = freeGlobal$1;
|
|
26
33
|
var freeGlobal = _freeGlobal;
|
|
27
34
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
28
|
-
var root$
|
|
29
|
-
var _root = root$
|
|
30
|
-
var root$
|
|
31
|
-
var Symbol$
|
|
32
|
-
var _Symbol = Symbol$
|
|
33
|
-
var Symbol$
|
|
34
|
-
var objectProto$
|
|
35
|
-
var hasOwnProperty$
|
|
36
|
-
var nativeObjectToString$1 = objectProto$
|
|
37
|
-
var symToStringTag$1 = Symbol$
|
|
35
|
+
var root$4 = freeGlobal || freeSelf || Function("return this")();
|
|
36
|
+
var _root = root$4;
|
|
37
|
+
var root$3 = _root;
|
|
38
|
+
var Symbol$4 = root$3.Symbol;
|
|
39
|
+
var _Symbol = Symbol$4;
|
|
40
|
+
var Symbol$3 = _Symbol;
|
|
41
|
+
var objectProto$5 = Object.prototype;
|
|
42
|
+
var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
|
|
43
|
+
var nativeObjectToString$1 = objectProto$5.toString;
|
|
44
|
+
var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
|
|
38
45
|
function getRawTag$1(value) {
|
|
39
|
-
var isOwn = hasOwnProperty$
|
|
46
|
+
var isOwn = hasOwnProperty$5.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
40
47
|
try {
|
|
41
48
|
value[symToStringTag$1] = void 0;
|
|
42
49
|
var unmasked = true;
|
|
@@ -53,39 +60,39 @@ function getRawTag$1(value) {
|
|
|
53
60
|
return result2;
|
|
54
61
|
}
|
|
55
62
|
var _getRawTag = getRawTag$1;
|
|
56
|
-
var objectProto$
|
|
57
|
-
var nativeObjectToString = objectProto$
|
|
63
|
+
var objectProto$4 = Object.prototype;
|
|
64
|
+
var nativeObjectToString = objectProto$4.toString;
|
|
58
65
|
function objectToString$1(value) {
|
|
59
66
|
return nativeObjectToString.call(value);
|
|
60
67
|
}
|
|
61
68
|
var _objectToString = objectToString$1;
|
|
62
|
-
var Symbol$
|
|
69
|
+
var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
63
70
|
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
64
|
-
var symToStringTag = Symbol$
|
|
65
|
-
function baseGetTag$
|
|
71
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
72
|
+
function baseGetTag$2(value) {
|
|
66
73
|
if (value == null) {
|
|
67
74
|
return value === void 0 ? undefinedTag : nullTag;
|
|
68
75
|
}
|
|
69
76
|
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
70
77
|
}
|
|
71
|
-
var _baseGetTag = baseGetTag$
|
|
78
|
+
var _baseGetTag = baseGetTag$2;
|
|
72
79
|
function isObject$6(value) {
|
|
73
80
|
var type = typeof value;
|
|
74
81
|
return value != null && (type == "object" || type == "function");
|
|
75
82
|
}
|
|
76
83
|
var isObject_1 = isObject$6;
|
|
77
|
-
var baseGetTag$
|
|
84
|
+
var baseGetTag$1 = _baseGetTag, isObject$5 = isObject_1;
|
|
78
85
|
var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
79
86
|
function isFunction$1(value) {
|
|
80
87
|
if (!isObject$5(value)) {
|
|
81
88
|
return false;
|
|
82
89
|
}
|
|
83
|
-
var tag = baseGetTag$
|
|
90
|
+
var tag = baseGetTag$1(value);
|
|
84
91
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
85
92
|
}
|
|
86
93
|
var isFunction_1 = isFunction$1;
|
|
87
|
-
var root$
|
|
88
|
-
var coreJsData$1 = root$
|
|
94
|
+
var root$2 = _root;
|
|
95
|
+
var coreJsData$1 = root$2["__core-js_shared__"];
|
|
89
96
|
var _coreJsData = coreJsData$1;
|
|
90
97
|
var coreJsData = _coreJsData;
|
|
91
98
|
var maskSrcKey = function() {
|
|
@@ -98,7 +105,7 @@ function isMasked$1(func) {
|
|
|
98
105
|
var _isMasked = isMasked$1;
|
|
99
106
|
var funcProto$1 = Function.prototype;
|
|
100
107
|
var funcToString$1 = funcProto$1.toString;
|
|
101
|
-
function toSource$
|
|
108
|
+
function toSource$1(func) {
|
|
102
109
|
if (func != null) {
|
|
103
110
|
try {
|
|
104
111
|
return funcToString$1.call(func);
|
|
@@ -111,22 +118,22 @@ function toSource$2(func) {
|
|
|
111
118
|
}
|
|
112
119
|
return "";
|
|
113
120
|
}
|
|
114
|
-
var _toSource = toSource$
|
|
115
|
-
var isFunction = isFunction_1, isMasked = _isMasked, isObject$4 = isObject_1, toSource
|
|
121
|
+
var _toSource = toSource$1;
|
|
122
|
+
var isFunction = isFunction_1, isMasked = _isMasked, isObject$4 = isObject_1, toSource = _toSource;
|
|
116
123
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
117
124
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
118
|
-
var funcProto = Function.prototype, objectProto$
|
|
125
|
+
var funcProto = Function.prototype, objectProto$3 = Object.prototype;
|
|
119
126
|
var funcToString = funcProto.toString;
|
|
120
|
-
var hasOwnProperty$
|
|
127
|
+
var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
|
|
121
128
|
var reIsNative = RegExp(
|
|
122
|
-
"^" + funcToString.call(hasOwnProperty$
|
|
129
|
+
"^" + funcToString.call(hasOwnProperty$4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
123
130
|
);
|
|
124
131
|
function baseIsNative$1(value) {
|
|
125
132
|
if (!isObject$4(value) || isMasked(value)) {
|
|
126
133
|
return false;
|
|
127
134
|
}
|
|
128
135
|
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
129
|
-
return pattern.test(toSource
|
|
136
|
+
return pattern.test(toSource(value));
|
|
130
137
|
}
|
|
131
138
|
var _baseIsNative = baseIsNative$1;
|
|
132
139
|
function getValue$1(object, key) {
|
|
@@ -134,15 +141,15 @@ function getValue$1(object, key) {
|
|
|
134
141
|
}
|
|
135
142
|
var _getValue = getValue$1;
|
|
136
143
|
var baseIsNative = _baseIsNative, getValue = _getValue;
|
|
137
|
-
function getNative$
|
|
144
|
+
function getNative$3(object, key) {
|
|
138
145
|
var value = getValue(object, key);
|
|
139
146
|
return baseIsNative(value) ? value : void 0;
|
|
140
147
|
}
|
|
141
|
-
var _getNative = getNative$
|
|
142
|
-
var getNative$
|
|
148
|
+
var _getNative = getNative$3;
|
|
149
|
+
var getNative$2 = _getNative;
|
|
143
150
|
var defineProperty$1 = function() {
|
|
144
151
|
try {
|
|
145
|
-
var func = getNative$
|
|
152
|
+
var func = getNative$2(Object, "defineProperty");
|
|
146
153
|
func({}, "", {});
|
|
147
154
|
return func;
|
|
148
155
|
} catch (e) {
|
|
@@ -168,25 +175,25 @@ function eq$2(value, other) {
|
|
|
168
175
|
}
|
|
169
176
|
var eq_1 = eq$2;
|
|
170
177
|
var baseAssignValue = _baseAssignValue, eq$1 = eq_1;
|
|
171
|
-
var objectProto$
|
|
172
|
-
var hasOwnProperty$
|
|
178
|
+
var objectProto$2 = Object.prototype;
|
|
179
|
+
var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
|
|
173
180
|
function assignValue$1(object, key, value) {
|
|
174
181
|
var objValue = object[key];
|
|
175
|
-
if (!(hasOwnProperty$
|
|
182
|
+
if (!(hasOwnProperty$3.call(object, key) && eq$1(objValue, value)) || value === void 0 && !(key in object)) {
|
|
176
183
|
baseAssignValue(object, key, value);
|
|
177
184
|
}
|
|
178
185
|
}
|
|
179
186
|
var _assignValue = assignValue$1;
|
|
180
187
|
var isArray$4 = Array.isArray;
|
|
181
188
|
var isArray_1 = isArray$4;
|
|
182
|
-
function isObjectLike$
|
|
189
|
+
function isObjectLike$1(value) {
|
|
183
190
|
return value != null && typeof value == "object";
|
|
184
191
|
}
|
|
185
|
-
var isObjectLike_1 = isObjectLike$
|
|
186
|
-
var baseGetTag
|
|
192
|
+
var isObjectLike_1 = isObjectLike$1;
|
|
193
|
+
var baseGetTag = _baseGetTag, isObjectLike = isObjectLike_1;
|
|
187
194
|
var symbolTag = "[object Symbol]";
|
|
188
195
|
function isSymbol$3(value) {
|
|
189
|
-
return typeof value == "symbol" || isObjectLike
|
|
196
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
190
197
|
}
|
|
191
198
|
var isSymbol_1 = isSymbol$3;
|
|
192
199
|
var isArray$3 = isArray_1, isSymbol$2 = isSymbol_1;
|
|
@@ -202,8 +209,8 @@ function isKey$1(value, object) {
|
|
|
202
209
|
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
203
210
|
}
|
|
204
211
|
var _isKey = isKey$1;
|
|
205
|
-
var getNative$
|
|
206
|
-
var nativeCreate$4 = getNative$
|
|
212
|
+
var getNative$1 = _getNative;
|
|
213
|
+
var nativeCreate$4 = getNative$1(Object, "create");
|
|
207
214
|
var _nativeCreate = nativeCreate$4;
|
|
208
215
|
var nativeCreate$3 = _nativeCreate;
|
|
209
216
|
function hashClear$1() {
|
|
@@ -219,23 +226,23 @@ function hashDelete$1(key) {
|
|
|
219
226
|
var _hashDelete = hashDelete$1;
|
|
220
227
|
var nativeCreate$2 = _nativeCreate;
|
|
221
228
|
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
222
|
-
var objectProto$
|
|
223
|
-
var hasOwnProperty$
|
|
229
|
+
var objectProto$1 = Object.prototype;
|
|
230
|
+
var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
|
|
224
231
|
function hashGet$1(key) {
|
|
225
232
|
var data = this.__data__;
|
|
226
233
|
if (nativeCreate$2) {
|
|
227
234
|
var result2 = data[key];
|
|
228
235
|
return result2 === HASH_UNDEFINED$1 ? void 0 : result2;
|
|
229
236
|
}
|
|
230
|
-
return hasOwnProperty$
|
|
237
|
+
return hasOwnProperty$2.call(data, key) ? data[key] : void 0;
|
|
231
238
|
}
|
|
232
239
|
var _hashGet = hashGet$1;
|
|
233
240
|
var nativeCreate$1 = _nativeCreate;
|
|
234
|
-
var objectProto
|
|
235
|
-
var hasOwnProperty$
|
|
241
|
+
var objectProto = Object.prototype;
|
|
242
|
+
var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
236
243
|
function hashHas$1(key) {
|
|
237
244
|
var data = this.__data__;
|
|
238
|
-
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$
|
|
245
|
+
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$1.call(data, key);
|
|
239
246
|
}
|
|
240
247
|
var _hashHas = hashHas$1;
|
|
241
248
|
var nativeCreate = _nativeCreate;
|
|
@@ -334,15 +341,15 @@ ListCache$1.prototype.get = listCacheGet;
|
|
|
334
341
|
ListCache$1.prototype.has = listCacheHas;
|
|
335
342
|
ListCache$1.prototype.set = listCacheSet;
|
|
336
343
|
var _ListCache = ListCache$1;
|
|
337
|
-
var getNative
|
|
338
|
-
var Map$
|
|
339
|
-
var _Map = Map$
|
|
340
|
-
var Hash = _Hash, ListCache = _ListCache, Map$
|
|
344
|
+
var getNative = _getNative, root$1 = _root;
|
|
345
|
+
var Map$2 = getNative(root$1, "Map");
|
|
346
|
+
var _Map = Map$2;
|
|
347
|
+
var Hash = _Hash, ListCache = _ListCache, Map$1 = _Map;
|
|
341
348
|
function mapCacheClear$1() {
|
|
342
349
|
this.size = 0;
|
|
343
350
|
this.__data__ = {
|
|
344
351
|
"hash": new Hash(),
|
|
345
|
-
"map": new (Map$
|
|
352
|
+
"map": new (Map$1 || ListCache)(),
|
|
346
353
|
"string": new Hash()
|
|
347
354
|
};
|
|
348
355
|
}
|
|
@@ -453,9 +460,9 @@ function arrayMap$1(array, iteratee) {
|
|
|
453
460
|
return result2;
|
|
454
461
|
}
|
|
455
462
|
var _arrayMap = arrayMap$1;
|
|
456
|
-
var Symbol$
|
|
463
|
+
var Symbol$1 = _Symbol, arrayMap = _arrayMap, isArray$2 = isArray_1, isSymbol$1 = isSymbol_1;
|
|
457
464
|
var INFINITY$1 = 1 / 0;
|
|
458
|
-
var symbolProto
|
|
465
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
459
466
|
function baseToString$1(value) {
|
|
460
467
|
if (typeof value == "string") {
|
|
461
468
|
return value;
|
|
@@ -547,99 +554,6 @@ function get(object, path, defaultValue) {
|
|
|
547
554
|
return result2 === void 0 ? defaultValue : result2;
|
|
548
555
|
}
|
|
549
556
|
var get_1 = get;
|
|
550
|
-
var root$5 = _root;
|
|
551
|
-
root$5.Uint8Array;
|
|
552
|
-
var Symbol$1 = _Symbol;
|
|
553
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
|
|
554
|
-
symbolProto ? symbolProto.valueOf : void 0;
|
|
555
|
-
var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
|
|
556
|
-
var argsTag = "[object Arguments]";
|
|
557
|
-
function baseIsArguments$1(value) {
|
|
558
|
-
return isObjectLike$1(value) && baseGetTag$1(value) == argsTag;
|
|
559
|
-
}
|
|
560
|
-
var _baseIsArguments = baseIsArguments$1;
|
|
561
|
-
var baseIsArguments = _baseIsArguments, isObjectLike = isObjectLike_1;
|
|
562
|
-
var objectProto = Object.prototype;
|
|
563
|
-
var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
564
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
565
|
-
baseIsArguments(function() {
|
|
566
|
-
return arguments;
|
|
567
|
-
}()) ? baseIsArguments : function(value) {
|
|
568
|
-
return isObjectLike(value) && hasOwnProperty$1.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
569
|
-
};
|
|
570
|
-
var isBuffer = { exports: {} };
|
|
571
|
-
function stubFalse() {
|
|
572
|
-
return false;
|
|
573
|
-
}
|
|
574
|
-
var stubFalse_1 = stubFalse;
|
|
575
|
-
(function(module, exports) {
|
|
576
|
-
var root2 = _root, stubFalse2 = stubFalse_1;
|
|
577
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
578
|
-
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
579
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
580
|
-
var Buffer2 = moduleExports ? root2.Buffer : void 0;
|
|
581
|
-
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
|
582
|
-
var isBuffer2 = nativeIsBuffer || stubFalse2;
|
|
583
|
-
module.exports = isBuffer2;
|
|
584
|
-
})(isBuffer, isBuffer.exports);
|
|
585
|
-
var _nodeUtil = { exports: {} };
|
|
586
|
-
(function(module, exports) {
|
|
587
|
-
var freeGlobal2 = _freeGlobal;
|
|
588
|
-
var freeExports = exports && !exports.nodeType && exports;
|
|
589
|
-
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
590
|
-
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
591
|
-
var freeProcess = moduleExports && freeGlobal2.process;
|
|
592
|
-
var nodeUtil2 = function() {
|
|
593
|
-
try {
|
|
594
|
-
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
595
|
-
if (types) {
|
|
596
|
-
return types;
|
|
597
|
-
}
|
|
598
|
-
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
599
|
-
} catch (e) {
|
|
600
|
-
}
|
|
601
|
-
}();
|
|
602
|
-
module.exports = nodeUtil2;
|
|
603
|
-
})(_nodeUtil, _nodeUtil.exports);
|
|
604
|
-
var nodeUtil = _nodeUtil.exports;
|
|
605
|
-
nodeUtil && nodeUtil.isTypedArray;
|
|
606
|
-
var getNative$3 = _getNative, root$4 = _root;
|
|
607
|
-
var DataView$1 = getNative$3(root$4, "DataView");
|
|
608
|
-
var _DataView = DataView$1;
|
|
609
|
-
var getNative$2 = _getNative, root$3 = _root;
|
|
610
|
-
var Promise$2 = getNative$2(root$3, "Promise");
|
|
611
|
-
var _Promise = Promise$2;
|
|
612
|
-
var getNative$1 = _getNative, root$2 = _root;
|
|
613
|
-
var Set$2 = getNative$1(root$2, "Set");
|
|
614
|
-
var _Set = Set$2;
|
|
615
|
-
var getNative = _getNative, root$1 = _root;
|
|
616
|
-
var WeakMap$1 = getNative(root$1, "WeakMap");
|
|
617
|
-
var _WeakMap = WeakMap$1;
|
|
618
|
-
var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
|
|
619
|
-
var mapTag = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
620
|
-
var dataViewTag = "[object DataView]";
|
|
621
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
622
|
-
var getTag = baseGetTag;
|
|
623
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag(new Map$1()) != mapTag || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
624
|
-
getTag = function(value) {
|
|
625
|
-
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
626
|
-
if (ctorString) {
|
|
627
|
-
switch (ctorString) {
|
|
628
|
-
case dataViewCtorString:
|
|
629
|
-
return dataViewTag;
|
|
630
|
-
case mapCtorString:
|
|
631
|
-
return mapTag;
|
|
632
|
-
case promiseCtorString:
|
|
633
|
-
return promiseTag;
|
|
634
|
-
case setCtorString:
|
|
635
|
-
return setTag;
|
|
636
|
-
case weakMapCtorString:
|
|
637
|
-
return weakMapTag;
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
return result2;
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
557
|
const isDate = (d) => d instanceof Date;
|
|
644
558
|
const isEmpty = (o) => Object.keys(o).length === 0;
|
|
645
559
|
const isObject$2 = (o) => o != null && typeof o === "object";
|
|
@@ -9003,17 +8917,104 @@ function array_move(arr, old_index, new_index) {
|
|
|
9003
8917
|
arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
|
|
9004
8918
|
return arr;
|
|
9005
8919
|
}
|
|
8920
|
+
function uiPatch(data, patch) {
|
|
8921
|
+
const ui = Object.assign({}, data._ui || {}, patch);
|
|
8922
|
+
return Object.assign({}, data, { _ui: ui });
|
|
8923
|
+
}
|
|
8924
|
+
function parseAdditionalInformation(payload) {
|
|
8925
|
+
var _a;
|
|
8926
|
+
const raw = (_a = payload == null ? void 0 : payload.additional_information) != null ? _a : payload == null ? void 0 : payload.additional_info;
|
|
8927
|
+
if (raw == null || raw === "")
|
|
8928
|
+
return null;
|
|
8929
|
+
if (typeof raw === "object")
|
|
8930
|
+
return raw;
|
|
8931
|
+
try {
|
|
8932
|
+
return JSON.parse(raw);
|
|
8933
|
+
} catch {
|
|
8934
|
+
return null;
|
|
8935
|
+
}
|
|
8936
|
+
}
|
|
8937
|
+
function itemPathForResourceId(idPath) {
|
|
8938
|
+
const withoutId = idPath.replace(/\.id$/, "");
|
|
8939
|
+
const lastDot = withoutId.lastIndexOf(".");
|
|
8940
|
+
if (lastDot === -1)
|
|
8941
|
+
return withoutId;
|
|
8942
|
+
return withoutId.substring(0, lastDot);
|
|
8943
|
+
}
|
|
8944
|
+
function applyMediaMetadataFromGallery(data, resourceIdPath, payload) {
|
|
8945
|
+
var _a, _b;
|
|
8946
|
+
const info = parseAdditionalInformation(payload);
|
|
8947
|
+
if (!info)
|
|
8948
|
+
return data;
|
|
8949
|
+
const itemPath = itemPathForResourceId(resourceIdPath);
|
|
8950
|
+
const mappings = [
|
|
8951
|
+
["alt_text", info.alt_text],
|
|
8952
|
+
["caption", (_a = info.img_title) != null ? _a : info.caption],
|
|
8953
|
+
["credit", (_b = info.img_credit) != null ? _b : info.credit]
|
|
8954
|
+
];
|
|
8955
|
+
let result2 = data;
|
|
8956
|
+
mappings.forEach(([field, value]) => {
|
|
8957
|
+
if (value == null || String(value).trim() === "")
|
|
8958
|
+
return;
|
|
8959
|
+
result2 = set_1(result2, `${itemPath}.${field}`, String(value).trim());
|
|
8960
|
+
});
|
|
8961
|
+
return result2;
|
|
8962
|
+
}
|
|
9006
8963
|
class KubikWidgetController extends Controller {
|
|
9007
8964
|
connect() {
|
|
8965
|
+
this.syncExpandedFromData();
|
|
9008
8966
|
this.getNewWidget();
|
|
9009
|
-
console.log("connected widget");
|
|
9010
8967
|
const element = this.element;
|
|
8968
|
+
if (this.expandedValue) {
|
|
8969
|
+
element.classList.add(this.expandedClass);
|
|
8970
|
+
} else {
|
|
8971
|
+
element.classList.remove(this.expandedClass);
|
|
8972
|
+
}
|
|
9011
8973
|
element.addEventListener("keydown", this.handleKeyDown.bind(this));
|
|
9012
8974
|
element.addEventListener("paste", this.handlePaste.bind(this));
|
|
9013
8975
|
}
|
|
8976
|
+
syncExpandedFromData() {
|
|
8977
|
+
const ui = this.dataValue._ui || {};
|
|
8978
|
+
if (typeof ui.expanded === "boolean") {
|
|
8979
|
+
this.expandedValue = ui.expanded;
|
|
8980
|
+
} else if (typeof this.dataValue.expanded === "boolean") {
|
|
8981
|
+
this.expandedValue = this.dataValue.expanded;
|
|
8982
|
+
}
|
|
8983
|
+
}
|
|
8984
|
+
toggleExpanded() {
|
|
8985
|
+
this.expandedValue = !this.expandedValue;
|
|
8986
|
+
if (this.hasExpandedInputTarget) {
|
|
8987
|
+
this.expandedInputTarget.value = this.expandedValue;
|
|
8988
|
+
}
|
|
8989
|
+
this.dataValue = uiPatch(this.dataValue, { expanded: this.expandedValue });
|
|
8990
|
+
}
|
|
8991
|
+
setActiveTab(event) {
|
|
8992
|
+
const tab = event.currentTarget.value;
|
|
8993
|
+
this.dataValue = uiPatch(this.dataValue, { active_tab: tab });
|
|
8994
|
+
}
|
|
8995
|
+
repeaterToggle(event) {
|
|
8996
|
+
var _a;
|
|
8997
|
+
const { tab, index: index2, expanded } = event.detail;
|
|
8998
|
+
if (tab == null || index2 == null)
|
|
8999
|
+
return;
|
|
9000
|
+
const items = [...((_a = this.dataValue[tab]) == null ? void 0 : _a.repeated_items) || []];
|
|
9001
|
+
if (!items[index2])
|
|
9002
|
+
return;
|
|
9003
|
+
items[index2] = Object.assign({}, items[index2], {
|
|
9004
|
+
_ui: Object.assign({}, items[index2]._ui || {}, { expanded })
|
|
9005
|
+
});
|
|
9006
|
+
const tabData = Object.assign({}, this.dataValue[tab], { repeated_items: items });
|
|
9007
|
+
this.dataValue = Object.assign({}, this.dataValue, { [tab]: tabData });
|
|
9008
|
+
}
|
|
9009
|
+
expandedValueChanged() {
|
|
9010
|
+
if (this.expandedValue) {
|
|
9011
|
+
this.element.classList.add(this.expandedClass);
|
|
9012
|
+
} else {
|
|
9013
|
+
this.element.classList.remove(this.expandedClass);
|
|
9014
|
+
}
|
|
9015
|
+
}
|
|
9014
9016
|
handleKeyDown(event) {
|
|
9015
9017
|
const element = this.element;
|
|
9016
|
-
console.log(event.key);
|
|
9017
9018
|
if (element.contains(document.activeElement) && (event.key === "Tab" || event.key === "Enter")) {
|
|
9018
9019
|
event.stopPropagation();
|
|
9019
9020
|
}
|
|
@@ -9070,10 +9071,18 @@ class KubikWidgetController extends Controller {
|
|
|
9070
9071
|
this.getNewWidget();
|
|
9071
9072
|
}
|
|
9072
9073
|
dataValueChanged(value, previousValue) {
|
|
9073
|
-
|
|
9074
|
+
if (!previousValue || !value)
|
|
9075
|
+
return;
|
|
9076
|
+
const diff = updatedDiff(previousValue, value);
|
|
9074
9077
|
const changedKeys = deepKeys_1(diff);
|
|
9078
|
+
if (changedKeys.length === 0)
|
|
9079
|
+
return;
|
|
9080
|
+
if (changedKeys.every((key) => key === "_ui" || key.startsWith("_ui."))) {
|
|
9081
|
+
return;
|
|
9082
|
+
}
|
|
9075
9083
|
const addedItem = diff["items"] && diff["items"]["repeated_items"] && JSON.stringify(Object.values(diff["items"]["repeated_items"])[0]) === JSON.stringify({});
|
|
9076
|
-
|
|
9084
|
+
const resourceIdChange = changedKeys.some((key) => key.match(/(^|\.)id$/));
|
|
9085
|
+
if (addedItem || resourceIdChange) {
|
|
9077
9086
|
this.getNewWidget();
|
|
9078
9087
|
}
|
|
9079
9088
|
}
|
|
@@ -9092,11 +9101,6 @@ class KubikWidgetController extends Controller {
|
|
|
9092
9101
|
if (event.currentTarget.dataset.checkbox === "true" && event.currentTarget.type === "checkbox") {
|
|
9093
9102
|
v = Array.from(event.currentTarget.parentElement.parentElement.querySelectorAll(`[name="${event.currentTarget.name}"]`)).map((el) => el.checked ? el.value : null).filter((el) => el !== null);
|
|
9094
9103
|
}
|
|
9095
|
-
if (event.currentTarget.dataset.repeatedKeyValue === "true") {
|
|
9096
|
-
const [field, idx, ...rest] = event.currentTarget.name.split(".").reverse();
|
|
9097
|
-
const fieldName = [rest.reverse().join("."), idx.toString(), field].join(".");
|
|
9098
|
-
get_1(this.dataValue, fieldName, "");
|
|
9099
|
-
}
|
|
9100
9104
|
if (event.currentTarget.dataset.repeated === "true") {
|
|
9101
9105
|
event.currentTarget.dataset.index;
|
|
9102
9106
|
const [field, index2, ...rest] = event.currentTarget.name.split(".").reverse();
|
|
@@ -9127,15 +9131,22 @@ class KubikWidgetController extends Controller {
|
|
|
9127
9131
|
}
|
|
9128
9132
|
receiveModalReturn(return_value) {
|
|
9129
9133
|
const returnObject = return_value;
|
|
9130
|
-
const
|
|
9134
|
+
const fieldPath = returnObject["return_payload"]["field_name"];
|
|
9135
|
+
let duplicateData = set_1(this.dataValue, fieldPath, returnObject["payload"]["id"]);
|
|
9136
|
+
duplicateData = applyMediaMetadataFromGallery(
|
|
9137
|
+
duplicateData,
|
|
9138
|
+
fieldPath,
|
|
9139
|
+
returnObject["payload"]
|
|
9140
|
+
);
|
|
9131
9141
|
this.dataValue = duplicateData;
|
|
9132
9142
|
this.getNewWidget();
|
|
9133
9143
|
}
|
|
9134
9144
|
getNewWidget() {
|
|
9135
|
-
fetch(`${this.setupValue["src"]}
|
|
9145
|
+
fetch(`${this.setupValue["src"]}`, {
|
|
9136
9146
|
method: "POST",
|
|
9137
9147
|
headers: {
|
|
9138
9148
|
"Content-Type": "application/json",
|
|
9149
|
+
"Accept": "text/vnd.turbo-stream.html",
|
|
9139
9150
|
"X-CSRF-Token": getMetaValue("csrf-token")
|
|
9140
9151
|
},
|
|
9141
9152
|
body: JSON.stringify({
|
|
@@ -9144,9 +9155,14 @@ class KubikWidgetController extends Controller {
|
|
|
9144
9155
|
setup: this.setupValue,
|
|
9145
9156
|
max_items: this.maxItemsValue
|
|
9146
9157
|
})
|
|
9147
|
-
}).then((response) => response.
|
|
9148
|
-
|
|
9149
|
-
|
|
9158
|
+
}).then((response) => response.text()).then((html) => {
|
|
9159
|
+
Turbo.renderStreamMessage(html);
|
|
9160
|
+
this.syncExpandedFromData();
|
|
9161
|
+
if (this.expandedValue) {
|
|
9162
|
+
this.element.classList.add(this.expandedClass);
|
|
9163
|
+
} else {
|
|
9164
|
+
this.element.classList.remove(this.expandedClass);
|
|
9165
|
+
}
|
|
9150
9166
|
});
|
|
9151
9167
|
}
|
|
9152
9168
|
}
|
|
@@ -9154,30 +9170,49 @@ __publicField(KubikWidgetController, "values", {
|
|
|
9154
9170
|
widgetId: String,
|
|
9155
9171
|
setup: Object,
|
|
9156
9172
|
data: Object,
|
|
9157
|
-
maxItems: { type: Number, default: 0 }
|
|
9173
|
+
maxItems: { type: Number, default: 0 },
|
|
9174
|
+
expanded: { type: Boolean, default: false }
|
|
9158
9175
|
});
|
|
9176
|
+
__publicField(KubikWidgetController, "targets", ["expandedInput"]);
|
|
9177
|
+
__publicField(KubikWidgetController, "classes", ["expanded"]);
|
|
9159
9178
|
class KubikRepeaterController extends Controller {
|
|
9160
9179
|
connect() {
|
|
9180
|
+
if (this.expandedValue) {
|
|
9181
|
+
this.element.classList.add(this.expandedClass);
|
|
9182
|
+
}
|
|
9161
9183
|
}
|
|
9162
9184
|
updateHeader(event) {
|
|
9163
9185
|
this.headerTarget.innerHTML = event.currentTarget.value;
|
|
9164
9186
|
}
|
|
9165
9187
|
toggleItem(event) {
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
} else {
|
|
9188
|
+
const expanded = !this.element.classList.contains(this.expandedClass);
|
|
9189
|
+
if (expanded) {
|
|
9169
9190
|
this.element.classList.add(this.expandedClass);
|
|
9191
|
+
} else {
|
|
9192
|
+
this.element.classList.remove(this.expandedClass);
|
|
9170
9193
|
}
|
|
9194
|
+
this.dispatch("toggle", {
|
|
9195
|
+
prefix: "",
|
|
9196
|
+
detail: {
|
|
9197
|
+
tab: this.tabValue,
|
|
9198
|
+
index: this.indexValue,
|
|
9199
|
+
expanded
|
|
9200
|
+
}
|
|
9201
|
+
});
|
|
9171
9202
|
}
|
|
9172
9203
|
}
|
|
9173
9204
|
__publicField(KubikRepeaterController, "targets", ["header"]);
|
|
9174
9205
|
__publicField(KubikRepeaterController, "classes", ["expanded"]);
|
|
9206
|
+
__publicField(KubikRepeaterController, "values", {
|
|
9207
|
+
tab: String,
|
|
9208
|
+
index: Number,
|
|
9209
|
+
expanded: { type: Boolean, default: false }
|
|
9210
|
+
});
|
|
9175
9211
|
class KubikKeyValueRepeaterController extends Controller {
|
|
9176
9212
|
connect() {
|
|
9177
9213
|
this.renderFields();
|
|
9178
9214
|
}
|
|
9179
9215
|
dataValueChanged() {
|
|
9180
|
-
console.log("dataValueChanged", this.dataValue);
|
|
9181
9216
|
this.dispatch("updateData", {
|
|
9182
9217
|
detail: {
|
|
9183
9218
|
fieldName: this.fieldNameValue,
|
|
@@ -9443,28 +9478,44 @@ __publicField(KubikAutocompleteController, "values", {
|
|
|
9443
9478
|
results: { type: Array, default: [] },
|
|
9444
9479
|
resultActive: Number
|
|
9445
9480
|
});
|
|
9481
|
+
function widgetExpanded(data) {
|
|
9482
|
+
if (!data || typeof data !== "object")
|
|
9483
|
+
return false;
|
|
9484
|
+
if (data._ui && typeof data._ui.expanded === "boolean")
|
|
9485
|
+
return data._ui.expanded;
|
|
9486
|
+
return !!data.expanded;
|
|
9487
|
+
}
|
|
9446
9488
|
const widgetWrapper = function widgetWrapper2(details = {}, data) {
|
|
9447
9489
|
let wrapperAttributes = {
|
|
9448
9490
|
"data-controller": "kubik-widget",
|
|
9491
|
+
"data-kubik-widget-expanded-class": "kubik-widget__expanded",
|
|
9492
|
+
"data-kubik-widget-expanded-value": JSON.stringify(widgetExpanded(data)),
|
|
9449
9493
|
"data-kubik-widget-setup-value": JSON.stringify(details.setup),
|
|
9450
9494
|
"data-kubik-widget-data-value": JSON.stringify(data),
|
|
9451
9495
|
"data-kubik-widget-widget-id-value": details.setup.widget_id,
|
|
9452
9496
|
"data-kubik-widget-widget-icon": details.setup.config.icon,
|
|
9497
|
+
"refresh": "morph",
|
|
9453
9498
|
id: details.setup.widget_id
|
|
9454
9499
|
};
|
|
9455
9500
|
if (details.items_limit) {
|
|
9456
9501
|
wrapperAttributes["data-kubik-widget-items-max-items-value"] = details.items_limit;
|
|
9457
9502
|
}
|
|
9458
9503
|
const wrapper = makeElement(
|
|
9459
|
-
"
|
|
9504
|
+
"turbo-frame",
|
|
9460
9505
|
[
|
|
9461
9506
|
"kubik_media_wrapper",
|
|
9462
|
-
"kubik-wysiwyg-component"
|
|
9507
|
+
"kubik-wysiwyg-component",
|
|
9508
|
+
details.setup.widget_class
|
|
9463
9509
|
],
|
|
9464
9510
|
wrapperAttributes
|
|
9465
9511
|
);
|
|
9466
9512
|
return wrapper;
|
|
9467
9513
|
};
|
|
9514
|
+
function uiFromData(data) {
|
|
9515
|
+
if (!data || typeof data !== "object")
|
|
9516
|
+
return {};
|
|
9517
|
+
return data._ui && typeof data._ui === "object" ? data._ui : {};
|
|
9518
|
+
}
|
|
9468
9519
|
class PluginFactory {
|
|
9469
9520
|
static get defaultWidgetConfig() {
|
|
9470
9521
|
return {
|
|
@@ -9472,7 +9523,7 @@ class PluginFactory {
|
|
|
9472
9523
|
};
|
|
9473
9524
|
}
|
|
9474
9525
|
constructor({ data, api }) {
|
|
9475
|
-
this.data = data;
|
|
9526
|
+
this.data = data || {};
|
|
9476
9527
|
this.api = api;
|
|
9477
9528
|
this.randomString = Math.random().toString(36).substring(2, 7);
|
|
9478
9529
|
this.label = this.constructor.toolbox.title;
|
|
@@ -9482,9 +9533,16 @@ class PluginFactory {
|
|
|
9482
9533
|
defaultConfig,
|
|
9483
9534
|
localConfig
|
|
9484
9535
|
);
|
|
9536
|
+
const ui = uiFromData(this.data);
|
|
9537
|
+
if (this.data.expanded !== void 0 && ui.expanded === void 0) {
|
|
9538
|
+
this.data = Object.assign({}, this.data, {
|
|
9539
|
+
_ui: Object.assign({}, ui, { expanded: this.data.expanded })
|
|
9540
|
+
});
|
|
9541
|
+
}
|
|
9485
9542
|
}
|
|
9486
9543
|
render() {
|
|
9487
9544
|
const widgetId = [this.config.widget_name, this.randomString].join("-");
|
|
9545
|
+
const widgetClass = `widget_${this.api.ui.nodes.wrapper.parentElement.dataset.editorId}`;
|
|
9488
9546
|
const wrapper = widgetWrapper({
|
|
9489
9547
|
setup: {
|
|
9490
9548
|
label: this.label,
|
|
@@ -9492,6 +9550,7 @@ class PluginFactory {
|
|
|
9492
9550
|
src: this.config.data_src,
|
|
9493
9551
|
widget_id: widgetId,
|
|
9494
9552
|
widget_type: this.config.widget_name,
|
|
9553
|
+
widget_class: widgetClass,
|
|
9495
9554
|
config: this.config
|
|
9496
9555
|
}
|
|
9497
9556
|
}, this.data);
|
|
@@ -9503,17 +9562,232 @@ class PluginFactory {
|
|
|
9503
9562
|
this.config.tabs.forEach((tab) => {
|
|
9504
9563
|
widgetData[tab["name"]] = data[tab["name"]];
|
|
9505
9564
|
});
|
|
9565
|
+
if (data._ui) {
|
|
9566
|
+
widgetData._ui = data._ui;
|
|
9567
|
+
} else if (data.expanded !== void 0) {
|
|
9568
|
+
widgetData._ui = { expanded: data.expanded };
|
|
9569
|
+
}
|
|
9506
9570
|
return widgetData;
|
|
9507
9571
|
}
|
|
9508
9572
|
validate(savedData) {
|
|
9509
9573
|
return true;
|
|
9510
9574
|
}
|
|
9511
9575
|
}
|
|
9576
|
+
function defineBlock({ toolbox, sanitize = {}, widgetConfig }) {
|
|
9577
|
+
if (!toolbox || !widgetConfig) {
|
|
9578
|
+
throw new Error("defineBlock requires toolbox and widgetConfig");
|
|
9579
|
+
}
|
|
9580
|
+
return class extends PluginFactory {
|
|
9581
|
+
static get toolbox() {
|
|
9582
|
+
return toolbox;
|
|
9583
|
+
}
|
|
9584
|
+
static get sanitize() {
|
|
9585
|
+
return sanitize;
|
|
9586
|
+
}
|
|
9587
|
+
static get widgetConfig() {
|
|
9588
|
+
return widgetConfig;
|
|
9589
|
+
}
|
|
9590
|
+
};
|
|
9591
|
+
}
|
|
9592
|
+
function contentTab(fields = []) {
|
|
9593
|
+
return {
|
|
9594
|
+
name: "content",
|
|
9595
|
+
label: "Content",
|
|
9596
|
+
fields: [
|
|
9597
|
+
{ name: "title", label: "Title", type: "text" },
|
|
9598
|
+
{ name: "intro", label: "Intro", type: "textarea" },
|
|
9599
|
+
{ name: "link", label: "Link", type: "text" },
|
|
9600
|
+
{ name: "link_text", label: "Link text", type: "text" },
|
|
9601
|
+
...fields
|
|
9602
|
+
]
|
|
9603
|
+
};
|
|
9604
|
+
}
|
|
9605
|
+
function settingsTab({ layouts = [], extras = [] } = {}) {
|
|
9606
|
+
const fields = [];
|
|
9607
|
+
if (layouts.length > 0) {
|
|
9608
|
+
fields.push({
|
|
9609
|
+
name: "layout",
|
|
9610
|
+
label: "Layout",
|
|
9611
|
+
type: "select",
|
|
9612
|
+
options: layouts
|
|
9613
|
+
});
|
|
9614
|
+
}
|
|
9615
|
+
fields.push(
|
|
9616
|
+
{ name: "additional_classes", type: "text", label: "Additional classes" },
|
|
9617
|
+
{ name: "element_id", type: "text", label: "Element ID" },
|
|
9618
|
+
...extras
|
|
9619
|
+
);
|
|
9620
|
+
return { name: "settings", label: "Settings", fields };
|
|
9621
|
+
}
|
|
9622
|
+
function standardSettingsExtras() {
|
|
9623
|
+
return [
|
|
9624
|
+
{
|
|
9625
|
+
name: "image_loading",
|
|
9626
|
+
label: "Image loading",
|
|
9627
|
+
type: "select",
|
|
9628
|
+
options: [
|
|
9629
|
+
{ value: "lazy", label: "Lazy" },
|
|
9630
|
+
{ value: "eager", label: "Eager (above the fold)" }
|
|
9631
|
+
]
|
|
9632
|
+
},
|
|
9633
|
+
{
|
|
9634
|
+
name: "data_attributes",
|
|
9635
|
+
label: "Data attributes",
|
|
9636
|
+
type: "key_value_repeater",
|
|
9637
|
+
prefix: "data",
|
|
9638
|
+
fields: ["key", "value"]
|
|
9639
|
+
}
|
|
9640
|
+
];
|
|
9641
|
+
}
|
|
9642
|
+
function thumbAndFieldsSections() {
|
|
9643
|
+
return [
|
|
9644
|
+
{ name: "thumb", classes: "thumb" },
|
|
9645
|
+
{ name: "fields", classes: "fields" }
|
|
9646
|
+
];
|
|
9647
|
+
}
|
|
9648
|
+
function manualItemsTab({
|
|
9649
|
+
name = "items",
|
|
9650
|
+
label = "Items",
|
|
9651
|
+
itemFields,
|
|
9652
|
+
addLabel = "Add item",
|
|
9653
|
+
summary = "title",
|
|
9654
|
+
sections = thumbAndFieldsSections()
|
|
9655
|
+
}) {
|
|
9656
|
+
return {
|
|
9657
|
+
name,
|
|
9658
|
+
label,
|
|
9659
|
+
sections,
|
|
9660
|
+
fields: itemFields,
|
|
9661
|
+
repeated: true,
|
|
9662
|
+
repeater_settings: {
|
|
9663
|
+
add_label: addLabel,
|
|
9664
|
+
summary
|
|
9665
|
+
}
|
|
9666
|
+
};
|
|
9667
|
+
}
|
|
9668
|
+
function resourceListSettingsTab({
|
|
9669
|
+
filterField = "filter",
|
|
9670
|
+
filterLabel = "Filter",
|
|
9671
|
+
filterOptions = [],
|
|
9672
|
+
layouts = [],
|
|
9673
|
+
extras = []
|
|
9674
|
+
}) {
|
|
9675
|
+
const fields = [];
|
|
9676
|
+
if (filterOptions.length > 0) {
|
|
9677
|
+
fields.push({
|
|
9678
|
+
name: filterField,
|
|
9679
|
+
label: filterLabel,
|
|
9680
|
+
type: "select",
|
|
9681
|
+
options: filterOptions
|
|
9682
|
+
});
|
|
9683
|
+
}
|
|
9684
|
+
if (layouts.length > 0) {
|
|
9685
|
+
fields.push({
|
|
9686
|
+
name: "layout",
|
|
9687
|
+
label: "Layout",
|
|
9688
|
+
type: "select",
|
|
9689
|
+
options: layouts
|
|
9690
|
+
});
|
|
9691
|
+
}
|
|
9692
|
+
fields.push(
|
|
9693
|
+
{ name: "additional_classes", type: "text", label: "Additional classes" },
|
|
9694
|
+
{ name: "element_id", type: "text", label: "Element ID" },
|
|
9695
|
+
...extras
|
|
9696
|
+
);
|
|
9697
|
+
return { name: "settings", label: "Settings", fields };
|
|
9698
|
+
}
|
|
9699
|
+
const presets = {
|
|
9700
|
+
contentTab,
|
|
9701
|
+
settingsTab,
|
|
9702
|
+
standardSettingsExtras,
|
|
9703
|
+
thumbAndFieldsSections,
|
|
9704
|
+
manualItemsTab,
|
|
9705
|
+
resourceListSettingsTab
|
|
9706
|
+
};
|
|
9707
|
+
const DEFAULT_INLINE_TOOLBAR = ["bold", "italic", "underline", "hyperlink"];
|
|
9708
|
+
const WIDGET_INLINE_TOOLBAR = ["underline", "hyperlink"];
|
|
9709
|
+
const EDITORJS_INLINE_ICON_SPRITE_ID = "kubik-editorjs-inline-icons";
|
|
9710
|
+
const EDITORJS_LINK_ICON_SPRITE = `
|
|
9711
|
+
<symbol id="link" viewBox="0 0 14 10">
|
|
9712
|
+
<path d="M6 0v2H5a3 3 0 000 6h1v2H5A5 5 0 115 0h1zm2 0h1a5 5 0 110 10H8V8h1a3 3 0 000-6H8V0zM5 4h4a1 1 0 110 2H5a1 1 0 110-2z"/>
|
|
9713
|
+
</symbol>
|
|
9714
|
+
<symbol id="unlink" viewBox="0 0 15 11">
|
|
9715
|
+
<path d="M13.073 2.099l-1.448 1.448A3 3 0 009 2H8V0h1c1.68 0 3.166.828 4.073 2.099zM6.929 4l-.879.879L7.172 6H5a1 1 0 110-2h1.929zM6 0v2H5a3 3 0 100 6h1v2H5A5 5 0 115 0h1zm6.414 7l2.122 2.121-1.415 1.415L11 8.414l-2.121 2.122L7.464 9.12 9.586 7 7.464 4.879 8.88 3.464 11 5.586l2.121-2.122 1.415 1.415L12.414 7z"/>
|
|
9716
|
+
</symbol>
|
|
9717
|
+
`;
|
|
9718
|
+
function ensureEditorJsInlineIcons() {
|
|
9719
|
+
if (document.getElementById(EDITORJS_INLINE_ICON_SPRITE_ID))
|
|
9720
|
+
return;
|
|
9721
|
+
if (document.getElementById("link"))
|
|
9722
|
+
return;
|
|
9723
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
9724
|
+
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
9725
|
+
svg.setAttribute("aria-hidden", "true");
|
|
9726
|
+
svg.style.display = "none";
|
|
9727
|
+
svg.id = EDITORJS_INLINE_ICON_SPRITE_ID;
|
|
9728
|
+
svg.innerHTML = EDITORJS_LINK_ICON_SPRITE;
|
|
9729
|
+
document.body.appendChild(svg);
|
|
9730
|
+
}
|
|
9731
|
+
function buildBaseEditorTools({
|
|
9732
|
+
widgetInlineToolbar = WIDGET_INLINE_TOOLBAR,
|
|
9733
|
+
richInlineToolbar = DEFAULT_INLINE_TOOLBAR
|
|
9734
|
+
} = {}) {
|
|
9735
|
+
return {
|
|
9736
|
+
paragraph: {
|
|
9737
|
+
class: Paragraph,
|
|
9738
|
+
inlineToolbar: widgetInlineToolbar
|
|
9739
|
+
},
|
|
9740
|
+
hyperlink: {
|
|
9741
|
+
class: Hyperlink,
|
|
9742
|
+
config: {}
|
|
9743
|
+
},
|
|
9744
|
+
embed: {
|
|
9745
|
+
class: Embed,
|
|
9746
|
+
config: {
|
|
9747
|
+
services: {
|
|
9748
|
+
youtube: true,
|
|
9749
|
+
vimeo: true,
|
|
9750
|
+
twitter: true,
|
|
9751
|
+
instagram: true
|
|
9752
|
+
}
|
|
9753
|
+
}
|
|
9754
|
+
},
|
|
9755
|
+
header: {
|
|
9756
|
+
class: Header,
|
|
9757
|
+
config: {
|
|
9758
|
+
placeholder: "Add header text",
|
|
9759
|
+
levels: [2, 3, 4, 5, 6],
|
|
9760
|
+
defaultLevel: 2
|
|
9761
|
+
},
|
|
9762
|
+
inlineToolbar: richInlineToolbar
|
|
9763
|
+
},
|
|
9764
|
+
nested_list: {
|
|
9765
|
+
class: NestedList,
|
|
9766
|
+
inlineToolbar: richInlineToolbar
|
|
9767
|
+
},
|
|
9768
|
+
quote: {
|
|
9769
|
+
class: Quote,
|
|
9770
|
+
inlineToolbar: richInlineToolbar,
|
|
9771
|
+
shortcut: "CMD+SHIFT+O",
|
|
9772
|
+
config: {
|
|
9773
|
+
quotePlaceholder: "Enter a quote",
|
|
9774
|
+
captionPlaceholder: "Quote's author"
|
|
9775
|
+
}
|
|
9776
|
+
},
|
|
9777
|
+
underline: Underline
|
|
9778
|
+
};
|
|
9779
|
+
}
|
|
9512
9780
|
var index = {
|
|
9513
9781
|
KubikWidgetController,
|
|
9514
9782
|
KubikRepeaterController,
|
|
9515
9783
|
KubikKeyValueRepeaterController,
|
|
9516
9784
|
PluginFactory,
|
|
9517
|
-
KubikAutocompleteController
|
|
9785
|
+
KubikAutocompleteController,
|
|
9786
|
+
defineBlock,
|
|
9787
|
+
presets,
|
|
9788
|
+
DEFAULT_INLINE_TOOLBAR,
|
|
9789
|
+
WIDGET_INLINE_TOOLBAR,
|
|
9790
|
+
ensureEditorJsInlineIcons,
|
|
9791
|
+
buildBaseEditorTools
|
|
9518
9792
|
};
|
|
9519
|
-
export { index as default };
|
|
9793
|
+
export { DEFAULT_INLINE_TOOLBAR, KubikAutocompleteController, KubikKeyValueRepeaterController, KubikRepeaterController, KubikWidgetController, PluginFactory, WIDGET_INLINE_TOOLBAR, buildBaseEditorTools, index as default, defineBlock, ensureEditorJsInlineIcons, presets };
|