@atlaskit/editor-common 74.5.2 → 74.7.0

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/index.js +26 -1
  3. package/dist/cjs/analytics/linking-utils.js +84 -0
  4. package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +156 -0
  5. package/dist/cjs/card/index.js +9 -1
  6. package/dist/cjs/messages/index.js +14 -0
  7. package/dist/cjs/messages/link-toolbar.js +60 -0
  8. package/dist/cjs/messages/media-and-embed-toolbar.js +20 -0
  9. package/dist/cjs/monitoring/error.js +1 -1
  10. package/dist/cjs/node-width/index.js +16 -2
  11. package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +225 -0
  12. package/dist/cjs/react-node-view/index.js +13 -0
  13. package/dist/cjs/{ui/Resizer/index.js → resizer/Resizer.js} +6 -3
  14. package/dist/cjs/{resizer.js → resizer/index.js} +1 -1
  15. package/dist/cjs/resizer/utils.js +21 -0
  16. package/dist/cjs/styles/shared/resizer.js +1 -1
  17. package/dist/cjs/styles/shared/table.js +5 -4
  18. package/dist/cjs/types/hyperlink.js +5 -0
  19. package/dist/cjs/types/resizable-media-single.js +5 -0
  20. package/dist/cjs/ui/DropList/index.js +1 -1
  21. package/dist/cjs/ui/LinkSearch/const.js +14 -0
  22. package/dist/cjs/ui/ResizerLegacy/index.js +210 -0
  23. package/dist/cjs/ui/ResizerLegacy/styled.js +15 -0
  24. package/dist/cjs/ui/ResizerLegacy/types.js +5 -0
  25. package/dist/cjs/ui/ResizerLegacy/utils.js +21 -0
  26. package/dist/cjs/ui/index.js +58 -0
  27. package/dist/cjs/utils/document.js +258 -0
  28. package/dist/cjs/utils/editor-core-utils.js +7 -2
  29. package/dist/cjs/utils/filter/privacy-filter.js +55 -0
  30. package/dist/cjs/utils/index.js +75 -0
  31. package/dist/cjs/utils/rich-media-utils.js +131 -0
  32. package/dist/cjs/version.json +1 -1
  33. package/dist/es2019/analytics/index.js +2 -1
  34. package/dist/es2019/analytics/linking-utils.js +74 -0
  35. package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +161 -0
  36. package/dist/es2019/card/index.js +2 -1
  37. package/dist/es2019/messages/index.js +2 -0
  38. package/dist/es2019/messages/link-toolbar.js +53 -0
  39. package/dist/es2019/messages/media-and-embed-toolbar.js +13 -0
  40. package/dist/es2019/monitoring/error.js +1 -1
  41. package/dist/es2019/node-width/index.js +12 -1
  42. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +219 -0
  43. package/dist/es2019/react-node-view/index.js +1 -0
  44. package/dist/es2019/{ui/Resizer/index.js → resizer/Resizer.js} +5 -3
  45. package/dist/es2019/resizer/index.js +1 -0
  46. package/dist/es2019/resizer/utils.js +12 -0
  47. package/dist/es2019/styles/shared/resizer.js +8 -4
  48. package/dist/es2019/styles/shared/table.js +5 -4
  49. package/dist/es2019/types/resizable-media-single.js +1 -0
  50. package/dist/es2019/ui/DropList/index.js +1 -1
  51. package/dist/es2019/ui/LinkSearch/const.js +4 -0
  52. package/dist/es2019/ui/ResizerLegacy/index.js +191 -0
  53. package/dist/es2019/ui/ResizerLegacy/styled.js +15 -0
  54. package/dist/es2019/ui/ResizerLegacy/types.js +1 -0
  55. package/dist/es2019/ui/ResizerLegacy/utils.js +12 -0
  56. package/dist/es2019/ui/index.js +5 -1
  57. package/dist/es2019/utils/document.js +253 -0
  58. package/dist/es2019/utils/editor-core-utils.js +4 -0
  59. package/dist/es2019/utils/filter/privacy-filter.js +47 -0
  60. package/dist/es2019/utils/index.js +5 -2
  61. package/dist/es2019/utils/rich-media-utils.js +109 -0
  62. package/dist/es2019/version.json +1 -1
  63. package/dist/esm/analytics/index.js +2 -1
  64. package/dist/esm/analytics/linking-utils.js +74 -0
  65. package/dist/esm/card/MediaAndEmbedsToolbar/index.js +146 -0
  66. package/dist/esm/card/index.js +2 -1
  67. package/dist/esm/messages/index.js +2 -0
  68. package/dist/esm/messages/link-toolbar.js +53 -0
  69. package/dist/esm/messages/media-and-embed-toolbar.js +13 -0
  70. package/dist/esm/monitoring/error.js +1 -1
  71. package/dist/esm/node-width/index.js +12 -1
  72. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +215 -0
  73. package/dist/esm/react-node-view/index.js +1 -0
  74. package/dist/esm/{ui/Resizer/index.js → resizer/Resizer.js} +6 -3
  75. package/dist/esm/resizer/index.js +1 -0
  76. package/dist/esm/resizer/types.js +1 -0
  77. package/dist/esm/resizer/utils.js +12 -0
  78. package/dist/esm/styles/shared/resizer.js +1 -1
  79. package/dist/esm/styles/shared/table.js +5 -4
  80. package/dist/esm/types/hyperlink.js +1 -0
  81. package/dist/esm/types/resizable-media-single.js +1 -0
  82. package/dist/esm/ui/DropList/index.js +1 -1
  83. package/dist/esm/ui/LinkSearch/const.js +4 -0
  84. package/dist/esm/ui/ResizerLegacy/index.js +203 -0
  85. package/dist/esm/ui/ResizerLegacy/styled.js +7 -0
  86. package/dist/esm/ui/ResizerLegacy/types.js +1 -0
  87. package/dist/esm/ui/ResizerLegacy/utils.js +12 -0
  88. package/dist/esm/ui/index.js +5 -1
  89. package/dist/esm/utils/document.js +246 -0
  90. package/dist/esm/utils/editor-core-utils.js +4 -0
  91. package/dist/esm/utils/filter/privacy-filter.js +48 -0
  92. package/dist/esm/utils/index.js +5 -2
  93. package/dist/esm/utils/rich-media-utils.js +118 -0
  94. package/dist/esm/version.json +1 -1
  95. package/dist/types/analytics/index.d.ts +2 -0
  96. package/dist/types/analytics/linking-utils.d.ts +14 -0
  97. package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +11 -0
  98. package/dist/types/card/index.d.ts +1 -0
  99. package/dist/types/messages/index.d.ts +2 -0
  100. package/dist/types/messages/link-toolbar.d.ts +52 -0
  101. package/dist/types/messages/media-and-embed-toolbar.d.ts +12 -0
  102. package/dist/types/node-width/index.d.ts +7 -0
  103. package/dist/types/react-node-view/getInlineNodeViewProducer.d.ts +25 -0
  104. package/dist/types/react-node-view/index.d.ts +3 -0
  105. package/dist/types/{ui/Resizer/index.d.ts → resizer/Resizer.d.ts} +1 -0
  106. package/dist/types/resizer/index.d.ts +2 -0
  107. package/dist/types/resizer/utils.d.ts +6 -0
  108. package/dist/types/styles/shared/table.d.ts +2 -1
  109. package/dist/types/types/hyperlink.d.ts +35 -0
  110. package/dist/types/types/index.d.ts +2 -0
  111. package/dist/types/types/resizable-media-single.d.ts +15 -0
  112. package/dist/types/ui/DropList/index.d.ts +1 -1
  113. package/dist/types/ui/LinkSearch/const.d.ts +4 -0
  114. package/dist/types/ui/ResizerLegacy/index.d.ts +40 -0
  115. package/dist/types/ui/ResizerLegacy/styled.d.ts +2 -0
  116. package/dist/types/ui/ResizerLegacy/types.d.ts +26 -0
  117. package/dist/types/ui/ResizerLegacy/utils.d.ts +6 -0
  118. package/dist/types/ui/index.d.ts +6 -0
  119. package/dist/types/utils/document.d.ts +19 -0
  120. package/dist/types/utils/editor-core-utils.d.ts +1 -0
  121. package/dist/types/utils/filter/privacy-filter.d.ts +9 -0
  122. package/dist/types/utils/index.d.ts +4 -1
  123. package/dist/types/utils/rich-media-utils.d.ts +8 -0
  124. package/dist/types-ts4.5/analytics/index.d.ts +2 -0
  125. package/dist/types-ts4.5/analytics/linking-utils.d.ts +14 -0
  126. package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +11 -0
  127. package/dist/types-ts4.5/card/index.d.ts +1 -0
  128. package/dist/types-ts4.5/messages/index.d.ts +2 -0
  129. package/dist/types-ts4.5/messages/link-toolbar.d.ts +52 -0
  130. package/dist/types-ts4.5/messages/media-and-embed-toolbar.d.ts +12 -0
  131. package/dist/types-ts4.5/node-width/index.d.ts +7 -0
  132. package/dist/types-ts4.5/react-node-view/getInlineNodeViewProducer.d.ts +25 -0
  133. package/dist/types-ts4.5/react-node-view/index.d.ts +3 -0
  134. package/dist/types-ts4.5/{ui/Resizer/index.d.ts → resizer/Resizer.d.ts} +1 -0
  135. package/dist/types-ts4.5/resizer/index.d.ts +2 -0
  136. package/dist/types-ts4.5/resizer/utils.d.ts +6 -0
  137. package/dist/types-ts4.5/styles/shared/table.d.ts +2 -1
  138. package/dist/types-ts4.5/types/hyperlink.d.ts +35 -0
  139. package/dist/types-ts4.5/types/index.d.ts +2 -0
  140. package/dist/types-ts4.5/types/resizable-media-single.d.ts +15 -0
  141. package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
  142. package/dist/types-ts4.5/ui/LinkSearch/const.d.ts +4 -0
  143. package/dist/types-ts4.5/ui/ResizerLegacy/index.d.ts +40 -0
  144. package/dist/types-ts4.5/ui/ResizerLegacy/styled.d.ts +2 -0
  145. package/dist/types-ts4.5/ui/ResizerLegacy/types.d.ts +26 -0
  146. package/dist/types-ts4.5/ui/ResizerLegacy/utils.d.ts +6 -0
  147. package/dist/types-ts4.5/ui/index.d.ts +6 -0
  148. package/dist/types-ts4.5/utils/document.d.ts +19 -0
  149. package/dist/types-ts4.5/utils/editor-core-utils.d.ts +1 -0
  150. package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +9 -0
  151. package/dist/types-ts4.5/utils/index.d.ts +4 -1
  152. package/dist/types-ts4.5/utils/rich-media-utils.d.ts +8 -0
  153. package/package.json +9 -9
  154. package/resizer/package.json +5 -5
  155. package/dist/cjs/ui/Resizer/utils.js +0 -8
  156. package/dist/es2019/resizer.js +0 -1
  157. package/dist/es2019/ui/Resizer/utils.js +0 -1
  158. package/dist/esm/resizer.js +0 -1
  159. package/dist/esm/ui/Resizer/utils.js +0 -1
  160. package/dist/types/resizer.d.ts +0 -2
  161. package/dist/types/ui/Resizer/utils.d.ts +0 -1
  162. package/dist/types-ts4.5/resizer.d.ts +0 -2
  163. package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -1
  164. /package/dist/cjs/{ui/Resizer → resizer}/types.js +0 -0
  165. /package/dist/es2019/{ui/Resizer → resizer}/types.js +0 -0
  166. /package/dist/{esm/ui/Resizer/types.js → es2019/types/hyperlink.js} +0 -0
  167. /package/dist/types/{ui/Resizer → resizer}/types.d.ts +0 -0
  168. /package/dist/types-ts4.5/{ui/Resizer → resizer}/types.d.ts +0 -0
