@atlaskit/editor-plugin-list 8.1.0 → 8.1.2

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,21 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 8.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ef001bf65d48f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef001bf65d48f) -
8
+ Remove usage of `platform_editor_toolbar_aifc` inside editor packages - instead rely on checking
9
+ for new toolbar plugin option, make `enableNewToolbarExperience` mandatory for consumers to opt in
10
+ to new toolbar experience
11
+ - Updated dependencies
12
+
13
+ ## 8.1.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 8.1.0
4
20
 
5
21
  ### Minor Changes
@@ -83,7 +83,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
83
83
  name: 'list',
84
84
  plugin: function plugin(_ref2) {
85
85
  var dispatch = _ref2.dispatch;
86
- return (0, _main.createPlugin)(dispatch, featureFlags);
86
+ return (0, _main.createPlugin)(dispatch, featureFlags, api);
87
87
  }
88
88
  }, {
89
89
  name: 'listInputRule',
@@ -14,7 +14,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
15
15
  var _view = require("@atlaskit/editor-prosemirror/view");
16
16
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
17
  var _selection2 = require("./utils/selection");
19
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -123,14 +122,15 @@ var reducer = function reducer() {
123
122
  return state;
124
123
  };
125
124
  };
126
- var createInitialState = function createInitialState(featureFlags) {
125
+ var createInitialState = function createInitialState(featureFlags, api) {
127
126
  return function (state) {
128
- return _objectSpread(_objectSpread({}, (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true) && (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState), {}, {
127
+ var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
128
+ return _objectSpread(_objectSpread({}, isToolbarAIFCEnabled && (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState), {}, {
129
129
  decorationSet: getDecorations(state.doc, state, featureFlags)
130
130
  });
131
131
  };
132
132
  };
133
- var createPlugin = exports.createPlugin = function createPlugin(eventDispatch, featureFlags) {
133
+ var createPlugin = exports.createPlugin = function createPlugin(eventDispatch, featureFlags, api) {
134
134
  var _pluginFactory = (0, _utils.pluginFactory)(listPluginKey, reducer(), {
135
135
  onDocChanged: handleDocChanged(featureFlags),
136
136
  onSelectionChanged: handleSelectionChanged
@@ -138,7 +138,7 @@ var createPlugin = exports.createPlugin = function createPlugin(eventDispatch, f
138
138
  getPluginState = _pluginFactory.getPluginState,
139
139
  createPluginState = _pluginFactory.createPluginState;
140
140
  return new _safePlugin.SafePlugin({
141
- state: createPluginState(eventDispatch, createInitialState(featureFlags)),
141
+ state: createPluginState(eventDispatch, createInitialState(featureFlags, api)),
142
142
  key: listPluginKey,
143
143
  props: {
144
144
  decorations: function decorations(state) {
@@ -74,7 +74,7 @@ export const listPlugin = ({
74
74
  name: 'list',
75
75
  plugin: ({
76
76
  dispatch
77
- }) => createPlugin(dispatch, featureFlags)
77
+ }) => createPlugin(dispatch, featureFlags, api)
78
78
  }, {
79
79
  name: 'listInputRule',
80
80
  plugin: ({
@@ -6,7 +6,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
9
  import { isWrappingPossible } from './utils/selection';
11
10
  const listPluginKey = new PluginKey('listPlugin');
12
11
  export const pluginKey = listPluginKey;
@@ -113,15 +112,16 @@ const handleSelectionChanged = (tr, pluginState) => {
113
112
  const reducer = () => state => {
114
113
  return state;
115
114
  };
116
- const createInitialState = featureFlags => state => {
115
+ const createInitialState = (featureFlags, api) => state => {
116
+ const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
117
117
  return {
118
118
  // When plugin is initialised, editor state is defined with selection
119
119
  // hence returning the list state based on the selection to avoid list button in primary toolbar flickering during initial load
120
- ...(editorExperiment('platform_editor_toolbar_aifc', true) && expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState),
120
+ ...(isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState),
121
121
  decorationSet: getDecorations(state.doc, state, featureFlags)
122
122
  };
123
123
  };
124
- export const createPlugin = (eventDispatch, featureFlags) => {
124
+ export const createPlugin = (eventDispatch, featureFlags, api) => {
125
125
  const {
126
126
  getPluginState,
127
127
  createPluginState
@@ -130,7 +130,7 @@ export const createPlugin = (eventDispatch, featureFlags) => {
130
130
  onSelectionChanged: handleSelectionChanged
131
131
  });
132
132
  return new SafePlugin({
133
- state: createPluginState(eventDispatch, createInitialState(featureFlags)),
133
+ state: createPluginState(eventDispatch, createInitialState(featureFlags, api)),
134
134
  key: listPluginKey,
135
135
  props: {
136
136
  decorations(state) {
@@ -78,7 +78,7 @@ export var listPlugin = function listPlugin(_ref) {
78
78
  name: 'list',
79
79
  plugin: function plugin(_ref2) {
80
80
  var dispatch = _ref2.dispatch;
81
- return createPlugin(dispatch, featureFlags);
81
+ return createPlugin(dispatch, featureFlags, api);
82
82
  }
83
83
  }, {
84
84
  name: 'listInputRule',
@@ -9,7 +9,6 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
9
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
11
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
  import { isWrappingPossible } from './utils/selection';
14
13
  var listPluginKey = new PluginKey('listPlugin');
15
14
  export var pluginKey = listPluginKey;
@@ -116,14 +115,15 @@ var reducer = function reducer() {
116
115
  return state;
117
116
  };
118
117
  };
119
- var createInitialState = function createInitialState(featureFlags) {
118
+ var createInitialState = function createInitialState(featureFlags, api) {
120
119
  return function (state) {
121
- return _objectSpread(_objectSpread({}, editorExperiment('platform_editor_toolbar_aifc', true) && expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState), {}, {
120
+ var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
121
+ return _objectSpread(_objectSpread({}, isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_patch_3', 'isEnabled', true) ? getListState(state.doc, state.selection) : initialState), {}, {
122
122
  decorationSet: getDecorations(state.doc, state, featureFlags)
123
123
  });
124
124
  };
125
125
  };
126
- export var createPlugin = function createPlugin(eventDispatch, featureFlags) {
126
+ export var createPlugin = function createPlugin(eventDispatch, featureFlags, api) {
127
127
  var _pluginFactory = pluginFactory(listPluginKey, reducer(), {
128
128
  onDocChanged: handleDocChanged(featureFlags),
129
129
  onSelectionChanged: handleSelectionChanged
@@ -131,7 +131,7 @@ export var createPlugin = function createPlugin(eventDispatch, featureFlags) {
131
131
  getPluginState = _pluginFactory.getPluginState,
132
132
  createPluginState = _pluginFactory.createPluginState;
133
133
  return new SafePlugin({
134
- state: createPluginState(eventDispatch, createInitialState(featureFlags)),
134
+ state: createPluginState(eventDispatch, createInitialState(featureFlags, api)),
135
135
  key: listPluginKey,
136
136
  props: {
137
137
  decorations: function decorations(state) {
@@ -2,11 +2,13 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
4
4
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
5
6
  import type { FindRootParentListNode, IndentList, IsInsideListItem, ListState, OutdentList, ToggleBulletList, ToggleOrderedList } from './types';
6
7
  export type ListPluginDependencies = [
7
8
  OptionalPlugin<FeatureFlagsPlugin>,
8
9
  OptionalPlugin<AnalyticsPlugin>,
9
- OptionalPlugin<BlockMenuPlugin>
10
+ OptionalPlugin<BlockMenuPlugin>,
11
+ OptionalPlugin<ToolbarPlugin>
10
12
  ];
11
13
  export type ListPluginActions = {
12
14
  findRootParentListNode: FindRootParentListNode;
@@ -1,11 +1,12 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
+ import type { ListPlugin } from '../listPluginType';
8
9
  import type { ListState } from '../types';
9
10
  export declare const pluginKey: PluginKey<ListState>;
10
11
  export declare const getDecorations: (doc: Node, state: EditorState, featureFlags: FeatureFlags) => DecorationSet;
11
- export declare const createPlugin: (eventDispatch: Dispatch, featureFlags: FeatureFlags) => SafePlugin;
12
+ export declare const createPlugin: (eventDispatch: Dispatch, featureFlags: FeatureFlags, api?: ExtractInjectionAPI<ListPlugin>) => SafePlugin;
@@ -2,11 +2,13 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
4
4
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
5
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
5
6
  import type { FindRootParentListNode, IndentList, IsInsideListItem, ListState, OutdentList, ToggleBulletList, ToggleOrderedList } from './types';
6
7
  export type ListPluginDependencies = [
7
8
  OptionalPlugin<FeatureFlagsPlugin>,
8
9
  OptionalPlugin<AnalyticsPlugin>,
9
- OptionalPlugin<BlockMenuPlugin>
10
+ OptionalPlugin<BlockMenuPlugin>,
11
+ OptionalPlugin<ToolbarPlugin>
10
12
  ];
11
13
  export type ListPluginActions = {
12
14
  findRootParentListNode: FindRootParentListNode;
@@ -1,11 +1,12 @@
1
1
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
+ import type { ListPlugin } from '../listPluginType';
8
9
  import type { ListState } from '../types';
9
10
  export declare const pluginKey: PluginKey<ListState>;
10
11
  export declare const getDecorations: (doc: Node, state: EditorState, featureFlags: FeatureFlags) => DecorationSet;
11
- export declare const createPlugin: (eventDispatch: Dispatch, featureFlags: FeatureFlags) => SafePlugin;
12
+ export declare const createPlugin: (eventDispatch: Dispatch, featureFlags: FeatureFlags, api?: ExtractInjectionAPI<ListPlugin>) => SafePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "8.1.0",
3
+ "version": "8.1.2",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,13 +31,14 @@
31
31
  "@atlaskit/editor-plugin-analytics": "^6.1.0",
32
32
  "@atlaskit/editor-plugin-block-menu": "^4.0.0",
33
33
  "@atlaskit/editor-plugin-feature-flags": "^5.0.0",
34
+ "@atlaskit/editor-plugin-toolbar": "^3.2.0",
34
35
  "@atlaskit/editor-prosemirror": "7.0.0",
35
- "@atlaskit/editor-toolbar": "^0.14.0",
36
+ "@atlaskit/editor-toolbar": "^0.15.0",
36
37
  "@atlaskit/icon": "^28.5.0",
37
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
39
  "@atlaskit/prosemirror-history": "^0.2.0",
39
40
  "@atlaskit/prosemirror-input-rules": "^3.5.0",
40
- "@atlaskit/tmp-editor-statsig": "^13.6.0",
41
+ "@atlaskit/tmp-editor-statsig": "^13.10.0",
41
42
  "@babel/runtime": "^7.0.0"
42
43
  },
43
44
  "peerDependencies": {