@atlaskit/editor-plugin-text-formatting 2.3.2 → 2.3.3

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,11 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 2.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 2.3.2
4
10
 
5
11
  ### Patch Changes
@@ -8,7 +8,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _keymaps = require("@atlaskit/editor-common/keymaps");
9
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
11
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
12
  var _commands = require("./commands");
14
13
  var _pluginKey = require("./plugin-key");
@@ -107,7 +106,7 @@ function keymapPlugin(schema, editorAnalyticsAPI) {
107
106
  props: {
108
107
  handleKeyDown: function handleKeyDown(view, event) {
109
108
  var keyboardEvent = (0, _keymaps.isCapsLockOnAndModifyKeyboardEvent)(event);
110
- var keymapList = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8') ? getEnabledKeylist(view) : list;
109
+ var keymapList = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? getEnabledKeylist(view) : list;
111
110
  return (0, _keymap.keydownHandler)(keymapList)(view, keyboardEvent);
112
111
  }
113
112
  }
@@ -128,7 +128,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
128
128
  formattingIconState = (0, _objectWithoutProperties2.default)(textFormattingState, _excluded);
129
129
  var hasMultiplePartsWithFormattingSelected;
130
130
  var commonActiveMarks = [];
131
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7')) {
131
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
132
132
  var selection = editorView.state.selection;
133
133
  var from = selection.from,
134
134
  to = selection.to;
@@ -59,7 +59,7 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
59
59
  var defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
60
60
  var iconBefore;
61
61
  var activeIconName = defaultIconName;
62
- if (hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7')) {
62
+ if (hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
63
63
  iconBefore = defaultIcon;
64
64
  } else {
65
65
  iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.hasMultiplePartsWithFormattingInSelection = exports.getCommonActiveMarks = void 0;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
7
  var _types = require("./types");
9
8
  var isMarkInIconTypes = function isMarkInIconTypes(node) {
10
9
  return node.marks.some(function (mark) {
@@ -16,19 +15,14 @@ var hasMultiplePartsWithFormattingInSelection = exports.hasMultiplePartsWithForm
16
15
  if (!selectedContent) {
17
16
  return false;
18
17
  }
19
- if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8')) {
20
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
21
- var contentWithMarks = selectedContent.filter(function (child) {
22
- return isMarkInIconTypes(child);
23
- });
24
- var hasFormatting = contentWithMarks.length > 0;
25
- var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
26
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
27
- }
28
- var marks = selectedContent.map(function (child) {
29
- return isMarkInIconTypes(child) ? child.marks : undefined;
30
- }).filter(Boolean);
31
- return marks.length > 1;
18
+
19
+ // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
20
+ var contentWithMarks = selectedContent.filter(function (child) {
21
+ return isMarkInIconTypes(child);
22
+ });
23
+ var hasFormatting = contentWithMarks.length > 0;
24
+ var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
25
+ return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
32
26
  };
33
27
  var getCommonActiveMarks = exports.getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
34
28
  var selectedContent = _ref2.selectedContent;
@@ -20,7 +20,7 @@ var useIconList = exports.useIconList = function useIconList(_ref) {
20
20
  }
21
21
  if (
22
22
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
23
- shouldUnselect && icon.isActive && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10')) {
23
+ shouldUnselect && icon.isActive && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10')) {
24
24
  icon.isActive = false;
25
25
  }
26
26
  var isIconSingleButton = iconTypeList.includes(icon.iconMark);
@@ -50,13 +50,13 @@ var SingleToolbarButtons = exports.SingleToolbarButtons = /*#__PURE__*/_react.de
50
50
  onClick: onClick(item.command),
51
51
  selected:
52
52
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
53
- hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
53
+ hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
54
54
  disabled: item.isDisabled,
55
55
  title: item.tooltipElement,
56
56
  iconBefore: item.iconElement,
57
57
  "aria-pressed":
58
58
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
59
- hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_7') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
59
+ hasMultiplePartsWithFormattingSelected && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_10') ? false : item.isActive,
60
60
  "aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
61
61
  "aria-keyshortcuts": item['aria-keyshortcuts']
62
62
  });
@@ -2,7 +2,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { bindKeymapWithEditorCommand, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
6
  import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from './commands';
8
7
  import { pluginKey } from './plugin-key';
@@ -101,7 +100,7 @@ export default function keymapPlugin(schema, editorAnalyticsAPI) {
101
100
  props: {
102
101
  handleKeyDown(view, event) {
103
102
  const keyboardEvent = isCapsLockOnAndModifyKeyboardEvent(event);
104
- const keymapList = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? getEnabledKeylist(view) : list;
103
+ const keymapList = editorExperiment('platform_editor_controls', 'variant1') ? getEnabledKeylist(view) : list;
105
104
  return keydownHandler(keymapList)(view, keyboardEvent);
106
105
  }
107
106
  }
@@ -122,7 +122,7 @@ const FloatingToolbarTextFormat = ({
122
122
  } = textFormattingState;
123
123
  let hasMultiplePartsWithFormattingSelected;
124
124
  let commonActiveMarks = [];
125
- if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
125
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
126
126
  const {
127
127
  selection
128
128
  } = editorView.state;
@@ -41,7 +41,7 @@ export const FormattingTextDropdownMenu = /*#__PURE__*/React.memo(({
41
41
  const defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
42
42
  let iconBefore;
43
43
  let activeIconName = defaultIconName;
44
- if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
44
+ if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1')) {
45
45
  iconBefore = defaultIcon;
46
46
  } else {
47
47
  iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { IconTypes } from './types';
3
2
  const isMarkInIconTypes = node => node.marks.some(mark => Object.values(IconTypes).includes(mark.type.name));
4
3
  export const hasMultiplePartsWithFormattingInSelection = ({
@@ -7,15 +6,12 @@ export const hasMultiplePartsWithFormattingInSelection = ({
7
6
  if (!selectedContent) {
8
7
  return false;
9
8
  }
10
- if (fg('platform_editor_controls_patch_8')) {
11
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
12
- const contentWithMarks = selectedContent.filter(child => isMarkInIconTypes(child));
13
- const hasFormatting = contentWithMarks.length > 0;
14
- const allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
15
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
16
- }
17
- const marks = selectedContent.map(child => isMarkInIconTypes(child) ? child.marks : undefined).filter(Boolean);
18
- return marks.length > 1;
9
+
10
+ // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
11
+ const contentWithMarks = selectedContent.filter(child => isMarkInIconTypes(child));
12
+ const hasFormatting = contentWithMarks.length > 0;
13
+ const allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
14
+ return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
19
15
  };
20
16
  export const getCommonActiveMarks = ({
21
17
  selectedContent
@@ -13,7 +13,7 @@ export const useIconList = ({
13
13
  }
14
14
  if (
15
15
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
16
- shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10')) {
16
+ shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10')) {
17
17
  icon.isActive = false;
18
18
  }
19
19
  const isIconSingleButton = iconTypeList.includes(icon.iconMark);
@@ -42,13 +42,13 @@ export const SingleToolbarButtons = /*#__PURE__*/React.memo(({
42
42
  onClick: onClick(item.command),
43
43
  selected:
44
44
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
45
- hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
45
+ hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
46
46
  disabled: item.isDisabled,
47
47
  title: item.tooltipElement,
48
48
  iconBefore: item.iconElement,
49
49
  "aria-pressed":
50
50
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
51
- hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
51
+ hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
52
52
  "aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
53
53
  "aria-keyshortcuts": item['aria-keyshortcuts']
54
54
  });
@@ -2,7 +2,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { bindKeymapWithEditorCommand, isCapsLockOnAndModifyKeyboardEvent, toggleBold, toggleCode, toggleItalic, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleUnderline } from '@atlaskit/editor-common/keymaps';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
5
- import { fg } from '@atlaskit/platform-feature-flags';
6
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
6
  import { toggleCodeWithAnalytics, toggleEmWithAnalytics, toggleStrikeWithAnalytics, toggleStrongWithAnalytics, toggleSubscriptWithAnalytics, toggleSuperscriptWithAnalytics, toggleUnderlineWithAnalytics } from './commands';
8
7
  import { pluginKey } from './plugin-key';
@@ -101,7 +100,7 @@ export default function keymapPlugin(schema, editorAnalyticsAPI) {
101
100
  props: {
102
101
  handleKeyDown: function handleKeyDown(view, event) {
103
102
  var keyboardEvent = isCapsLockOnAndModifyKeyboardEvent(event);
104
- var keymapList = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? getEnabledKeylist(view) : list;
103
+ var keymapList = editorExperiment('platform_editor_controls', 'variant1') ? getEnabledKeylist(view) : list;
105
104
  return keydownHandler(keymapList)(view, keyboardEvent);
106
105
  }
107
106
  }
@@ -120,7 +120,7 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
120
120
  formattingIconState = _objectWithoutProperties(textFormattingState, _excluded);
121
121
  var hasMultiplePartsWithFormattingSelected;
122
122
  var commonActiveMarks = [];
123
- if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
123
+ if (editorExperiment('platform_editor_controls', 'variant1')) {
124
124
  var selection = editorView.state.selection;
125
125
  var from = selection.from,
126
126
  to = selection.to;
@@ -50,7 +50,7 @@ export var FormattingTextDropdownMenu = /*#__PURE__*/React.memo(function (_ref)
50
50
  var defaultIconName = (_items$0$items$2 = items[0].items[0]) === null || _items$0$items$2 === void 0 ? void 0 : _items$0$items$2.value.name;
51
51
  var iconBefore;
52
52
  var activeIconName = defaultIconName;
53
- if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7')) {
53
+ if (hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1')) {
54
54
  iconBefore = defaultIcon;
55
55
  } else {
56
56
  iconBefore = activeItem ? activeItem === null || activeItem === void 0 ? void 0 : activeItem.elemBefore : defaultIcon;
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import { IconTypes } from './types';
3
2
  var isMarkInIconTypes = function isMarkInIconTypes(node) {
4
3
  return node.marks.some(function (mark) {
@@ -10,19 +9,14 @@ export var hasMultiplePartsWithFormattingInSelection = function hasMultipleParts
10
9
  if (!selectedContent) {
11
10
  return false;
12
11
  }
13
- if (fg('platform_editor_controls_patch_8')) {
14
- // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
15
- var contentWithMarks = selectedContent.filter(function (child) {
16
- return isMarkInIconTypes(child);
17
- });
18
- var hasFormatting = contentWithMarks.length > 0;
19
- var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
20
- return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
21
- }
22
- var marks = selectedContent.map(function (child) {
23
- return isMarkInIconTypes(child) ? child.marks : undefined;
24
- }).filter(Boolean);
25
- return marks.length > 1;
12
+
13
+ // Check if there are multiple parts with formatting or if only one part has formatting and the rest have none
14
+ var contentWithMarks = selectedContent.filter(function (child) {
15
+ return isMarkInIconTypes(child);
16
+ });
17
+ var hasFormatting = contentWithMarks.length > 0;
18
+ var allPartsHaveFormatting = contentWithMarks.length === selectedContent.length;
19
+ return hasFormatting && (!allPartsHaveFormatting || contentWithMarks.length > 1);
26
20
  };
27
21
  export var getCommonActiveMarks = function getCommonActiveMarks(_ref2) {
28
22
  var selectedContent = _ref2.selectedContent;
@@ -13,7 +13,7 @@ export var useIconList = function useIconList(_ref) {
13
13
  }
14
14
  if (
15
15
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
16
- shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10')) {
16
+ shouldUnselect && icon.isActive && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10')) {
17
17
  icon.isActive = false;
18
18
  }
19
19
  var isIconSingleButton = iconTypeList.includes(icon.iconMark);
@@ -41,13 +41,13 @@ export var SingleToolbarButtons = /*#__PURE__*/React.memo(function (_ref) {
41
41
  onClick: onClick(item.command),
42
42
  selected:
43
43
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
44
- hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
44
+ hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
45
45
  disabled: item.isDisabled,
46
46
  title: item.tooltipElement,
47
47
  iconBefore: item.iconElement,
48
48
  "aria-pressed":
49
49
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
50
- hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_7') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
50
+ hasMultiplePartsWithFormattingSelected && editorExperiment('platform_editor_controls', 'variant1') && !fg('platform_editor_controls_patch_10') ? false : item.isActive,
51
51
  "aria-label": (_item$ariaLabel = item['aria-label']) !== null && _item$ariaLabel !== void 0 ? _item$ariaLabel : String(item.content),
52
52
  "aria-keyshortcuts": item['aria-keyshortcuts']
53
53
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-formatting",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Text-formatting plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -45,8 +45,8 @@
45
45
  "@atlaskit/icon": "^27.0.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
48
- "@atlaskit/tmp-editor-statsig": "^7.1.0",
49
- "@atlaskit/tokens": "^5.2.0",
48
+ "@atlaskit/tmp-editor-statsig": "^8.0.0",
49
+ "@atlaskit/tokens": "^5.3.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -107,9 +107,6 @@
107
107
  "platform_editor_resolve_marks": {
108
108
  "type": "boolean"
109
109
  },
110
- "platform_editor_controls_patch_8": {
111
- "type": "boolean"
112
- },
113
110
  "platform_editor_controls_patch_9": {
114
111
  "type": "boolean"
115
112
  },
@@ -127,9 +124,6 @@
127
124
  },
128
125
  "platform_editor_use_preferences_plugin": {
129
126
  "type": "boolean"
130
- },
131
- "platform_editor_controls_patch_7": {
132
- "type": "boolean"
133
127
  }
134
128
  }
135
129
  }