@atlaskit/editor-plugin-insert-block 1.11.0 → 1.12.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,28 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#137041](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137041)
8
+ [`060aff106c5ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/060aff106c5ac) -
9
+ Add new experiment for insert menu in right rail, allow right menu to be opened from main toolbar
10
+ '+' button
11
+
12
+ ### Patch Changes
13
+
14
+ - [#137041](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137041)
15
+ [`060aff106c5ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/060aff106c5ac) -
16
+ Add insert-right-rail experiment and reimplement right rail logic
17
+
18
+ ## 1.11.1
19
+
20
+ ### Patch Changes
21
+
22
+ - [#136413](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136413)
23
+ [`934839fbec788`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/934839fbec788) -
24
+ Revert ED-24737-enable-right-rail due to HOT-111462
25
+
3
26
  ## 1.11.0
4
27
 
5
28
  ### Minor Changes
@@ -112,7 +112,7 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
112
112
  name: 'insertBlock',
113
113
  component: primaryToolbarComponent
114
114
  });
115
- return {
115
+ var plugin = {
116
116
  name: 'insertBlock',
117
117
  actions: {
118
118
  toggleAdditionalMenu: function toggleAdditionalMenu() {
@@ -203,25 +203,6 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
203
203
  return _templateOptions.templateOptions;
204
204
  }
205
205
  return [];
206
- },
207
- contextPanel: function contextPanel(state) {
208
- /**
209
- * For insert menu in right rail experiment
210
- * - Clean up ticket ED-24801
211
- */
212
- if (!(0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
213
- return;
214
- }
215
-
216
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
217
- // so instead just rely on plugin key as we don't need to be reactive to changes here
218
- var pluginState = _elementBrowser.elementBrowserPmKey.getState(state);
219
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
220
- return /*#__PURE__*/_react.default.createElement(_ElementRail.InsertMenuRail, {
221
- api: api
222
- });
223
- }
224
- return;
225
206
  }
226
207
  },
227
208
  usePluginHook: function usePluginHook() {
@@ -233,6 +214,20 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
233
214
  },
234
215
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
235
216
  };
217
+ if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
218
+ plugin.pluginsOptions.contextPanel = function (state) {
219
+ // api.getSharedState() will have an outdated reference to editorState on first mount of this component
220
+ // so instead just rely on plugin key as we don't need to be reactive to changes here
221
+ var pluginState = _elementBrowser.elementBrowserPmKey.getState(state);
222
+ if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
223
+ return /*#__PURE__*/_react.default.createElement(_ElementRail.InsertMenuRail, {
224
+ api: api
225
+ });
226
+ }
227
+ return;
228
+ };
229
+ }
230
+ return plugin;
236
231
  };
