@startlibs/form 1.0.0-alpha-10c → 1.0.0-alpha-10d
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/lib/index.js +55 -231
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -44,14 +44,10 @@ var _filter = _interopDefault(require('lodash/fp/filter'));
|
|
|
44
44
|
var _map = _interopDefault(require('lodash/fp/map'));
|
|
45
45
|
var _stubFalse = _interopDefault(require('lodash/fp/stubFalse'));
|
|
46
46
|
var _isObject = _interopDefault(require('lodash/fp/isObject'));
|
|
47
|
-
require('@babel/runtime/helpers/awaitAsyncGenerator');
|
|
48
|
-
require('@babel/runtime/helpers/wrapAsyncGenerator');
|
|
49
|
-
var _ = _interopDefault(require('lodash/fp'));
|
|
50
|
-
require('@babel/runtime/helpers/typeof');
|
|
51
|
-
var createEmotion = _interopDefault(require('create-emotion'));
|
|
52
47
|
var _isFinite = _interopDefault(require('lodash/fp/isFinite'));
|
|
53
48
|
var _negate = _interopDefault(require('lodash/fp/negate'));
|
|
54
49
|
var _zipObject = _interopDefault(require('lodash/fp/zipObject'));
|
|
50
|
+
var _last = _interopDefault(require('lodash/fp/last'));
|
|
55
51
|
var _flatten = _interopDefault(require('lodash/fp/flatten'));
|
|
56
52
|
var _fromPairs = _interopDefault(require('lodash/fp/fromPairs'));
|
|
57
53
|
var _pick = _interopDefault(require('lodash/fp/pick'));
|
|
@@ -3061,206 +3057,6 @@ var FormMeta = function FormMeta(_ref3) {
|
|
|
3061
3057
|
return utils.ifUndefined(utils.callIfFunction(children, value, setValue), value, null);
|
|
3062
3058
|
};
|
|
3063
3059
|
|
|
3064
|
-
var scrollWidth = function () {
|
|
3065
|
-
if (!window.document) return 0;
|
|
3066
|
-
var html = document.documentElement;
|
|
3067
|
-
var oldOverflow = html.style.overflowY;
|
|
3068
|
-
html.style.overflowY = 'scroll';
|
|
3069
|
-
var width = window.innerWidth - html.clientWidth;
|
|
3070
|
-
html.style.overflowY = oldOverflow;
|
|
3071
|
-
return width;
|
|
3072
|
-
}();
|
|
3073
|
-
|
|
3074
|
-
var callIfFunction = function callIfFunction(prop) {
|
|
3075
|
-
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
3076
|
-
args[_key6 - 1] = arguments[_key6];
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
return typeof prop === "function" ? prop.apply(void 0, args) : prop;
|
|
3080
|
-
};
|
|
3081
|
-
|
|
3082
|
-
var moveElement = _.curry(function (from, to, list) {
|
|
3083
|
-
var el = list[from];
|
|
3084
|
-
|
|
3085
|
-
var without = _.pullAt(from, list);
|
|
3086
|
-
|
|
3087
|
-
without.splice(to, 0, el);
|
|
3088
|
-
return without;
|
|
3089
|
-
});
|
|
3090
|
-
var unsetOrRemoveAt = _.curry(function (path, value) {
|
|
3091
|
-
var pathArr = toPath(path);
|
|
3092
|
-
|
|
3093
|
-
var _pathArr$slice = pathArr.slice(-1),
|
|
3094
|
-
_pathArr$slice2 = _slicedToArray(_pathArr$slice, 1),
|
|
3095
|
-
lastKey = _pathArr$slice2[0];
|
|
3096
|
-
|
|
3097
|
-
return update(pathArr.slice(0, -1), function (v) {
|
|
3098
|
-
return Array.isArray(v) ? removeAt(lastKey, v) : unset(lastKey, v);
|
|
3099
|
-
}, value);
|
|
3100
|
-
});
|
|
3101
|
-
|
|
3102
|
-
var sanitizePath = function sanitizePath(path) {
|
|
3103
|
-
return Array.isArray(path) ? path.map(sanitizePath) : typeof path === 'number' ? path.toString() : path === undefined ? [] : path;
|
|
3104
|
-
};
|
|
3105
|
-
|
|
3106
|
-
var toPath = function toPath(path) {
|
|
3107
|
-
return _.toPath(sanitizePath(path));
|
|
3108
|
-
};
|
|
3109
|
-
|
|
3110
|
-
var isEmptyPath = function isEmptyPath(path) {
|
|
3111
|
-
return path && !path.length;
|
|
3112
|
-
};
|
|
3113
|
-
|
|
3114
|
-
var update = _.curry(function (path, updater, state) {
|
|
3115
|
-
var sanitizedPath = sanitizePath(path);
|
|
3116
|
-
|
|
3117
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
3118
|
-
return updater(state);
|
|
3119
|
-
} else {
|
|
3120
|
-
return _.update(sanitizedPath, updater, state);
|
|
3121
|
-
}
|
|
3122
|
-
});
|
|
3123
|
-
var get = _.curry(function (path, state) {
|
|
3124
|
-
var sanitizedPath = sanitizePath(path);
|
|
3125
|
-
|
|
3126
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
3127
|
-
return state;
|
|
3128
|
-
} else {
|
|
3129
|
-
return _.get(sanitizedPath, state);
|
|
3130
|
-
}
|
|
3131
|
-
});
|
|
3132
|
-
var set = _.curry(function (path, value, state) {
|
|
3133
|
-
var sanitizedPath = sanitizePath(path);
|
|
3134
|
-
|
|
3135
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
3136
|
-
return value;
|
|
3137
|
-
} else {
|
|
3138
|
-
return _.set(sanitizedPath, value, state);
|
|
3139
|
-
}
|
|
3140
|
-
});
|
|
3141
|
-
var unset = _.curry(function (path, state) {
|
|
3142
|
-
var sanitizedPath = sanitizePath(path);
|
|
3143
|
-
|
|
3144
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
3145
|
-
return undefined;
|
|
3146
|
-
} else {
|
|
3147
|
-
return _.unset(sanitizedPath, state);
|
|
3148
|
-
}
|
|
3149
|
-
});
|
|
3150
|
-
var removeNAt = _.curry(function (pos, n, value) {
|
|
3151
|
-
return _toConsumableArray(value.slice(0, Number(pos))).concat(_toConsumableArray(value.slice(Number(pos) + n)));
|
|
3152
|
-
});
|
|
3153
|
-
var removeAt = removeNAt(_.__, 1);
|
|
3154
|
-
var when = _.curry(function (cond, fn, value) {
|
|
3155
|
-
return callIfFunction(cond, value) ? fn(value) : value;
|
|
3156
|
-
});
|
|
3157
|
-
var assign = _.curry(function (a, b) {
|
|
3158
|
-
return _.assign(b, a);
|
|
3159
|
-
});
|
|
3160
|
-
var concat = _.curry(function (a, b) {
|
|
3161
|
-
return _.concat(b, a);
|
|
3162
|
-
});
|
|
3163
|
-
var each = _.each.convert({
|
|
3164
|
-
cap: false
|
|
3165
|
-
});
|
|
3166
|
-
var find = _.find.convert({
|
|
3167
|
-
cap: false
|
|
3168
|
-
});
|
|
3169
|
-
var filter = _.filter.convert({
|
|
3170
|
-
cap: false
|
|
3171
|
-
});
|
|
3172
|
-
var map = _.map.convert({
|
|
3173
|
-
cap: false
|
|
3174
|
-
});
|
|
3175
|
-
var insertAt = _.curry(function (pos, newElements, value) {
|
|
3176
|
-
return _toConsumableArray(value.slice(0, pos).concat(newElements)).concat(_toConsumableArray(value.slice(pos)));
|
|
3177
|
-
});
|
|
3178
|
-
|
|
3179
|
-
function _templateObject$3() {
|
|
3180
|
-
var data = _taggedTemplateLiteral(["\n ", ""]);
|
|
3181
|
-
|
|
3182
|
-
_templateObject$3 = function _templateObject() {
|
|
3183
|
-
return data;
|
|
3184
|
-
};
|
|
3185
|
-
|
|
3186
|
-
return data;
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
|
|
3190
|
-
var currentWidth = callIfFunction(customWidth);
|
|
3191
|
-
return !sizeParis.find(function (_ref4) {
|
|
3192
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
3193
|
-
size = _ref5[0],
|
|
3194
|
-
type = _ref5[1];
|
|
3195
|
-
|
|
3196
|
-
if (type === "min-width") {
|
|
3197
|
-
return currentWidth < size;
|
|
3198
|
-
}
|
|
3199
|
-
|
|
3200
|
-
if (type === "max-width") {
|
|
3201
|
-
return currentWidth > size;
|
|
3202
|
-
}
|
|
3203
|
-
});
|
|
3204
|
-
};
|
|
3205
|
-
|
|
3206
|
-
var media = function media() {
|
|
3207
|
-
for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
3208
|
-
sizePairs[_key3] = arguments[_key3];
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
return function () {
|
|
3212
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
3213
|
-
args[_key4] = arguments[_key4];
|
|
3214
|
-
}
|
|
3215
|
-
|
|
3216
|
-
return styled.css(["", ""], function (props) {
|
|
3217
|
-
var _props$theme, _props$theme2;
|
|
3218
|
-
|
|
3219
|
-
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? styled.css.apply(void 0, args) : "" : styled.css(["@media ", "{", "}"], sizePairs.map(function (_ref6) {
|
|
3220
|
-
var _ref7 = _slicedToArray(_ref6, 2),
|
|
3221
|
-
size = _ref7[0],
|
|
3222
|
-
type = _ref7[1];
|
|
3223
|
-
|
|
3224
|
-
return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
|
|
3225
|
-
}).join(' and '), styled.css.apply(void 0, args));
|
|
3226
|
-
});
|
|
3227
|
-
};
|
|
3228
|
-
};
|
|
3229
|
-
media.mobile = media([600, 'max-width']);
|
|
3230
|
-
|
|
3231
|
-
media.between = function (min, max) {
|
|
3232
|
-
return media([min, 'min-width'], [max, 'max-width']);
|
|
3233
|
-
};
|
|
3234
|
-
|
|
3235
|
-
media.max = function (n) {
|
|
3236
|
-
return media([n, 'max-width']);
|
|
3237
|
-
};
|
|
3238
|
-
|
|
3239
|
-
media.min = function (n) {
|
|
3240
|
-
return media([n, 'min-width']);
|
|
3241
|
-
};
|
|
3242
|
-
|
|
3243
|
-
media.desktop = media([601, 'min-width']);
|
|
3244
|
-
|
|
3245
|
-
var getFrameOffset = function getFrameOffset(i, total) {
|
|
3246
|
-
return Math.round(i * 100 / (total - 1));
|
|
3247
|
-
};
|
|
3248
|
-
|
|
3249
|
-
var emotion = createEmotion({
|
|
3250
|
-
nonce: __webpack_nonce__
|
|
3251
|
-
});
|
|
3252
|
-
var oneWayAnimation = function oneWayAnimation() {
|
|
3253
|
-
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
3254
|
-
frames[_key5] = arguments[_key5];
|
|
3255
|
-
}
|
|
3256
|
-
|
|
3257
|
-
return emotion.keyframes(_templateObject$3(), frames.map(function (frame, i) {
|
|
3258
|
-
return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
|
|
3259
|
-
}));
|
|
3260
|
-
};
|
|
3261
|
-
var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
3262
|
-
var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
3263
|
-
|
|
3264
3060
|
var addRootPath = function addRootPath(errorRootPath, errors, path) {
|
|
3265
3061
|
var rootPath = [].concat(errorRootPath || [], path);
|
|
3266
3062
|
return Object.keys(errors).reduce(function (acc, error) {
|
|
@@ -3990,10 +3786,10 @@ var Radiobox = function Radiobox(_ref) {
|
|
|
3990
3786
|
}));
|
|
3991
3787
|
};
|
|
3992
3788
|
|
|
3993
|
-
function _templateObject$
|
|
3789
|
+
function _templateObject$3() {
|
|
3994
3790
|
var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
|
|
3995
3791
|
|
|
3996
|
-
_templateObject$
|
|
3792
|
+
_templateObject$3 = function _templateObject() {
|
|
3997
3793
|
return data;
|
|
3998
3794
|
};
|
|
3999
3795
|
|
|
@@ -4019,7 +3815,7 @@ var CheckboxContent = styled__default.div.withConfig({
|
|
|
4019
3815
|
displayName: "SimpleCheckbox__CheckboxContent",
|
|
4020
3816
|
componentId: "am8pps-4"
|
|
4021
3817
|
})(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
|
|
4022
|
-
return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$
|
|
3818
|
+
return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$3()), function (props) {
|
|
4023
3819
|
return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
|
|
4024
3820
|
}, function (props) {
|
|
4025
3821
|
return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{", "{color:", ";}}"], utils.getColor('main'), function (props) {
|
|
@@ -4075,10 +3871,10 @@ var SimpleCheckbox = styled__default(function (_ref) {
|
|
|
4075
3871
|
componentId: "am8pps-5"
|
|
4076
3872
|
})(["cursor:pointer;position:relative;margin-bottom:1rem;display:block;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
|
|
4077
3873
|
|
|
4078
|
-
function _templateObject$
|
|
3874
|
+
function _templateObject$4() {
|
|
4079
3875
|
var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
|
|
4080
3876
|
|
|
4081
|
-
_templateObject$
|
|
3877
|
+
_templateObject$4 = function _templateObject() {
|
|
4082
3878
|
return data;
|
|
4083
3879
|
};
|
|
4084
3880
|
|
|
@@ -4104,7 +3900,7 @@ var RadioboxContent = styled__default.div.withConfig({
|
|
|
4104
3900
|
displayName: "SimpleRadiobox__RadioboxContent",
|
|
4105
3901
|
componentId: "qv83xo-4"
|
|
4106
3902
|
})(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
|
|
4107
|
-
return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$
|
|
3903
|
+
return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$4()), function (props) {
|
|
4108
3904
|
return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
|
|
4109
3905
|
}, function (props) {
|
|
4110
3906
|
return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{:before{background-color:", ";}}"], utils.getColor('main'), function (props) {
|
|
@@ -4206,10 +4002,10 @@ function _templateObject2$2() {
|
|
|
4206
4002
|
return data;
|
|
4207
4003
|
}
|
|
4208
4004
|
|
|
4209
|
-
function _templateObject$
|
|
4005
|
+
function _templateObject$5() {
|
|
4210
4006
|
var data = _taggedTemplateLiteral(["\n width: 2.5rem;\n "]);
|
|
4211
4007
|
|
|
4212
|
-
_templateObject$
|
|
4008
|
+
_templateObject$5 = function _templateObject() {
|
|
4213
4009
|
return data;
|
|
4214
4010
|
};
|
|
4215
4011
|
|
|
@@ -4222,7 +4018,7 @@ var LEVELS = [DAY, MONTH, YEAR];
|
|
|
4222
4018
|
var DatePickerContainer = styled__default.div.withConfig({
|
|
4223
4019
|
displayName: "DatePicker__DatePickerContainer",
|
|
4224
4020
|
componentId: "sc-1wo8j4d-0"
|
|
4225
|
-
})(["width:20rem;position:absolute;z-index:10;background-color:white;border-radius:5px;border:1px solid ", ";user-select:none;box-shadow:0 0 4px 0 rgba(0,0,0,0.2);font-size:13px;text-align:center;animation:0.2s datePickerFadeInDown ease-out;display:none;@supports (flex-wrap:wrap){display:block;}input{padding-right:2.25rem;", "}@keyframes datePickerFadeInDown{from{opacity:0;transform:translateY(-10px);pointer-events:none;}to{opacity:1;transform:none;pointer-events:none;}}"], utils.getColor('gray210'), utils.media.mobile(_templateObject$
|
|
4021
|
+
})(["width:20rem;position:absolute;z-index:10;background-color:white;border-radius:5px;border:1px solid ", ";user-select:none;box-shadow:0 0 4px 0 rgba(0,0,0,0.2);font-size:13px;text-align:center;animation:0.2s datePickerFadeInDown ease-out;display:none;@supports (flex-wrap:wrap){display:block;}input{padding-right:2.25rem;", "}@keyframes datePickerFadeInDown{from{opacity:0;transform:translateY(-10px);pointer-events:none;}to{opacity:1;transform:none;pointer-events:none;}}"], utils.getColor('gray210'), utils.media.mobile(_templateObject$5()));
|
|
4226
4022
|
var CalendarHeader = styled__default.div.withConfig({
|
|
4227
4023
|
displayName: "DatePicker__CalendarHeader",
|
|
4228
4024
|
componentId: "sc-1wo8j4d-1"
|
|
@@ -4895,10 +4691,10 @@ function getClosestNextLeapYear(year) {
|
|
|
4895
4691
|
return y;
|
|
4896
4692
|
}
|
|
4897
4693
|
|
|
4898
|
-
function _templateObject$
|
|
4694
|
+
function _templateObject$6() {
|
|
4899
4695
|
var data = _taggedTemplateLiteral(["\n padding 1rem;\n "]);
|
|
4900
4696
|
|
|
4901
|
-
_templateObject$
|
|
4697
|
+
_templateObject$6 = function _templateObject() {
|
|
4902
4698
|
return data;
|
|
4903
4699
|
};
|
|
4904
4700
|
|
|
@@ -4921,7 +4717,7 @@ var ExpandableBoxStyled = styled__default.div.withConfig({
|
|
|
4921
4717
|
return polished.darken(0.05, utils.getColor("gray240")(props));
|
|
4922
4718
|
}, function (props) {
|
|
4923
4719
|
return polished.darken(0.08, utils.getColor("gray240")(props));
|
|
4924
|
-
}) : styled.css(["padding 1.5rem;", " ", ""], utils.media.max(340)(_templateObject$
|
|
4720
|
+
}) : styled.css(["padding 1.5rem;", " ", ""], utils.media.max(340)(_templateObject$6()), function (props) {
|
|
4925
4721
|
return props.fixMarginBottom && "\n padding-bottom: 0.5rem !important;\n ";
|
|
4926
4722
|
});
|
|
4927
4723
|
}, components.SwitchDiv);
|
|
@@ -5108,10 +4904,10 @@ var FlipDiv$1 = function FlipDiv(_ref3) {
|
|
|
5108
4904
|
}));
|
|
5109
4905
|
};
|
|
5110
4906
|
|
|
5111
|
-
function _templateObject$
|
|
4907
|
+
function _templateObject$7() {
|
|
5112
4908
|
var data = _taggedTemplateLiteral(["\n padding-right: 2.25rem;\n background: rgba(0,0,0,0.075);\n "]);
|
|
5113
4909
|
|
|
5114
|
-
_templateObject$
|
|
4910
|
+
_templateObject$7 = function _templateObject() {
|
|
5115
4911
|
return data;
|
|
5116
4912
|
};
|
|
5117
4913
|
|
|
@@ -5203,7 +4999,7 @@ var RichTextContainer = styled__default.div.withConfig({
|
|
|
5203
4999
|
}, function (props) {
|
|
5204
5000
|
return props.focus && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);\n ");
|
|
5205
5001
|
}, function (props) {
|
|
5206
|
-
return props.locked && css(_templateObject$
|
|
5002
|
+
return props.locked && css(_templateObject$7());
|
|
5207
5003
|
});
|
|
5208
5004
|
var RichTextInput = styled__default.div.withConfig({
|
|
5209
5005
|
displayName: "RichText__RichTextInput",
|
|
@@ -5322,6 +5118,10 @@ var cleanEditor = function cleanEditor(editor, acceptedTags) {
|
|
|
5322
5118
|
clean(el.childNodes);
|
|
5323
5119
|
el.removeAttribute('class');
|
|
5324
5120
|
|
|
5121
|
+
if (tagName === 'a') {
|
|
5122
|
+
el.setAttribute('target', '_blank');
|
|
5123
|
+
}
|
|
5124
|
+
|
|
5325
5125
|
if (el.getAttribute('style')) {
|
|
5326
5126
|
var usedStyles = _toPairs(_pick(acceptedStyles, el.style)).filter(function (_ref) {
|
|
5327
5127
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -5521,6 +5321,10 @@ var RichText = function RichText(_ref5) {
|
|
|
5521
5321
|
|
|
5522
5322
|
var keydownHandler = function keydownHandler(e) {
|
|
5523
5323
|
if (containerFocused.isOpen === 2) {
|
|
5324
|
+
if (formatTools.indexOf('link') < 0) {
|
|
5325
|
+
return;
|
|
5326
|
+
}
|
|
5327
|
+
|
|
5524
5328
|
if (e.key === "k" && e.ctrlKey || e.key === "k" && e.metaKey) {
|
|
5525
5329
|
e.preventDefault();
|
|
5526
5330
|
execCommand(null, 'link');
|
|
@@ -5569,17 +5373,23 @@ var RichText = function RichText(_ref5) {
|
|
|
5569
5373
|
_anchor.innerHTML = '​';
|
|
5570
5374
|
|
|
5571
5375
|
if (range.collapsed) {
|
|
5572
|
-
|
|
5376
|
+
range.insertNode(_anchor);
|
|
5573
5377
|
} else {
|
|
5378
|
+
if (range.commonAncestorContainer === input.current) {
|
|
5379
|
+
range.setStart(range.endContainer, 0);
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5574
5382
|
document.execCommand('createLink', false, '_');
|
|
5575
5383
|
_anchor = window.getSelection().anchorNode;
|
|
5576
5384
|
}
|
|
5577
5385
|
|
|
5578
|
-
var _parent =
|
|
5386
|
+
var _parent = range.commonAncestorContainer.nodeType === 3 ? range.commonAncestorContainer.parentNode : range.commonAncestorContainer;
|
|
5579
5387
|
|
|
5580
|
-
_parent.
|
|
5388
|
+
var links = _parent.querySelectorAll("a[href='_']");
|
|
5581
5389
|
|
|
5582
|
-
|
|
5390
|
+
Array.from(links).slice(0, -1).forEach(removeLinkFromNode);
|
|
5391
|
+
nodeEl = _last(links);
|
|
5392
|
+
nodeEl.setAttribute('href', ' ');
|
|
5583
5393
|
}
|
|
5584
5394
|
}
|
|
5585
5395
|
|
|
@@ -5788,10 +5598,14 @@ var RichText = function RichText(_ref5) {
|
|
|
5788
5598
|
});
|
|
5789
5599
|
};
|
|
5790
5600
|
|
|
5601
|
+
var removeLinkFromNode = function removeLinkFromNode(node) {
|
|
5602
|
+
node.outerHTML = node.innerHTML === "\u200B" ? '' : node.innerHTML;
|
|
5603
|
+
};
|
|
5604
|
+
|
|
5791
5605
|
var removeLink = function removeLink(e) {
|
|
5792
5606
|
if (e) e.preventDefault();
|
|
5793
5607
|
alreadyCancelled.set(true);
|
|
5794
|
-
activeLinkNode.current
|
|
5608
|
+
removeLinkFromNode(activeLinkNode.current);
|
|
5795
5609
|
linkPopup.close();
|
|
5796
5610
|
|
|
5797
5611
|
if (input.current) {
|
|
@@ -5888,6 +5702,8 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
|
|
|
5888
5702
|
values = _ref7.values;
|
|
5889
5703
|
var linkPopup = React.useRef();
|
|
5890
5704
|
var formRef = React.useRef();
|
|
5705
|
+
var linkTextRef = React.useRef();
|
|
5706
|
+
var linkUrlRef = React.useRef();
|
|
5891
5707
|
var LABELS = React.useContext(core.StartlibsContext).labels.RichText;
|
|
5892
5708
|
|
|
5893
5709
|
var preValidation = function preValidation(formValues) {
|
|
@@ -5910,7 +5726,8 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
|
|
|
5910
5726
|
|
|
5911
5727
|
var checkEscOrEnter = function checkEscOrEnter(e) {
|
|
5912
5728
|
if (e.keyCode === 27) {
|
|
5913
|
-
e.stopPropagation()
|
|
5729
|
+
e.stopPropagation();
|
|
5730
|
+
cancel(e);
|
|
5914
5731
|
} else if (e.keyCode === 13) {
|
|
5915
5732
|
e.preventDefault();
|
|
5916
5733
|
e.stopPropagation();
|
|
@@ -5929,6 +5746,13 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
|
|
|
5929
5746
|
'left': left + 'px',
|
|
5930
5747
|
'top': top + 'px'
|
|
5931
5748
|
});
|
|
5749
|
+
|
|
5750
|
+
if (values.linkText) {
|
|
5751
|
+
linkUrlRef.current.focus();
|
|
5752
|
+
} else {
|
|
5753
|
+
linkTextRef.current.focus();
|
|
5754
|
+
}
|
|
5755
|
+
|
|
5932
5756
|
return cancel;
|
|
5933
5757
|
}, []);
|
|
5934
5758
|
return React__default.createElement(WithForm, {
|
|
@@ -5945,12 +5769,12 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
|
|
|
5945
5769
|
className: "popup rich-text-link-editor ignore-link",
|
|
5946
5770
|
contentEditable: false
|
|
5947
5771
|
}, React__default.createElement(TextInput, {
|
|
5948
|
-
|
|
5772
|
+
ref: linkTextRef,
|
|
5949
5773
|
mandatory: true,
|
|
5950
5774
|
path: "linkText",
|
|
5951
5775
|
label: LABELS.popupLinkText
|
|
5952
5776
|
}), React__default.createElement(TextInput, {
|
|
5953
|
-
|
|
5777
|
+
ref: linkUrlRef,
|
|
5954
5778
|
mandatory: true,
|
|
5955
5779
|
path: "linkUrl",
|
|
5956
5780
|
label: LABELS.popupLinkUrl
|
|
@@ -6073,10 +5897,10 @@ var ToggleCheckbox = styled__default(function (_ref) {
|
|
|
6073
5897
|
return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
|
|
6074
5898
|
});
|
|
6075
5899
|
|
|
6076
|
-
function _templateObject$
|
|
5900
|
+
function _templateObject$8() {
|
|
6077
5901
|
var data = _taggedTemplateLiteral(["\n min-width: 0;\n ", "\n "]);
|
|
6078
5902
|
|
|
6079
|
-
_templateObject$
|
|
5903
|
+
_templateObject$8 = function _templateObject() {
|
|
6080
5904
|
return data;
|
|
6081
5905
|
};
|
|
6082
5906
|
|
|
@@ -6095,7 +5919,7 @@ var TabButton = styled__default(components.Button).withConfig({
|
|
|
6095
5919
|
return props.isFirst !== undefined && !props.isFirst && "\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n :focus:after{\n border-bottom-left-radius: 2px;\n border-top-left-radius: 2px;\n }\n ";
|
|
6096
5920
|
}, function (props) {
|
|
6097
5921
|
return props.isLast !== undefined && !props.isLast && "\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n :focus:after{\n border-bottom-right-radius: 2px;\n border-top-right-radius: 2px;\n z-index: 2;\n }\n ";
|
|
6098
|
-
}, utils.media.mobile(_templateObject$
|
|
5922
|
+
}, utils.media.mobile(_templateObject$8(), function (props) {
|
|
6099
5923
|
return props.icon ? "\n padding-left: 1.25rem;\n padding-right: 1rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ";
|
|
6100
5924
|
}), utils.customTheme('TabButton'));
|
|
6101
5925
|
var InnerButton = styled__default.a.withConfig({
|