@@ -0,0 +1,118 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
5
+ import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
6
+ import { shouldAddDefaultWrappedWidth } from '../ui/MediaSingle';
7
+ import { calcPxFromColumns, wrappedLayouts } from '../ui/MediaSingle/grid';
8
+ export var nonWrappedLayouts = ['center', 'wide', 'full-width'];
9
+ export var floatingLayouts = ['wrap-left', 'wrap-right'];
10
+ export var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos) {
11
+ if (typeof pos !== 'number' || isNaN(pos) || !view) {
12
+ return false;
13
+ }
14
+ var $pos = view.state.doc.resolve(pos);
15
+ var _view$state$schema$no = view.state.schema.nodes,
16
+ expand = _view$state$schema$no.expand,
17
+ nestedExpand = _view$state$schema$no.nestedExpand,
18
+ layoutColumn = _view$state$schema$no.layoutColumn;
19
+ return !!findParentNodeOfTypeClosestToPos($pos, [expand, nestedExpand, layoutColumn]);
20
+ };
21
+ export var alignAttributes = function alignAttributes(layout, oldAttrs) {
22
+ var gridSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 12;
23
+ var originalWidth = arguments.length > 3 ? arguments[3] : undefined;
24
+ var lineLength = arguments.length > 4 ? arguments[4] : undefined;
25
+ var width = oldAttrs.width;
26
+ var oldLayout = oldAttrs.layout;
27
+ var oldLayoutIsNonWrapped = nonWrappedLayouts.indexOf(oldLayout) > -1;
28
+ var newLayoutIsNonWrapped = nonWrappedLayouts.indexOf(layout) > -1;
29
+ var newLayoutIsWrapped = wrappedLayouts.indexOf(layout) > -1;
30
+ var oldLayoutIsWrapped = wrappedLayouts.indexOf(oldLayout) > -1;
31
+ if (oldLayoutIsNonWrapped && shouldAddDefaultWrappedWidth(layout, originalWidth, lineLength)) {
32
+ // 'full-width' or 'wide' or 'center' -> 'wrap-left' or 'wrap-right' or 'align-end' or 'align-start'
33
+ if (!width || width >= 100 || oldLayout !== 'center' // == 'full-width' or 'wide'
34
+ ) {
35
+ width = 50;
36
+ }
37
+ } else if (layout !== oldLayout && ['full-width', 'wide'].indexOf(oldLayout) > -1) {
38
+ // 'full-width' -> 'center' or 'wide'
39
+ // 'wide' -> 'center' or 'full-width'
40
+ // unset width
41
+ width = undefined;
42
+ } else if (width) {
43
+ var cols = Math.round(width / 100 * gridSize);
44
+ var targetCols = cols;
45
+ if (oldLayoutIsWrapped && newLayoutIsNonWrapped) {
46
+ // wrap -> center needs to align to even grid
47
+ targetCols = Math.floor(targetCols / 2) * 2;
48
+ width = undefined;
49
+ } else if (oldLayoutIsNonWrapped && newLayoutIsWrapped) {
50
+ // Can be here only if
51
+ // 'full-width' or 'wide' or 'center' -> 'wrap-left' or 'wrap-right' or 'align-end' or 'align-start'
52
+ // AND
53
+ // !originalWidth || !lineLength || small image
54
+ // AND
55
+ // width defined!
56
+
57
+ // cannot resize to full column width, and cannot resize to 1 column
58
+ if (cols <= 1) {
59
+ targetCols = 2;
60
+ } else if (cols >= gridSize) {
61
+ targetCols = 10;
62
+ }
63
+ }
64
+ if (targetCols !== cols) {
65
+ width = targetCols / gridSize * 100;
66
+ }
67
+ }
68
+ return _objectSpread(_objectSpread({}, oldAttrs), {}, {
69
+ layout: layout,
70
+ width: width
71
+ });
72
+ };
73
+ export function calculateSnapPoints(_ref) {
74
+ var $pos = _ref.$pos,
75
+ akEditorWideLayoutWidth = _ref.akEditorWideLayoutWidth,
76
+ allowBreakoutSnapPoints = _ref.allowBreakoutSnapPoints,
77
+ containerWidth = _ref.containerWidth,
78
+ gridSize = _ref.gridSize,
79
+ gridWidth = _ref.gridWidth,
80
+ insideInlineLike = _ref.insideInlineLike,
81
+ insideLayout = _ref.insideLayout,
82
+ isVideoFile = _ref.isVideoFile,
83
+ lineLength = _ref.lineLength,
84
+ offsetLeft = _ref.offsetLeft,
85
+ wrappedLayout = _ref.wrappedLayout;
86
+ var snapTargets = [];
87
+ for (var i = 0; i < gridWidth; i++) {
88
+ var pxFromColumns = calcPxFromColumns(i, lineLength, gridWidth);
89
+ snapTargets.push(insideLayout ? pxFromColumns : pxFromColumns - offsetLeft);
90
+ }
91
+ // full width
92
+ snapTargets.push(lineLength - offsetLeft);
93
+ var columns = wrappedLayout || insideInlineLike ? 1 : 2;
94
+ var minimumWidth = calcPxFromColumns(columns, lineLength, gridSize);
95
+ var snapPoints = snapTargets.filter(function (width) {
96
+ return width >= minimumWidth;
97
+ });
98
+ if (!$pos) {
99
+ return snapPoints;
100
+ }
101
+ snapPoints = isVideoFile ? snapPoints.filter(function (width) {
102
+ return width > 320;
103
+ }) : snapPoints;
104
+ var isTopLevel = $pos.parent.type.name === 'doc';
105
+ if (isTopLevel && allowBreakoutSnapPoints) {
106
+ snapPoints.push(akEditorWideLayoutWidth);
107
+ var fullWidthPoint = containerWidth - akEditorBreakoutPadding;
108
+ if (fullWidthPoint > akEditorWideLayoutWidth) {
109
+ snapPoints.push(fullWidthPoint);
110
+ }
111
+ }
112
+
113
+ // EDM-1107: Ensure new snapPoints are sorted with existing points
114
+ snapPoints = snapPoints.sort(function (a, b) {
115
+ return a - b;
116
+ });
117
+ return snapPoints;
118
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.5.2",
3
+ "version": "74.7.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,3 +3,5 @@ export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadCal
3
3
  export type { EditorAnalyticsAPI } from './api';
4
4
  export { fireAnalyticsEvent } from './fire-analytics-event';
5
5
  export { getAnalyticsEventsFromTransaction } from './utils';
6
+ export { buildEditLinkPayload, buildVisitedLinkPayload, buildOpenedSettingsPayload, unlinkPayload, } from './linking-utils';
7
+ export type { LinkType } from './linking-utils';
@@ -0,0 +1,14 @@
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, AnalyticsEventPayload, EVENT_TYPE, INPUT_METHOD } from './types';
2
+ export declare const buildEditLinkPayload: (type: LinkType) => AnalyticsEventPayload;
3
+ export type LinkType = ACTION_SUBJECT_ID.CARD_INLINE | ACTION_SUBJECT_ID.CARD_BLOCK | ACTION_SUBJECT_ID.EMBEDS | ACTION_SUBJECT_ID.HYPERLINK;
4
+ export declare const buildVisitedLinkPayload: (type: LinkType) => AnalyticsEventPayload;
5
+ export declare const buildOpenedSettingsPayload: (type: LinkType) => AnalyticsEventPayload;
6
+ export declare const unlinkPayload: (type: LinkType) => {
7
+ action: ACTION;
8
+ actionSubject: ACTION_SUBJECT;
9
+ actionSubjectId: ACTION_SUBJECT_ID.CARD_INLINE | undefined;
10
+ attributes: {
11
+ inputMethod: INPUT_METHOD;
12
+ };
13
+ eventType: EVENT_TYPE;
14
+ };
@@ -0,0 +1,11 @@
1
+ import { NodeType } from 'prosemirror-model';
2
+ import { EditorState } from 'prosemirror-state';
3
+ import { IntlShape } from 'react-intl-next';
4
+ import { EditorAnalyticsAPI } from '../../analytics';
5
+ import type { Command, EditorContainerWidth, FloatingToolbarItem, NextEditorPlugin, PluginDependenciesAPI } from '../../types';
6
+ type WidthPluginType = NextEditorPlugin<'width', {
7
+ sharedState: EditorContainerWidth | undefined;
8
+ }>;
9
+ type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
10
+ declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
11
+ export default buildLayoutButtons;
@@ -1,2 +1,3 @@
1
1
  export type { CardOptions } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata, } from './utils';
