@fonixtree/magic-design 1.0.188 → 1.0.189
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/es/composite-comp/common/components/ProductItem/index.js +8 -2
- package/es/meta-comp/components/Text/index.js +17 -4
- package/es/meta-comp/config-panels/TextConfig/index.js +28 -7
- package/es/meta-comp/config-panels/TextConfig/index.less +27 -0
- package/lib/composite-comp/common/components/ProductItem/index.js +8 -2
- package/lib/meta-comp/components/Text/index.js +17 -4
- package/lib/meta-comp/config-panels/TextConfig/index.js +28 -7
- package/lib/meta-comp/config-panels/TextConfig/index.less +27 -0
- package/package.json +1 -1
|
@@ -98,7 +98,11 @@ function (_super) {
|
|
|
98
98
|
ProductItem.prototype.componentDidMount = function () {
|
|
99
99
|
if (this.videoRef.current) {
|
|
100
100
|
this.videoRef.current.setAttribute('playsinline', '');
|
|
101
|
-
this.videoRef.current.setAttribute('webkit-playsinline', '');
|
|
101
|
+
this.videoRef.current.setAttribute('webkit-playsinline', ''); // 阻止全屏
|
|
102
|
+
|
|
103
|
+
this.videoRef.current.addEventListener('webkitbeginfullscreen', function (e) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
});
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
108
|
|
|
@@ -176,10 +180,12 @@ function (_super) {
|
|
|
176
180
|
}), data.url && data.url.includes('.mp4') && /*#__PURE__*/_react["default"].createElement("video", {
|
|
177
181
|
ref: this.videoRef,
|
|
178
182
|
autoPlay: true,
|
|
183
|
+
disablePictureInPicture: true,
|
|
179
184
|
loop: true,
|
|
180
185
|
muted: true,
|
|
181
186
|
playsinline: true,
|
|
182
|
-
"webkit-playsinline": true
|
|
187
|
+
"webkit-playsinline": true,
|
|
188
|
+
"x-webkit-airplay": "deny"
|
|
183
189
|
}, /*#__PURE__*/_react["default"].createElement("source", {
|
|
184
190
|
src: data.url,
|
|
185
191
|
type: "video/mp4"
|
|
@@ -139,6 +139,7 @@ function (_super) {
|
|
|
139
139
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
140
140
|
|
|
141
141
|
_this.textRef = /*#__PURE__*/_react["default"].createRef();
|
|
142
|
+
_this.quillWrapRef = /*#__PURE__*/_react["default"].createRef();
|
|
142
143
|
_this.quillRef = null;
|
|
143
144
|
_this.state = {
|
|
144
145
|
editabled: false
|
|
@@ -175,10 +176,22 @@ function (_super) {
|
|
|
175
176
|
close: _this.onEditorClose
|
|
176
177
|
}
|
|
177
178
|
});
|
|
179
|
+
|
|
180
|
+
document.addEventListener('mousedown', _this.onEditorBlur);
|
|
178
181
|
}, 100);
|
|
179
182
|
});
|
|
180
183
|
};
|
|
181
184
|
|
|
185
|
+
_this.onEditorBlur = function (event) {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
|
|
188
|
+
var toolbarDom = document.querySelector('.toolbar-wrap');
|
|
189
|
+
|
|
190
|
+
if (((_a = _this.quillWrapRef) === null || _a === void 0 ? void 0 : _a.current) && !((_b = _this.quillWrapRef) === null || _b === void 0 ? void 0 : _b.current.contains(event.target)) && !toolbarDom.contains(event.target)) {
|
|
191
|
+
_this.onEditorClose();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
182
195
|
_this.onContentClick = function () {
|
|
183
196
|
var data = _this.props.data;
|
|
184
197
|
|
|
@@ -190,6 +203,7 @@ function (_super) {
|
|
|
190
203
|
};
|
|
191
204
|
|
|
192
205
|
_this.onEditorClose = function () {
|
|
206
|
+
document.removeEventListener('mousedown', _this.onEditorBlur);
|
|
193
207
|
_this.props.data.html = _this.quillRef.root.innerHTML;
|
|
194
208
|
|
|
195
209
|
_this.setState({
|
|
@@ -253,10 +267,9 @@ function (_super) {
|
|
|
253
267
|
}
|
|
254
268
|
|
|
255
269
|
if (editabled) {
|
|
256
|
-
return /*#__PURE__*/_react["default"].createElement("div",
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
270
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
271
|
+
ref: this.quillWrapRef
|
|
272
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
260
273
|
className: "quill-text-content-wrap",
|
|
261
274
|
style: {
|
|
262
275
|
zIndex: 3
|
|
@@ -151,6 +151,15 @@ function (_super) {
|
|
|
151
151
|
|
|
152
152
|
_this.state = {};
|
|
153
153
|
_this.containerRef = /*#__PURE__*/_react["default"].createRef();
|
|
154
|
+
_this.editInputRef = /*#__PURE__*/_react["default"].createRef();
|
|
155
|
+
|
|
156
|
+
_this.onEditInputBlur = function (event) {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
|
|
159
|
+
if (((_a = _this.editInputRef) === null || _a === void 0 ? void 0 : _a.current) && !((_b = _this.editInputRef) === null || _b === void 0 ? void 0 : _b.current.contains(event.target))) {
|
|
160
|
+
_this.selfRender();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
154
163
|
|
|
155
164
|
_this.onSizeTypeChange = function (v, obj) {
|
|
156
165
|
_extends(obj, sizeTypeMap[v]);
|
|
@@ -165,11 +174,23 @@ function (_super) {
|
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
TextConfig.prototype.componentDidMount = function () {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
|
|
179
|
+
var data = this.props.data;
|
|
168
180
|
window.document.addEventListener('text-render', this.selfRender);
|
|
181
|
+
(_b = (_a = this.editInputRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.addEventListener('input', function () {
|
|
182
|
+
if (data.html) {
|
|
183
|
+
data.html = this.textContent;
|
|
184
|
+
} else {
|
|
185
|
+
data.text = this.textContent;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
document.addEventListener('mousedown', this.onEditInputBlur);
|
|
169
189
|
};
|
|
170
190
|
|
|
171
191
|
TextConfig.prototype.componentWillUnmount = function () {
|
|
172
192
|
window.document.removeEventListener('text-render', this.selfRender);
|
|
193
|
+
document.removeEventListener('mousedown', this.onEditInputBlur);
|
|
173
194
|
};
|
|
174
195
|
|
|
175
196
|
TextConfig.prototype.render = function () {
|
|
@@ -365,13 +386,13 @@ function (_super) {
|
|
|
365
386
|
className: "text-input",
|
|
366
387
|
split: "solid",
|
|
367
388
|
title: (0, _locale.i18n)('TEXT')
|
|
368
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
389
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
390
|
+
ref: this.editInputRef,
|
|
391
|
+
className: "edit-input",
|
|
392
|
+
contentEditable: "true",
|
|
393
|
+
dangerouslySetInnerHTML: {
|
|
394
|
+
__html: data.html || data.text
|
|
395
|
+
}
|
|
375
396
|
})), /*#__PURE__*/_react["default"].createElement(_common.Collapse // divider="dashed"
|
|
376
397
|
// headerSize="small"
|
|
377
398
|
, {
|
|
@@ -11,6 +11,33 @@
|
|
|
11
11
|
border-color: #EDF0F4 !important;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.edit-input {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 36px;
|
|
17
|
+
line-height: 36px;
|
|
18
|
+
padding: 0 11px;
|
|
19
|
+
color: rgba(0, 0, 0, 0.85);
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
background-image: none;
|
|
23
|
+
border: 1px solid #d9d9d9;
|
|
24
|
+
border-radius: 4px;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
border-color: #40a9ff;
|
|
30
|
+
border-right-width: 1px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
border-color: #40a9ff;
|
|
35
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
36
|
+
border-right-width: 1px;
|
|
37
|
+
outline: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
14
41
|
.edit-text-btn {
|
|
15
42
|
margin: 8px auto;
|
|
16
43
|
padding: 6px 16px;
|
|
@@ -98,7 +98,11 @@ function (_super) {
|
|
|
98
98
|
ProductItem.prototype.componentDidMount = function () {
|
|
99
99
|
if (this.videoRef.current) {
|
|
100
100
|
this.videoRef.current.setAttribute('playsinline', '');
|
|
101
|
-
this.videoRef.current.setAttribute('webkit-playsinline', '');
|
|
101
|
+
this.videoRef.current.setAttribute('webkit-playsinline', ''); // 阻止全屏
|
|
102
|
+
|
|
103
|
+
this.videoRef.current.addEventListener('webkitbeginfullscreen', function (e) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
});
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
108
|
|
|
@@ -176,10 +180,12 @@ function (_super) {
|
|
|
176
180
|
}), data.url && data.url.includes('.mp4') && /*#__PURE__*/_react["default"].createElement("video", {
|
|
177
181
|
ref: this.videoRef,
|
|
178
182
|
autoPlay: true,
|
|
183
|
+
disablePictureInPicture: true,
|
|
179
184
|
loop: true,
|
|
180
185
|
muted: true,
|
|
181
186
|
playsinline: true,
|
|
182
|
-
"webkit-playsinline": true
|
|
187
|
+
"webkit-playsinline": true,
|
|
188
|
+
"x-webkit-airplay": "deny"
|
|
183
189
|
}, /*#__PURE__*/_react["default"].createElement("source", {
|
|
184
190
|
src: data.url,
|
|
185
191
|
type: "video/mp4"
|
|
@@ -139,6 +139,7 @@ function (_super) {
|
|
|
139
139
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
140
140
|
|
|
141
141
|
_this.textRef = /*#__PURE__*/_react["default"].createRef();
|
|
142
|
+
_this.quillWrapRef = /*#__PURE__*/_react["default"].createRef();
|
|
142
143
|
_this.quillRef = null;
|
|
143
144
|
_this.state = {
|
|
144
145
|
editabled: false
|
|
@@ -175,10 +176,22 @@ function (_super) {
|
|
|
175
176
|
close: _this.onEditorClose
|
|
176
177
|
}
|
|
177
178
|
});
|
|
179
|
+
|
|
180
|
+
document.addEventListener('mousedown', _this.onEditorBlur);
|
|
178
181
|
}, 100);
|
|
179
182
|
});
|
|
180
183
|
};
|
|
181
184
|
|
|
185
|
+
_this.onEditorBlur = function (event) {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
|
|
188
|
+
var toolbarDom = document.querySelector('.toolbar-wrap');
|
|
189
|
+
|
|
190
|
+
if (((_a = _this.quillWrapRef) === null || _a === void 0 ? void 0 : _a.current) && !((_b = _this.quillWrapRef) === null || _b === void 0 ? void 0 : _b.current.contains(event.target)) && !toolbarDom.contains(event.target)) {
|
|
191
|
+
_this.onEditorClose();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
182
195
|
_this.onContentClick = function () {
|
|
183
196
|
var data = _this.props.data;
|
|
184
197
|
|
|
@@ -190,6 +203,7 @@ function (_super) {
|
|
|
190
203
|
};
|
|
191
204
|
|
|
192
205
|
_this.onEditorClose = function () {
|
|
206
|
+
document.removeEventListener('mousedown', _this.onEditorBlur);
|
|
193
207
|
_this.props.data.html = _this.quillRef.root.innerHTML;
|
|
194
208
|
|
|
195
209
|
_this.setState({
|
|
@@ -253,10 +267,9 @@ function (_super) {
|
|
|
253
267
|
}
|
|
254
268
|
|
|
255
269
|
if (editabled) {
|
|
256
|
-
return /*#__PURE__*/_react["default"].createElement("div",
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
270
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
271
|
+
ref: this.quillWrapRef
|
|
272
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
260
273
|
className: "quill-text-content-wrap",
|
|
261
274
|
style: {
|
|
262
275
|
zIndex: 3
|
|
@@ -151,6 +151,15 @@ function (_super) {
|
|
|
151
151
|
|
|
152
152
|
_this.state = {};
|
|
153
153
|
_this.containerRef = /*#__PURE__*/_react["default"].createRef();
|
|
154
|
+
_this.editInputRef = /*#__PURE__*/_react["default"].createRef();
|
|
155
|
+
|
|
156
|
+
_this.onEditInputBlur = function (event) {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
|
|
159
|
+
if (((_a = _this.editInputRef) === null || _a === void 0 ? void 0 : _a.current) && !((_b = _this.editInputRef) === null || _b === void 0 ? void 0 : _b.current.contains(event.target))) {
|
|
160
|
+
_this.selfRender();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
154
163
|
|
|
155
164
|
_this.onSizeTypeChange = function (v, obj) {
|
|
156
165
|
_extends(obj, sizeTypeMap[v]);
|
|
@@ -165,11 +174,23 @@ function (_super) {
|
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
TextConfig.prototype.componentDidMount = function () {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
|
|
179
|
+
var data = this.props.data;
|
|
168
180
|
window.document.addEventListener('text-render', this.selfRender);
|
|
181
|
+
(_b = (_a = this.editInputRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.addEventListener('input', function () {
|
|
182
|
+
if (data.html) {
|
|
183
|
+
data.html = this.textContent;
|
|
184
|
+
} else {
|
|
185
|
+
data.text = this.textContent;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
document.addEventListener('mousedown', this.onEditInputBlur);
|
|
169
189
|
};
|
|
170
190
|
|
|
171
191
|
TextConfig.prototype.componentWillUnmount = function () {
|
|
172
192
|
window.document.removeEventListener('text-render', this.selfRender);
|
|
193
|
+
document.removeEventListener('mousedown', this.onEditInputBlur);
|
|
173
194
|
};
|
|
174
195
|
|
|
175
196
|
TextConfig.prototype.render = function () {
|
|
@@ -365,13 +386,13 @@ function (_super) {
|
|
|
365
386
|
className: "text-input",
|
|
366
387
|
split: "solid",
|
|
367
388
|
title: (0, _locale.i18n)('TEXT')
|
|
368
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
389
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
390
|
+
ref: this.editInputRef,
|
|
391
|
+
className: "edit-input",
|
|
392
|
+
contentEditable: "true",
|
|
393
|
+
dangerouslySetInnerHTML: {
|
|
394
|
+
__html: data.html || data.text
|
|
395
|
+
}
|
|
375
396
|
})), /*#__PURE__*/_react["default"].createElement(_common.Collapse // divider="dashed"
|
|
376
397
|
// headerSize="small"
|
|
377
398
|
, {
|
|
@@ -11,6 +11,33 @@
|
|
|
11
11
|
border-color: #EDF0F4 !important;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.edit-input {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 36px;
|
|
17
|
+
line-height: 36px;
|
|
18
|
+
padding: 0 11px;
|
|
19
|
+
color: rgba(0, 0, 0, 0.85);
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
background-image: none;
|
|
23
|
+
border: 1px solid #d9d9d9;
|
|
24
|
+
border-radius: 4px;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
border-color: #40a9ff;
|
|
30
|
+
border-right-width: 1px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
border-color: #40a9ff;
|
|
35
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
36
|
+
border-right-width: 1px;
|
|
37
|
+
outline: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
14
41
|
.edit-text-btn {
|
|
15
42
|
margin: 8px auto;
|
|
16
43
|
padding: 6px 16px;
|