@atlaskit/editor-plugin-extension 1.4.3 → 1.4.5

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,19 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 1.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.4.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#97599](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97599)
14
+ [`32c3130b08fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32c3130b08fe) -
15
+ [ED-22282] Bump adf-schema to 36.1.0
16
+
3
17
  ## 1.4.3
4
18
 
5
19
  ### Patch Changes
@@ -57,7 +57,7 @@ var forceAutoSave = exports.forceAutoSave = function forceAutoSave(applyChangeTo
57
57
  }, applyChangeToContextPanel);
58
58
  };
59
59
  };
60
- var updateExtensionLayout = exports.updateExtensionLayout = function updateExtensionLayout(layout) {
60
+ var updateExtensionLayout = exports.updateExtensionLayout = function updateExtensionLayout(layout, analyticsApi) {
61
61
  return (0, _pluginFactory.createCommand)({
62
62
  type: 'UPDATE_STATE',
63
63
  data: {
@@ -70,6 +70,22 @@ var updateExtensionLayout = exports.updateExtensionLayout = function updateExten
70
70
  layout: layout
71
71
  }));
72
72
  trWithNewNodeMarkup.setMeta('scrollIntoView', false);
73
+ if (analyticsApi) {
74
+ analyticsApi.attachAnalyticsEvent({
75
+ action: _analytics.ACTION.UPDATED,
76
+ actionSubject: _analytics.ACTION_SUBJECT.EXTENSION,
77
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.EXTENSION,
78
+ eventType: _analytics.EVENT_TYPE.TRACK,
79
+ attributes: {
80
+ extensionType: selectedExtension.node.attrs.extensionType,
81
+ extensionKey: selectedExtension.node.attrs.extensionKey,
82
+ localId: selectedExtension.node.attrs.localId,
83
+ layout: layout,
84
+ selection: tr.selection.toJSON(),
85
+ targetSelectionSource: _analytics.TARGET_SELECTION_SOURCE.CURRENT_SELECTION
86
+ }
87
+ })(tr);
88
+ }
73
89
  return trWithNewNodeMarkup;
74
90
  }
75
91
  return tr;
@@ -42,7 +42,7 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
42
42
  // and not inside a layoutSection
43
43
  return !!((isMultiBodiedExtension || isNonEmbeddedBodiedExtension || isNonEmbeddedExtension) && !(0, _utils2.hasParentNodeOfType)([layoutSection])(selection));
44
44
  };
45
- var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled) {
45
+ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI) {
46
46
  var nodeWithPos = (0, _utils3.getSelectedExtension)(state, true);
47
47
 
48
48
  // we should only return breakout options when breakouts are enabled and the node supports them
@@ -51,21 +51,21 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
51
51
  return [{
52
52
  type: 'button',
53
53
  icon: _mediaCenter.default,
54
- onClick: (0, _commands.updateExtensionLayout)('default'),
54
+ onClick: (0, _commands.updateExtensionLayout)('default', editorAnalyticsAPI),
55
55
  selected: layout === 'default',
56
56
  title: formatMessage(_messages.default.layoutFixedWidth),
57
57
  tabIndex: null
58
58
  }, {
59
59
  type: 'button',
60
60
  icon: _mediaWide.default,
61
- onClick: (0, _commands.updateExtensionLayout)('wide'),
61
+ onClick: (0, _commands.updateExtensionLayout)('wide', editorAnalyticsAPI),
62
62
  selected: layout === 'wide',
63
63
  title: formatMessage(_messages.default.layoutWide),
64
64
  tabIndex: null
65
65
  }, {
66
66
  type: 'button',
67
67
  icon: _mediaFullWidth.default,
68
- onClick: (0, _commands.updateExtensionLayout)('full-width'),
68
+ onClick: (0, _commands.updateExtensionLayout)('full-width', editorAnalyticsAPI),
69
69
  selected: layout === 'full-width',
70
70
  title: formatMessage(_messages.default.layoutFullWidth),
71
71
  tabIndex: null
@@ -107,7 +107,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
107
107
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
108
108
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
109
109
  var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
110
- var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
110
+ var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
111
111
  var extensionObj = (0, _utils3.getSelectedExtension)(state, true);
112
112
 
113
113
  // Check if we need to show confirm dialog for delete button
@@ -1,4 +1,4 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
2
2
  import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
3
3
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
@@ -39,7 +39,7 @@ export const forceAutoSave = applyChangeToContextPanel => (resolve, reject) => c
39
39
  autoSaveReject: reject
40
40
  }
41
41
  }, applyChangeToContextPanel);
42
- export const updateExtensionLayout = layout => createCommand({
42
+ export const updateExtensionLayout = (layout, analyticsApi) => createCommand({
43
43
  type: 'UPDATE_STATE',
44
44
  data: {
45
45
  layout
@@ -52,6 +52,22 @@ export const updateExtensionLayout = layout => createCommand({
52
52
  layout
53
53
  });
54
54
  trWithNewNodeMarkup.setMeta('scrollIntoView', false);
55
+ if (analyticsApi) {
56
+ analyticsApi.attachAnalyticsEvent({
57
+ action: ACTION.UPDATED,
58
+ actionSubject: ACTION_SUBJECT.EXTENSION,
59
+ actionSubjectId: ACTION_SUBJECT_ID.EXTENSION,
60
+ eventType: EVENT_TYPE.TRACK,
61
+ attributes: {
62
+ extensionType: selectedExtension.node.attrs.extensionType,
63
+ extensionKey: selectedExtension.node.attrs.extensionKey,
64
+ localId: selectedExtension.node.attrs.localId,
65
+ layout,
66
+ selection: tr.selection.toJSON(),
67
+ targetSelectionSource: TARGET_SELECTION_SOURCE.CURRENT_SELECTION
68
+ }
69
+ })(tr);
70
+ }
55
71
  return trWithNewNodeMarkup;
56
72
  }
57
73
  return tr;
@@ -39,7 +39,7 @@ const isLayoutSupported = (state, selectedExtNode) => {
39
39
  // and not inside a layoutSection
40
40
  return !!((isMultiBodiedExtension || isNonEmbeddedBodiedExtension || isNonEmbeddedExtension) && !hasParentNodeOfType([layoutSection])(selection));
41
41
  };
42
- const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled) => {
42
+ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI) => {
43
43
  const nodeWithPos = getSelectedExtension(state, true);
44
44
 
45
45
  // we should only return breakout options when breakouts are enabled and the node supports them
@@ -50,21 +50,21 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled)
50
50
  return [{
51
51
  type: 'button',
52
52
  icon: CenterIcon,
53
- onClick: updateExtensionLayout('default'),
53
+ onClick: updateExtensionLayout('default', editorAnalyticsAPI),
54
54
  selected: layout === 'default',
55
55
  title: formatMessage(commonMessages.layoutFixedWidth),
56
56
  tabIndex: null
57
57
  }, {
58
58
  type: 'button',
59
59
  icon: WideIcon,
60
- onClick: updateExtensionLayout('wide'),
60
+ onClick: updateExtensionLayout('wide', editorAnalyticsAPI),
61
61
  selected: layout === 'wide',
62
62
  title: formatMessage(commonMessages.layoutWide),
63
63
  tabIndex: null
64
64
  }, {
65
65
  type: 'button',
66
66
  icon: FullWidthIcon,
67
- onClick: updateExtensionLayout('full-width'),
67
+ onClick: updateExtensionLayout('full-width', editorAnalyticsAPI),
68
68
  selected: layout === 'full-width',
69
69
  title: formatMessage(commonMessages.layoutFullWidth),
70
70
  tabIndex: null
@@ -108,7 +108,7 @@ export const getToolbarConfig = ({
108
108
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
109
109
  const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
110
110
  const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
111
- const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
111
+ const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
112
112
  const extensionObj = getSelectedExtension(state, true);
113
113
 
114
114
  // Check if we need to show confirm dialog for delete button
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
5
5
  import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
@@ -48,7 +48,7 @@ export var forceAutoSave = function forceAutoSave(applyChangeToContextPanel) {
48
48
  }, applyChangeToContextPanel);
49
49
  };
50
50
  };
51
- export var updateExtensionLayout = function updateExtensionLayout(layout) {
51
+ export var updateExtensionLayout = function updateExtensionLayout(layout, analyticsApi) {
52
52
  return createCommand({
53
53
  type: 'UPDATE_STATE',
54
54
  data: {
@@ -61,6 +61,22 @@ export var updateExtensionLayout = function updateExtensionLayout(layout) {
61
61
  layout: layout
62
62
  }));
63
63
  trWithNewNodeMarkup.setMeta('scrollIntoView', false);
64
+ if (analyticsApi) {
65
+ analyticsApi.attachAnalyticsEvent({
66
+ action: ACTION.UPDATED,
67
+ actionSubject: ACTION_SUBJECT.EXTENSION,
68
+ actionSubjectId: ACTION_SUBJECT_ID.EXTENSION,
69
+ eventType: EVENT_TYPE.TRACK,
70
+ attributes: {
71
+ extensionType: selectedExtension.node.attrs.extensionType,
72
+ extensionKey: selectedExtension.node.attrs.extensionKey,
73
+ localId: selectedExtension.node.attrs.localId,
74
+ layout: layout,
75
+ selection: tr.selection.toJSON(),
76
+ targetSelectionSource: TARGET_SELECTION_SOURCE.CURRENT_SELECTION
77
+ }
78
+ })(tr);
79
+ }
64
80
  return trWithNewNodeMarkup;
65
81
  }
66
82
  return tr;
@@ -35,7 +35,7 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
35
35
  // and not inside a layoutSection
36
36
  return !!((isMultiBodiedExtension || isNonEmbeddedBodiedExtension || isNonEmbeddedExtension) && !hasParentNodeOfType([layoutSection])(selection));
37
37
  };
38
- var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled) {
38
+ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI) {
39
39
  var nodeWithPos = getSelectedExtension(state, true);
40
40
 
41
41
  // we should only return breakout options when breakouts are enabled and the node supports them
@@ -44,21 +44,21 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
44
44
  return [{
45
45
  type: 'button',
46
46
  icon: CenterIcon,
47
- onClick: updateExtensionLayout('default'),
47
+ onClick: updateExtensionLayout('default', editorAnalyticsAPI),
48
48
  selected: layout === 'default',
49
49
  title: formatMessage(commonMessages.layoutFixedWidth),
50
50
  tabIndex: null
51
51
  }, {
52
52
  type: 'button',
53
53
  icon: WideIcon,
54
- onClick: updateExtensionLayout('wide'),
54
+ onClick: updateExtensionLayout('wide', editorAnalyticsAPI),
55
55
  selected: layout === 'wide',
56
56
  title: formatMessage(commonMessages.layoutWide),
57
57
  tabIndex: null
58
58
  }, {
59
59
  type: 'button',
60
60
  icon: FullWidthIcon,
61
- onClick: updateExtensionLayout('full-width'),
61
+ onClick: updateExtensionLayout('full-width', editorAnalyticsAPI),
62
62
  selected: layout === 'full-width',
63
63
  title: formatMessage(commonMessages.layoutFullWidth),
64
64
  tabIndex: null
@@ -100,7 +100,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
100
100
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
101
101
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
102
102
  var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
103
- var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
103
+ var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
104
104
  var extensionObj = getSelectedExtension(state, true);
105
105
 
106
106
  // Check if we need to show confirm dialog for delete button
@@ -9,7 +9,7 @@ export declare function updateState(state: Partial<ExtensionState>): import("@at
9
9
  export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
10
10
  export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
11
11
  export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => (resolve: () => void, reject?: RejectSave) => import("@atlaskit/editor-common/types").Command;
12
- export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
12
+ export declare const updateExtensionLayout: (layout: ExtensionLayout, analyticsApi?: EditorAnalyticsAPI) => import("@atlaskit/editor-common/types").Command;
13
13
  export declare const removeExtension: (editorAnalyticsAPI?: EditorAnalyticsAPI) => import("@atlaskit/editor-common/types").Command;
14
14
  export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
15
15
  export declare const removeSelectedNodeWithAnalytics: (state: EditorState, tr: Transaction, analyticsApi?: EditorAnalyticsAPI) => Transaction;
@@ -9,7 +9,7 @@ export declare function updateState(state: Partial<ExtensionState>): import("@at
9
9
  export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
10
10
  export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
11
11
  export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => (resolve: () => void, reject?: RejectSave) => import("@atlaskit/editor-common/types").Command;
12
- export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
12
+ export declare const updateExtensionLayout: (layout: ExtensionLayout, analyticsApi?: EditorAnalyticsAPI) => import("@atlaskit/editor-common/types").Command;
13
13
  export declare const removeExtension: (editorAnalyticsAPI?: EditorAnalyticsAPI) => import("@atlaskit/editor-common/types").Command;
14
14
  export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
15
15
  export declare const removeSelectedNodeWithAnalytics: (state: EditorState, tr: Transaction, analyticsApi?: EditorAnalyticsAPI) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,15 +24,15 @@
24
24
  ".": "./src/index.ts"
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/adf-schema": "^35.12.2",
27
+ "@atlaskit/adf-schema": "^36.1.0",
28
28
  "@atlaskit/adf-utils": "^19.1.0",
29
29
  "@atlaskit/analytics-next": "^9.3.0",
30
- "@atlaskit/avatar": "^21.7.0",
30
+ "@atlaskit/avatar": "^21.8.0",
31
31
  "@atlaskit/button": "^17.14.0",
32
32
  "@atlaskit/checkbox": "^13.3.0",
33
33
  "@atlaskit/datetime-picker": "^13.5.0",
34
34
  "@atlaskit/editor-common": "^79.2.0",
35
- "@atlaskit/editor-json-transformer": "^8.11.0",
35
+ "@atlaskit/editor-json-transformer": "^8.12.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
37
37
  "@atlaskit/editor-plugin-context-identifier": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-context-panel": "^1.1.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-shared-styles": "^2.10.0",
44
44
  "@atlaskit/editor-tables": "^2.7.0",
45
45
  "@atlaskit/empty-state": "^7.8.0",
46
- "@atlaskit/form": "^9.3.0",
46
+ "@atlaskit/form": "^10.0.0",
47
47
  "@atlaskit/icon": "^22.1.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.0",
49
49
  "@atlaskit/primitives": "^6.1.0",
@@ -55,9 +55,9 @@
55
55
  "@atlaskit/tabs": "^16.1.0",
56
56
  "@atlaskit/textarea": "^5.4.0",
57
57
  "@atlaskit/textfield": "^6.3.0",
58
- "@atlaskit/theme": "^12.7.0",
58
+ "@atlaskit/theme": "^12.8.0",
59
59
  "@atlaskit/toggle": "^13.1.0",
60
- "@atlaskit/tokens": "^1.45.0",
60
+ "@atlaskit/tokens": "^1.47.0",
61
61
  "@atlaskit/tooltip": "^18.3.0",
62
62
  "@babel/runtime": "^7.0.0",
63
63
  "@emotion/react": "^11.7.1",