@atlaskit/editor-plugin-expand 7.4.10 → 7.4.12

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,21 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 7.4.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
8
+ tsignores added for help-center local consumpton removed
9
+ - Updated dependencies
10
+
11
+ ## 7.4.11
12
+
13
+ ### Patch Changes
14
+
15
+ - [`bd911d5eca1cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd911d5eca1cb) -
16
+ Use new transfromNode command in existing block menu items. Update transformNode analytics type.
17
+ - Updated dependencies
18
+
3
19
  ## 7.4.10
4
20
 
5
21
  ### Patch Changes
@@ -35,8 +35,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
35
35
  state: state,
36
36
  key: _pluginFactory.pluginKey,
37
37
  props: {
38
- // @ts-ignore - Workaround for help-center local consumption
39
-
40
38
  nodeViews: {
41
39
  expand: (0, _nodeviews.default)({
42
40
  getIntl: getIntl,
@@ -55,11 +53,9 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
55
53
  __livePage: __livePage
56
54
  })
57
55
  },
58
- // @ts-ignore - Workaround for help-center local consumption
59
56
  handleKeyDown: function handleKeyDown(_view, event) {
60
57
  return containsClass(event.target, _styles.expandClassNames.titleContainer);
61
58
  },
62
- // @ts-ignore - Workaround for help-center local consumption
63
59
  handleKeyPress: function handleKeyPress(_view, event) {
64
60
  return containsClass(event.target, _styles.expandClassNames.titleContainer);
65
61
  },
@@ -71,13 +67,11 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
71
67
  }, {
72
68
  useLongPressSelection: useLongPressSelection
73
69
  }),
74
- // @ts-ignore - Workaround for help-center local consumption
75
70
  handleDrop: function handleDrop(view, event, slice, moved) {
76
71
  return handleExpandDrag(view, event, slice);
77
72
  }
78
73
  },
79
74
  // @see ED-8027 to follow up on this work-around
80
- // @ts-ignore - Workaround for help-center local consumption
81
75
  filterTransaction: function filterTransaction(tr) {
82
76
  if (containsClass(document.activeElement, _styles.expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
83
77
  return false;
@@ -115,9 +109,6 @@ function handleExpandDrag(view, event, slice) {
115
109
  to = selection.to;
116
110
  var sliceContainsExpand = false;
117
111
  var sliceContainsNestedExpand = false;
118
-
119
- // @ts-ignore - Workaround for help-center local consumption
120
-
121
112
  slice.content.forEach(function (node) {
122
113
  if (node.type === state.schema.nodes.expand) {
123
114
  sliceContainsExpand = true;
@@ -33,8 +33,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
33
33
  return new _safePlugin.SafePlugin({
34
34
  key: pluginKey,
35
35
  props: {
36
- // @ts-ignore - Workaround for help-center local consumption
37
-
38
36
  nodeViews: {
39
37
  expand: (0, _nodeViews.default)({
40
38
  getIntl: getIntl,
@@ -53,11 +51,9 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
53
51
  __livePage: __livePage
54
52
  })
55
53
  },
56
- // @ts-ignore - Workaround for help-center local consumption
57
54
  handleKeyDown: function handleKeyDown(_view, event) {
58
55
  return containsClass(event.target, _styles.expandClassNames.titleContainer);
59
56
  },
60
- // @ts-ignore - Workaround for help-center local consumption
61
57
  handleKeyPress: function handleKeyPress(_view, event) {
62
58
  return containsClass(event.target, _styles.expandClassNames.titleContainer);
63
59
  },
@@ -69,13 +65,11 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
69
65
  }, {
70
66
  useLongPressSelection: useLongPressSelection
71
67
  }),
72
- // @ts-ignore - Workaround for help-center local consumption
73
68
  handleDrop: function handleDrop(view, event, slice, moved) {
74
69
  return handleExpandDrag(view, event, slice);
75
70
  }
76
71
  },
77
72
  // @see ED-8027 to follow up on this work-around
78
- // @ts-ignore - Workaround for help-center local consumption
79
73
  filterTransaction: function filterTransaction(tr) {
80
74
  if (containsClass(document.activeElement, _styles.expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
81
75
  return false;
@@ -97,9 +91,6 @@ function handleExpandDrag(view, event, slice) {
97
91
  to = selection.to;
98
92
  var sliceContainsExpand = false;
99
93
  var sliceContainsNestedExpand = false;
100
-
101
- // @ts-ignore - Workaround for help-center local consumption
102
-
103
94
  slice.content.forEach(function (node) {
104
95
  if (node.type === state.schema.nodes.expand) {
105
96
  sliceContainsExpand = true;
@@ -31,13 +31,20 @@ var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
31
31
  return false;
32
32
  }, [selection]);
33
33
  var handleClick = function handleClick(event) {
34
- var _api$blockMenu;
35
34
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
36
35
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
37
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(nodeName, {
38
- inputMethod: inputMethod,
39
- triggeredFrom: triggeredFrom
40
- }));
36
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
37
+ var _api$blockMenu;
38
+ var tr = _ref2.tr;
39
+ var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.expand, {
40
+ inputMethod: inputMethod,
41
+ triggeredFrom: triggeredFrom,
42
+ targetTypeName: nodeName
43
+ });
44
+ return command ? command({
45
+ tr: tr
46
+ }) : null;
47
+ });
41
48
  };
42
49
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
43
50
  onClick: handleClick,
@@ -19,8 +19,6 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
19
19
  state: state,
20
20
  key: pluginKey,
21
21
  props: {
22
- // @ts-ignore - Workaround for help-center local consumption
23
-
24
22
  nodeViews: {
25
23
  expand: ExpandNodeView({
26
24
  getIntl,
@@ -39,13 +37,9 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
39
37
  __livePage
40
38
  })
41
39
  },
42
- // @ts-ignore - Workaround for help-center local consumption
43
-
44
40
  handleKeyDown(_view, event) {
45
41
  return containsClass(event.target, expandClassNames.titleContainer);
46
42
  },
47
- // @ts-ignore - Workaround for help-center local consumption
48
-
49
43
  handleKeyPress(_view, event) {
50
44
  return containsClass(event.target, expandClassNames.titleContainer);
51
45
  },
@@ -55,15 +49,11 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
55
49
  handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], target => target.classList.contains(expandClassNames.prefix), {
56
50
  useLongPressSelection
57
51
  }),
58
- // @ts-ignore - Workaround for help-center local consumption
59
-
60
52
  handleDrop(view, event, slice, moved) {
61
53
  return handleExpandDrag(view, event, slice);
62
54
  }
63
55
  },
64
56
  // @see ED-8027 to follow up on this work-around
65
- // @ts-ignore - Workaround for help-center local consumption
66
-
67
57
  filterTransaction(tr) {
68
58
  if (containsClass(document.activeElement, expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
69
59
  return false;
@@ -109,9 +99,6 @@ export function handleExpandDrag(view, event, slice) {
109
99
  } = selection;
110
100
  let sliceContainsExpand = false;
111
101
  let sliceContainsNestedExpand = false;
112
-
113
- // @ts-ignore - Workaround for help-center local consumption
114
-
115
102
  slice.content.forEach(node => {
116
103
  if (node.type === state.schema.nodes.expand) {
117
104
  sliceContainsExpand = true;
@@ -16,8 +16,6 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
16
16
  return new SafePlugin({
17
17
  key: pluginKey,
18
18
  props: {
19
- // @ts-ignore - Workaround for help-center local consumption
20
-
21
19
  nodeViews: {
22
20
  expand: ExpandNodeView({
23
21
  getIntl,
@@ -36,13 +34,9 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
36
34
  __livePage
37
35
  })
38
36
  },
39
- // @ts-ignore - Workaround for help-center local consumption
40
-
41
37
  handleKeyDown(_view, event) {
42
38
  return containsClass(event.target, expandClassNames.titleContainer);
43
39
  },
44
- // @ts-ignore - Workaround for help-center local consumption
45
-
46
40
  handleKeyPress(_view, event) {
47
41
  return containsClass(event.target, expandClassNames.titleContainer);
48
42
  },
@@ -52,15 +46,11 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
52
46
  handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], target => target.classList.contains(expandClassNames.prefix), {
53
47
  useLongPressSelection
54
48
  }),
55
- // @ts-ignore - Workaround for help-center local consumption
56
-
57
49
  handleDrop(view, event, slice, moved) {
58
50
  return handleExpandDrag(view, event, slice);
59
51
  }
60
52
  },
61
53
  // @see ED-8027 to follow up on this work-around
62
- // @ts-ignore - Workaround for help-center local consumption
63
-
64
54
  filterTransaction(tr) {
65
55
  if (containsClass(document.activeElement, expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
66
56
  return false;
@@ -88,9 +78,6 @@ export function handleExpandDrag(view, event, slice) {
88
78
  } = selection;
89
79
  let sliceContainsExpand = false;
90
80
  let sliceContainsNestedExpand = false;
91
-
92
- // @ts-ignore - Workaround for help-center local consumption
93
-
94
81
  slice.content.forEach(node => {
95
82
  if (node.type === state.schema.nodes.expand) {
96
83
  sliceContainsExpand = true;
@@ -24,13 +24,21 @@ const ExpandBlockMenuItem = ({
24
24
  return false;
25
25
  }, [selection]);
26
26
  const handleClick = event => {
27
- var _api$blockMenu;
28
27
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
29
28
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
30
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(nodeName, {
31
- inputMethod,
32
- triggeredFrom
33
- }));
29
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
30
+ tr
31
+ }) => {
32
+ var _api$blockMenu;
33
+ const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.expand, {
34
+ inputMethod,
35
+ triggeredFrom,
36
+ targetTypeName: nodeName
37
+ });
38
+ return command ? command({
39
+ tr
40
+ }) : null;
41
+ });
34
42
  };
35
43
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
36
44
  onClick: handleClick,
@@ -25,8 +25,6 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
25
25
  state: state,
26
26
  key: pluginKey,
27
27
  props: {
28
- // @ts-ignore - Workaround for help-center local consumption
29
-
30
28
  nodeViews: {
31
29
  expand: ExpandNodeView({
32
30
  getIntl: getIntl,
@@ -45,11 +43,9 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
45
43
  __livePage: __livePage
46
44
  })
47
45
  },
48
- // @ts-ignore - Workaround for help-center local consumption
49
46
  handleKeyDown: function handleKeyDown(_view, event) {
50
47
  return containsClass(event.target, expandClassNames.titleContainer);
51
48
  },
52
- // @ts-ignore - Workaround for help-center local consumption
53
49
  handleKeyPress: function handleKeyPress(_view, event) {
54
50
  return containsClass(event.target, expandClassNames.titleContainer);
55
51
  },
@@ -61,13 +57,11 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
61
57
  }, {
62
58
  useLongPressSelection: useLongPressSelection
63
59
  }),
64
- // @ts-ignore - Workaround for help-center local consumption
65
60
  handleDrop: function handleDrop(view, event, slice, moved) {
66
61
  return handleExpandDrag(view, event, slice);
67
62
  }
68
63
  },
69
64
  // @see ED-8027 to follow up on this work-around
70
- // @ts-ignore - Workaround for help-center local consumption
71
65
  filterTransaction: function filterTransaction(tr) {
72
66
  if (containsClass(document.activeElement, expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
73
67
  return false;
@@ -105,9 +99,6 @@ export function handleExpandDrag(view, event, slice) {
105
99
  to = selection.to;
106
100
  var sliceContainsExpand = false;
107
101
  var sliceContainsNestedExpand = false;
108
-
109
- // @ts-ignore - Workaround for help-center local consumption
110
-
111
102
  slice.content.forEach(function (node) {
112
103
  if (node.type === state.schema.nodes.expand) {
113
104
  sliceContainsExpand = true;
@@ -22,8 +22,6 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
22
22
  return new SafePlugin({
23
23
  key: pluginKey,
24
24
  props: {
25
- // @ts-ignore - Workaround for help-center local consumption
26
-
27
25
  nodeViews: {
28
26
  expand: ExpandNodeView({
29
27
  getIntl: getIntl,
@@ -42,11 +40,9 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
42
40
  __livePage: __livePage
43
41
  })
44
42
  },
45
- // @ts-ignore - Workaround for help-center local consumption
46
43
  handleKeyDown: function handleKeyDown(_view, event) {
47
44
  return containsClass(event.target, expandClassNames.titleContainer);
48
45
  },
49
- // @ts-ignore - Workaround for help-center local consumption
50
46
  handleKeyPress: function handleKeyPress(_view, event) {
51
47
  return containsClass(event.target, expandClassNames.titleContainer);
52
48
  },
@@ -58,13 +54,11 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
58
54
  }, {
59
55
  useLongPressSelection: useLongPressSelection
60
56
  }),
61
- // @ts-ignore - Workaround for help-center local consumption
62
57
  handleDrop: function handleDrop(view, event, slice, moved) {
63
58
  return handleExpandDrag(view, event, slice);
64
59
  }
65
60
  },
66
61
  // @see ED-8027 to follow up on this work-around
67
- // @ts-ignore - Workaround for help-center local consumption
68
62
  filterTransaction: function filterTransaction(tr) {
69
63
  if (containsClass(document.activeElement, expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
70
64
  return false;
@@ -86,9 +80,6 @@ export function handleExpandDrag(view, event, slice) {
86
80
  to = selection.to;
87
81
  var sliceContainsExpand = false;
88
82
  var sliceContainsNestedExpand = false;
89
-
90
- // @ts-ignore - Workaround for help-center local consumption
91
-
92
83
  slice.content.forEach(function (node) {
93
84
  if (node.type === state.schema.nodes.expand) {
94
85
  sliceContainsExpand = true;
@@ -22,13 +22,20 @@ var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
22
22
  return false;
23
23
  }, [selection]);
24
24
  var handleClick = function handleClick(event) {
25
- var _api$blockMenu;
26
25
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
27
26
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
28
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(nodeName, {
29
- inputMethod: inputMethod,
30
- triggeredFrom: triggeredFrom
31
- }));
27
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
28
+ var _api$blockMenu;
29
+ var tr = _ref2.tr;
30
+ var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.expand, {
31
+ inputMethod: inputMethod,
32
+ triggeredFrom: triggeredFrom,
33
+ targetTypeName: nodeName
34
+ });
35
+ return command ? command({
36
+ tr: tr
37
+ }) : null;
38
+ });
32
39
  };
33
40
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
34
41
  onClick: handleClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "7.4.10",
3
+ "version": "7.4.12",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/browser-apis": "^0.0.1",
34
34
  "@atlaskit/button": "^23.6.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
36
- "@atlaskit/editor-plugin-block-menu": "^5.0.0",
36
+ "@atlaskit/editor-plugin-block-menu": "^5.1.0",
37
37
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
38
38
  "@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/icon-lab": "^5.12.0",
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
50
  "@atlaskit/prosemirror-history": "^0.2.0",
51
- "@atlaskit/tmp-editor-statsig": "^14.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^14.2.0",
52
52
  "@atlaskit/tokens": "^8.4.0",
53
53
  "@atlaskit/tooltip": "^20.10.0",
54
54
  "@babel/runtime": "^7.0.0",