3
+ export { default as buildLayoutButtons } from './MediaAndEmbedsToolbar';
@@ -1,8 +1,10 @@
1
1
  export { codeBidiWarningMessages } from './codeBidiWarning';
2
2
  export { linkMessages } from './link';
3
+ export { linkToolbarMessages } from './link-toolbar';
3
4
  export { unsupportedContentMessages } from './unsupportedContent';
4
5
  export { codeBlockButtonMessages } from './codeBlockButton';
5
6
  export { toolbarInsertBlockMessages } from './insert-block';
7
+ export { toolbarMessages as mediaAndEmbedToolbarMessages } from './media-and-embed-toolbar';
6
8
  declare const _default: {
7
9
  layoutFixedWidth: {
8
10
  id: string;
@@ -0,0 +1,52 @@
1
+ export declare const linkToolbarMessages: {
2
+ addLink: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ unableToOpenLink: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ unlink: {
13
+ id: string;
14
+ defaultMessage: string;
15
+ description: string;
16
+ };
17
+ editLink: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ placeholder: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ linkPlaceholder: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
32
+ linkAddress: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
37
+ invalidLink: {
38
+ id: string;
39
+ defaultMessage: string;
40
+ description: string;
41
+ };
42
+ emptyLink: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ settingsLink: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
52
+ };
@@ -0,0 +1,12 @@
1
+ export declare const toolbarMessages: {
2
+ wrapLeft: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ wrapRight: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -1,7 +1,14 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
1
2
  import { EditorState } from 'prosemirror-state';
2
3
  import type { EditorContainerWidth } from '../types/editor-container-width';
4
+ export declare const layoutToWidth: {
5
+ default: number;
6
+ wide: number;
7
+ 'full-width': number;
8
+ };
3
9
  /**
4
10
  * Calculates width of parent node of a nested node (inside layouts, extension)
5
11
  * If current node selection is not nested will return undefined
6
12
  */
7
13
  export declare const getParentNodeWidth: (pos: number | undefined, state: EditorState, containerWidth: EditorContainerWidth, isFullWidthModeEnabled?: boolean) => any;
14
+ export declare const getTableContainerWidth: (node: PMNode) => number;
@@ -0,0 +1,25 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { Node as PMNode } from 'prosemirror-model';
4
+ import { EditorProps, EditorView } from 'prosemirror-view';
5
+ import type { PMPluginFactoryParams } from '../types';
6
+ export type InlineNodeViewComponentProps = {
7
+ view: EditorView;
8
+ getPos: NodeViewParams['getPos'];
9
+ node: PMNode;
10
+ };
11
+ type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<InlineNodeViewComponentProps & ExtraComponentProps>;
12
+ export declare const inlineNodeViewClassname = "inlineNodeView";
13
+ type NodeViewProducer = NonNullable<EditorProps['nodeViews']>[string];
14
+ type NodeViewParams = {
15
+ node: Parameters<NodeViewProducer>[0];
16
+ view: Parameters<NodeViewProducer>[1];
17
+ getPos: Parameters<NodeViewProducer>[2];
18
+ decorations: Parameters<NodeViewProducer>[3];
19
+ };
20
+ export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, }: {
21
+ pmPluginFactoryParams: PMPluginFactoryParams;
22
+ Component: InlineNodeViewComponent<ExtraComponentProps>;
23
+ extraComponentProps?: ExtraComponentProps;
24
+ }): NodeViewProducer;
25
+ export {};
@@ -4,6 +4,9 @@ import { Decoration, EditorView, NodeView } from 'prosemirror-view';
4
4
  import { EventDispatcher } from '../event-dispatcher';
5
5
  import type { PortalProviderAPI } from '../ui/PortalProvider';
6
6
  import { ForwardRef, getPosHandler, ReactComponentProps, shouldUpdate } from './types';
7
+ export type { getPosHandler, ReactComponentProps };
8
+ export type { InlineNodeViewComponentProps } from './getInlineNodeViewProducer';
9
+ export { getInlineNodeViewProducer, inlineNodeViewClassname, } from './getInlineNodeViewProducer';
7
10
  export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
8
11
  private domRef?;
9
12
  private contentDOMWrapper?;
@@ -20,5 +20,6 @@ export type ResizerProps = {
20
20
  handleComponent?: HandleComponent;
21
21
  handlerHeightSize?: HandlerHeightSizeType;
22
22
  handleAlignmentMethod?: HandleAlignmentMethod;
23
+ resizeRatio?: number;
23
24
  };
24
25
  export default function ResizerNext(props: PropsWithChildren<ResizerProps>): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as ResizerNext } from './Resizer';
