@lowdefy/block-utils 4.0.0-rc.1 → 4.0.0-rc.11
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/dist/HtmlComponent.js +19 -3
- package/dist/mediaToCssObject.js +1 -1
- package/dist/renderHtml.js +2 -1
- package/package.json +11 -11
package/dist/HtmlComponent.js
CHANGED
|
@@ -24,8 +24,21 @@ let HtmlComponent = class HtmlComponent extends React.Component {
|
|
|
24
24
|
const htmlString = type.isNone(this.props.html) ? '' : this.props.html.toString();
|
|
25
25
|
this.div.innerHTML = DOMPurify.sanitize(htmlString);
|
|
26
26
|
}
|
|
27
|
+
onTextSelection() {
|
|
28
|
+
if (this.props.events?.onTextSelection) {
|
|
29
|
+
const selection = window.getSelection().toString();
|
|
30
|
+
if (selection !== '') {
|
|
31
|
+
this.props.methods.triggerEvent({
|
|
32
|
+
name: 'onTextSelection',
|
|
33
|
+
event: {
|
|
34
|
+
selection: selection
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
27
40
|
render() {
|
|
28
|
-
const { div
|
|
41
|
+
const { div, id, methods, style } = this.props;
|
|
29
42
|
if (div === true) {
|
|
30
43
|
return /*#__PURE__*/ React.createElement("div", {
|
|
31
44
|
id: id,
|
|
@@ -35,7 +48,8 @@ let HtmlComponent = class HtmlComponent extends React.Component {
|
|
|
35
48
|
this.div = el;
|
|
36
49
|
}
|
|
37
50
|
},
|
|
38
|
-
className: methods.makeCssClass(style)
|
|
51
|
+
className: methods.makeCssClass(style),
|
|
52
|
+
onMouseUp: this.onTextSelection
|
|
39
53
|
});
|
|
40
54
|
}
|
|
41
55
|
return /*#__PURE__*/ React.createElement("span", {
|
|
@@ -46,7 +60,8 @@ let HtmlComponent = class HtmlComponent extends React.Component {
|
|
|
46
60
|
this.div = el;
|
|
47
61
|
}
|
|
48
62
|
},
|
|
49
|
-
className: methods.makeCssClass(style)
|
|
63
|
+
className: methods.makeCssClass(style),
|
|
64
|
+
onMouseUp: this.onTextSelection
|
|
50
65
|
});
|
|
51
66
|
}
|
|
52
67
|
constructor(props){
|
|
@@ -54,6 +69,7 @@ let HtmlComponent = class HtmlComponent extends React.Component {
|
|
|
54
69
|
this.div = {
|
|
55
70
|
innerHTML: ''
|
|
56
71
|
};
|
|
72
|
+
this.onTextSelection = this.onTextSelection.bind(this);
|
|
57
73
|
}
|
|
58
74
|
};
|
|
59
75
|
export default HtmlComponent;
|
package/dist/mediaToCssObject.js
CHANGED
|
@@ -62,7 +62,7 @@ const mediaToCssObject = (styles, styleObjectOnly)=>{
|
|
|
62
62
|
if (styleObjectOnly) {
|
|
63
63
|
mq = mediaReact;
|
|
64
64
|
}
|
|
65
|
-
const { xs
|
|
65
|
+
const { xs, sm, md, lg, xl, xxl, ...others } = style;
|
|
66
66
|
if (xs) {
|
|
67
67
|
others[mq.xs] = xs;
|
|
68
68
|
}
|
package/dist/renderHtml.js
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
*/ import React from 'react';
|
|
16
16
|
import { type } from '@lowdefy/helpers';
|
|
17
17
|
import HtmlComponent from './HtmlComponent.js';
|
|
18
|
-
const renderHtml = ({ div , html
|
|
18
|
+
const renderHtml = ({ div, events, html, id, methods, style })=>type.isNone(html) ? undefined : /*#__PURE__*/ React.createElement(HtmlComponent, {
|
|
19
19
|
div: div,
|
|
20
|
+
events: events,
|
|
20
21
|
html: html,
|
|
21
22
|
id: id,
|
|
22
23
|
methods: methods,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/block-utils",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Block Utils",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -41,28 +41,28 @@
|
|
|
41
41
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@emotion/css": "11.
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-rc.
|
|
46
|
-
"dompurify": "
|
|
44
|
+
"@emotion/css": "11.11.2",
|
|
45
|
+
"@lowdefy/helpers": "4.0.0-rc.11",
|
|
46
|
+
"dompurify": "3.0.6",
|
|
47
47
|
"react": "18.2.0",
|
|
48
48
|
"react-dom": "18.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "7.
|
|
51
|
+
"@babel/core": "7.23.0",
|
|
52
52
|
"@emotion/jest": "11.10.5",
|
|
53
|
-
"@swc/cli": "0.1.
|
|
54
|
-
"@swc/core": "1.3.
|
|
55
|
-
"@swc/jest": "0.2.
|
|
53
|
+
"@swc/cli": "0.1.62",
|
|
54
|
+
"@swc/core": "1.3.92",
|
|
55
|
+
"@swc/jest": "0.2.29",
|
|
56
56
|
"@testing-library/dom": "8.19.1",
|
|
57
57
|
"@testing-library/react": "13.4.0",
|
|
58
58
|
"@testing-library/user-event": "14.4.3",
|
|
59
59
|
"copyfiles": "2.4.1",
|
|
60
|
-
"jest": "28.1.
|
|
61
|
-
"jest-environment-jsdom": "28.1.
|
|
60
|
+
"jest": "28.1.3",
|
|
61
|
+
"jest-environment-jsdom": "28.1.3",
|
|
62
62
|
"jest-serializer-html": "7.1.0"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "dbc49d3688a6d2f44de25cc3f4bc071627f7ebfa"
|
|
68
68
|
}
|