@atlaskit/editor-core 187.42.5 → 187.43.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.43.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ec4867e1376`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ec4867e1376) - Removed captions flag and replaced with a new media prop `allowCaptions`. `allowCaptions` is set to `false` by default and products will need to opt in to be able to use captions from now on.
8
+
9
+ ## 187.42.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`37c62369dae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/37c62369dae) - NO-ISSUE Import doc builder types from editor-common
14
+
3
15
  ## 187.42.5
4
16
 
5
17
  ### Patch Changes
@@ -130,7 +130,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
130
130
  return builder;
131
131
  }).maybeAdd(_plugins.captionPlugin, function (plugin, builder) {
132
132
  // EDM-799: inside caption plugin we do the feature flag in enabling the plugin
133
- if (props.media && (0, _mediaCommon.getMediaFeatureFlag)('captions', props.media.featureFlags)) {
133
+ if (props.media && (props.media.allowCaptions || (0, _mediaCommon.getMediaFeatureFlag)('captions', props.media.featureFlags))) {
134
134
  return builder.add(plugin);
135
135
  }
136
136
  return builder;
@@ -11,16 +11,16 @@ var _pluginKey = require("./plugin-key");
11
11
  function getMarkSelectionDecorationStartAndEnd(_ref) {
12
12
  var markType = _ref.markType,
13
13
  transaction = _ref.transaction;
14
- var headHesolvedPos = transaction.selection.$head;
14
+ var headResolvedPos = transaction.selection.$head;
15
15
  var textNodeIndex = transaction.selection.$head.index();
16
- var textNode = headHesolvedPos.parent.maybeChild(textNodeIndex);
16
+ var textNode = headResolvedPos.parent.maybeChild(textNodeIndex);
17
17
  var textNodeOffset = 0;
18
- headHesolvedPos.parent.forEach(function (_node, nodeOffset, index) {
18
+ headResolvedPos.parent.forEach(function (_node, nodeOffset, index) {
19
19
  if (index === textNodeIndex) {
20
20
  textNodeOffset = nodeOffset;
21
21
  }
22
22
  });
23
- var start = headHesolvedPos.start(headHesolvedPos.depth) + textNodeOffset;
23
+ var start = headResolvedPos.start(headResolvedPos.depth) + textNodeOffset;
24
24
  var end = start + textNode.text.length;
25
25
  return {
26
26
  start: start,
@@ -73,14 +73,20 @@ var mediaPlugin = function mediaPlugin(_ref2) {
73
73
  allowMediaGroup = _ref3$allowMediaGroup === void 0 ? true : _ref3$allowMediaGroup,
74
74
  _ref3$allowMediaSingl = _ref3.allowMediaSingle,
75
75
  allowMediaSingle = _ref3$allowMediaSingl === void 0 ? false : _ref3$allowMediaSingl,
76
+ allowCaptions = _ref3.allowCaptions,
76
77
  mediaFeatureFlags = _ref3.featureFlags;
77
- var captions = (0, _mediaCommon.getMediaFeatureFlag)('captions', mediaFeatureFlags);
78
78
  var allowMediaInline = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
79
+ var withCaption = (0, _mediaCommon.getMediaFeatureFlag)('captions', mediaFeatureFlags);
80
+
81
+ // temporary mapping - we will support captions feature flag until
82
+ // confluence removes the feature flag support in their code base and
83
+ // utilizes allowCaptions media prop instead
84
+ var mappedAllowCaptions = allowCaptions ? allowCaptions : withCaption;
79
85
  var mediaSingleOption = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? {
80
- withCaption: captions,
86
+ withCaption: mappedAllowCaptions,
81
87
  withExtendedWidthTypes: true
82
88
  } : {
83
- withCaption: captions,
89
+ withCaption: mappedAllowCaptions,
84
90
  withExtendedWidthTypes: false
85
91
  };
86
92
  var mediaSingleNode = (0, _adfSchema.mediaSingleSpec)(mediaSingleOption);
@@ -370,7 +370,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
370
370
  contentWidth: contentWidthForLegacyExperience,
371
371
  containerWidth: containerWidth,
372
372
  gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
373
- })
373
+ }),
374
+ allowCaptions: mediaOptions.allowCaptions
374
375
  };
375
376
  var resizableMediaSingleProps = _objectSpread({
376
377
  view: view,
@@ -394,7 +395,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
394
395
  canResize = canResize && !disabledNode;
395
396
  }
396
397
  }
397
- var shouldShowPlaceholder = (0, _mediaCommon2.getMediaFeatureFlag)('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof _state.NodeSelection;
398
+ var shouldShowPlaceholder = (mediaOptions.allowCaptions || (0, _mediaCommon2.getMediaFeatureFlag)('captions', mediaOptions.featureFlags)) && node.childCount !== 2 && isSelected && state.selection instanceof _state.NodeSelection;
398
399
  var MediaChildren = (0, _react.jsx)("figure", {
399
400
  ref: this.mediaSingleWrapperRef,
400
401
  css: [_styles.figureWrapper],
@@ -18,7 +18,7 @@ function keymapPlugin(options, editorAnalyticsAPI) {
18
18
  featureFlags = _ref.featureFlags;
19
19
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.undo.common, ignoreLinksInSteps, list);
20
20
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, splitMediaGroup, list);
21
- if ((0, _mediaCommon.getMediaFeatureFlag)('captions', featureFlags)) {
21
+ if (options !== null && options !== void 0 && options.allowCaptions || (0, _mediaCommon.getMediaFeatureFlag)('captions', featureFlags)) {
22
22
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveDown.common, insertAndSelectCaption(editorAnalyticsAPI), list);
23
23
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.tab.common, insertAndSelectCaption(editorAnalyticsAPI), list);
24
24
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, arrowLeftFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.42.5";
9
+ var version = "187.43.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -119,7 +119,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
119
119
  return builder;
120
120
  }).maybeAdd(captionPlugin, (plugin, builder) => {
121
121
  // EDM-799: inside caption plugin we do the feature flag in enabling the plugin
122
- if (props.media && getMediaFeatureFlag('captions', props.media.featureFlags)) {
122
+ if (props.media && (props.media.allowCaptions || getMediaFeatureFlag('captions', props.media.featureFlags))) {
123
123
  return builder.add(plugin);
124
124
  }
125
125
  return builder;
@@ -5,16 +5,16 @@ function getMarkSelectionDecorationStartAndEnd({
5
5
  markType,
6
6
  transaction
7
7
  }) {
8
- const headHesolvedPos = transaction.selection.$head;
8
+ const headResolvedPos = transaction.selection.$head;
9
9
  const textNodeIndex = transaction.selection.$head.index();
10
- const textNode = headHesolvedPos.parent.maybeChild(textNodeIndex);
10
+ const textNode = headResolvedPos.parent.maybeChild(textNodeIndex);
11
11
  let textNodeOffset = 0;
12
- headHesolvedPos.parent.forEach((_node, nodeOffset, index) => {
12
+ headResolvedPos.parent.forEach((_node, nodeOffset, index) => {
13
13
  if (index === textNodeIndex) {
14
14
  textNodeOffset = nodeOffset;
15
15
  }
16
16
  });
17
- const start = headHesolvedPos.start(headHesolvedPos.depth) + textNodeOffset;
17
+ const start = headResolvedPos.start(headResolvedPos.depth) + textNodeOffset;
18
18
  const end = start + textNode.text.length;
19
19
  return {
20
20
  start,
@@ -60,15 +60,21 @@ const mediaPlugin = ({
60
60
  const {
61
61
  allowMediaGroup = true,
62
62
  allowMediaSingle = false,
63
+ allowCaptions,
63
64
  featureFlags: mediaFeatureFlags
64
65
  } = options || {};
65
- const captions = getMediaFeatureFlag('captions', mediaFeatureFlags);
66
66
  const allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
67
+ const withCaption = getMediaFeatureFlag('captions', mediaFeatureFlags);
68
+
69
+ // temporary mapping - we will support captions feature flag until
70
+ // confluence removes the feature flag support in their code base and
71
+ // utilizes allowCaptions media prop instead
72
+ const mappedAllowCaptions = allowCaptions ? allowCaptions : withCaption;
67
73
  const mediaSingleOption = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
68
- withCaption: captions,
74
+ withCaption: mappedAllowCaptions,
69
75
  withExtendedWidthTypes: true
70
76
  } : {
71
- withCaption: captions,
77
+ withCaption: mappedAllowCaptions,
72
78
  withExtendedWidthTypes: false
73
79
  };
74
80
  const mediaSingleNode = mediaSingleSpec(mediaSingleOption);
@@ -277,7 +277,8 @@ export default class MediaSingleNode extends Component {
277
277
  contentWidth: contentWidthForLegacyExperience,
278
278
  containerWidth,
279
279
  gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
280
- })
280
+ }),
281
+ allowCaptions: mediaOptions.allowCaptions
281
282
  };
282
283
  const resizableMediaSingleProps = {
283
284
  view: view,
@@ -304,7 +305,7 @@ export default class MediaSingleNode extends Component {
304
305
  canResize = canResize && !disabledNode;
305
306
  }
306
307
  }
307
- const shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
308
+ const shouldShowPlaceholder = (mediaOptions.allowCaptions || getMediaFeatureFlag('captions', mediaOptions.featureFlags)) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
308
309
  const MediaChildren = jsx("figure", {
309
310
  ref: this.mediaSingleWrapperRef,
310
311
  css: [figureWrapper],
@@ -12,7 +12,7 @@ export function keymapPlugin(options, editorAnalyticsAPI) {
12
12
  } = options || {};
13
13
  bindKeymapWithCommand(undo.common, ignoreLinksInSteps, list);
14
14
  bindKeymapWithCommand(enter.common, splitMediaGroup, list);
15
- if (getMediaFeatureFlag('captions', featureFlags)) {
15
+ if (options !== null && options !== void 0 && options.allowCaptions || getMediaFeatureFlag('captions', featureFlags)) {
16
16
  bindKeymapWithCommand(moveDown.common, insertAndSelectCaption(editorAnalyticsAPI), list);
17
17
  bindKeymapWithCommand(tab.common, insertAndSelectCaption(editorAnalyticsAPI), list);
18
18
  bindKeymapWithCommand(moveLeft.common, arrowLeftFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.42.5";
2
+ export const version = "187.43.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -123,7 +123,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
123
123
  return builder;
124
124
  }).maybeAdd(captionPlugin, function (plugin, builder) {
125
125
  // EDM-799: inside caption plugin we do the feature flag in enabling the plugin
126
- if (props.media && getMediaFeatureFlag('captions', props.media.featureFlags)) {
126
+ if (props.media && (props.media.allowCaptions || getMediaFeatureFlag('captions', props.media.featureFlags))) {
127
127
  return builder.add(plugin);
128
128
  }
129
129
  return builder;
@@ -4,16 +4,16 @@ import { copyButtonPluginKey } from './plugin-key';
4
4
  function getMarkSelectionDecorationStartAndEnd(_ref) {
5
5
  var markType = _ref.markType,
6
6
  transaction = _ref.transaction;
7
- var headHesolvedPos = transaction.selection.$head;
7
+ var headResolvedPos = transaction.selection.$head;
8
8
  var textNodeIndex = transaction.selection.$head.index();
9
- var textNode = headHesolvedPos.parent.maybeChild(textNodeIndex);
9
+ var textNode = headResolvedPos.parent.maybeChild(textNodeIndex);
10
10
  var textNodeOffset = 0;
11
- headHesolvedPos.parent.forEach(function (_node, nodeOffset, index) {
11
+ headResolvedPos.parent.forEach(function (_node, nodeOffset, index) {
12
12
  if (index === textNodeIndex) {
13
13
  textNodeOffset = nodeOffset;
14
14
  }
15
15
  });
16
- var start = headHesolvedPos.start(headHesolvedPos.depth) + textNodeOffset;
16
+ var start = headResolvedPos.start(headResolvedPos.depth) + textNodeOffset;
17
17
  var end = start + textNode.text.length;
18
18
  return {
19
19
  start: start,
@@ -60,14 +60,20 @@ var mediaPlugin = function mediaPlugin(_ref2) {
60
60
  allowMediaGroup = _ref3$allowMediaGroup === void 0 ? true : _ref3$allowMediaGroup,
61
61
  _ref3$allowMediaSingl = _ref3.allowMediaSingle,
62
62
  allowMediaSingle = _ref3$allowMediaSingl === void 0 ? false : _ref3$allowMediaSingl,
63
+ allowCaptions = _ref3.allowCaptions,
63
64
  mediaFeatureFlags = _ref3.featureFlags;
64
- var captions = getMediaFeatureFlag('captions', mediaFeatureFlags);
65
65
  var allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
66
+ var withCaption = getMediaFeatureFlag('captions', mediaFeatureFlags);
67
+
68
+ // temporary mapping - we will support captions feature flag until
69
+ // confluence removes the feature flag support in their code base and
70
+ // utilizes allowCaptions media prop instead
71
+ var mappedAllowCaptions = allowCaptions ? allowCaptions : withCaption;
66
72
  var mediaSingleOption = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
67
- withCaption: captions,
73
+ withCaption: mappedAllowCaptions,
68
74
  withExtendedWidthTypes: true
69
75
  } : {
70
- withCaption: captions,
76
+ withCaption: mappedAllowCaptions,
71
77
  withExtendedWidthTypes: false
72
78
  };
73
79
  var mediaSingleNode = mediaSingleSpec(mediaSingleOption);
@@ -361,7 +361,8 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
361
361
  contentWidth: contentWidthForLegacyExperience,
362
362
  containerWidth: containerWidth,
363
363
  gutterOffset: MEDIA_SINGLE_GUTTER_SIZE
364
- })
364
+ }),
365
+ allowCaptions: mediaOptions.allowCaptions
365
366
  };
366
367
  var resizableMediaSingleProps = _objectSpread({
367
368
  view: view,
@@ -385,7 +386,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
385
386
  canResize = canResize && !disabledNode;
386
387
  }
387
388
  }
388
- var shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
389
+ var shouldShowPlaceholder = (mediaOptions.allowCaptions || getMediaFeatureFlag('captions', mediaOptions.featureFlags)) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
389
390
  var MediaChildren = jsx("figure", {
390
391
  ref: this.mediaSingleWrapperRef,
391
392
  css: [figureWrapper],
@@ -11,7 +11,7 @@ export function keymapPlugin(options, editorAnalyticsAPI) {
11
11
  featureFlags = _ref.featureFlags;
12
12
  bindKeymapWithCommand(undo.common, ignoreLinksInSteps, list);
13
13
  bindKeymapWithCommand(enter.common, splitMediaGroup, list);
14
- if (getMediaFeatureFlag('captions', featureFlags)) {
14
+ if (options !== null && options !== void 0 && options.allowCaptions || getMediaFeatureFlag('captions', featureFlags)) {
15
15
  bindKeymapWithCommand(moveDown.common, insertAndSelectCaption(editorAnalyticsAPI), list);
16
16
  bindKeymapWithCommand(tab.common, insertAndSelectCaption(editorAnalyticsAPI), list);
17
17
  bindKeymapWithCommand(moveLeft.common, arrowLeftFromMediaSingle(options === null || options === void 0 ? void 0 : options.editorSelectionAPI), list);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.42.5";
2
+ export var version = "187.43.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -42,6 +42,7 @@ export interface MediaOptions {
42
42
  editorSelectionAPI?: EditorSelectionAPI;
43
43
  featureFlags?: MediaFeatureFlags;
44
44
  getEditorFeatureFlags?: GetEditorFeatureFlags;
45
+ allowCaptions?: boolean;
45
46
  }
46
47
  export interface MediaSingleOptions {
47
48
  disableLayout?: boolean;
@@ -42,6 +42,7 @@ export interface MediaOptions {
42
42
  editorSelectionAPI?: EditorSelectionAPI;
43
43
  featureFlags?: MediaFeatureFlags;
44
44
  getEditorFeatureFlags?: GetEditorFeatureFlags;
45
+ allowCaptions?: boolean;
45
46
  }
46
47
  export interface MediaSingleOptions {
47
48
  disableLayout?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.42.5",
3
+ "version": "187.43.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -167,7 +167,7 @@
167
167
  "@atlaskit/media-test-helpers": "^33.0.0",
168
168
  "@atlaskit/menu": "^1.10.0",
169
169
  "@atlaskit/platform-feature-flags": "^0.2.0",
170
- "@atlaskit/renderer": "^108.11.0",
170
+ "@atlaskit/renderer": "^108.12.0",
171
171
  "@atlaskit/section-message": "^6.4.0",
172
172
  "@atlaskit/smart-user-picker": "^6.3.0",
173
173
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
package/report.api.md CHANGED
@@ -1206,6 +1206,8 @@ export interface MediaOptions {
1206
1206
  // (undocumented)
1207
1207
  allowBreakoutSnapPoints?: boolean;
1208
1208
  // (undocumented)
1209
+ allowCaptions?: boolean;
1210
+ // (undocumented)
1209
1211
  allowDropzoneDropLine?: boolean;
1210
1212
  // (undocumented)
1211
1213
  allowLazyLoading?: boolean;
@@ -1092,6 +1092,8 @@ export interface MediaOptions {
1092
1092
  // (undocumented)
1093
1093
  allowBreakoutSnapPoints?: boolean;
1094
1094
  // (undocumented)
1095
+ allowCaptions?: boolean;
1096
+ // (undocumented)
1095
1097
  allowDropzoneDropLine?: boolean;
1096
1098
  // (undocumented)
1097
1099
  allowLazyLoading?: boolean;