2
+ export type { HandlerHeightSizeType, EnabledHandles } from './types';
@@ -0,0 +1,6 @@
1
+ export declare const snapTo: (target: number, points: number[]) => number;
2
+ export declare const handleSides: Array<'left' | 'right'>;
3
+ export declare const imageAlignmentMap: {
4
+ left: string;
5
+ right: string;
6
+ };
@@ -25,7 +25,8 @@ export declare const TableSharedCssClassName: {
25
25
  TABLE_HEADER_CELL_WRAPPER: string;
26
26
  TABLE_ROW_CONTROLS_WRAPPER: string;
27
27
  TABLE_COLUMN_CONTROLS_DECORATIONS: string;
28
+ TABLE_RESIZER_CONTAINER: string;
28
29
  };
29
30
  declare const tableSharedStyle: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
30
- export declare const calcTableWidth: (layout: TableLayout, containerWidth?: number, addControllerPadding?: boolean) => string;
31
+ export declare const calcTableWidth: (layout: TableLayout, containerWidth?: number, addControllerPadding?: boolean) => number | 'inherit';
31
32
  export { tableSharedStyle };
@@ -0,0 +1,35 @@
1
+ import type { LinkPickerProps } from '@atlaskit/link-picker';
2
+ import { INPUT_METHOD } from '../analytics';
3
+ import { CardOptions } from '../card';
4
+ import { EditorAppearance } from './editor-appearance';
5
+ export type LinkInputType = INPUT_METHOD.MANUAL | INPUT_METHOD.TYPEAHEAD;
6
+ /**
7
+ * Configuration for the link picker
8
+ * Extends `LinkPickerProps` to provide future extensibility out-of-the-box
9
+ */
10
+ export interface LinkPickerOptions extends Partial<LinkPickerProps> {
11
+ }
12
+ /**
13
+ * Configuration for editor linking behaviours
14
+ */
15
+ export interface LinkingOptions {
16
+ /**
17
+ * Initial props to configure the link picker component with. Primarily used to provide link search and suggestions capabilities.
18
+ * @see https://atlaskit.atlassian.com/packages/editor/editor-core/example/full-page-with-link-picker
19
+ * @see https://atlaskit.atlassian.com/packages/linking-platform/link-picker
20
+ */
21
+ linkPicker?: LinkPickerOptions;
22
+ /**
23
+ * Enables and configure smart link behaviour
24
+ */
25
+ smartLinks?: CardOptions;
26
+ }
27
+ /**
28
+ * Configuration for the Hyperlink plugin
29
+ */
30
+ export interface HyperlinkPluginOptions {
31
+ cardOptions?: CardOptions;
32
+ linkPicker?: LinkPickerOptions;
33
+ platform?: 'mobile' | 'web';
34
+ editorAppearance?: EditorAppearance;
35
+ }
@@ -34,3 +34,5 @@ export type IconProps = {
34
34
  };
