@zipify/wysiwyg 1.2.2-1 → 1.2.4

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/wysiwyg.mjs CHANGED
@@ -12551,32 +12551,47 @@ function getBasePlacement(placement) {
12551
12551
  var max$3 = Math.max;
12552
12552
  var min$3 = Math.min;
12553
12553
  var round = Math.round;
12554
- function getBoundingClientRect(element, includeScale) {
12554
+ function getUAString() {
12555
+ var uaData = navigator.userAgentData;
12556
+ if (uaData != null && uaData.brands) {
12557
+ return uaData.brands.map(function(item) {
12558
+ return item.brand + "/" + item.version;
12559
+ }).join(" ");
12560
+ }
12561
+ return navigator.userAgent;
12562
+ }
12563
+ function isLayoutViewport() {
12564
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
12565
+ }
12566
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
12555
12567
  if (includeScale === void 0) {
12556
12568
  includeScale = false;
12557
12569
  }
12558
- var rect = element.getBoundingClientRect();
12570
+ if (isFixedStrategy === void 0) {
12571
+ isFixedStrategy = false;
12572
+ }
12573
+ var clientRect2 = element.getBoundingClientRect();
12559
12574
  var scaleX = 1;
12560
12575
  var scaleY = 1;
12561
- if (isHTMLElement(element) && includeScale) {
12562
- var offsetHeight = element.offsetHeight;
12563
- var offsetWidth = element.offsetWidth;
12564
- if (offsetWidth > 0) {
12565
- scaleX = round(rect.width) / offsetWidth || 1;
12566
- }
12567
- if (offsetHeight > 0) {
12568
- scaleY = round(rect.height) / offsetHeight || 1;
12569
- }
12570
- }
12576
+ if (includeScale && isHTMLElement(element)) {
12577
+ scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
12578
+ scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
12579
+ }
12580
+ var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
12581
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
12582
+ var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
12583
+ var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
12584
+ var width = clientRect2.width / scaleX;
12585
+ var height = clientRect2.height / scaleY;
12571
12586
  return {
12572
- width: rect.width / scaleX,
12573
- height: rect.height / scaleY,
12574
- top: rect.top / scaleY,
12575
- right: rect.right / scaleX,
12576
- bottom: rect.bottom / scaleY,
12577
- left: rect.left / scaleX,
12578
- x: rect.left / scaleX,
12579
- y: rect.top / scaleY
12587
+ width,
12588
+ height,
12589
+ top: y,
12590
+ right: x + width,
12591
+ bottom: y + height,
12592
+ left: x,
12593
+ x,
12594
+ y
12580
12595
  };
12581
12596
  }
12582
12597
  function getLayoutRect(element) {
@@ -12633,8 +12648,8 @@ function getTrueOffsetParent(element) {
12633
12648
  return element.offsetParent;
12634
12649
  }
12635
12650
  function getContainingBlock(element) {
12636
- var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
12637
- var isIE = navigator.userAgent.indexOf("Trident") !== -1;
12651
+ var isFirefox = /firefox/i.test(getUAString());
12652
+ var isIE = /Trident/i.test(getUAString());
12638
12653
  if (isIE && isHTMLElement(element)) {
12639
12654
  var elementCss = getComputedStyle$1(element);
12640
12655
  if (elementCss.position === "fixed") {
@@ -12954,7 +12969,7 @@ function getWindowScroll(node) {
12954
12969
  function getWindowScrollBarX(element) {
12955
12970
  return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
12956
12971
  }
12957
- function getViewportRect(element) {
12972
+ function getViewportRect(element, strategy) {
12958
12973
  var win = getWindow(element);
12959
12974
  var html2 = getDocumentElement(element);
12960
12975
  var visualViewport = win.visualViewport;
@@ -12965,7 +12980,8 @@ function getViewportRect(element) {
12965
12980
  if (visualViewport) {
12966
12981
  width = visualViewport.width;
12967
12982
  height = visualViewport.height;
12968
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
12983
+ var layoutViewport = isLayoutViewport();
12984
+ if (layoutViewport || !layoutViewport && strategy === "fixed") {
12969
12985
  x = visualViewport.offsetLeft;
12970
12986
  y = visualViewport.offsetTop;
12971
12987
  }
@@ -13029,8 +13045,8 @@ function rectToClientRect(rect) {
13029
13045
  bottom: rect.y + rect.height
13030
13046
  });
13031
13047
  }
13032
- function getInnerBoundingClientRect(element) {
13033
- var rect = getBoundingClientRect(element);
13048
+ function getInnerBoundingClientRect(element, strategy) {
13049
+ var rect = getBoundingClientRect(element, false, strategy === "fixed");
13034
13050
  rect.top = rect.top + element.clientTop;
13035
13051
  rect.left = rect.left + element.clientLeft;
13036
13052
  rect.bottom = rect.top + element.clientHeight;
@@ -13041,8 +13057,8 @@ function getInnerBoundingClientRect(element) {
13041
13057
  rect.y = rect.top;
13042
13058
  return rect;
13043
13059
  }
13044
- function getClientRectFromMixedType(element, clippingParent) {
13045
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
13060
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
13061
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
13046
13062
  }
13047
13063
  function getClippingParents(element) {
13048
13064
  var clippingParents2 = listScrollParents(getParentNode(element));
@@ -13055,18 +13071,18 @@ function getClippingParents(element) {
13055
13071
  return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
13056
13072
  });
13057
13073
  }
13058
- function getClippingRect(element, boundary, rootBoundary) {
13074
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
13059
13075
  var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
13060
13076
  var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
13061
13077
  var firstClippingParent = clippingParents2[0];
13062
13078
  var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
13063
- var rect = getClientRectFromMixedType(element, clippingParent);
13079
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
13064
13080
  accRect.top = max$3(rect.top, accRect.top);
13065
13081
  accRect.right = min$3(rect.right, accRect.right);
13066
13082
  accRect.bottom = min$3(rect.bottom, accRect.bottom);
13067
13083
  accRect.left = max$3(rect.left, accRect.left);
13068
13084
  return accRect;
13069
- }, getClientRectFromMixedType(element, firstClippingParent));
13085
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
13070
13086
  clippingRect.width = clippingRect.right - clippingRect.left;
13071
13087
  clippingRect.height = clippingRect.bottom - clippingRect.top;
13072
13088
  clippingRect.x = clippingRect.left;
@@ -13129,12 +13145,12 @@ function detectOverflow(state, options) {
13129
13145
  if (options === void 0) {
13130
13146
  options = {};
13131
13147
  }
13132
- var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
13148
+ var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
13133
13149
  var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
13134
13150
  var altContext = elementContext === popper ? reference : popper;
13135
13151
  var popperRect = state.rects.popper;
13136
13152
  var element = state.elements[altBoundary ? altContext : elementContext];
13137
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
13153
+ var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
13138
13154
  var referenceClientRect = getBoundingClientRect(state.elements.reference);
13139
13155
  var popperOffsets2 = computeOffsets({
13140
13156
  reference: referenceClientRect,
@@ -13521,7 +13537,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
13521
13537
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
13522
13538
  var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
13523
13539
  var documentElement = getDocumentElement(offsetParent);
13524
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
13540
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
13525
13541
  var scroll = {
13526
13542
  scrollLeft: 0,
13527
13543
  scrollTop: 0
@@ -23677,12 +23693,12 @@ const Alignment = Extension.create({
23677
23693
  parseHTML({ style: style2 }) {
23678
23694
  const textAlign = convertAlignment(style2.textAlign);
23679
23695
  if (textAlign) {
23680
- return { desktop: textAlign, tablet: textAlign, mobile: null };
23696
+ return { desktop: textAlign, tablet: textAlign, mobile: textAlign };
23681
23697
  }
23682
- const mobile = null;
23698
+ const mobile = style2.getPropertyValue("--zw-text-align-mobile") || null;
23683
23699
  const tablet = style2.getPropertyValue("--zw-text-align-tablet") || null;
23684
23700
  const desktop = style2.getPropertyValue("--zw-text-align-desktop") || null;
23685
- if (!tablet && !desktop)
23701
+ if (!mobile && !tablet && !desktop)
23686
23702
  return null;
23687
23703
  return { desktop, tablet, mobile };
23688
23704
  },
@@ -23702,7 +23718,7 @@ const Alignment = Extension.create({
23702
23718
  addCommands() {
23703
23719
  return {
23704
23720
  applyAlignment: createCommand(({ commands: commands2 }, value) => {
23705
- commands2.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS$1);
23721
+ commands2.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: value });
23706
23722
  }),
23707
23723
  getAlignment: createCommand(({ commands: commands2 }) => {
23708
23724
  const attribute = commands2.getBlockAttributes(this.name, DEFAULTS$1);
@@ -23,13 +23,10 @@ export const Alignment = Extension.create({
23
23
  const textAlign = convertAlignment(style.textAlign);
24
24
 
25
25
  if (textAlign) {
26
- // return { desktop: textAlign, tablet: textAlign, mobile: textAlign };
27
-
28
- // Temporary until release BUILDER_MODES
29
- return { desktop: textAlign, tablet: textAlign, mobile: null };
26
+ return { desktop: textAlign, tablet: textAlign, mobile: textAlign };
30
27
  }
31
28
 
32
- const mobile = null; //style.getPropertyValue('--zw-text-align-mobile') || null;
29
+ const mobile = style.getPropertyValue('--zw-text-align-mobile') || null;
33
30
  const tablet = style.getPropertyValue('--zw-text-align-tablet') || null;
34
31
  const desktop = style.getPropertyValue('--zw-text-align-desktop') || null;
35
32
 
@@ -60,7 +57,7 @@ export const Alignment = Extension.create({
60
57
  // commands.setBlockAttributes(this.name, { [device]: value }, DEFAULTS);
61
58
 
62
59
  // Temporary until release BUILDER_MODES
63
- commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: null }, DEFAULTS);
60
+ commands.setBlockAttributes(this.name, { desktop: value, tablet: value, mobile: value });
64
61
  }),
65
62
 
66
63
  getAlignment: createCommand(({ commands }) => {
@@ -7,7 +7,7 @@ Object {
7
7
  "attrs": Object {
8
8
  "alignment": Object {
9
9
  "desktop": "right",
10
- "mobile": null,
10
+ "mobile": "right",
11
11
  "tablet": "right",
12
12
  },
13
13
  },
@@ -31,7 +31,7 @@ Object {
31
31
  "attrs": Object {
32
32
  "alignment": Object {
33
33
  "desktop": "right",
34
- "mobile": null,
34
+ "mobile": "center",
35
35
  "tablet": null,
36
36
  },
37
37
  },
@@ -55,7 +55,7 @@ Object {
55
55
  "attrs": Object {
56
56
  "alignment": Object {
57
57
  "desktop": "center",
58
- "mobile": null,
58
+ "mobile": "center",
59
59
  "tablet": "center",
60
60
  },
61
61
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "1.2.2-1",
3
+ "version": "1.2.4",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "prepare": "husky install"
32
32
  },
33
33
  "dependencies": {
34
- "@popperjs/core": "^2.11.5",
34
+ "@popperjs/core": "^2.11.6",
35
35
  "@tiptap/core": "^2.0.0-beta.183",
36
36
  "@tiptap/extension-document": "^2.0.0-beta.17",
37
37
  "@tiptap/extension-heading": "^2.0.0-beta.29",
@@ -57,6 +57,7 @@
57
57
  "@babel/plugin-transform-runtime": "^7.18.10",
58
58
  "@babel/preset-env": "^7.19.0",
59
59
  "@babel/runtime": "^7.19.0",
60
+ "@rollup/plugin-babel": "^5.3.1",
60
61
  "@rollup/plugin-commonjs": "^22.0.2",
61
62
  "@rollup/plugin-node-resolve": "^14.0.0",
62
63
  "@rollup/plugin-replace": "^4.0.0",