@atlaskit/editor-common 102.13.2 → 102.13.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/analytics/types/enums.js +1 -0
  3. package/dist/cjs/extensibility/Extension/Extension/index.js +0 -25
  4. package/dist/cjs/messages/link-toolbar.js +5 -0
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +185 -106
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/utils/referentiality.js +2 -2
  9. package/dist/es2019/analytics/types/enums.js +1 -0
  10. package/dist/es2019/extensibility/Extension/Extension/index.js +1 -26
  11. package/dist/es2019/messages/link-toolbar.js +5 -0
  12. package/dist/es2019/monitoring/error.js +1 -1
  13. package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +181 -97
  14. package/dist/es2019/ui/DropList/index.js +1 -1
  15. package/dist/esm/analytics/types/enums.js +1 -0
  16. package/dist/esm/extensibility/Extension/Extension/index.js +1 -26
  17. package/dist/esm/messages/link-toolbar.js +5 -0
  18. package/dist/esm/monitoring/error.js +1 -1
  19. package/dist/esm/react-node-view/getInlineNodeViewProducer.js +185 -106
  20. package/dist/esm/ui/DropList/index.js +1 -1
  21. package/dist/esm/utils/referentiality.js +2 -2
  22. package/dist/types/analytics/types/enums.d.ts +2 -1
  23. package/dist/types/analytics/types/find-replace-events.d.ts +1 -1
  24. package/dist/types/messages/link-toolbar.d.ts +5 -0
  25. package/dist/types/react-node-view/getInlineNodeViewProducer.d.ts +13 -0
  26. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
  27. package/dist/types-ts4.5/analytics/types/find-replace-events.d.ts +1 -1
  28. package/dist/types-ts4.5/messages/link-toolbar.d.ts +5 -0
  29. package/dist/types-ts4.5/react-node-view/getInlineNodeViewProducer.d.ts +13 -0
  30. package/package.json +2 -2
@@ -21,67 +21,149 @@ import { generateUniqueNodeKey } from './generateUniqueNodeKey';
21
21
  import { getOrCreateOnVisibleObserver } from './onVisibleObserverFactory';
22
22
  var isSSR = Boolean(process.env.REACT_SSR);
23
23
  export var inlineNodeViewClassname = 'inlineNodeView';
24
-
25
- // number of initial nodes to allow React to render before switching to fallback
26
- var initialReactRenderedNodeCount = 0;
27
24
  var canRenderFallback = function canRenderFallback(node) {
28
25
  return node.type.isInline && node.type.isAtom && node.type.isLeaf;
29
26
  };
30
27
 
31
28
  // list of inline nodes with toDOM fallback implementations that can be virtualized. As
32
29
  // additional nodes are converted they should be added here