35
35
  export type { TTITracking, TransactionTracking, UITracking, CatchAllTracking, NodeViewTracking, BrowserFreezetracking, ProseMirrorRenderedTracking, InputTracking, ContentRetrievalTracking, OnChangeCallbackTracking, OnEditorReadyCallbackTracking, PasteTracking, RenderTracking, PerformanceTracking, } from './performance-tracking';
36
36
  export type { GridType } from './grid';
37
+ export type { LinkInputType, LinkPickerOptions, LinkingOptions, HyperlinkPluginOptions, } from './hyperlink';
38
+ export type { SnapPointsProps } from './resizable-media-single';
@@ -0,0 +1,15 @@
1
+ import { ResolvedPos } from 'prosemirror-model';
2
+ export interface SnapPointsProps {
3
+ $pos?: ResolvedPos | null;
4
+ akEditorWideLayoutWidth: number;
5
+ allowBreakoutSnapPoints?: boolean;
6
+ containerWidth: number;
7
+ gridSize: number;
8
+ gridWidth: number;
9
+ insideInlineLike: boolean;
10
+ insideLayout: boolean;
11
+ isVideoFile: boolean;
12
+ lineLength: number;
13
+ offsetLeft: number;
14
+ wrappedLayout: boolean;
15
+ }
@@ -16,5 +16,5 @@ export type OpenChangedEvent = {
16
16
  isOpen: boolean;
17
17
  event: MouseEvent | KeyboardEvent;
18
18
  };
