@atlaskit/editor-plugin-selection 8.0.13 → 8.0.14

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,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 8.0.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [`369e414179c61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/369e414179c61) -
8
+ Cleanup feature flag platform_editor_fix_gapcursor_on_paste. The fix for gapcursor on paste is now
9
+ enabled by default.
10
+ - Updated dependencies
11
+
3
12
  ## 8.0.13
4
13
 
5
14
  ### Patch Changes
@@ -4,10 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.toDOMOld = exports.toDOMNew = exports.toDOM = void 0;
7
+ exports.toDOM = void 0;
8
8
  var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
9
9
  var _selection = require("@atlaskit/editor-common/selection");
10
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
10
  var _utils = require("../utils");
12
11
  /**
13
12
  * We have a couple of nodes that require us to compute style
@@ -71,40 +70,7 @@ var mutateElementStyle = function mutateElementStyle(element, style, side) {
71
70
  }
72
71
  }
73
72
  };
74
- var toDOMOld = exports.toDOMOld = function toDOMOld(view, getPos) {
75
- var selection = view.state.selection;
76
- var $from = selection.$from,
77
- side = selection.side;
78
- var isRightCursor = side === _selection.Side.RIGHT;
79
- var node = isRightCursor ? $from.nodeBefore : $from.nodeAfter;
80
- var nodeStart = getPos();
81
- // @ts-ignore - [unblock prosemirror bump] nodeStart can be undefined
82
- var dom = view.nodeDOM(nodeStart);
83
- var element = document.createElement('span');
84
- element.className = "ProseMirror-gapcursor ".concat(isRightCursor ? '-right' : '-left');
85
- element.appendChild(document.createElement('span'));
86
- if (dom instanceof HTMLElement && element.firstChild) {
87
- var style = computeNestedStyle(dom) || window.getComputedStyle(dom);
88
- var gapCursor = element.firstChild;
89
- gapCursor.style.height = "".concat(measureHeight(style), "px");
90
- var layoutMode = node && (0, _utils.getLayoutModeFromTargetNode)(node);
91
- if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
92
- gapCursor.style.marginTop = style.getPropertyValue('margin-top');
93
- }
94
-
95
- // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
96
- var isNestedTable = (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0;
97
- if (layoutMode && !isNestedTable) {
98
- gapCursor.setAttribute('layout', layoutMode);
99
- var breakoutModeStyle = (0, _utils.getComputedStyleForLayoutMode)(dom, node, style);
100
- gapCursor.style.width = "".concat(measureWidth(breakoutModeStyle), "px");
101
- } else {
102
- mutateElementStyle(gapCursor, style, selection.side);
103
- }
104
- }
105
- return element;
106
- };
107
- var toDOMNew = exports.toDOMNew = function toDOMNew(view, getPos) {
73
+ var toDOM = exports.toDOM = function toDOM(view, getPos) {
108
74
  var selection = view.state.selection;
109
75
  var $from = selection.$from,
110
76
  side = selection.side;
@@ -148,7 +114,4 @@ var toDOMNew = exports.toDOMNew = function toDOMNew(view, getPos) {
148
114
  });
149
115
  }
150
116
  return element;
151
- };
152
- var toDOM = exports.toDOM = function toDOM(view, getPos) {
153
- return (0, _expValEquals.expValEquals)('platform_editor_fix_gapcursor_on_paste', 'isEnabled', true) ? toDOMNew(view, getPos) : toDOMOld(view, getPos);
154
117
  };
@@ -1,5 +1,4 @@
1
1
  import { Side } from '@atlaskit/editor-common/selection';
2
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
2
  import { getComputedStyleForLayoutMode, getLayoutModeFromTargetNode, isLeftCursor } from '../utils';
4
3
 
5
4
  /**
@@ -60,42 +59,7 @@ const mutateElementStyle = (element, style, side) => {
60
59
  }
61
60
  }
62
61
  };
63
- export const toDOMOld = (view, getPos) => {
64
- const selection = view.state.selection;
65
- const {
66
- $from,
67
- side
68
- } = selection;
69
- const isRightCursor = side === Side.RIGHT;
70
- const node = isRightCursor ? $from.nodeBefore : $from.nodeAfter;
71
- const nodeStart = getPos();
72
- // @ts-ignore - [unblock prosemirror bump] nodeStart can be undefined
73
- const dom = view.nodeDOM(nodeStart);
74
- const element = document.createElement('span');
75
- element.className = `ProseMirror-gapcursor ${isRightCursor ? '-right' : '-left'}`;
76
- element.appendChild(document.createElement('span'));
77
- if (dom instanceof HTMLElement && element.firstChild) {
78
- const style = computeNestedStyle(dom) || window.getComputedStyle(dom);
79
- const gapCursor = element.firstChild;
80
- gapCursor.style.height = `${measureHeight(style)}px`;
81
- const layoutMode = node && getLayoutModeFromTargetNode(node);
82
- if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
83
- gapCursor.style.marginTop = style.getPropertyValue('margin-top');
84
- }
85
-
86
- // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
87
- const isNestedTable = (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0;
88
- if (layoutMode && !isNestedTable) {
89
- gapCursor.setAttribute('layout', layoutMode);
90
- const breakoutModeStyle = getComputedStyleForLayoutMode(dom, node, style);
91
- gapCursor.style.width = `${measureWidth(breakoutModeStyle)}px`;
92
- } else {
93
- mutateElementStyle(gapCursor, style, selection.side);
94
- }
95
- }
96
- return element;
97
- };
98
- export const toDOMNew = (view, getPos) => {
62
+ export const toDOM = (view, getPos) => {
99
63
  const selection = view.state.selection;
100
64
  const {
101
65
  $from,
@@ -141,7 +105,4 @@ export const toDOMNew = (view, getPos) => {
141
105
  });
142
106
  }
143
107
  return element;
144
- };
145
- export const toDOM = (view, getPos) => {
146
- return expValEquals('platform_editor_fix_gapcursor_on_paste', 'isEnabled', true) ? toDOMNew(view, getPos) : toDOMOld(view, getPos);
147
108
  };
@@ -1,6 +1,5 @@
1
1
  import _toArray from "@babel/runtime/helpers/toArray";
2
2
  import { Side } from '@atlaskit/editor-common/selection';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { getComputedStyleForLayoutMode, getLayoutModeFromTargetNode, isLeftCursor } from '../utils';
5
4
 
6
5
  /**
@@ -65,40 +64,7 @@ var mutateElementStyle = function mutateElementStyle(element, style, side) {
65
64
  }
66
65
  }
67
66
  };
68
- export var toDOMOld = function toDOMOld(view, getPos) {
69
- var selection = view.state.selection;
70
- var $from = selection.$from,
71
- side = selection.side;
72
- var isRightCursor = side === Side.RIGHT;
73
- var node = isRightCursor ? $from.nodeBefore : $from.nodeAfter;
74
- var nodeStart = getPos();
75
- // @ts-ignore - [unblock prosemirror bump] nodeStart can be undefined
76
- var dom = view.nodeDOM(nodeStart);
77
- var element = document.createElement('span');
78
- element.className = "ProseMirror-gapcursor ".concat(isRightCursor ? '-right' : '-left');
79
- element.appendChild(document.createElement('span'));
80
- if (dom instanceof HTMLElement && element.firstChild) {
81
- var style = computeNestedStyle(dom) || window.getComputedStyle(dom);
82
- var gapCursor = element.firstChild;
83
- gapCursor.style.height = "".concat(measureHeight(style), "px");
84
- var layoutMode = node && getLayoutModeFromTargetNode(node);
85
- if (nodeStart !== 0 || layoutMode || (node === null || node === void 0 ? void 0 : node.type.name) === 'table') {
86
- gapCursor.style.marginTop = style.getPropertyValue('margin-top');
87
- }
88
-
89
- // Tables nested inside other elements such as layouts, expands and other tables do not have fixed width
90
- var isNestedTable = (node === null || node === void 0 ? void 0 : node.type.name) === 'table' && selection.$to.depth > 0;
91
- if (layoutMode && !isNestedTable) {
92
- gapCursor.setAttribute('layout', layoutMode);
93
- var breakoutModeStyle = getComputedStyleForLayoutMode(dom, node, style);
94
- gapCursor.style.width = "".concat(measureWidth(breakoutModeStyle), "px");
95
- } else {
96
- mutateElementStyle(gapCursor, style, selection.side);
97
- }
98
- }
99
- return element;
100
- };
101
- export var toDOMNew = function toDOMNew(view, getPos) {
67
+ export var toDOM = function toDOM(view, getPos) {
102
68
  var selection = view.state.selection;
103
69
  var $from = selection.$from,
104
70
  side = selection.side;
@@ -142,7 +108,4 @@ export var toDOMNew = function toDOMNew(view, getPos) {
142
108
  });
143
109
  }
144
110
  return element;
145
- };
146
- export var toDOM = function toDOM(view, getPos) {
147
- return expValEquals('platform_editor_fix_gapcursor_on_paste', 'isEnabled', true) ? toDOMNew(view, getPos) : toDOMOld(view, getPos);
148
111
  };
@@ -1,4 +1,2 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const toDOMOld: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
3
- export declare const toDOMNew: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
4
2
  export declare const toDOM: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
@@ -1,4 +1,2 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const toDOMOld: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
3
- export declare const toDOMNew: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
4
2
  export declare const toDOM: (view: EditorView, getPos: () => number | undefined) => HTMLSpanElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "8.0.13",
3
+ "version": "8.0.14",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,12 +25,12 @@
25
25
  "@atlaskit/editor-shared-styles": "^3.10.0",
26
26
  "@atlaskit/editor-tables": "^2.9.0",
27
27
  "@atlaskit/platform-feature-flags": "^1.1.0",
28
- "@atlaskit/tmp-editor-statsig": "^46.0.0",
29
- "@atlaskit/tokens": "^11.2.0",
28
+ "@atlaskit/tmp-editor-statsig": "^47.0.0",
29
+ "@atlaskit/tokens": "^11.3.0",
30
30
  "@babel/runtime": "^7.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@atlaskit/editor-common": "^112.9.0",
33
+ "@atlaskit/editor-common": "^112.10.0",
34
34
  "react": "^18.2.0"
35
35
  },
36
36
  "techstack": {