33
- var virtualizedNodeWhitelist = ['status', 'mention', 'emoji', 'date', 'inlineCard'];
34
- var virtualisationConfiguration = function virtualisationConfiguration() {
35
- var enableVirtualization = false;
36
- var reactRenderedDocumentPositionThreshold = 0;
37
- if (isSSR) {
38
- return {
39
- enableVirtualization: enableVirtualization,
40
- reactRenderedDocumentPositionThreshold: reactRenderedDocumentPositionThreshold,
41
- virtualizeCurrentNode: function virtualizeCurrentNode() {
42
- return false;
43
- }
44
- };
45
- }
30
+ var virtualizedNodeAllowlist = ['status', 'mention', 'emoji', 'date', 'inlineCard'];
31
+ function checkExperimentExposure() {
46
32
  if (editorExperiment('platform_editor_inline_node_virtualization', 'off', {
47
33
  exposure: true
48
34
  })) {
49
- enableVirtualization = false;
50
- } else if (editorExperiment('platform_editor_inline_node_virtualization', 'fallback-small', {
51
- exposure: true
52
- })) {
53
- enableVirtualization = true;
54
- reactRenderedDocumentPositionThreshold = 100;
55
- } else if (editorExperiment('platform_editor_inline_node_virtualization', 'fallback-large', {
35
+ return false;
36
+ }
37
+ if (editorExperiment('platform_editor_inline_node_virtualization', 'fallback-small', {
56
38
  exposure: true
57
39
  })) {
58
- enableVirtualization = true;
59
- reactRenderedDocumentPositionThreshold = 400;
40
+ return true;
60
41
  }
61
-
62
- // we need to be able to override the threshold to 0
63
- // for specific situation, primarily testing
64
- if (reactRenderedDocumentPositionThreshold !== 0 && fg('platform_editor_inline_node_virt_threshold_override')) {
65
- reactRenderedDocumentPositionThreshold = 0;
66
- }
67
- return {
68
- enableVirtualization: enableVirtualization,
69
- reactRenderedDocumentPositionThreshold: reactRenderedDocumentPositionThreshold,
70
- virtualizeCurrentNode: function virtualizeCurrentNode(nodeType) {
71
- return enableVirtualization && virtualizedNodeWhitelist.includes(nodeType) && !(initialReactRenderedNodeCount < reactRenderedDocumentPositionThreshold);
72
- }
73
- };
74
- };
42
+ return false;
43
+ }
75
44
  function createNodeView(_ref) {
76
45
  var nodeViewParams = _ref.nodeViewParams,
77
46
  pmPluginFactoryParams = _ref.pmPluginFactoryParams,
78
47
  Component = _ref.Component,
79
48
  extraComponentProps = _ref.extraComponentProps,
80
49
  extraNodeViewProps = _ref.extraNodeViewProps;
81
- var _virtualisationConfig = virtualisationConfiguration(),
82
- enableVirtualization = _virtualisationConfig.enableVirtualization,
83
- virtualizeCurrentNode = _virtualisationConfig.virtualizeCurrentNode;
84
- var virtualizeNode = virtualizeCurrentNode(nodeViewParams.node.type.name);
50
+ // We set a variable for the current node which is
51
+ // used for comparisions when doing updates, before being
52
+ // overwritten to the updated node.
53
+ var currentNode = nodeViewParams.node;
54
+ var key = generateUniqueNodeKey();
55
+
56
+ // First we setup the dom element which will be rendered and "tracked" by prosemirror
57
+ // and also used as a "editor portal" (not react portal) target by the editor
58
+ // portal provider api, for rendering the Component passed.
59
+
60
+ var domRef = document.createElement('span');
61
+ domRef.contentEditable = 'false';
62
+ setDomAttrs(nodeViewParams.node, domRef);
63
+ var fallbackRef = {
64
+ current: null
65
+ };
66
+
67
+ // @see ED-3790
68
+ // something gets messed up during mutation processing inside of a
69
+ // nodeView if DOM structure has nested plain "div"s, it doesn't see the
70
+ // difference between them and it kills the nodeView
71
+ domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
72
+
73
+ // This util is shared for tracking rendering, and the ErrorBoundary that
74
+ // is setup to wrap the Component when rendering
75
+ // NOTE: This is not a prosemirror dispatch
76
+ function dispatchAnalyticsEvent(payload) {
77
+ pmPluginFactoryParams.eventDispatcher.emit(analyticsEventKey, {
78
+ payload: payload
79
+ });
80
+ }
81
+
82
+ // This is called to render the Component into domRef which is inside the
83
+ // prosemirror View.
84
+ // Internally it uses the unstable_renderSubtreeIntoContainer api to render,
85
+ // to the passed dom element (domRef) which means it is automatically
86
+ // "cleaned up" when you do a "re render".
87
+ function renderComponent() {
88
+ pmPluginFactoryParams.portalProviderAPI.render(getPortalChildren({
89
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
90
+ currentNode: currentNode,
91
+ nodeViewParams: nodeViewParams,
92
+ Component: Component,
93
+ extraComponentProps: extraComponentProps
94
+ }), domRef, key);
95
+ }
96
+ var _getPerformanceOption = getPerformanceOptions(nodeViewParams.view),
97
+ samplingRate = _getPerformanceOption.samplingRate,
98
+ slowThreshold = _getPerformanceOption.slowThreshold,
99
+ trackingEnabled = _getPerformanceOption.trackingEnabled;
100
+ trackingEnabled && startMeasureReactNodeViewRendered({
101
+ nodeTypeName: currentNode.type.name
102
+ });
103
+
104
+ // We render the component while creating the node view
105
+ renderComponent();
106
+ trackingEnabled && stopMeasureReactNodeViewRendered({
107
+ nodeTypeName: currentNode.type.name,
108
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
109
+ samplingRate: samplingRate,
110
+ slowThreshold: slowThreshold
111
+ });
112
+ var extraNodeViewPropsWithStopEvent = _objectSpread({}, extraNodeViewProps);
113
+
114
+ // https://prosemirror.net/docs/ref/#view.NodeView
115
+ var nodeView = _objectSpread({
116
+ get dom() {
117
+ return domRef;
118
+ },
119
+ update: function update(nextNode, _decorations) {
120
+ // Let ProseMirror handle the update if node types are different.
121
+ // This prevents an issue where it was not possible to select the
122
+ // inline node view then replace it by entering text - the node
123
+ // view contents would be deleted but the node view itself would
124
+ // stay in the view and become uneditable.
125
+ if (currentNode.type !== nextNode.type) {
126
+ return false;
127
+ }
128
+ // On updates, we only set the new attributes if the type, attributes, and marks
129
+ // have changed on the node.
130
+
131
+ // NOTE: this could mean attrs changes aren't reflected in the dom,
132
+ // when an attribute key which was previously present is no longer
133
+ // present.
134
+ // ie.
135
+ // -> Original attributes { text: "hello world", color: "red" }
136
+ // -> Updated attributes { color: "blue" }
137
+ // in this case, the dom text attribute will not be cleared.
138
+ //
139
+ // This may not be an issue with any of our current node schemas.
140
+ if (!currentNode.sameMarkup(nextNode)) {
141
+ setDomAttrs(nextNode, domRef);
142
+ }
143
+ currentNode = nextNode;
144
+ renderComponent();
145
+ return true;
146
+ },
147
+ destroy: function destroy() {
148
+ // When prosemirror destroys the node view, we need to clean up
149
+ // what we have previously rendered using the editor portal
150
+ // provider api.
151
+ pmPluginFactoryParams.portalProviderAPI.remove(key);
152
+ // @ts-expect-error Expect an error as domRef is expected to be
153
+ // of HTMLSpanElement type however once the node view has
154
+ // been destroyed no other consumers should still be using it.
155
+ domRef = undefined;
156
+ fallbackRef.current = null;
157
+ }
158
+ }, extraNodeViewPropsWithStopEvent);
159
+ return nodeView;
160
+ }
161
+ function createNodeViewVirtualized(_ref2) {
162
+ var nodeViewParams = _ref2.nodeViewParams,
163
+ pmPluginFactoryParams = _ref2.pmPluginFactoryParams,
164
+ Component = _ref2.Component,
165
+ extraComponentProps = _ref2.extraComponentProps,
166
+ extraNodeViewProps = _ref2.extraNodeViewProps;
85
167
  // We set a variable for the current node which is
86
168
  // used for comparisions when doing updates, before being
87
169
  // overwritten to the updated node.
@@ -133,18 +215,20 @@ function createNodeView(_ref) {
133
215
  nodeViewParams: nodeViewParams,
134
216
  Component: Component,
135
217
  extraComponentProps: extraComponentProps
136
- }), domRef, key, enableVirtualization ? onBeforeReactDomRender : undefined);
218
+ }), domRef, key, onBeforeReactDomRender);
137
219
  }