19
- declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "children" | "id" | "position" | "trigger" | "testId" | "analyticsContext" | "isOpen" | "shouldFitContainer" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
19
+ declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "children" | "id" | "position" | "trigger" | "testId" | "analyticsContext" | "shouldFitContainer" | "isOpen" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
20
20
  export default _default;
@@ -0,0 +1,4 @@
1
+ export declare const RECENT_SEARCH_WIDTH_IN_PX = 420;
2
+ export declare const RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX = 360;
3
+ export declare const RECENT_SEARCH_HEIGHT_IN_PX = 360;
4
+ export declare const LINKPICKER_HEIGHT_IN_PX = 570;
@@ -0,0 +1,40 @@
1
+ import React, { RefObject } from 'react';
2
+ import { Resizable } from 're-resizable';
3
+ import { RichMediaLayout } from '@atlaskit/adf-schema';
4
+ import { DispatchAnalyticsEvent } from '../../analytics';
5
+ import { EnabledHandles, Props as ResizableMediaSingleProps } from './types';
6
+ export interface ResizableNumberSize {
7
+ width: number;
8
+ height: number;
9
+ }
10
+ export type ResizerProps = Omit<ResizableMediaSingleProps, 'height' | 'width'> & {
11
+ selected?: boolean;
12
+ enable: EnabledHandles;
13
+ calcNewSize: (newWidth: number, stop: boolean) => {
14
+ layout: RichMediaLayout;
15
+ width: number | null;
16
+ };
17
+ snapPoints: number[];
18
+ scaleFactor?: number;
19
+ highlights: (width: number, snapPoints: number[]) => number[] | string[];
20
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
21
+ nodeType?: 'media' | 'embed';
22
+ innerPadding?: number;
23
+ height?: number;
24
+ width: number;
25
+ ratio?: string;
26
+ handleComponentFunc?: (side: string) => React.ReactElement<any> | undefined;
27
+ };
28
+ export type ResizerState = {
29
+ isResizing: boolean;
30
+ };
31
+ export default class Resizer extends React.Component<ResizerProps, ResizerState> {
32
+ resizable: RefObject<Resizable>;
33
+ state: {
34
+ isResizing: boolean;
35
+ };
36
+ private handleResizeStart;
37
+ private handleResize;
38
+ private handleResizeStop;
39
+ render(): JSX.Element;
40
+ }
@@ -0,0 +1,2 @@
1
+ import { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from '../MediaSingle/styled';
2
+ export declare const wrapperStyle: (props: MediaSingleDimensionHelperProps) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,26 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { RichMediaLayout } from '@atlaskit/adf-schema';
3
+ import { MediaClientConfig } from '@atlaskit/media-core';
4
+ import type { DispatchAnalyticsEvent } from '../../analytics';
5
+ import type { getPosHandler } from '../../react-node-view';
6
+ import type { GridType } from '../../types';
7
+ import type { MediaSingleProps } from '../../ui';
8
+ export type EnabledHandles = {
9
+ left?: boolean;
10
+ right?: boolean;
11
+ };
12
+ export type Props = MediaSingleProps & {
13
+ updateSize: (width: number | null, layout: RichMediaLayout) => void;
14
+ displayGrid: ((show: boolean, type: GridType, highlight: number[] | string[]) => void) | undefined;
15
+ getPos: getPosHandler;
16
+ view: EditorView;
17
+ lineLength: number;
18
+ gridSize: number;
19
+ containerWidth: number;
20
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
21
+ allowBreakoutSnapPoints?: boolean;
22
+ selected?: boolean;
23
+ viewMediaClientConfig?: MediaClientConfig;
24
+ fullWidthMode?: boolean;
25
+ updateWidth?: (newWidth: number) => void;
26
+ };
@@ -0,0 +1,6 @@
1
+ export declare const snapTo: (target: number, points: number[]) => number;
2
+ export declare const handleSides: Array<'left' | 'right'>;
3
+ export declare const imageAlignmentMap: {
4
+ left: string;
5
+ right: string;
6
+ };
@@ -26,4 +26,10 @@ export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle
26
26
  export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE, } from './IntlErrorBoundary';