237
232
  function ToolbarInsertBlockWithInjectionApi(_ref3) {
238
233
  var _ref4, _ref5, _pluginInjectionApi$i, _pluginInjectionApi$c, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
@@ -101,7 +101,7 @@ export const insertBlockPlugin = ({
101
101
  name: 'insertBlock',
102
102
  component: primaryToolbarComponent
103
103
  });
104
- return {
104
+ const plugin = {
105
105
  name: 'insertBlock',
106
106
  actions: {
107
107
  toggleAdditionalMenu: () => {
@@ -194,25 +194,6 @@ export const insertBlockPlugin = ({
194
194
  return templateOptions;
195
195
  }
196
196
  return [];
197
- },
198
- contextPanel: state => {
199
- /**
200
- * For insert menu in right rail experiment
201
- * - Clean up ticket ED-24801
202
- */
203
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
204
- return;
205
- }
206
-
207
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
208
- // so instead just rely on plugin key as we don't need to be reactive to changes here
209
- const pluginState = elementBrowserPmKey.getState(state);
210
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
211
- return /*#__PURE__*/React.createElement(InsertMenuRail, {
212
- api: api
213
- });
214
- }
215
- return;
216
197
  }
217
198
  },
218
199
  usePluginHook: () => {
@@ -224,6 +205,20 @@ export const insertBlockPlugin = ({
224
205
  },
225
206
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
226
207
  };
208
+ if (editorExperiment('insert-menu-in-right-rail', true)) {
209
+ plugin.pluginsOptions.contextPanel = state => {
210
+ // api.getSharedState() will have an outdated reference to editorState on first mount of this component
211
+ // so instead just rely on plugin key as we don't need to be reactive to changes here
212
+ const pluginState = elementBrowserPmKey.getState(state);
213
+ if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
214
+ return /*#__PURE__*/React.createElement(InsertMenuRail, {
215
+ api: api
216
+ });
217
+ }
218
+ return;
219
+ };
220
+ }
221
+ return plugin;
227
222
  };
228
223
  function ToolbarInsertBlockWithInjectionApi({
229
224
  editorView,
@@ -102,7 +102,7 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
102
102
  name: 'insertBlock',
103
103
  component: primaryToolbarComponent
104
104
  });
105
- return {
105
+ var plugin = {
106
106
  name: 'insertBlock',
107
107
  actions: {
108
108
  toggleAdditionalMenu: function toggleAdditionalMenu() {
@@ -193,25 +193,6 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
193
193
  return templateOptions;
194
194
  }
195
195
  return [];
196
- },
197
- contextPanel: function contextPanel(state) {
198
- /**
199
- * For insert menu in right rail experiment
200
- * - Clean up ticket ED-24801
201
- */
202
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
203
- return;
204
- }
205
-
206
- // api.getSharedState() will have an outdated reference to editorState on first mount of this component
207
- // so instead just rely on plugin key as we don't need to be reactive to changes here
208
- var pluginState = elementBrowserPmKey.getState(state);
209
- if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
210
- return /*#__PURE__*/React.createElement(InsertMenuRail, {
211
- api: api
212
- });
213
- }
214
- return;
215
196
  }
216
197
  },
217
198
  usePluginHook: function usePluginHook() {
@@ -223,6 +204,20 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
223
204
  },
224
205
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
225
206
  };
207
+ if (editorExperiment('insert-menu-in-right-rail', true)) {
208
+ plugin.pluginsOptions.contextPanel = function (state) {
209
+ // api.getSharedState() will have an outdated reference to editorState on first mount of this component
210
+ // so instead just rely on plugin key as we don't need to be reactive to changes here
211
+ var pluginState = elementBrowserPmKey.getState(state);
212
+ if (pluginState !== null && pluginState !== void 0 && pluginState.menuBrowserOpen) {
213
+ return /*#__PURE__*/React.createElement(InsertMenuRail, {
214
+ api: api
215
+ });
216
+ }
217
+ return;
218
+ };
219
+ }
220
+ return plugin;
226
221
  };
227
222
  function ToolbarInsertBlockWithInjectionApi(_ref3) {
228
223
  var _ref4, _ref5, _pluginInjectionApi$i, _pluginInjectionApi$c, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^88.7.0",
34
+ "@atlaskit/editor-common": "^88.8.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
36
36
  "@atlaskit/editor-plugin-block-type": "^3.14.0",
37
37
  "@atlaskit/editor-plugin-code-block": "^3.3.0",
@@ -60,7 +60,7 @@
60
60
  "@atlaskit/icon": "^22.15.0",
61
61
  "@atlaskit/primitives": "^12.1.0",
62
62
  "@atlaskit/theme": "^13.0.0",
63
- "@atlaskit/tmp-editor-statsig": "^2.0.0",
63
+ "@atlaskit/tmp-editor-statsig": "^2.1.0",
64
64
  "@atlaskit/tokens": "^1.59.0",
65
65
  "@babel/runtime": "^7.0.0",
66
66
  "@emotion/react": "^11.7.1",