138
220
  var didRenderComponentWithIntersectionObserver = false;
139
221
  var destroyed = false;
140
222
  var removeIntersectionObserver = function removeIntersectionObserver() {};
141
223
  function renderFallback() {
142
224
  var _currentNode$type;
143
- if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 || (_currentNode$type = _currentNode$type.spec) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.toDOM) === 'function') {
144
- var fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
145
- fallbackRef.current = fallback.dom;
146
- domRef.replaceChildren(fallback.dom);
225
+ if (!canRenderFallback(currentNode) || typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 || (_currentNode$type = _currentNode$type.spec) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.toDOM) !== 'function') {
226
+ return;
147
227
  }
228
+ var fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
229
+ var dom = fallback.dom;
230
+ fallbackRef.current = dom;
231
+ domRef.replaceChildren(dom);
148
232
  }
149
233
  function attachNodeViewObserver() {
150
234
  var observer = getOrCreateOnVisibleObserver(nodeViewParams.view);
@@ -157,36 +241,14 @@ function createNodeView(_ref) {
157
241
  });
158
242
  }
159
243
  }
160
- if (virtualizeNode) {
161
- renderFallback();
162
- // allow the fallback to render first before attaching the observer.
163
- // Will tweak this in a follow up PR to optimise rendering of visible
164
- // nodes without fallback rendering.
165
- setTimeout(function () {
166
- attachNodeViewObserver();
167
- }, 0);
168
- } else {
169
- initialReactRenderedNodeCount = initialReactRenderedNodeCount + 1;
170
- var _getPerformanceOption = getPerformanceOptions(nodeViewParams.view),
171
- samplingRate = _getPerformanceOption.samplingRate,
172
- slowThreshold = _getPerformanceOption.slowThreshold,
173
- trackingEnabled = _getPerformanceOption.trackingEnabled;
174
- trackingEnabled && startMeasureReactNodeViewRendered({
175
- nodeTypeName: currentNode.type.name
176
- });
177
-
178
- // We render the component while creating the node view
179
- renderComponent();
180
- trackingEnabled && stopMeasureReactNodeViewRendered({
181
- nodeTypeName: currentNode.type.name,
182
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
183
- samplingRate: samplingRate,
184
- slowThreshold: slowThreshold
185
- });
186
- }
187
- var extraNodeViewPropsWithStopEvent = _objectSpread(_objectSpread({}, extraNodeViewProps), enableVirtualization ? {
188
- // This is not related to virtualization, but it's something we should fix/handle
189
- // Remove this comment when virtualization experiment is cleaned up
244
+ renderFallback();
245
+ // allow the fallback to render first before attaching the observer.
246
+ // Will tweak this in a follow up PR to optimise rendering of visible
247
+ // nodes without fallback rendering.
248
+ setTimeout(function () {
249
+ attachNodeViewObserver();
250
+ }, 0);
251
+ var extraNodeViewPropsWithStopEvent = _objectSpread(_objectSpread({}, extraNodeViewProps), {}, {
190
252
  stopEvent: function stopEvent(event) {
191
253
  var maybeStopEvent = extraNodeViewProps === null || extraNodeViewProps === void 0 ? void 0 : extraNodeViewProps.stopEvent;
192
254
  if (typeof maybeStopEvent === 'function') {
@@ -194,7 +256,7 @@ function createNodeView(_ref) {
194
256
  }
195
257
  return false;
196
258
  }
197
- } : {});
259
+ });
198
260
 
199
261
  // https://prosemirror.net/docs/ref/#view.NodeView
200
262
  var nodeView = _objectSpread({
@@ -226,19 +288,14 @@ function createNodeView(_ref) {
226
288
  setDomAttrs(nextNode, domRef);
227
289
  }
228
290
  currentNode = nextNode;
229
- if (virtualizeNode) {
230
- if (didRenderComponentWithIntersectionObserver) {
231
- renderComponent();
232
- }
233
- } else {
291
+ if (didRenderComponentWithIntersectionObserver) {
234
292
  renderComponent();
235
293
  }
236
294
  return true;
237
295
  },
238
296
  destroy: function destroy() {
239
- if (virtualizeNode) {
240
- removeIntersectionObserver();
241
- }
297
+ removeIntersectionObserver();
298
+ destroyed = true;
242
299
 
243
300
  // When prosemirror destroys the node view, we need to clean up
244
301
  // what we have previously rendered using the editor portal
@@ -249,9 +306,6 @@ function createNodeView(_ref) {
249
306
  // been destroyed no other consumers should still be using it.
250
307
  domRef = undefined;
251
308
  fallbackRef.current = null;
252
- if (virtualizeNode) {
253
- destroyed = true;
254
- }
255
309
  }
256
310
  }, extraNodeViewPropsWithStopEvent);
257
311
  return nodeView;
@@ -266,12 +320,12 @@ function setDomAttrs(node, element) {
266
320
  element.setAttribute(attr, node.attrs[attr]);
267
321
  });
268
322
  }