27
27
  export { default as IntlProviderIfMissingWrapper } from './IntlProviderIfMissingWrapper';
28
28
  export { default as FloatingToolbarButton } from './FloatingToolbar/Button';
29
+ export { RECENT_SEARCH_WIDTH_IN_PX, RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, LINKPICKER_HEIGHT_IN_PX, } from './LinkSearch/const';
29
30
  export { ContextPanelProvider, ContextPanelWidthProvider, ContextPanelConsumer, ContextPanel, } from './ContextPanel/context';
31
+ export { default as Resizer } from './ResizerLegacy';
32
+ export type { ResizerState } from './ResizerLegacy';
33
+ export type { EnabledHandles, Props as ResizerProps, } from './ResizerLegacy/types';
34
+ export { snapTo, handleSides, imageAlignmentMap } from './ResizerLegacy/utils';
35
+ export { wrapperStyle } from './ResizerLegacy/styled';
@@ -0,0 +1,19 @@
1
+ import { Node, ResolvedPos, Schema } from 'prosemirror-model';
2
+ import { EditorState, ReadonlyTransaction, Transaction } from 'prosemirror-state';
3
+ import { DispatchAnalyticsEvent } from '../analytics';
4
+ import { ProviderFactory } from '../provider-factory';
5
+ import { ReplaceRawValue, Transformer } from '../types';
6
+ type ChangedFn = (node: Node<any>, pos: number, parent: Node<any>, index: number) => boolean | null | undefined | void;
7
+ export declare const getStepRange: (transaction: Transaction | ReadonlyTransaction) => {
8
+ from: number;
9
+ to: number;
10
+ } | null;
11
+ export declare function hasDocAsParent($anchor: ResolvedPos): boolean;
12
+ /**
13
+ * Checks if a node looks like an empty document
14
+ */
15
+ export declare function isEmptyDocument(node: Node): boolean;
16
+ export declare function bracketTyped(state: EditorState): boolean;
17
+ export declare function nodesBetweenChanged(tr: Transaction | ReadonlyTransaction, f: ChangedFn, startPos?: number): void;
18
+ export declare function processRawValue(schema: Schema, value?: ReplaceRawValue, providerFactory?: ProviderFactory, sanitizePrivateContent?: boolean, contentTransformer?: Transformer<string>, dispatchAnalyticsEvent?: DispatchAnalyticsEvent): Node | undefined;
19
+ export {};
@@ -26,3 +26,4 @@ export declare const setNodeSelection: (view: EditorView, pos: number) => void;
26
26
  export declare function setTextSelection(view: EditorView, anchor: number, head?: number): void;
27
27
  export declare function nonNullable<T>(value: T): value is NonNullable<T>;
28
28
  export declare const isValidPosition: (pos: number, state: EditorState) => boolean;
