pixuireactcomponents 1.3.64 → 1.3.66

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.64",
3
+ "version": "1.3.66",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -126,7 +126,29 @@ export function ScrollBar(props) {
126
126
  sWindow.style.overflow = 'hidden';
127
127
  sWindow.style.overflow = 'scroll';
128
128
  };
129
- return (h("div", { id: "sframe", style: sFrameStyle },
129
+ var handleMouseEnter = function () {
130
+ sBlock.style.backgroundImage = "url(".concat(props.sBlockImgHavor, ")");
131
+ sFrame.style.backgroundImage = "url(".concat(props.sFrameImgHavor, ")");
132
+ };
133
+ var handleMouseLeave = function () {
134
+ sFrame.style.backgroundImage = "url(".concat(props.sframeImgNormal, ")");
135
+ sBlock.style.backgroundImage = "url(".concat(props.sblockImgNormal, ")");
136
+ };
137
+ var dragendMouseLeave = function (event) {
138
+ // 获取鼠标位置
139
+ if (event.clientY < sFrame.getBoundingClientRect().top || // 超出上边界
140
+ event.clientY > sFrame.getBoundingClientRect().bottom || // 超出下边界
141
+ event.clientX > sFrame.getBoundingClientRect().right || // 超出右边界
142
+ event.clientX < sFrame.getBoundingClientRect().left) { // 超出左边界
143
+ handleMouseLeave();
144
+ }
145
+ else {
146
+ handleMouseEnter();
147
+ }
148
+ };
149
+ return (
150
+ // <div id="sframe" style={sFrameStyle}>
151
+ h("div", { id: "sframe", style: sFrameStyle, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
130
152
  h("div", { id: "sblock", style: sBlockStyle, draggable: true, onDragStart: function (event) {
131
153
  sBlock.style.backgroundImage = "url(".concat(props.sBlockImgClick, ")");
132
154
  sFrame.style.backgroundImage = "url(".concat(props.sFrameImgClick, ")");
@@ -137,5 +159,7 @@ export function ScrollBar(props) {
137
159
  isDragingSBlock = false;
138
160
  sBlock.style.backgroundImage = "url(".concat(props.sBlockImgNormal, ")");
139
161
  sFrame.style.backgroundImage = "url(".concat(props.sFrameImgNormal, ")");
162
+ // pixui bug fix: drag end 时判断鼠标区域是否在滚动条外
163
+ dragendMouseLeave(event);
140
164
  }, onDrag: sBlockScrolling })));
141
165
  }
@@ -78,17 +78,17 @@ tools.getHashStr = function (str) {
78
78
  tools.convertRichText = function (str) {
79
79
  var res = str
80
80
  .replaceAll(/<img([^>]*)>/g, '<img$1></img>') //传过来的这两个标签会少结束标签
81
- .replaceAll(/<h[1,2,3,4,5,6]><br><\/h[1,2,3,4,5,6]>/g, '<br /><div style = "width:50px;height:15px;" />')
82
- .replaceAll(/<br>/g, '<br /><div style = "width:50px;height:15px;" />')
81
+ .replaceAll(/<h[1,2,3,4,5,6]><br><\/h[1,2,3,4,5,6]>/g, '<br /><div style = "width:50px;height:15px;" ></div>')
82
+ .replaceAll(/<p><br><\/p>/g, '<br /><div style = "width:50px;height:15px;" ></div>')
83
83
  .replaceAll(/<p/g, '<text')
84
84
  .replaceAll(/<\/p>/g, '</text>') //包text否则会丢break word
85
85
  .replaceAll(/<span/g, '<text')
86
86
  .replaceAll(/<\/span>/g, '</text>') //包text否则会丢break word
87
87
  .replaceAll(/&nbsp;/g, ' '); //单一行只有nbsp的时候,会整个解析不出来,pixui innerHtml bug
88
88
  for (var i = 1; i <= 6; i++) {
89
- res = res.replaceAll("<h".concat(i, ">"), "<h".concat(i, "><text>"));
90
- res = res.replaceAll("</h".concat(i, ">"), "</text></h".concat(i, ">"));
89
+ res = res.replaceAll(/(<h${i}\s[^>]*>)([^<]*)(<\/h${i}>)/g, '$1<text>$2</text>$3'); //h1-h6的内容包 text
91
90
  }
91
+ res = res.replaceAll(/<br>/g, '<br /><div style = "width:50px;height:15px;" ></div>');
92
92
  for (var i = 1; i < 10; i++) {
93
93
  res = res.replaceAll("class=\"ql-indent-".concat(i, "\""), " style=\"padding-left: ".concat(i * 2, "rem;\""));
94
94
  }