@cocreate/resize 1.2.35 → 1.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [1.3.1](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.3.0...v1.3.1) (2022-12-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump dependencies ([7f36c49](https://github.com/CoCreate-app/CoCreate-resize/commit/7f36c49640d289c9a7fd10c4ed34be33dd49dd12))
7
+
8
+ # [1.3.0](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.2.35...v1.3.0) (2022-12-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([f89c206](https://github.com/CoCreate-app/CoCreate-resize/commit/f89c206b33fc91cf4efd9df925771b758458537c))
14
+
15
+
16
+ ### Features
17
+
18
+ * apply styleTag to insert and remove style pointer-events none on iframes during resize ([8c86165](https://github.com/CoCreate-app/CoCreate-resize/commit/8c86165028c23ad850c9f4e693cb3c8bd7ca7668))
19
+
1
20
  ## [1.2.35](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.2.34...v1.2.35) (2022-12-15)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/resize",
3
- "version": "1.2.35",
3
+ "version": "1.3.1",
4
4
  "description": "A light weight resize handler make any element resizable by adding data attributes or usinng init object. Great for Customized text box or text area.",
5
5
  "keywords": [
6
6
  "resize",
@@ -59,7 +59,7 @@
59
59
  "webpack-log": "^3.0.1"
60
60
  },
61
61
  "dependencies": {
62
- "@cocreate/docs": "^1.4.19",
63
- "@cocreate/observer": "^1.5.39"
62
+ "@cocreate/docs": "^1.4.21",
63
+ "@cocreate/observer": "^1.5.43"
64
64
  }
65
65
  }
package/src/index.js CHANGED
@@ -5,6 +5,11 @@ import "./index.css";
5
5
  const EVENTS = ['mousemove touchmove', 'mousedown touchstart', 'mouseup touchend'];
6
6
  const DIRECTIONS = ['left', 'right', 'top', 'bottom'];
7
7
 
8
+ const styleEl = document.createElement("style");
9
+ styleEl.setAttribute('component', 'resize');
10
+ document.head.appendChild(styleEl);
11
+ const styleSheet = styleEl.sheet;
12
+
8
13
  const coCreateResize = {
9
14
  selector: '', //'.resize',
10
15
  resizers: [],
@@ -156,7 +161,7 @@ CoCreateResize.prototype = {
156
161
  }
157
162
 
158
163
  let selector = document.defaultView.getComputedStyle(this.resizeWidget);
159
- this.processIframe();
164
+ styleSheet.insertRule('iframe {pointer-events: none}', 0)
160
165
 
161
166
  if (idx == 'top' || idx == 'bottom') {
162
167
  this.startTop = parseInt(selector.top, 10);
@@ -295,9 +300,7 @@ CoCreateResize.prototype = {
295
300
  },
296
301
 
297
302
  stopDrag: function(e) {
298
- document.querySelectorAll('iframe').forEach(function(item) {
299
- item.style.pointerEvents = null;
300
- });
303
+ styleSheet.deleteRule(0)
301
304
  if (this.resizeWidget.hasAttribute('resizing')){
302
305
  this.resizeWidget.removeAttribute('resizing', '')
303
306
  }
@@ -400,17 +403,10 @@ CoCreateResize.prototype = {
400
403
  }
401
404
  },
402
405
 
403
- // style="pointer-events:none" for iframe when drag event starts
404
- processIframe: function() {
405
- document.querySelectorAll('iframe').forEach(function(item) {
406
- item.style.pointerEvents = null;
407
- });
408
- },
409
-
410
406
  collaborate: function({left, top, width, height, rowEnd, columnEnd}) {
411
407
  if (window.CoCreate && window.CoCreate.text) {
412
408
  let domTextEditor = this.resizeWidget.closest('[contenteditable]');
413
- if (domTextEditor){
409
+ if (domTextEditor) {
414
410
  if (left)
415
411
  CoCreate.text.setStyle({
416
412
  domTextEditor, target: this.resizeWidget, property: 'left', value: left + 'px'