29
+ export declare const isInLayoutColumn: (state: EditorState) => boolean;
@@ -0,0 +1,9 @@
1
+ import { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import { ProviderFactory } from '../../provider-factory';
3
+ /**
4
+ * Sanitises a document where some content should not be in the document (e.g. mention names).
5
+ *
6
+ * It is expected that these names we be resolved separately (e.g. when rendering
7
+ * a node view).
8
+ */
9
+ export declare function sanitizeNodeForPrivacy(json: JSONDocNode, providerFactory?: ProviderFactory): JSONDocNode;
@@ -6,7 +6,7 @@ export { default as ErrorReporter } from './error-reporter';
6
6
  export type { ErrorReportingHandler } from './error-reporter';
7
7
  export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC, } from './date';
8
8
  export type { Date } from './date';
9
- export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, } from './editor-core-utils';
9
+ export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, } from './editor-core-utils';
10
10
  export { withImageLoader } from './imageLoader';
11
11
  export type { ImageLoaderProps, ImageLoaderState, ImageStatus, } from './imageLoader';
12
12
  export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, } from './breakout';
@@ -50,3 +50,6 @@ export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder, is
50
50
  export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLinkDomain, findFilepaths, isLinkInMatches, FILEPATH_REGEXP, DONTLINKIFY_REGEXP, getLinkCreationAnalyticsEvent, } from './hyperlink';
51
51
  export declare const pmHistoryPluginKey = "history$";
52
52
  export { gridTypeForLayout } from './grid';
53
+ export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, } from './document';
54
+ export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
55
+ export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
@@ -0,0 +1,8 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
3
+ import { SnapPointsProps } from '../types';
4
+ export declare const nonWrappedLayouts: RichMediaLayout[];
5
+ export declare const floatingLayouts: string[];
6
+ export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
7
+ export declare const alignAttributes: (layout: RichMediaLayout, oldAttrs: RichMediaAttributes, gridSize: number | undefined, originalWidth: number, lineLength?: number) => RichMediaAttributes;
8
+ export declare function calculateSnapPoints({ $pos, akEditorWideLayoutWidth, allowBreakoutSnapPoints, containerWidth, gridSize, gridWidth, insideInlineLike, insideLayout, isVideoFile, lineLength, offsetLeft, wrappedLayout, }: SnapPointsProps): number[];
@@ -3,3 +3,5 @@ export type { AnalyticsDispatch, AnalyticsEventPayload, AnalyticsEventPayloadCal
3
3
  export type { EditorAnalyticsAPI } from './api';
4
4
  export { fireAnalyticsEvent } from './fire-analytics-event';
5
5
  export { getAnalyticsEventsFromTransaction } from './utils';
6
+ export { buildEditLinkPayload, buildVisitedLinkPayload, buildOpenedSettingsPayload, unlinkPayload, } from './linking-utils';
7
+ export type { LinkType } from './linking-utils';
@@ -0,0 +1,14 @@
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, AnalyticsEventPayload, EVENT_TYPE, INPUT_METHOD } from './types';
2
+ export declare const buildEditLinkPayload: (type: LinkType) => AnalyticsEventPayload;
3
+ export type LinkType = ACTION_SUBJECT_ID.CARD_INLINE | ACTION_SUBJECT_ID.CARD_BLOCK | ACTION_SUBJECT_ID.EMBEDS | ACTION_SUBJECT_ID.HYPERLINK;
4
+ export declare const buildVisitedLinkPayload: (type: LinkType) => AnalyticsEventPayload;
5
+ export declare const buildOpenedSettingsPayload: (type: LinkType) => AnalyticsEventPayload;
6
+ export declare const unlinkPayload: (type: LinkType) => {
7
+ action: ACTION;
8
+ actionSubject: ACTION_SUBJECT;
9
+ actionSubjectId: ACTION_SUBJECT_ID.CARD_INLINE | undefined;
10
+ attributes: {
11
+ inputMethod: INPUT_METHOD;
12
+ };
13
+ eventType: EVENT_TYPE;
14
+ };
@@ -0,0 +1,11 @@
1
+ import { NodeType } from 'prosemirror-model';
2
+ import { EditorState } from 'prosemirror-state';
3
+ import { IntlShape } from 'react-intl-next';
4
+ import { EditorAnalyticsAPI } from '../../analytics';
5
+ import type { Command, EditorContainerWidth, FloatingToolbarItem, NextEditorPlugin, PluginDependenciesAPI } from '../../types';
6
+ type WidthPluginType = NextEditorPlugin<'width', {
7
+ sharedState: EditorContainerWidth | undefined;
8
+ }>;
9
+ type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
10
+ declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
11
+ export default buildLayoutButtons;
@@ -1,2 +1,3 @@
1
1
  export type { CardOptions } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata, } from './utils';
3
+ export { default as buildLayoutButtons } from './MediaAndEmbedsToolbar';
@@ -1,8 +1,10 @@
1
1
  export { codeBidiWarningMessages } from './codeBidiWarning';
2
2
  export { linkMessages } from './link';
3
+ export { linkToolbarMessages } from './link-toolbar';
3
4
  export { unsupportedContentMessages } from './unsupportedContent';
4
5
  export { codeBlockButtonMessages } from './codeBlockButton';
5
6
  export { toolbarInsertBlockMessages } from './insert-block';
7
+ export { toolbarMessages as mediaAndEmbedToolbarMessages } from './media-and-embed-toolbar';
6
8
  declare const _default: {
7
9
  layoutFixedWidth: {
8
10
  id: string;