@lotte-innovate/ui-component-test 0.0.97 → 0.0.99
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib/Typography/Header/index.d.ts +1 -1
- package/dist/lib/Typography/Text/index.d.ts +1 -1
- package/dist/lib/components/Accordion/index.d.ts +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogAction.d.ts +3 -3
- package/dist/lib/components/AlertDialog/AlertDialogCancel.d.ts +3 -3
- package/dist/lib/components/AlertDialog/AlertDialogContent.d.ts +3 -3
- package/dist/lib/components/AlertDialog/AlertDialogDescription.d.ts +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogTitle.d.ts +1 -1
- package/dist/lib/components/AlertDialog/AlertDialogTrigger.d.ts +4 -4
- package/dist/lib/components/AspectRatio/index.d.ts +1 -1
- package/dist/lib/components/Avatar/index.d.ts +2 -2
- package/dist/lib/components/Avatar/index.js +1 -1
- package/dist/lib/components/Badge/index.d.ts +4 -4
- package/dist/lib/components/BarChart/index.d.ts +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbLink.d.ts +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbPage.d.ts +1 -1
- package/dist/lib/components/Breadcrumb/BreadcrumbRoot.d.ts +2 -2
- package/dist/lib/components/BubbleChart/index.d.ts +1 -1
- package/dist/lib/components/Button/index.d.ts +4 -4
- package/dist/lib/components/Callout/CalloutIcon.d.ts +3 -3
- package/dist/lib/components/Callout/CalloutRoot.d.ts +4 -4
- package/dist/lib/components/Callout/CalloutText.d.ts +2 -2
- package/dist/lib/components/Card/index.d.ts +4 -4
- package/dist/lib/components/Checkbox/index.d.ts +3 -3
- package/dist/lib/components/CheckboxCard/index.d.ts +3 -3
- package/dist/lib/components/CheckboxGroup/CheckboxGroupRoot.d.ts +1 -1
- package/dist/lib/components/Collapsible/index.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuContent.d.ts +2 -2
- package/dist/lib/components/ContextMenu/ContextMenuItem.d.ts +2 -2
- package/dist/lib/components/ContextMenu/ContextMenuItem.js +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuItemIndicator.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuLabel.d.ts +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuSeparator.js +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuSeparator.mjs +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuSeparator.mjs.map +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuSubContent.d.ts +2 -2
- package/dist/lib/components/ContextMenu/ContextMenuTrigger.js +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuTrigger.mjs +1 -1
- package/dist/lib/components/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
- package/dist/lib/components/DataList/DataListItem.d.ts +1 -1
- package/dist/lib/components/DataList/DataListLabel.d.ts +2 -2
- package/dist/lib/components/DataList/DataListRoot.d.ts +1 -1
- package/dist/lib/components/DataList/DataListValue.d.ts +2 -2
- package/dist/lib/components/Dialog/DialogAction.d.ts +2 -2
- package/dist/lib/components/Dialog/DialogCancel.d.ts +2 -2
- package/dist/lib/components/Dialog/DialogContent.d.ts +3 -3
- package/dist/lib/components/Dialog/DialogDescription.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogSlot.d.ts +1 -1
- package/dist/lib/components/Dialog/DialogTitle.d.ts +1 -1
- package/dist/lib/components/DoughnutChart/index.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdonMenuSubContent.d.ts +2 -2
- package/dist/lib/components/DropdownMenu/DropdownMenuContent.d.ts +2 -2
- package/dist/lib/components/DropdownMenu/DropdownMenuItem.d.ts +2 -2
- package/dist/lib/components/DropdownMenu/DropdownMenuItem.js +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuItemIndicator.d.ts +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuSeparator.js +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuSeparator.mjs +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuSeparator.mjs.map +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
- package/dist/lib/components/Editor/index.d.ts +2 -2
- package/dist/lib/components/Editor/index.js +1 -1
- package/dist/lib/components/Editor/index.mjs +1 -1
- package/dist/lib/components/Footer/index.d.ts +2 -2
- package/dist/lib/components/Gnb/GnbInfo.d.ts +1 -1
- package/dist/lib/components/Gnb/GnbLogo.d.ts +1 -1
- package/dist/lib/components/Gnb/GnbMenu.d.ts +1 -1
- package/dist/lib/components/Gnb/GnbRoot.d.ts +2 -2
- package/dist/lib/components/HoverCard/HoverCardContent.d.ts +4 -4
- package/dist/lib/components/HoverCard/HoverCardContent.js +1 -1
- package/dist/lib/components/IconButton/index.d.ts +3 -3
- package/dist/lib/components/IconButton/index.js +1 -1
- package/dist/lib/components/Inset/index.d.ts +2 -2
- package/dist/lib/components/Label/index.d.ts +3 -3
- package/dist/lib/components/LineChart/index.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarContent.d.ts +2 -2
- package/dist/lib/components/Menubar/MenubarItem.d.ts +2 -2
- package/dist/lib/components/Menubar/MenubarItem.js +1 -1
- package/dist/lib/components/Menubar/MenubarItemIndicator.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarRoot.d.ts +2 -2
- package/dist/lib/components/Menubar/MenubarSeparator.js +1 -1
- package/dist/lib/components/Menubar/MenubarSeparator.mjs +1 -1
- package/dist/lib/components/Menubar/MenubarSeparator.mjs.map +1 -1
- package/dist/lib/components/Menubar/MenubarSubContent.d.ts +1 -1
- package/dist/lib/components/Menubar/MenubarTrigger.d.ts +2 -2
- package/dist/lib/components/NavigationMenu/NavigationMenuContent.d.ts +1 -1
- package/dist/lib/components/NavigationMenu/NavigationMenuLink.d.ts +2 -2
- package/dist/lib/components/NavigationMenu/NavigationMenuList.d.ts +2 -2
- package/dist/lib/components/NavigationMenu/NavigationMenuTrigger.d.ts +2 -2
- package/dist/lib/components/NavigationMenu/NavigationMenuViewport.d.ts +3 -3
- package/dist/lib/components/PieChart/index.d.ts +1 -1
- package/dist/lib/components/Popover/PopoverClose.d.ts +1 -1
- package/dist/lib/components/Popover/PopoverContent.d.ts +3 -3
- package/dist/lib/components/Progress/index.d.ts +3 -3
- package/dist/lib/components/RadarChart/index.d.ts +1 -1
- package/dist/lib/components/Radio/index.d.ts +1 -1
- package/dist/lib/components/RadioCards/RadioCardsItem.d.ts +2 -2
- package/dist/lib/components/RadioCards/RadioCardsRoot.d.ts +1 -1
- package/dist/lib/components/RadioGroup/RadioGroupItem.d.ts +1 -1
- package/dist/lib/components/RadioGroup/RadioGroupRoot.d.ts +1 -1
- package/dist/lib/components/SegmentedControl/SegmentedControlRoot.d.ts +1 -1
- package/dist/lib/components/Select/index.d.ts +1 -1
- package/dist/lib/components/Separator/index.d.ts +1 -1
- package/dist/lib/components/Skeleton/index.d.ts +1 -1
- package/dist/lib/components/Slider/index.d.ts +1 -1
- package/dist/lib/components/Spinner/index.d.ts +1 -1
- package/dist/lib/components/Table/index.d.ts +2 -2
- package/dist/lib/components/Tabs/index.d.ts +1 -1
- package/dist/lib/components/TextArea/index.d.ts +3 -3
- package/dist/lib/components/TextField/index.d.ts +1 -1
- package/dist/lib/components/Timeline/TimelineRoot.d.ts +2 -2
- package/dist/lib/components/Toast/ToastActionButton.d.ts +3 -3
- package/dist/lib/components/Toast/ToastDescription.d.ts +2 -2
- package/dist/lib/components/Toast/ToastRoot.d.ts +4 -4
- package/dist/lib/components/Toast/ToastTitle.d.ts +2 -2
- package/dist/lib/components/Toggle/ToggleWithText.d.ts +3 -3
- package/dist/lib/components/Toggle/index.d.ts +3 -3
- package/dist/lib/components/ToggleGroup/ToggleGroupItem.d.ts +1 -1
- package/dist/lib/components/ToggleGroup/ToggleGroupRoot.d.ts +1 -1
- package/dist/lib/components/ToggleSwitch/index.d.ts +3 -3
- package/dist/lib/components/Tooltip/index.d.ts +2 -2
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/public/tinymce/icons/default/icons.d.ts +0 -0
- package/dist/public/tinymce/icons/default/icons.js +0 -195
- package/dist/public/tinymce/icons/default/index.d.ts +0 -1
- package/dist/public/tinymce/icons/default/index.js +0 -8
- package/dist/public/tinymce/models/dom/index.d.ts +0 -1
- package/dist/public/tinymce/models/dom/index.js +0 -8
- package/dist/public/tinymce/models/dom/model.d.ts +0 -0
- package/dist/public/tinymce/models/dom/model.js +0 -7988
- package/dist/public/tinymce/plugins/advlist/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/advlist/index.js +0 -8
- package/dist/public/tinymce/plugins/advlist/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/advlist/plugin.js +0 -255
- package/dist/public/tinymce/plugins/autolink/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/autolink/index.js +0 -8
- package/dist/public/tinymce/plugins/autolink/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/autolink/plugin.js +0 -221
- package/dist/public/tinymce/plugins/code/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/code/index.js +0 -8
- package/dist/public/tinymce/plugins/code/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/code/plugin.js +0 -77
- package/dist/public/tinymce/plugins/codesample/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/codesample/index.js +0 -8
- package/dist/public/tinymce/plugins/codesample/plugin.d.ts +0 -45
- package/dist/public/tinymce/plugins/codesample/plugin.js +0 -2462
- package/dist/public/tinymce/plugins/image/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/image/index.js +0 -8
- package/dist/public/tinymce/plugins/image/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/image/plugin.js +0 -1523
- package/dist/public/tinymce/plugins/link/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/link/index.js +0 -8
- package/dist/public/tinymce/plugins/link/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/link/plugin.js +0 -1246
- package/dist/public/tinymce/plugins/lists/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/lists/index.js +0 -8
- package/dist/public/tinymce/plugins/lists/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/lists/plugin.js +0 -2191
- package/dist/public/tinymce/plugins/table/index.d.ts +0 -1
- package/dist/public/tinymce/plugins/table/index.js +0 -8
- package/dist/public/tinymce/plugins/table/plugin.d.ts +0 -0
- package/dist/public/tinymce/plugins/table/plugin.js +0 -3399
- package/dist/public/tinymce/skins/content/default/content.d.ts +0 -0
- package/dist/public/tinymce/skins/content/default/content.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide/content.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide/content.inline.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide/content.inline.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide/content.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide/skin.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide/skin.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide/skin.shadowdom.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide/skin.shadowdom.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide-dark/content.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide-dark/content.inline.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide-dark/content.inline.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide-dark/content.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide-dark/skin.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide-dark/skin.js +0 -3
- package/dist/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.d.ts +0 -0
- package/dist/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +0 -3
- package/dist/public/tinymce/themes/silver/index.d.ts +0 -1
- package/dist/public/tinymce/themes/silver/index.js +0 -8
- package/dist/public/tinymce/themes/silver/theme.d.ts +0 -0
- package/dist/public/tinymce/themes/silver/theme.js +0 -29731
@@ -1,1523 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* TinyMCE version 6.8.5 (TBD)
|
4
|
-
*/
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
6
|
-
__assign = Object.assign || function(t) {
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
8
|
-
s = arguments[i];
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
10
|
-
t[p] = s[p];
|
11
|
-
}
|
12
|
-
return t;
|
13
|
-
};
|
14
|
-
return __assign.apply(this, arguments);
|
15
|
-
};
|
16
|
-
(function () {
|
17
|
-
'use strict';
|
18
|
-
var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
19
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
20
|
-
var hasProto = function (v, constructor, predicate) {
|
21
|
-
var _a;
|
22
|
-
if (predicate(v, constructor.prototype)) {
|
23
|
-
return true;
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
27
|
-
}
|
28
|
-
};
|
29
|
-
var typeOf = function (x) {
|
30
|
-
var t = typeof x;
|
31
|
-
if (x === null) {
|
32
|
-
return 'null';
|
33
|
-
}
|
34
|
-
else if (t === 'object' && Array.isArray(x)) {
|
35
|
-
return 'array';
|
36
|
-
}
|
37
|
-
else if (t === 'object' && hasProto(x, String, function (o, proto) { return proto.isPrototypeOf(o); })) {
|
38
|
-
return 'string';
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
return t;
|
42
|
-
}
|
43
|
-
};
|
44
|
-
var isType = function (type) { return function (value) { return typeOf(value) === type; }; };
|
45
|
-
var isSimpleType = function (type) { return function (value) { return typeof value === type; }; };
|
46
|
-
var eq = function (t) { return function (a) { return t === a; }; };
|
47
|
-
var is = function (value, constructor) { return isObject(value) && hasProto(value, constructor, function (o, proto) { return getPrototypeOf(o) === proto; }); };
|
48
|
-
var isString = isType('string');
|
49
|
-
var isObject = isType('object');
|
50
|
-
var isPlainObject = function (value) { return is(value, Object); };
|
51
|
-
var isArray = isType('array');
|
52
|
-
var isNull = eq(null);
|
53
|
-
var isBoolean = isSimpleType('boolean');
|
54
|
-
var isNullable = function (a) { return a === null || a === undefined; };
|
55
|
-
var isNonNullable = function (a) { return !isNullable(a); };
|
56
|
-
var isFunction = isSimpleType('function');
|
57
|
-
var isNumber = isSimpleType('number');
|
58
|
-
var isArrayOf = function (value, pred) {
|
59
|
-
if (isArray(value)) {
|
60
|
-
for (var i = 0, len = value.length; i < len; ++i) {
|
61
|
-
if (!pred(value[i])) {
|
62
|
-
return false;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
return true;
|
66
|
-
}
|
67
|
-
return false;
|
68
|
-
};
|
69
|
-
var noop = function () {
|
70
|
-
};
|
71
|
-
var Optional = /** @class */ (function () {
|
72
|
-
function Optional(tag, value) {
|
73
|
-
this.tag = tag;
|
74
|
-
this.value = value;
|
75
|
-
}
|
76
|
-
Optional.some = function (value) {
|
77
|
-
return new Optional(true, value);
|
78
|
-
};
|
79
|
-
Optional.none = function () {
|
80
|
-
return Optional.singletonNone;
|
81
|
-
};
|
82
|
-
Optional.prototype.fold = function (onNone, onSome) {
|
83
|
-
if (this.tag) {
|
84
|
-
return onSome(this.value);
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
return onNone();
|
88
|
-
}
|
89
|
-
};
|
90
|
-
Optional.prototype.isSome = function () {
|
91
|
-
return this.tag;
|
92
|
-
};
|
93
|
-
Optional.prototype.isNone = function () {
|
94
|
-
return !this.tag;
|
95
|
-
};
|
96
|
-
Optional.prototype.map = function (mapper) {
|
97
|
-
if (this.tag) {
|
98
|
-
return Optional.some(mapper(this.value));
|
99
|
-
}
|
100
|
-
else {
|
101
|
-
return Optional.none();
|
102
|
-
}
|
103
|
-
};
|
104
|
-
Optional.prototype.bind = function (binder) {
|
105
|
-
if (this.tag) {
|
106
|
-
return binder(this.value);
|
107
|
-
}
|
108
|
-
else {
|
109
|
-
return Optional.none();
|
110
|
-
}
|
111
|
-
};
|
112
|
-
Optional.prototype.exists = function (predicate) {
|
113
|
-
return this.tag && predicate(this.value);
|
114
|
-
};
|
115
|
-
Optional.prototype.forall = function (predicate) {
|
116
|
-
return !this.tag || predicate(this.value);
|
117
|
-
};
|
118
|
-
Optional.prototype.filter = function (predicate) {
|
119
|
-
if (!this.tag || predicate(this.value)) {
|
120
|
-
return this;
|
121
|
-
}
|
122
|
-
else {
|
123
|
-
return Optional.none();
|
124
|
-
}
|
125
|
-
};
|
126
|
-
Optional.prototype.getOr = function (replacement) {
|
127
|
-
return this.tag ? this.value : replacement;
|
128
|
-
};
|
129
|
-
Optional.prototype.or = function (replacement) {
|
130
|
-
return this.tag ? this : replacement;
|
131
|
-
};
|
132
|
-
Optional.prototype.getOrThunk = function (thunk) {
|
133
|
-
return this.tag ? this.value : thunk();
|
134
|
-
};
|
135
|
-
Optional.prototype.orThunk = function (thunk) {
|
136
|
-
return this.tag ? this : thunk();
|
137
|
-
};
|
138
|
-
Optional.prototype.getOrDie = function (message) {
|
139
|
-
if (!this.tag) {
|
140
|
-
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
141
|
-
}
|
142
|
-
else {
|
143
|
-
return this.value;
|
144
|
-
}
|
145
|
-
};
|
146
|
-
Optional.from = function (value) {
|
147
|
-
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
148
|
-
};
|
149
|
-
Optional.prototype.getOrNull = function () {
|
150
|
-
return this.tag ? this.value : null;
|
151
|
-
};
|
152
|
-
Optional.prototype.getOrUndefined = function () {
|
153
|
-
return this.value;
|
154
|
-
};
|
155
|
-
Optional.prototype.each = function (worker) {
|
156
|
-
if (this.tag) {
|
157
|
-
worker(this.value);
|
158
|
-
}
|
159
|
-
};
|
160
|
-
Optional.prototype.toArray = function () {
|
161
|
-
return this.tag ? [this.value] : [];
|
162
|
-
};
|
163
|
-
Optional.prototype.toString = function () {
|
164
|
-
return this.tag ? "some(".concat(this.value, ")") : 'none()';
|
165
|
-
};
|
166
|
-
return Optional;
|
167
|
-
}());
|
168
|
-
Optional.singletonNone = new Optional(false);
|
169
|
-
var keys = Object.keys;
|
170
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
171
|
-
var each = function (obj, f) {
|
172
|
-
var props = keys(obj);
|
173
|
-
for (var k = 0, len = props.length; k < len; k++) {
|
174
|
-
var i = props[k];
|
175
|
-
var x = obj[i];
|
176
|
-
f(x, i);
|
177
|
-
}
|
178
|
-
};
|
179
|
-
var objAcc = function (r) { return function (x, i) {
|
180
|
-
r[i] = x;
|
181
|
-
}; };
|
182
|
-
var internalFilter = function (obj, pred, onTrue, onFalse) {
|
183
|
-
each(obj, function (x, i) {
|
184
|
-
(pred(x, i) ? onTrue : onFalse)(x, i);
|
185
|
-
});
|
186
|
-
};
|
187
|
-
var filter = function (obj, pred) {
|
188
|
-
var t = {};
|
189
|
-
internalFilter(obj, pred, objAcc(t), noop);
|
190
|
-
return t;
|
191
|
-
};
|
192
|
-
var has = function (obj, key) { return hasOwnProperty.call(obj, key); };
|
193
|
-
var hasNonNullableKey = function (obj, key) { return has(obj, key) && obj[key] !== undefined && obj[key] !== null; };
|
194
|
-
var nativePush = Array.prototype.push;
|
195
|
-
var flatten = function (xs) {
|
196
|
-
var r = [];
|
197
|
-
for (var i = 0, len = xs.length; i < len; ++i) {
|
198
|
-
if (!isArray(xs[i])) {
|
199
|
-
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
200
|
-
}
|
201
|
-
nativePush.apply(r, xs[i]);
|
202
|
-
}
|
203
|
-
return r;
|
204
|
-
};
|
205
|
-
var get = function (xs, i) { return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); };
|
206
|
-
var head = function (xs) { return get(xs, 0); };
|
207
|
-
var findMap = function (arr, f) {
|
208
|
-
for (var i = 0; i < arr.length; i++) {
|
209
|
-
var r = f(arr[i], i);
|
210
|
-
if (r.isSome()) {
|
211
|
-
return r;
|
212
|
-
}
|
213
|
-
}
|
214
|
-
return Optional.none();
|
215
|
-
};
|
216
|
-
typeof window !== 'undefined' ? window : Function('return this;')();
|
217
|
-
var rawSet = function (dom, key, value) {
|
218
|
-
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
219
|
-
dom.setAttribute(key, value + '');
|
220
|
-
}
|
221
|
-
else {
|
222
|
-
console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
|
223
|
-
throw new Error('Attribute value was not simple');
|
224
|
-
}
|
225
|
-
};
|
226
|
-
var set = function (element, key, value) {
|
227
|
-
rawSet(element.dom, key, value);
|
228
|
-
};
|
229
|
-
var remove = function (element, key) {
|
230
|
-
element.dom.removeAttribute(key);
|
231
|
-
};
|
232
|
-
var fromHtml = function (html, scope) {
|
233
|
-
var doc = scope || document;
|
234
|
-
var div = doc.createElement('div');
|
235
|
-
div.innerHTML = html;
|
236
|
-
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
237
|
-
var message = 'HTML does not have a single root node';
|
238
|
-
console.error(message, html);
|
239
|
-
throw new Error(message);
|
240
|
-
}
|
241
|
-
return fromDom(div.childNodes[0]);
|
242
|
-
};
|
243
|
-
var fromTag = function (tag, scope) {
|
244
|
-
var doc = scope || document;
|
245
|
-
var node = doc.createElement(tag);
|
246
|
-
return fromDom(node);
|
247
|
-
};
|
248
|
-
var fromText = function (text, scope) {
|
249
|
-
var doc = scope || document;
|
250
|
-
var node = doc.createTextNode(text);
|
251
|
-
return fromDom(node);
|
252
|
-
};
|
253
|
-
var fromDom = function (node) {
|
254
|
-
if (node === null || node === undefined) {
|
255
|
-
throw new Error('Node cannot be null or undefined');
|
256
|
-
}
|
257
|
-
return { dom: node };
|
258
|
-
};
|
259
|
-
var fromPoint = function (docElm, x, y) { return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom); };
|
260
|
-
var SugarElement = {
|
261
|
-
fromHtml: fromHtml,
|
262
|
-
fromTag: fromTag,
|
263
|
-
fromText: fromText,
|
264
|
-
fromDom: fromDom,
|
265
|
-
fromPoint: fromPoint
|
266
|
-
};
|
267
|
-
var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
268
|
-
var global$2 = tinymce.util.Tools.resolve('tinymce.util.URI');
|
269
|
-
var isNotEmpty = function (s) { return s.length > 0; };
|
270
|
-
var option = function (name) { return function (editor) { return editor.options.get(name); }; };
|
271
|
-
var register$2 = function (editor) {
|
272
|
-
var registerOption = editor.options.register;
|
273
|
-
registerOption('image_dimensions', {
|
274
|
-
processor: 'boolean',
|
275
|
-
default: true
|
276
|
-
});
|
277
|
-
registerOption('image_advtab', {
|
278
|
-
processor: 'boolean',
|
279
|
-
default: false
|
280
|
-
});
|
281
|
-
registerOption('image_uploadtab', {
|
282
|
-
processor: 'boolean',
|
283
|
-
default: true
|
284
|
-
});
|
285
|
-
registerOption('image_prepend_url', {
|
286
|
-
processor: 'string',
|
287
|
-
default: ''
|
288
|
-
});
|
289
|
-
registerOption('image_class_list', { processor: 'object[]' });
|
290
|
-
registerOption('image_description', {
|
291
|
-
processor: 'boolean',
|
292
|
-
default: true
|
293
|
-
});
|
294
|
-
registerOption('image_title', {
|
295
|
-
processor: 'boolean',
|
296
|
-
default: false
|
297
|
-
});
|
298
|
-
registerOption('image_caption', {
|
299
|
-
processor: 'boolean',
|
300
|
-
default: false
|
301
|
-
});
|
302
|
-
registerOption('image_list', {
|
303
|
-
processor: function (value) {
|
304
|
-
var valid = value === false || isString(value) || isArrayOf(value, isObject) || isFunction(value);
|
305
|
-
return valid ? {
|
306
|
-
value: value,
|
307
|
-
valid: valid
|
308
|
-
} : {
|
309
|
-
valid: false,
|
310
|
-
message: 'Must be false, a string, an array or a function.'
|
311
|
-
};
|
312
|
-
},
|
313
|
-
default: false
|
314
|
-
});
|
315
|
-
};
|
316
|
-
var hasDimensions = option('image_dimensions');
|
317
|
-
var hasAdvTab = option('image_advtab');
|
318
|
-
var hasUploadTab = option('image_uploadtab');
|
319
|
-
var getPrependUrl = option('image_prepend_url');
|
320
|
-
var getClassList = option('image_class_list');
|
321
|
-
var hasDescription = option('image_description');
|
322
|
-
var hasImageTitle = option('image_title');
|
323
|
-
var hasImageCaption = option('image_caption');
|
324
|
-
var getImageList = option('image_list');
|
325
|
-
var showAccessibilityOptions = option('a11y_advanced_options');
|
326
|
-
var isAutomaticUploadsEnabled = option('automatic_uploads');
|
327
|
-
var hasUploadUrl = function (editor) { return isNotEmpty(editor.options.get('images_upload_url')); };
|
328
|
-
var hasUploadHandler = function (editor) { return isNonNullable(editor.options.get('images_upload_handler')); };
|
329
|
-
var parseIntAndGetMax = function (val1, val2) { return Math.max(parseInt(val1, 10), parseInt(val2, 10)); };
|
330
|
-
var getImageSize = function (url) { return new Promise(function (callback) {
|
331
|
-
var img = document.createElement('img');
|
332
|
-
var done = function (dimensions) {
|
333
|
-
img.onload = img.onerror = null;
|
334
|
-
if (img.parentNode) {
|
335
|
-
img.parentNode.removeChild(img);
|
336
|
-
}
|
337
|
-
callback(dimensions);
|
338
|
-
};
|
339
|
-
img.onload = function () {
|
340
|
-
var width = parseIntAndGetMax(img.width, img.clientWidth);
|
341
|
-
var height = parseIntAndGetMax(img.height, img.clientHeight);
|
342
|
-
var dimensions = {
|
343
|
-
width: width,
|
344
|
-
height: height
|
345
|
-
};
|
346
|
-
done(Promise.resolve(dimensions));
|
347
|
-
};
|
348
|
-
img.onerror = function () {
|
349
|
-
done(Promise.reject("Failed to get image dimensions for: ".concat(url)));
|
350
|
-
};
|
351
|
-
var style = img.style;
|
352
|
-
style.visibility = 'hidden';
|
353
|
-
style.position = 'fixed';
|
354
|
-
style.bottom = style.left = '0px';
|
355
|
-
style.width = style.height = 'auto';
|
356
|
-
document.body.appendChild(img);
|
357
|
-
img.src = url;
|
358
|
-
}); };
|
359
|
-
var removePixelSuffix = function (value) {
|
360
|
-
if (value) {
|
361
|
-
value = value.replace(/px$/, '');
|
362
|
-
}
|
363
|
-
return value;
|
364
|
-
};
|
365
|
-
var addPixelSuffix = function (value) {
|
366
|
-
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
367
|
-
value += 'px';
|
368
|
-
}
|
369
|
-
return value;
|
370
|
-
};
|
371
|
-
var mergeMargins = function (css) {
|
372
|
-
if (css.margin) {
|
373
|
-
var splitMargin = String(css.margin).split(' ');
|
374
|
-
switch (splitMargin.length) {
|
375
|
-
case 1:
|
376
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
377
|
-
css['margin-right'] = css['margin-right'] || splitMargin[0];
|
378
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
379
|
-
css['margin-left'] = css['margin-left'] || splitMargin[0];
|
380
|
-
break;
|
381
|
-
case 2:
|
382
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
383
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
384
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
385
|
-
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
386
|
-
break;
|
387
|
-
case 3:
|
388
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
389
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
390
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
391
|
-
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
392
|
-
break;
|
393
|
-
case 4:
|
394
|
-
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
395
|
-
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
396
|
-
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
397
|
-
css['margin-left'] = css['margin-left'] || splitMargin[3];
|
398
|
-
}
|
399
|
-
delete css.margin;
|
400
|
-
}
|
401
|
-
return css;
|
402
|
-
};
|
403
|
-
var createImageList = function (editor, callback) {
|
404
|
-
var imageList = getImageList(editor);
|
405
|
-
if (isString(imageList)) {
|
406
|
-
fetch(imageList).then(function (res) {
|
407
|
-
if (res.ok) {
|
408
|
-
res.json().then(callback);
|
409
|
-
}
|
410
|
-
});
|
411
|
-
}
|
412
|
-
else if (isFunction(imageList)) {
|
413
|
-
imageList(callback);
|
414
|
-
}
|
415
|
-
else {
|
416
|
-
callback(imageList);
|
417
|
-
}
|
418
|
-
};
|
419
|
-
var waitLoadImage = function (editor, data, imgElm) {
|
420
|
-
var selectImage = function () {
|
421
|
-
imgElm.onload = imgElm.onerror = null;
|
422
|
-
if (editor.selection) {
|
423
|
-
editor.selection.select(imgElm);
|
424
|
-
editor.nodeChanged();
|
425
|
-
}
|
426
|
-
};
|
427
|
-
imgElm.onload = function () {
|
428
|
-
if (!data.width && !data.height && hasDimensions(editor)) {
|
429
|
-
editor.dom.setAttribs(imgElm, {
|
430
|
-
width: String(imgElm.clientWidth),
|
431
|
-
height: String(imgElm.clientHeight)
|
432
|
-
});
|
433
|
-
}
|
434
|
-
selectImage();
|
435
|
-
};
|
436
|
-
imgElm.onerror = selectImage;
|
437
|
-
};
|
438
|
-
var blobToDataUri = function (blob) { return new Promise(function (resolve, reject) {
|
439
|
-
var reader = new FileReader();
|
440
|
-
reader.onload = function () {
|
441
|
-
resolve(reader.result);
|
442
|
-
};
|
443
|
-
reader.onerror = function () {
|
444
|
-
var _a;
|
445
|
-
reject((_a = reader.error) === null || _a === void 0 ? void 0 : _a.message);
|
446
|
-
};
|
447
|
-
reader.readAsDataURL(blob);
|
448
|
-
}); };
|
449
|
-
var isPlaceholderImage = function (imgElm) { return imgElm.nodeName === 'IMG' && (imgElm.hasAttribute('data-mce-object') || imgElm.hasAttribute('data-mce-placeholder')); };
|
450
|
-
var isSafeImageUrl = function (editor, src) {
|
451
|
-
var getOption = editor.options.get;
|
452
|
-
return global$2.isDomSafe(src, 'img', {
|
453
|
-
allow_html_data_urls: getOption('allow_html_data_urls'),
|
454
|
-
allow_script_urls: getOption('allow_script_urls'),
|
455
|
-
allow_svg_data_urls: getOption('allow_svg_data_urls')
|
456
|
-
});
|
457
|
-
};
|
458
|
-
var DOM = global$3.DOM;
|
459
|
-
var getHspace = function (image) {
|
460
|
-
if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) {
|
461
|
-
return removePixelSuffix(image.style.marginLeft);
|
462
|
-
}
|
463
|
-
else {
|
464
|
-
return '';
|
465
|
-
}
|
466
|
-
};
|
467
|
-
var getVspace = function (image) {
|
468
|
-
if (image.style.marginTop && image.style.marginBottom && image.style.marginTop === image.style.marginBottom) {
|
469
|
-
return removePixelSuffix(image.style.marginTop);
|
470
|
-
}
|
471
|
-
else {
|
472
|
-
return '';
|
473
|
-
}
|
474
|
-
};
|
475
|
-
var getBorder = function (image) {
|
476
|
-
if (image.style.borderWidth) {
|
477
|
-
return removePixelSuffix(image.style.borderWidth);
|
478
|
-
}
|
479
|
-
else {
|
480
|
-
return '';
|
481
|
-
}
|
482
|
-
};
|
483
|
-
var getAttrib = function (image, name) {
|
484
|
-
var _a;
|
485
|
-
if (image.hasAttribute(name)) {
|
486
|
-
return (_a = image.getAttribute(name)) !== null && _a !== void 0 ? _a : '';
|
487
|
-
}
|
488
|
-
else {
|
489
|
-
return '';
|
490
|
-
}
|
491
|
-
};
|
492
|
-
var hasCaption = function (image) { return image.parentNode !== null && image.parentNode.nodeName === 'FIGURE'; };
|
493
|
-
var updateAttrib = function (image, name, value) {
|
494
|
-
if (value === '' || value === null) {
|
495
|
-
image.removeAttribute(name);
|
496
|
-
}
|
497
|
-
else {
|
498
|
-
image.setAttribute(name, value);
|
499
|
-
}
|
500
|
-
};
|
501
|
-
var wrapInFigure = function (image) {
|
502
|
-
var figureElm = DOM.create('figure', { class: 'image' });
|
503
|
-
DOM.insertAfter(figureElm, image);
|
504
|
-
figureElm.appendChild(image);
|
505
|
-
figureElm.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
|
506
|
-
figureElm.contentEditable = 'false';
|
507
|
-
};
|
508
|
-
var removeFigure = function (image) {
|
509
|
-
var figureElm = image.parentNode;
|
510
|
-
if (isNonNullable(figureElm)) {
|
511
|
-
DOM.insertAfter(image, figureElm);
|
512
|
-
DOM.remove(figureElm);
|
513
|
-
}
|
514
|
-
};
|
515
|
-
var toggleCaption = function (image) {
|
516
|
-
if (hasCaption(image)) {
|
517
|
-
removeFigure(image);
|
518
|
-
}
|
519
|
-
else {
|
520
|
-
wrapInFigure(image);
|
521
|
-
}
|
522
|
-
};
|
523
|
-
var normalizeStyle = function (image, normalizeCss) {
|
524
|
-
var attrValue = image.getAttribute('style');
|
525
|
-
var value = normalizeCss(attrValue !== null ? attrValue : '');
|
526
|
-
if (value.length > 0) {
|
527
|
-
image.setAttribute('style', value);
|
528
|
-
image.setAttribute('data-mce-style', value);
|
529
|
-
}
|
530
|
-
else {
|
531
|
-
image.removeAttribute('style');
|
532
|
-
}
|
533
|
-
};
|
534
|
-
var setSize = function (name, normalizeCss) { return function (image, name, value) {
|
535
|
-
var styles = image.style;
|
536
|
-
if (styles[name]) {
|
537
|
-
styles[name] = addPixelSuffix(value);
|
538
|
-
normalizeStyle(image, normalizeCss);
|
539
|
-
}
|
540
|
-
else {
|
541
|
-
updateAttrib(image, name, value);
|
542
|
-
}
|
543
|
-
}; };
|
544
|
-
var getSize = function (image, name) {
|
545
|
-
if (image.style[name]) {
|
546
|
-
return removePixelSuffix(image.style[name]);
|
547
|
-
}
|
548
|
-
else {
|
549
|
-
return getAttrib(image, name);
|
550
|
-
}
|
551
|
-
};
|
552
|
-
var setHspace = function (image, value) {
|
553
|
-
var pxValue = addPixelSuffix(value);
|
554
|
-
image.style.marginLeft = pxValue;
|
555
|
-
image.style.marginRight = pxValue;
|
556
|
-
};
|
557
|
-
var setVspace = function (image, value) {
|
558
|
-
var pxValue = addPixelSuffix(value);
|
559
|
-
image.style.marginTop = pxValue;
|
560
|
-
image.style.marginBottom = pxValue;
|
561
|
-
};
|
562
|
-
var setBorder = function (image, value) {
|
563
|
-
var pxValue = addPixelSuffix(value);
|
564
|
-
image.style.borderWidth = pxValue;
|
565
|
-
};
|
566
|
-
var setBorderStyle = function (image, value) {
|
567
|
-
image.style.borderStyle = value;
|
568
|
-
};
|
569
|
-
var getBorderStyle = function (image) {
|
570
|
-
var _a;
|
571
|
-
return (_a = image.style.borderStyle) !== null && _a !== void 0 ? _a : '';
|
572
|
-
};
|
573
|
-
var isFigure = function (elm) { return isNonNullable(elm) && elm.nodeName === 'FIGURE'; };
|
574
|
-
var isImage = function (elm) { return elm.nodeName === 'IMG'; };
|
575
|
-
var getIsDecorative = function (image) { return DOM.getAttrib(image, 'alt').length === 0 && DOM.getAttrib(image, 'role') === 'presentation'; };
|
576
|
-
var getAlt = function (image) {
|
577
|
-
if (getIsDecorative(image)) {
|
578
|
-
return '';
|
579
|
-
}
|
580
|
-
else {
|
581
|
-
return getAttrib(image, 'alt');
|
582
|
-
}
|
583
|
-
};
|
584
|
-
var defaultData = function () { return ({
|
585
|
-
src: '',
|
586
|
-
alt: '',
|
587
|
-
title: '',
|
588
|
-
width: '',
|
589
|
-
height: '',
|
590
|
-
class: '',
|
591
|
-
style: '',
|
592
|
-
caption: false,
|
593
|
-
hspace: '',
|
594
|
-
vspace: '',
|
595
|
-
border: '',
|
596
|
-
borderStyle: '',
|
597
|
-
isDecorative: false
|
598
|
-
}); };
|
599
|
-
var getStyleValue = function (normalizeCss, data) {
|
600
|
-
var _a;
|
601
|
-
var image = document.createElement('img');
|
602
|
-
updateAttrib(image, 'style', data.style);
|
603
|
-
if (getHspace(image) || data.hspace !== '') {
|
604
|
-
setHspace(image, data.hspace);
|
605
|
-
}
|
606
|
-
if (getVspace(image) || data.vspace !== '') {
|
607
|
-
setVspace(image, data.vspace);
|
608
|
-
}
|
609
|
-
if (getBorder(image) || data.border !== '') {
|
610
|
-
setBorder(image, data.border);
|
611
|
-
}
|
612
|
-
if (getBorderStyle(image) || data.borderStyle !== '') {
|
613
|
-
setBorderStyle(image, data.borderStyle);
|
614
|
-
}
|
615
|
-
return normalizeCss((_a = image.getAttribute('style')) !== null && _a !== void 0 ? _a : '');
|
616
|
-
};
|
617
|
-
var create = function (normalizeCss, data) {
|
618
|
-
var image = document.createElement('img');
|
619
|
-
write(normalizeCss, __assign(__assign({}, data), { caption: false }), image);
|
620
|
-
setAlt(image, data.alt, data.isDecorative);
|
621
|
-
if (data.caption) {
|
622
|
-
var figure = DOM.create('figure', { class: 'image' });
|
623
|
-
figure.appendChild(image);
|
624
|
-
figure.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
|
625
|
-
figure.contentEditable = 'false';
|
626
|
-
return figure;
|
627
|
-
}
|
628
|
-
else {
|
629
|
-
return image;
|
630
|
-
}
|
631
|
-
};
|
632
|
-
var read = function (normalizeCss, image) { return ({
|
633
|
-
src: getAttrib(image, 'src'),
|
634
|
-
alt: getAlt(image),
|
635
|
-
title: getAttrib(image, 'title'),
|
636
|
-
width: getSize(image, 'width'),
|
637
|
-
height: getSize(image, 'height'),
|
638
|
-
class: getAttrib(image, 'class'),
|
639
|
-
style: normalizeCss(getAttrib(image, 'style')),
|
640
|
-
caption: hasCaption(image),
|
641
|
-
hspace: getHspace(image),
|
642
|
-
vspace: getVspace(image),
|
643
|
-
border: getBorder(image),
|
644
|
-
borderStyle: getBorderStyle(image),
|
645
|
-
isDecorative: getIsDecorative(image)
|
646
|
-
}); };
|
647
|
-
var updateProp = function (image, oldData, newData, name, set) {
|
648
|
-
if (newData[name] !== oldData[name]) {
|
649
|
-
set(image, name, String(newData[name]));
|
650
|
-
}
|
651
|
-
};
|
652
|
-
var setAlt = function (image, alt, isDecorative) {
|
653
|
-
if (isDecorative) {
|
654
|
-
DOM.setAttrib(image, 'role', 'presentation');
|
655
|
-
var sugarImage = SugarElement.fromDom(image);
|
656
|
-
set(sugarImage, 'alt', '');
|
657
|
-
}
|
658
|
-
else {
|
659
|
-
if (isNull(alt)) {
|
660
|
-
var sugarImage = SugarElement.fromDom(image);
|
661
|
-
remove(sugarImage, 'alt');
|
662
|
-
}
|
663
|
-
else {
|
664
|
-
var sugarImage = SugarElement.fromDom(image);
|
665
|
-
set(sugarImage, 'alt', alt);
|
666
|
-
}
|
667
|
-
if (DOM.getAttrib(image, 'role') === 'presentation') {
|
668
|
-
DOM.setAttrib(image, 'role', '');
|
669
|
-
}
|
670
|
-
}
|
671
|
-
};
|
672
|
-
var updateAlt = function (image, oldData, newData) {
|
673
|
-
if (newData.alt !== oldData.alt || newData.isDecorative !== oldData.isDecorative) {
|
674
|
-
setAlt(image, newData.alt, newData.isDecorative);
|
675
|
-
}
|
676
|
-
};
|
677
|
-
var normalized = function (set, normalizeCss) { return function (image, name, value) {
|
678
|
-
set(image, value);
|
679
|
-
normalizeStyle(image, normalizeCss);
|
680
|
-
}; };
|
681
|
-
var write = function (normalizeCss, newData, image) {
|
682
|
-
var oldData = read(normalizeCss, image);
|
683
|
-
updateProp(image, oldData, newData, 'caption', function (image, _name, _value) { return toggleCaption(image); });
|
684
|
-
updateProp(image, oldData, newData, 'src', updateAttrib);
|
685
|
-
updateProp(image, oldData, newData, 'title', updateAttrib);
|
686
|
-
updateProp(image, oldData, newData, 'width', setSize('width', normalizeCss));
|
687
|
-
updateProp(image, oldData, newData, 'height', setSize('height', normalizeCss));
|
688
|
-
updateProp(image, oldData, newData, 'class', updateAttrib);
|
689
|
-
updateProp(image, oldData, newData, 'style', normalized(function (image, value) { return updateAttrib(image, 'style', value); }, normalizeCss));
|
690
|
-
updateProp(image, oldData, newData, 'hspace', normalized(setHspace, normalizeCss));
|
691
|
-
updateProp(image, oldData, newData, 'vspace', normalized(setVspace, normalizeCss));
|
692
|
-
updateProp(image, oldData, newData, 'border', normalized(setBorder, normalizeCss));
|
693
|
-
updateProp(image, oldData, newData, 'borderStyle', normalized(setBorderStyle, normalizeCss));
|
694
|
-
updateAlt(image, oldData, newData);
|
695
|
-
};
|
696
|
-
var normalizeCss$1 = function (editor, cssText) {
|
697
|
-
var css = editor.dom.styles.parse(cssText);
|
698
|
-
var mergedCss = mergeMargins(css);
|
699
|
-
var compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));
|
700
|
-
return editor.dom.styles.serialize(compressed);
|
701
|
-
};
|
702
|
-
var getSelectedImage = function (editor) {
|
703
|
-
var imgElm = editor.selection.getNode();
|
704
|
-
var figureElm = editor.dom.getParent(imgElm, 'figure.image');
|
705
|
-
if (figureElm) {
|
706
|
-
return editor.dom.select('img', figureElm)[0];
|
707
|
-
}
|
708
|
-
if (imgElm && (imgElm.nodeName !== 'IMG' || isPlaceholderImage(imgElm))) {
|
709
|
-
return null;
|
710
|
-
}
|
711
|
-
return imgElm;
|
712
|
-
};
|
713
|
-
var splitTextBlock = function (editor, figure) {
|
714
|
-
var _a;
|
715
|
-
var dom = editor.dom;
|
716
|
-
var textBlockElements = filter(editor.schema.getTextBlockElements(), function (_, parentElm) { return !editor.schema.isValidChild(parentElm, 'figure'); });
|
717
|
-
var textBlock = dom.getParent(figure.parentNode, function (node) { return hasNonNullableKey(textBlockElements, node.nodeName); }, editor.getBody());
|
718
|
-
if (textBlock) {
|
719
|
-
return (_a = dom.split(textBlock, figure)) !== null && _a !== void 0 ? _a : figure;
|
720
|
-
}
|
721
|
-
else {
|
722
|
-
return figure;
|
723
|
-
}
|
724
|
-
};
|
725
|
-
var readImageDataFromSelection = function (editor) {
|
726
|
-
var image = getSelectedImage(editor);
|
727
|
-
return image ? read(function (css) { return normalizeCss$1(editor, css); }, image) : defaultData();
|
728
|
-
};
|
729
|
-
var insertImageAtCaret = function (editor, data) {
|
730
|
-
var elm = create(function (css) { return normalizeCss$1(editor, css); }, data);
|
731
|
-
editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
|
732
|
-
editor.focus();
|
733
|
-
editor.selection.setContent(elm.outerHTML);
|
734
|
-
var insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
|
735
|
-
editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
|
736
|
-
if (isFigure(insertedElm)) {
|
737
|
-
var figure = splitTextBlock(editor, insertedElm);
|
738
|
-
editor.selection.select(figure);
|
739
|
-
}
|
740
|
-
else {
|
741
|
-
editor.selection.select(insertedElm);
|
742
|
-
}
|
743
|
-
};
|
744
|
-
var syncSrcAttr = function (editor, image) {
|
745
|
-
editor.dom.setAttrib(image, 'src', image.getAttribute('src'));
|
746
|
-
};
|
747
|
-
var deleteImage = function (editor, image) {
|
748
|
-
if (image) {
|
749
|
-
var elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
|
750
|
-
editor.dom.remove(elm);
|
751
|
-
editor.focus();
|
752
|
-
editor.nodeChanged();
|
753
|
-
if (editor.dom.isEmpty(editor.getBody())) {
|
754
|
-
editor.setContent('');
|
755
|
-
editor.selection.setCursorLocation();
|
756
|
-
}
|
757
|
-
}
|
758
|
-
};
|
759
|
-
var writeImageDataToSelection = function (editor, data) {
|
760
|
-
var image = getSelectedImage(editor);
|
761
|
-
if (image) {
|
762
|
-
write(function (css) { return normalizeCss$1(editor, css); }, data, image);
|
763
|
-
syncSrcAttr(editor, image);
|
764
|
-
if (isFigure(image.parentNode)) {
|
765
|
-
var figure = image.parentNode;
|
766
|
-
splitTextBlock(editor, figure);
|
767
|
-
editor.selection.select(image.parentNode);
|
768
|
-
}
|
769
|
-
else {
|
770
|
-
editor.selection.select(image);
|
771
|
-
waitLoadImage(editor, data, image);
|
772
|
-
}
|
773
|
-
}
|
774
|
-
};
|
775
|
-
var sanitizeImageData = function (editor, data) {
|
776
|
-
var src = data.src;
|
777
|
-
return __assign(__assign({}, data), { src: isSafeImageUrl(editor, src) ? src : '' });
|
778
|
-
};
|
779
|
-
var insertOrUpdateImage = function (editor, partialData) {
|
780
|
-
var image = getSelectedImage(editor);
|
781
|
-
if (image) {
|
782
|
-
var selectedImageData = read(function (css) { return normalizeCss$1(editor, css); }, image);
|
783
|
-
var data = __assign(__assign({}, selectedImageData), partialData);
|
784
|
-
var sanitizedData = sanitizeImageData(editor, data);
|
785
|
-
if (data.src) {
|
786
|
-
writeImageDataToSelection(editor, sanitizedData);
|
787
|
-
}
|
788
|
-
else {
|
789
|
-
deleteImage(editor, image);
|
790
|
-
}
|
791
|
-
}
|
792
|
-
else if (partialData.src) {
|
793
|
-
insertImageAtCaret(editor, __assign(__assign({}, defaultData()), partialData));
|
794
|
-
}
|
795
|
-
};
|
796
|
-
var deep = function (old, nu) {
|
797
|
-
var bothObjects = isPlainObject(old) && isPlainObject(nu);
|
798
|
-
return bothObjects ? deepMerge(old, nu) : nu;
|
799
|
-
};
|
800
|
-
var baseMerge = function (merger) {
|
801
|
-
return function () {
|
802
|
-
var objects = [];
|
803
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
804
|
-
objects[_i] = arguments[_i];
|
805
|
-
}
|
806
|
-
if (objects.length === 0) {
|
807
|
-
throw new Error("Can't merge zero objects");
|
808
|
-
}
|
809
|
-
var ret = {};
|
810
|
-
for (var j = 0; j < objects.length; j++) {
|
811
|
-
var curObject = objects[j];
|
812
|
-
for (var key in curObject) {
|
813
|
-
if (has(curObject, key)) {
|
814
|
-
ret[key] = merger(ret[key], curObject[key]);
|
815
|
-
}
|
816
|
-
}
|
817
|
-
}
|
818
|
-
return ret;
|
819
|
-
};
|
820
|
-
};
|
821
|
-
var deepMerge = baseMerge(deep);
|
822
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.util.ImageUploader');
|
823
|
-
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
824
|
-
var getValue = function (item) { return isString(item.value) ? item.value : ''; };
|
825
|
-
var getText = function (item) {
|
826
|
-
if (isString(item.text)) {
|
827
|
-
return item.text;
|
828
|
-
}
|
829
|
-
else if (isString(item.title)) {
|
830
|
-
return item.title;
|
831
|
-
}
|
832
|
-
else {
|
833
|
-
return '';
|
834
|
-
}
|
835
|
-
};
|
836
|
-
var sanitizeList = function (list, extractValue) {
|
837
|
-
var out = [];
|
838
|
-
global.each(list, function (item) {
|
839
|
-
var text = getText(item);
|
840
|
-
if (item.menu !== undefined) {
|
841
|
-
var items = sanitizeList(item.menu, extractValue);
|
842
|
-
out.push({
|
843
|
-
text: text,
|
844
|
-
items: items
|
845
|
-
});
|
846
|
-
}
|
847
|
-
else {
|
848
|
-
var value = extractValue(item);
|
849
|
-
out.push({
|
850
|
-
text: text,
|
851
|
-
value: value
|
852
|
-
});
|
853
|
-
}
|
854
|
-
});
|
855
|
-
return out;
|
856
|
-
};
|
857
|
-
var sanitizer = function (extractor) {
|
858
|
-
if (extractor === void 0) { extractor = getValue; }
|
859
|
-
return function (list) {
|
860
|
-
if (list) {
|
861
|
-
return Optional.from(list).map(function (list) { return sanitizeList(list, extractor); });
|
862
|
-
}
|
863
|
-
else {
|
864
|
-
return Optional.none();
|
865
|
-
}
|
866
|
-
};
|
867
|
-
};
|
868
|
-
var sanitize = function (list) { return sanitizer(getValue)(list); };
|
869
|
-
var isGroup = function (item) { return has(item, 'items'); };
|
870
|
-
var findEntryDelegate = function (list, value) { return findMap(list, function (item) {
|
871
|
-
if (isGroup(item)) {
|
872
|
-
return findEntryDelegate(item.items, value);
|
873
|
-
}
|
874
|
-
else if (item.value === value) {
|
875
|
-
return Optional.some(item);
|
876
|
-
}
|
877
|
-
else {
|
878
|
-
return Optional.none();
|
879
|
-
}
|
880
|
-
}); };
|
881
|
-
var findEntry = function (optList, value) { return optList.bind(function (list) { return findEntryDelegate(list, value); }); };
|
882
|
-
var ListUtils = {
|
883
|
-
sanitizer: sanitizer,
|
884
|
-
sanitize: sanitize,
|
885
|
-
findEntry: findEntry
|
886
|
-
};
|
887
|
-
var makeTab$2 = function (_info) { return ({
|
888
|
-
title: 'Advanced',
|
889
|
-
name: 'advanced',
|
890
|
-
items: [{
|
891
|
-
type: 'grid',
|
892
|
-
columns: 2,
|
893
|
-
items: [
|
894
|
-
{
|
895
|
-
type: 'input',
|
896
|
-
label: 'Vertical space',
|
897
|
-
name: 'vspace',
|
898
|
-
inputMode: 'numeric'
|
899
|
-
},
|
900
|
-
{
|
901
|
-
type: 'input',
|
902
|
-
label: 'Horizontal space',
|
903
|
-
name: 'hspace',
|
904
|
-
inputMode: 'numeric'
|
905
|
-
},
|
906
|
-
{
|
907
|
-
type: 'input',
|
908
|
-
label: 'Border width',
|
909
|
-
name: 'border',
|
910
|
-
inputMode: 'numeric'
|
911
|
-
},
|
912
|
-
{
|
913
|
-
type: 'listbox',
|
914
|
-
name: 'borderstyle',
|
915
|
-
label: 'Border style',
|
916
|
-
items: [
|
917
|
-
{
|
918
|
-
text: 'Select...',
|
919
|
-
value: ''
|
920
|
-
},
|
921
|
-
{
|
922
|
-
text: 'Solid',
|
923
|
-
value: 'solid'
|
924
|
-
},
|
925
|
-
{
|
926
|
-
text: 'Dotted',
|
927
|
-
value: 'dotted'
|
928
|
-
},
|
929
|
-
{
|
930
|
-
text: 'Dashed',
|
931
|
-
value: 'dashed'
|
932
|
-
},
|
933
|
-
{
|
934
|
-
text: 'Double',
|
935
|
-
value: 'double'
|
936
|
-
},
|
937
|
-
{
|
938
|
-
text: 'Groove',
|
939
|
-
value: 'groove'
|
940
|
-
},
|
941
|
-
{
|
942
|
-
text: 'Ridge',
|
943
|
-
value: 'ridge'
|
944
|
-
},
|
945
|
-
{
|
946
|
-
text: 'Inset',
|
947
|
-
value: 'inset'
|
948
|
-
},
|
949
|
-
{
|
950
|
-
text: 'Outset',
|
951
|
-
value: 'outset'
|
952
|
-
},
|
953
|
-
{
|
954
|
-
text: 'None',
|
955
|
-
value: 'none'
|
956
|
-
},
|
957
|
-
{
|
958
|
-
text: 'Hidden',
|
959
|
-
value: 'hidden'
|
960
|
-
}
|
961
|
-
]
|
962
|
-
}
|
963
|
-
]
|
964
|
-
}]
|
965
|
-
}); };
|
966
|
-
var AdvTab = { makeTab: makeTab$2 };
|
967
|
-
var collect = function (editor) {
|
968
|
-
var urlListSanitizer = ListUtils.sanitizer(function (item) { return editor.convertURL(item.value || item.url || '', 'src'); });
|
969
|
-
var futureImageList = new Promise(function (completer) {
|
970
|
-
createImageList(editor, function (imageList) {
|
971
|
-
completer(urlListSanitizer(imageList).map(function (items) { return flatten([
|
972
|
-
[{
|
973
|
-
text: 'None',
|
974
|
-
value: ''
|
975
|
-
}],
|
976
|
-
items
|
977
|
-
]); }));
|
978
|
-
});
|
979
|
-
});
|
980
|
-
var classList = ListUtils.sanitize(getClassList(editor));
|
981
|
-
var hasAdvTab$1 = hasAdvTab(editor);
|
982
|
-
var hasUploadTab$1 = hasUploadTab(editor);
|
983
|
-
var hasUploadUrl$1 = hasUploadUrl(editor);
|
984
|
-
var hasUploadHandler$1 = hasUploadHandler(editor);
|
985
|
-
var image = readImageDataFromSelection(editor);
|
986
|
-
var hasDescription$1 = hasDescription(editor);
|
987
|
-
var hasImageTitle$1 = hasImageTitle(editor);
|
988
|
-
var hasDimensions$1 = hasDimensions(editor);
|
989
|
-
var hasImageCaption$1 = hasImageCaption(editor);
|
990
|
-
var hasAccessibilityOptions = showAccessibilityOptions(editor);
|
991
|
-
var automaticUploads = isAutomaticUploadsEnabled(editor);
|
992
|
-
var prependURL = Optional.some(getPrependUrl(editor)).filter(function (preUrl) { return isString(preUrl) && preUrl.length > 0; });
|
993
|
-
return futureImageList.then(function (imageList) { return ({
|
994
|
-
image: image,
|
995
|
-
imageList: imageList,
|
996
|
-
classList: classList,
|
997
|
-
hasAdvTab: hasAdvTab$1,
|
998
|
-
hasUploadTab: hasUploadTab$1,
|
999
|
-
hasUploadUrl: hasUploadUrl$1,
|
1000
|
-
hasUploadHandler: hasUploadHandler$1,
|
1001
|
-
hasDescription: hasDescription$1,
|
1002
|
-
hasImageTitle: hasImageTitle$1,
|
1003
|
-
hasDimensions: hasDimensions$1,
|
1004
|
-
hasImageCaption: hasImageCaption$1,
|
1005
|
-
prependURL: prependURL,
|
1006
|
-
hasAccessibilityOptions: hasAccessibilityOptions,
|
1007
|
-
automaticUploads: automaticUploads
|
1008
|
-
}); });
|
1009
|
-
};
|
1010
|
-
var makeItems = function (info) {
|
1011
|
-
var imageUrl = {
|
1012
|
-
name: 'src',
|
1013
|
-
type: 'urlinput',
|
1014
|
-
filetype: 'image',
|
1015
|
-
label: 'Source',
|
1016
|
-
picker_text: 'Browse files'
|
1017
|
-
};
|
1018
|
-
var imageList = info.imageList.map(function (items) { return ({
|
1019
|
-
name: 'images',
|
1020
|
-
type: 'listbox',
|
1021
|
-
label: 'Image list',
|
1022
|
-
items: items
|
1023
|
-
}); });
|
1024
|
-
var imageDescription = {
|
1025
|
-
name: 'alt',
|
1026
|
-
type: 'input',
|
1027
|
-
label: 'Alternative description',
|
1028
|
-
enabled: !(info.hasAccessibilityOptions && info.image.isDecorative)
|
1029
|
-
};
|
1030
|
-
var imageTitle = {
|
1031
|
-
name: 'title',
|
1032
|
-
type: 'input',
|
1033
|
-
label: 'Image title'
|
1034
|
-
};
|
1035
|
-
var imageDimensions = {
|
1036
|
-
name: 'dimensions',
|
1037
|
-
type: 'sizeinput'
|
1038
|
-
};
|
1039
|
-
var isDecorative = {
|
1040
|
-
type: 'label',
|
1041
|
-
label: 'Accessibility',
|
1042
|
-
items: [{
|
1043
|
-
name: 'isDecorative',
|
1044
|
-
type: 'checkbox',
|
1045
|
-
label: 'Image is decorative'
|
1046
|
-
}]
|
1047
|
-
};
|
1048
|
-
var classList = info.classList.map(function (items) { return ({
|
1049
|
-
name: 'classes',
|
1050
|
-
type: 'listbox',
|
1051
|
-
label: 'Class',
|
1052
|
-
items: items
|
1053
|
-
}); });
|
1054
|
-
var caption = {
|
1055
|
-
type: 'label',
|
1056
|
-
label: 'Caption',
|
1057
|
-
items: [{
|
1058
|
-
type: 'checkbox',
|
1059
|
-
name: 'caption',
|
1060
|
-
label: 'Show caption'
|
1061
|
-
}]
|
1062
|
-
};
|
1063
|
-
var getDialogContainerType = function (useColumns) { return useColumns ? {
|
1064
|
-
type: 'grid',
|
1065
|
-
columns: 2
|
1066
|
-
} : { type: 'panel' }; };
|
1067
|
-
return flatten([
|
1068
|
-
[imageUrl],
|
1069
|
-
imageList.toArray(),
|
1070
|
-
info.hasAccessibilityOptions && info.hasDescription ? [isDecorative] : [],
|
1071
|
-
info.hasDescription ? [imageDescription] : [],
|
1072
|
-
info.hasImageTitle ? [imageTitle] : [],
|
1073
|
-
info.hasDimensions ? [imageDimensions] : [],
|
1074
|
-
[__assign(__assign({}, getDialogContainerType(info.classList.isSome() && info.hasImageCaption)), { items: flatten([
|
1075
|
-
classList.toArray(),
|
1076
|
-
info.hasImageCaption ? [caption] : []
|
1077
|
-
]) })]
|
1078
|
-
]);
|
1079
|
-
};
|
1080
|
-
var makeTab$1 = function (info) { return ({
|
1081
|
-
title: 'General',
|
1082
|
-
name: 'general',
|
1083
|
-
items: makeItems(info)
|
1084
|
-
}); };
|
1085
|
-
var MainTab = {
|
1086
|
-
makeTab: makeTab$1,
|
1087
|
-
makeItems: makeItems
|
1088
|
-
};
|
1089
|
-
var makeTab = function (_info) {
|
1090
|
-
var items = [{
|
1091
|
-
type: 'dropzone',
|
1092
|
-
name: 'fileinput'
|
1093
|
-
}];
|
1094
|
-
return {
|
1095
|
-
title: 'Upload',
|
1096
|
-
name: 'upload',
|
1097
|
-
items: items
|
1098
|
-
};
|
1099
|
-
};
|
1100
|
-
var UploadTab = { makeTab: makeTab };
|
1101
|
-
var createState = function (info) { return ({
|
1102
|
-
prevImage: ListUtils.findEntry(info.imageList, info.image.src),
|
1103
|
-
prevAlt: info.image.alt,
|
1104
|
-
open: true
|
1105
|
-
}); };
|
1106
|
-
var fromImageData = function (image) { return ({
|
1107
|
-
src: {
|
1108
|
-
value: image.src,
|
1109
|
-
meta: {}
|
1110
|
-
},
|
1111
|
-
images: image.src,
|
1112
|
-
alt: image.alt,
|
1113
|
-
title: image.title,
|
1114
|
-
dimensions: {
|
1115
|
-
width: image.width,
|
1116
|
-
height: image.height
|
1117
|
-
},
|
1118
|
-
classes: image.class,
|
1119
|
-
caption: image.caption,
|
1120
|
-
style: image.style,
|
1121
|
-
vspace: image.vspace,
|
1122
|
-
border: image.border,
|
1123
|
-
hspace: image.hspace,
|
1124
|
-
borderstyle: image.borderStyle,
|
1125
|
-
fileinput: [],
|
1126
|
-
isDecorative: image.isDecorative
|
1127
|
-
}); };
|
1128
|
-
var toImageData = function (data, removeEmptyAlt) { return ({
|
1129
|
-
src: data.src.value,
|
1130
|
-
alt: (data.alt === null || data.alt.length === 0) && removeEmptyAlt ? null : data.alt,
|
1131
|
-
title: data.title,
|
1132
|
-
width: data.dimensions.width,
|
1133
|
-
height: data.dimensions.height,
|
1134
|
-
class: data.classes,
|
1135
|
-
style: data.style,
|
1136
|
-
caption: data.caption,
|
1137
|
-
hspace: data.hspace,
|
1138
|
-
vspace: data.vspace,
|
1139
|
-
border: data.border,
|
1140
|
-
borderStyle: data.borderstyle,
|
1141
|
-
isDecorative: data.isDecorative
|
1142
|
-
}); };
|
1143
|
-
var addPrependUrl2 = function (info, srcURL) {
|
1144
|
-
if (!/^(?:[a-zA-Z]+:)?\/\//.test(srcURL)) {
|
1145
|
-
return info.prependURL.bind(function (prependUrl) {
|
1146
|
-
if (srcURL.substring(0, prependUrl.length) !== prependUrl) {
|
1147
|
-
return Optional.some(prependUrl + srcURL);
|
1148
|
-
}
|
1149
|
-
return Optional.none();
|
1150
|
-
});
|
1151
|
-
}
|
1152
|
-
return Optional.none();
|
1153
|
-
};
|
1154
|
-
var addPrependUrl = function (info, api) {
|
1155
|
-
var data = api.getData();
|
1156
|
-
addPrependUrl2(info, data.src.value).each(function (srcURL) {
|
1157
|
-
api.setData({
|
1158
|
-
src: {
|
1159
|
-
value: srcURL,
|
1160
|
-
meta: data.src.meta
|
1161
|
-
}
|
1162
|
-
});
|
1163
|
-
});
|
1164
|
-
};
|
1165
|
-
var formFillFromMeta2 = function (info, data, meta) {
|
1166
|
-
if (info.hasDescription && isString(meta.alt)) {
|
1167
|
-
data.alt = meta.alt;
|
1168
|
-
}
|
1169
|
-
if (info.hasAccessibilityOptions) {
|
1170
|
-
data.isDecorative = meta.isDecorative || data.isDecorative || false;
|
1171
|
-
}
|
1172
|
-
if (info.hasImageTitle && isString(meta.title)) {
|
1173
|
-
data.title = meta.title;
|
1174
|
-
}
|
1175
|
-
if (info.hasDimensions) {
|
1176
|
-
if (isString(meta.width)) {
|
1177
|
-
data.dimensions.width = meta.width;
|
1178
|
-
}
|
1179
|
-
if (isString(meta.height)) {
|
1180
|
-
data.dimensions.height = meta.height;
|
1181
|
-
}
|
1182
|
-
}
|
1183
|
-
if (isString(meta.class)) {
|
1184
|
-
ListUtils.findEntry(info.classList, meta.class).each(function (entry) {
|
1185
|
-
data.classes = entry.value;
|
1186
|
-
});
|
1187
|
-
}
|
1188
|
-
if (info.hasImageCaption) {
|
1189
|
-
if (isBoolean(meta.caption)) {
|
1190
|
-
data.caption = meta.caption;
|
1191
|
-
}
|
1192
|
-
}
|
1193
|
-
if (info.hasAdvTab) {
|
1194
|
-
if (isString(meta.style)) {
|
1195
|
-
data.style = meta.style;
|
1196
|
-
}
|
1197
|
-
if (isString(meta.vspace)) {
|
1198
|
-
data.vspace = meta.vspace;
|
1199
|
-
}
|
1200
|
-
if (isString(meta.border)) {
|
1201
|
-
data.border = meta.border;
|
1202
|
-
}
|
1203
|
-
if (isString(meta.hspace)) {
|
1204
|
-
data.hspace = meta.hspace;
|
1205
|
-
}
|
1206
|
-
if (isString(meta.borderstyle)) {
|
1207
|
-
data.borderstyle = meta.borderstyle;
|
1208
|
-
}
|
1209
|
-
}
|
1210
|
-
};
|
1211
|
-
var formFillFromMeta = function (info, api) {
|
1212
|
-
var data = api.getData();
|
1213
|
-
var meta = data.src.meta;
|
1214
|
-
if (meta !== undefined) {
|
1215
|
-
var newData = deepMerge({}, data);
|
1216
|
-
formFillFromMeta2(info, newData, meta);
|
1217
|
-
api.setData(newData);
|
1218
|
-
}
|
1219
|
-
};
|
1220
|
-
var calculateImageSize = function (helpers, info, state, api) {
|
1221
|
-
var data = api.getData();
|
1222
|
-
var url = data.src.value;
|
1223
|
-
var meta = data.src.meta || {};
|
1224
|
-
if (!meta.width && !meta.height && info.hasDimensions) {
|
1225
|
-
if (isNotEmpty(url)) {
|
1226
|
-
helpers.imageSize(url).then(function (size) {
|
1227
|
-
if (state.open) {
|
1228
|
-
api.setData({ dimensions: size });
|
1229
|
-
}
|
1230
|
-
}).catch(function (e) { return console.error(e); });
|
1231
|
-
}
|
1232
|
-
else {
|
1233
|
-
api.setData({
|
1234
|
-
dimensions: {
|
1235
|
-
width: '',
|
1236
|
-
height: ''
|
1237
|
-
}
|
1238
|
-
});
|
1239
|
-
}
|
1240
|
-
}
|
1241
|
-
};
|
1242
|
-
var updateImagesDropdown = function (info, state, api) {
|
1243
|
-
var data = api.getData();
|
1244
|
-
var image = ListUtils.findEntry(info.imageList, data.src.value);
|
1245
|
-
state.prevImage = image;
|
1246
|
-
api.setData({ images: image.map(function (entry) { return entry.value; }).getOr('') });
|
1247
|
-
};
|
1248
|
-
var changeSrc = function (helpers, info, state, api) {
|
1249
|
-
addPrependUrl(info, api);
|
1250
|
-
formFillFromMeta(info, api);
|
1251
|
-
calculateImageSize(helpers, info, state, api);
|
1252
|
-
updateImagesDropdown(info, state, api);
|
1253
|
-
};
|
1254
|
-
var changeImages = function (helpers, info, state, api) {
|
1255
|
-
var data = api.getData();
|
1256
|
-
var image = ListUtils.findEntry(info.imageList, data.images);
|
1257
|
-
image.each(function (img) {
|
1258
|
-
var updateAlt = data.alt === '' || state.prevImage.map(function (image) { return image.text === data.alt; }).getOr(false);
|
1259
|
-
if (updateAlt) {
|
1260
|
-
if (img.value === '') {
|
1261
|
-
api.setData({
|
1262
|
-
src: img,
|
1263
|
-
alt: state.prevAlt
|
1264
|
-
});
|
1265
|
-
}
|
1266
|
-
else {
|
1267
|
-
api.setData({
|
1268
|
-
src: img,
|
1269
|
-
alt: img.text
|
1270
|
-
});
|
1271
|
-
}
|
1272
|
-
}
|
1273
|
-
else {
|
1274
|
-
api.setData({ src: img });
|
1275
|
-
}
|
1276
|
-
});
|
1277
|
-
state.prevImage = image;
|
1278
|
-
changeSrc(helpers, info, state, api);
|
1279
|
-
};
|
1280
|
-
var changeFileInput = function (helpers, info, state, api) {
|
1281
|
-
var data = api.getData();
|
1282
|
-
api.block('Uploading image');
|
1283
|
-
head(data.fileinput).fold(function () {
|
1284
|
-
api.unblock();
|
1285
|
-
}, function (file) {
|
1286
|
-
var blobUri = URL.createObjectURL(file);
|
1287
|
-
var finalize = function () {
|
1288
|
-
api.unblock();
|
1289
|
-
URL.revokeObjectURL(blobUri);
|
1290
|
-
};
|
1291
|
-
var updateSrcAndSwitchTab = function (url) {
|
1292
|
-
api.setData({
|
1293
|
-
src: {
|
1294
|
-
value: url,
|
1295
|
-
meta: {}
|
1296
|
-
}
|
1297
|
-
});
|
1298
|
-
api.showTab('general');
|
1299
|
-
changeSrc(helpers, info, state, api);
|
1300
|
-
};
|
1301
|
-
blobToDataUri(file).then(function (dataUrl) {
|
1302
|
-
var blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
|
1303
|
-
if (info.automaticUploads) {
|
1304
|
-
helpers.uploadImage(blobInfo).then(function (result) {
|
1305
|
-
updateSrcAndSwitchTab(result.url);
|
1306
|
-
finalize();
|
1307
|
-
}).catch(function (err) {
|
1308
|
-
finalize();
|
1309
|
-
helpers.alertErr(err);
|
1310
|
-
});
|
1311
|
-
}
|
1312
|
-
else {
|
1313
|
-
helpers.addToBlobCache(blobInfo);
|
1314
|
-
updateSrcAndSwitchTab(blobInfo.blobUri());
|
1315
|
-
api.unblock();
|
1316
|
-
}
|
1317
|
-
});
|
1318
|
-
});
|
1319
|
-
};
|
1320
|
-
var changeHandler = function (helpers, info, state) { return function (api, evt) {
|
1321
|
-
if (evt.name === 'src') {
|
1322
|
-
changeSrc(helpers, info, state, api);
|
1323
|
-
}
|
1324
|
-
else if (evt.name === 'images') {
|
1325
|
-
changeImages(helpers, info, state, api);
|
1326
|
-
}
|
1327
|
-
else if (evt.name === 'alt') {
|
1328
|
-
state.prevAlt = api.getData().alt;
|
1329
|
-
}
|
1330
|
-
else if (evt.name === 'fileinput') {
|
1331
|
-
changeFileInput(helpers, info, state, api);
|
1332
|
-
}
|
1333
|
-
else if (evt.name === 'isDecorative') {
|
1334
|
-
api.setEnabled('alt', !api.getData().isDecorative);
|
1335
|
-
}
|
1336
|
-
}; };
|
1337
|
-
var closeHandler = function (state) { return function () {
|
1338
|
-
state.open = false;
|
1339
|
-
}; };
|
1340
|
-
var makeDialogBody = function (info) {
|
1341
|
-
if (info.hasAdvTab || info.hasUploadUrl || info.hasUploadHandler) {
|
1342
|
-
var tabPanel = {
|
1343
|
-
type: 'tabpanel',
|
1344
|
-
tabs: flatten([
|
1345
|
-
[MainTab.makeTab(info)],
|
1346
|
-
info.hasAdvTab ? [AdvTab.makeTab(info)] : [],
|
1347
|
-
info.hasUploadTab && (info.hasUploadUrl || info.hasUploadHandler) ? [UploadTab.makeTab(info)] : []
|
1348
|
-
])
|
1349
|
-
};
|
1350
|
-
return tabPanel;
|
1351
|
-
}
|
1352
|
-
else {
|
1353
|
-
var panel = {
|
1354
|
-
type: 'panel',
|
1355
|
-
items: MainTab.makeItems(info)
|
1356
|
-
};
|
1357
|
-
return panel;
|
1358
|
-
}
|
1359
|
-
};
|
1360
|
-
var submitHandler = function (editor, info, helpers) { return function (api) {
|
1361
|
-
var data = deepMerge(fromImageData(info.image), api.getData());
|
1362
|
-
var finalData = __assign(__assign({}, data), { style: getStyleValue(helpers.normalizeCss, toImageData(data, false)) });
|
1363
|
-
editor.execCommand('mceUpdateImage', false, toImageData(finalData, info.hasAccessibilityOptions));
|
1364
|
-
editor.editorUpload.uploadImagesAuto();
|
1365
|
-
api.close();
|
1366
|
-
}; };
|
1367
|
-
var imageSize = function (editor) { return function (url) {
|
1368
|
-
if (!isSafeImageUrl(editor, url)) {
|
1369
|
-
return Promise.resolve({
|
1370
|
-
width: '',
|
1371
|
-
height: ''
|
1372
|
-
});
|
1373
|
-
}
|
1374
|
-
else {
|
1375
|
-
return getImageSize(editor.documentBaseURI.toAbsolute(url)).then(function (dimensions) { return ({
|
1376
|
-
width: String(dimensions.width),
|
1377
|
-
height: String(dimensions.height)
|
1378
|
-
}); });
|
1379
|
-
}
|
1380
|
-
}; };
|
1381
|
-
var createBlobCache = function (editor) { return function (file, blobUri, dataUrl) {
|
1382
|
-
var _a;
|
1383
|
-
return editor.editorUpload.blobCache.create({
|
1384
|
-
blob: file,
|
1385
|
-
blobUri: blobUri,
|
1386
|
-
name: (_a = file.name) === null || _a === void 0 ? void 0 : _a.replace(/\.[^\.]+$/, ''),
|
1387
|
-
filename: file.name,
|
1388
|
-
base64: dataUrl.split(',')[1]
|
1389
|
-
});
|
1390
|
-
}; };
|
1391
|
-
var addToBlobCache = function (editor) { return function (blobInfo) {
|
1392
|
-
editor.editorUpload.blobCache.add(blobInfo);
|
1393
|
-
}; };
|
1394
|
-
var alertErr = function (editor) { return function (message) {
|
1395
|
-
editor.windowManager.alert(message);
|
1396
|
-
}; };
|
1397
|
-
var normalizeCss = function (editor) { return function (cssText) { return normalizeCss$1(editor, cssText); }; };
|
1398
|
-
var parseStyle = function (editor) { return function (cssText) { return editor.dom.parseStyle(cssText); }; };
|
1399
|
-
var serializeStyle = function (editor) { return function (stylesArg, name) { return editor.dom.serializeStyle(stylesArg, name); }; };
|
1400
|
-
var uploadImage = function (editor) { return function (blobInfo) { return global$1(editor).upload([blobInfo], false).then(function (results) {
|
1401
|
-
var _a;
|
1402
|
-
if (results.length === 0) {
|
1403
|
-
return Promise.reject('Failed to upload image');
|
1404
|
-
}
|
1405
|
-
else if (results[0].status === false) {
|
1406
|
-
return Promise.reject((_a = results[0].error) === null || _a === void 0 ? void 0 : _a.message);
|
1407
|
-
}
|
1408
|
-
else {
|
1409
|
-
return results[0];
|
1410
|
-
}
|
1411
|
-
}); }; };
|
1412
|
-
var Dialog = function (editor) {
|
1413
|
-
var helpers = {
|
1414
|
-
imageSize: imageSize(editor),
|
1415
|
-
addToBlobCache: addToBlobCache(editor),
|
1416
|
-
createBlobCache: createBlobCache(editor),
|
1417
|
-
alertErr: alertErr(editor),
|
1418
|
-
normalizeCss: normalizeCss(editor),
|
1419
|
-
parseStyle: parseStyle(editor),
|
1420
|
-
serializeStyle: serializeStyle(editor),
|
1421
|
-
uploadImage: uploadImage(editor)
|
1422
|
-
};
|
1423
|
-
var open = function () {
|
1424
|
-
collect(editor).then(function (info) {
|
1425
|
-
var state = createState(info);
|
1426
|
-
return {
|
1427
|
-
title: 'Insert/Edit Image',
|
1428
|
-
size: 'normal',
|
1429
|
-
body: makeDialogBody(info),
|
1430
|
-
buttons: [
|
1431
|
-
{
|
1432
|
-
type: 'cancel',
|
1433
|
-
name: 'cancel',
|
1434
|
-
text: 'Cancel'
|
1435
|
-
},
|
1436
|
-
{
|
1437
|
-
type: 'submit',
|
1438
|
-
name: 'save',
|
1439
|
-
text: 'Save',
|
1440
|
-
primary: true
|
1441
|
-
}
|
1442
|
-
],
|
1443
|
-
initialData: fromImageData(info.image),
|
1444
|
-
onSubmit: submitHandler(editor, info, helpers),
|
1445
|
-
onChange: changeHandler(helpers, info, state),
|
1446
|
-
onClose: closeHandler(state)
|
1447
|
-
};
|
1448
|
-
}).then(editor.windowManager.open);
|
1449
|
-
};
|
1450
|
-
return { open: open };
|
1451
|
-
};
|
1452
|
-
var register$1 = function (editor) {
|
1453
|
-
editor.addCommand('mceImage', Dialog(editor).open);
|
1454
|
-
editor.addCommand('mceUpdateImage', function (_ui, data) {
|
1455
|
-
editor.undoManager.transact(function () { return insertOrUpdateImage(editor, data); });
|
1456
|
-
});
|
1457
|
-
};
|
1458
|
-
var hasImageClass = function (node) {
|
1459
|
-
var className = node.attr('class');
|
1460
|
-
return isNonNullable(className) && /\bimage\b/.test(className);
|
1461
|
-
};
|
1462
|
-
var toggleContentEditableState = function (state) { return function (nodes) {
|
1463
|
-
var i = nodes.length;
|
1464
|
-
var toggleContentEditable = function (node) {
|
1465
|
-
node.attr('contenteditable', state ? 'true' : null);
|
1466
|
-
};
|
1467
|
-
while (i--) {
|
1468
|
-
var node = nodes[i];
|
1469
|
-
if (hasImageClass(node)) {
|
1470
|
-
node.attr('contenteditable', state ? 'false' : null);
|
1471
|
-
global.each(node.getAll('figcaption'), toggleContentEditable);
|
1472
|
-
}
|
1473
|
-
}
|
1474
|
-
}; };
|
1475
|
-
var setup = function (editor) {
|
1476
|
-
editor.on('PreInit', function () {
|
1477
|
-
editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
|
1478
|
-
editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
|
1479
|
-
});
|
1480
|
-
};
|
1481
|
-
var onSetupEditable = function (editor) { return function (api) {
|
1482
|
-
var nodeChanged = function () {
|
1483
|
-
api.setEnabled(editor.selection.isEditable());
|
1484
|
-
};
|
1485
|
-
editor.on('NodeChange', nodeChanged);
|
1486
|
-
nodeChanged();
|
1487
|
-
return function () {
|
1488
|
-
editor.off('NodeChange', nodeChanged);
|
1489
|
-
};
|
1490
|
-
}; };
|
1491
|
-
var register = function (editor) {
|
1492
|
-
editor.ui.registry.addToggleButton('image', {
|
1493
|
-
icon: 'image',
|
1494
|
-
tooltip: 'Insert/edit image',
|
1495
|
-
onAction: Dialog(editor).open,
|
1496
|
-
onSetup: function (buttonApi) {
|
1497
|
-
buttonApi.setActive(isNonNullable(getSelectedImage(editor)));
|
1498
|
-
var unbindSelectorChanged = editor.selection.selectorChangedWithUnbind('img:not([data-mce-object]):not([data-mce-placeholder]),figure.image', buttonApi.setActive).unbind;
|
1499
|
-
var unbindEditable = onSetupEditable(editor)(buttonApi);
|
1500
|
-
return function () {
|
1501
|
-
unbindSelectorChanged();
|
1502
|
-
unbindEditable();
|
1503
|
-
};
|
1504
|
-
}
|
1505
|
-
});
|
1506
|
-
editor.ui.registry.addMenuItem('image', {
|
1507
|
-
icon: 'image',
|
1508
|
-
text: 'Image...',
|
1509
|
-
onAction: Dialog(editor).open,
|
1510
|
-
onSetup: onSetupEditable(editor)
|
1511
|
-
});
|
1512
|
-
editor.ui.registry.addContextMenu('image', { update: function (element) { return editor.selection.isEditable() && (isFigure(element) || isImage(element) && !isPlaceholderImage(element)) ? ['image'] : []; } });
|
1513
|
-
};
|
1514
|
-
var Plugin = function () {
|
1515
|
-
global$4.add('image', function (editor) {
|
1516
|
-
register$2(editor);
|
1517
|
-
setup(editor);
|
1518
|
-
register(editor);
|
1519
|
-
register$1(editor);
|
1520
|
-
});
|
1521
|
-
};
|
1522
|
-
Plugin();
|
1523
|
-
})();
|