269
- function getPortalChildren(_ref2) {
270
- var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
271
- currentNode = _ref2.currentNode,
272
- nodeViewParams = _ref2.nodeViewParams,
273
- Component = _ref2.Component,
274
- extraComponentProps = _ref2.extraComponentProps;
323
+ function getPortalChildren(_ref3) {
324
+ var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
325
+ currentNode = _ref3.currentNode,
326
+ nodeViewParams = _ref3.nodeViewParams,
327
+ Component = _ref3.Component,
328
+ extraComponentProps = _ref3.extraComponentProps;
275
329
  return function portalChildren() {
276
330
  var _currentNode$type$nam, _currentNode$type2;
277
331
  // All inline nodes use `display: inline` to allow for multi-line
@@ -342,18 +396,22 @@ function getPortalChildren(_ref2) {
342
396
  // [nodeViewName: string]: NodeViewProducer
343
397
  // }
344
398
 
399
+ var counterPerEditorViewMap = new WeakMap();
345
400
  // This return of this function is intended to be the value of a key
346
401
  // in a ProseMirror nodeViews object.
347
- export function getInlineNodeViewProducer(_ref3) {
348
- var pmPluginFactoryParams = _ref3.pmPluginFactoryParams,
349
- Component = _ref3.Component,
350
- extraComponentProps = _ref3.extraComponentProps,
351
- extraNodeViewProps = _ref3.extraNodeViewProps;
402
+ export function getInlineNodeViewProducer(_ref4) {
403
+ var pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
404
+ Component = _ref4.Component,
405
+ extraComponentProps = _ref4.extraComponentProps,
406
+ extraNodeViewProps = _ref4.extraNodeViewProps;
352
407
  function nodeViewProducer() {
353
- var nodeView = createNodeView({
408
+ var _node$type;
409
+ var view = arguments.length <= 1 ? undefined : arguments[1];
410
+ var node = arguments.length <= 0 ? undefined : arguments[0];
411
+ var parameters = {
354
412
  nodeViewParams: {
355
- node: arguments.length <= 0 ? undefined : arguments[0],
356
- view: arguments.length <= 1 ? undefined : arguments[1],
413
+ node: node,
414
+ view: view,
357
415
  getPos: arguments.length <= 2 ? undefined : arguments[2],
358
416
  decorations: arguments.length <= 3 ? undefined : arguments[3]
359
417
  },
@@ -361,8 +419,29 @@ export function getInlineNodeViewProducer(_ref3) {
361
419
  Component: Component,
362
420
  extraComponentProps: extraComponentProps,
363
421
  extraNodeViewProps: extraNodeViewProps
364
- });
365
- return nodeView;
422
+ };
423
+ var isNodeTypeAllowedToBeVirtualized = virtualizedNodeAllowlist.includes((node === null || node === void 0 || (_node$type = node.type) === null || _node$type === void 0 ? void 0 : _node$type.name) || '');
424
+ if (!isNodeTypeAllowedToBeVirtualized || isSSR) {
425
+ return createNodeView(parameters);
426
+ }
427
+ if (fg('platform_editor_inline_node_virt_threshold_override')) {
428
+ return createNodeViewVirtualized(parameters);
429
+ }
430
+ var inlineNodeViewsVirtualizationCounter = counterPerEditorViewMap.get(view) || 0;
431
+ inlineNodeViewsVirtualizationCounter += 1;
432
+ counterPerEditorViewMap.set(view, inlineNodeViewsVirtualizationCounter);
433
+
434
+ // We never virtualize the 100th first elements
435
+ if (inlineNodeViewsVirtualizationCounter <= 100) {
436
+ return createNodeView(parameters);
437
+ }
438
+ if (
439
+ // Due to the experiment, we need to check experiment exposure
440
+ // when a document has more than 100 (virtulizables) nodes.
441
+ checkExperimentExposure()) {
442
+ return createNodeViewVirtualized(parameters);
443
+ }
444
+ return createNodeView(parameters);
366
445
  }
367
446
  return nodeViewProducer;
368
447
  }
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "102.13.2";
23
+ var packageVersion = "102.13.4";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -249,8 +249,8 @@ var getNodeNameById = function getNodeNameById(id, allNodes) {
249
249
  if (_typeof(id) === 'object') {
250
250
  var name;
251
251
  id.forEach(function (localId) {
252
- var _name, _allNodes$localId;
253
- name = (_name = name) !== null && _name !== void 0 ? _name : (_allNodes$localId = allNodes[localId]) === null || _allNodes$localId === void 0 ? void 0 : _allNodes$localId.name;
252
+ var _allNodes$localId;
253
+ name = name !== null && name !== void 0 ? name : (_allNodes$localId = allNodes[localId]) === null || _allNodes$localId === void 0 ? void 0 : _allNodes$localId.name;
254
254
  });
255
255
  return name || null;
256
256
  }
@@ -230,7 +230,8 @@ export declare enum TRIGGER_METHOD {
230
230
  BUTTON = "button",
231
231
  KEYBOARD = "keyboard",// single key, e.g. Esc, Enter
232
232
  SHORTCUT = "shortcut",// combination of keys, e.g. Mod + F
233
- TOOLBAR = "toolbar"
233
+ TOOLBAR = "toolbar",
234
+ EXTERNAL = "external"
234
235
  }
235
236
  export declare enum ACTION_SUBJECT {
236
237
  AI_INTERACTION = "aiInteraction",
@@ -2,7 +2,7 @@ import type { ACTION, ACTION_SUBJECT, INPUT_METHOD, TRIGGER_METHOD } from './enu
2
2
  import type { TrackAEP, UIAEP } from './utils';
3
3
  type ActivateAEP = UIAEP<ACTION.ACTIVATED, ACTION_SUBJECT.FIND_REPLACE_DIALOG, undefined, {
4
4
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.PREFILL;
5
- triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR;
5
+ triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL;
6
6
  }, undefined>;
7
7
  type DeactivateAEP = UIAEP<ACTION.DEACTIVATED, ACTION_SUBJECT.FIND_REPLACE_DIALOG, undefined, {
8
8
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
@@ -59,6 +59,11 @@ export declare const linkToolbarMessages: {
59
59
  defaultMessage: string;
60
60
  description: string;
61
61
  };
62
+ preferencesLink: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
62
67
  editDatasource: {
63
68
  id: string;
64
69
  defaultMessage: string;
@@ -12,9 +12,22 @@ export type InlineNodeViewComponentProps = {
12
12
  node: PMNode;
13
13
  };
14
14
  type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<React.PropsWithChildren<InlineNodeViewComponentProps & ExtraComponentProps>>;
15
+ export type CreateNodeViewOptions<ExtraComponentProps> = {
16
+ nodeViewParams: NodeViewParams;
17
+ pmPluginFactoryParams: PMPluginFactoryParams;
18
+ Component: InlineNodeViewComponent<ExtraComponentProps>;
19
+ extraComponentProps: ExtraComponentProps;
20
+ extraNodeViewProps?: Pick<NodeView, 'stopEvent'>;
21
+ };
15
22
  export declare const inlineNodeViewClassname = "inlineNodeView";
16
23
  type NodeViewProducer = (node: PMNode, view: EditorView, getPos: () => GetPosReturn, decorations: readonly Decoration[]) => NodeView;
17
24
  type GetPosReturn = number | undefined;
25
+ type NodeViewParams = {
26
+ node: Parameters<NodeViewProducer>[0];
27
+ view: Parameters<NodeViewProducer>[1];
28
+ getPos: () => GetPosReturn;
29
+ decorations: Parameters<NodeViewProducer>[3];
30
+ };
18
31
  export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, extraNodeViewProps, }: {
19
32
  pmPluginFactoryParams: PMPluginFactoryParams;
20
33
  Component: InlineNodeViewComponent<ExtraComponentProps>;
@@ -230,7 +230,8 @@ export declare enum TRIGGER_METHOD {
230
230
  BUTTON = "button",
231
231
  KEYBOARD = "keyboard",// single key, e.g. Esc, Enter
232
232
  SHORTCUT = "shortcut",// combination of keys, e.g. Mod + F
233
- TOOLBAR = "toolbar"
233
+ TOOLBAR = "toolbar",
234
+ EXTERNAL = "external"
234
235
  }
235
236
  export declare enum ACTION_SUBJECT {
236
237
  AI_INTERACTION = "aiInteraction",
@@ -2,7 +2,7 @@ import type { ACTION, ACTION_SUBJECT, INPUT_METHOD, TRIGGER_METHOD } from './enu
2
2
  import type { TrackAEP, UIAEP } from './utils';
3
3
  type ActivateAEP = UIAEP<ACTION.ACTIVATED, ACTION_SUBJECT.FIND_REPLACE_DIALOG, undefined, {
4
4
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.PREFILL;
5
- triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR;
5
+ triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL;
6
6
  }, undefined>;
7
7
  type DeactivateAEP = UIAEP<ACTION.DEACTIVATED, ACTION_SUBJECT.FIND_REPLACE_DIALOG, undefined, {
8
8
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
@@ -59,6 +59,11 @@ export declare const linkToolbarMessages: {
59
59
  defaultMessage: string;
60
60
  description: string;
61
61
  };
62
+ preferencesLink: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
62
67
  editDatasource: {
63
68
  id: string;
64
69
  defaultMessage: string;
@@ -12,9 +12,22 @@ export type InlineNodeViewComponentProps = {
12
12
  node: PMNode;
13
13
  };
14
14
  type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<React.PropsWithChildren<InlineNodeViewComponentProps & ExtraComponentProps>>;
15
+ export type CreateNodeViewOptions<ExtraComponentProps> = {
16
+ nodeViewParams: NodeViewParams;
17
+ pmPluginFactoryParams: PMPluginFactoryParams;
18
+ Component: InlineNodeViewComponent<ExtraComponentProps>;
19
+ extraComponentProps: ExtraComponentProps;
20
+ extraNodeViewProps?: Pick<NodeView, 'stopEvent'>;
21
+ };
15
22
  export declare const inlineNodeViewClassname = "inlineNodeView";
16
23
  type NodeViewProducer = (node: PMNode, view: EditorView, getPos: () => GetPosReturn, decorations: readonly Decoration[]) => NodeView;
17
24
  type GetPosReturn = number | undefined;
25
+ type NodeViewParams = {
26
+ node: Parameters<NodeViewProducer>[0];
27
+ view: Parameters<NodeViewProducer>[1];
28
+ getPos: () => GetPosReturn;
29
+ decorations: Parameters<NodeViewProducer>[3];
30
+ };
18
31
  export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, extraNodeViewProps, }: {
19
32
  pmPluginFactoryParams: PMPluginFactoryParams;
20
33
  Component: InlineNodeViewComponent<ExtraComponentProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.13.2",
3
+ "version": "102.13.4",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -153,7 +153,7 @@
153
153
  "@atlaskit/platform-feature-flags": "^1.1.0",
154
154
  "@atlaskit/popper": "^7.0.0",
155
155
  "@atlaskit/primitives": "^14.2.0",
156
- "@atlaskit/profilecard": "^23.5.0",
156
+ "@atlaskit/profilecard": "^23.6.0",
157
157
  "@atlaskit/section-message": "^8.2.0",
158
158
  "@atlaskit/smart-card": "^36.0.0",
159
159
  "@atlaskit/smart-user-picker": "^8.0.0",