@atlaskit/editor-plugin-expand 1.2.6 → 1.3.1

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 (73) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/{nodeviews → legacyExpand/nodeviews}/index.js +18 -5
  3. package/dist/cjs/legacyExpand/plugin.js +105 -0
  4. package/dist/cjs/plugin.js +13 -93
  5. package/dist/cjs/singlePlayerExpand/plugin.js +35 -0
  6. package/dist/es2019/index.js +2 -0
  7. package/dist/es2019/{nodeviews → legacyExpand/nodeviews}/index.js +18 -5
  8. package/dist/es2019/legacyExpand/plugin.js +90 -0
  9. package/dist/es2019/plugin.js +14 -85
  10. package/dist/es2019/singlePlayerExpand/plugin.js +30 -0
  11. package/dist/esm/index.js +2 -0
  12. package/dist/esm/{nodeviews → legacyExpand/nodeviews}/index.js +18 -5
  13. package/dist/esm/legacyExpand/plugin.js +92 -0
  14. package/dist/esm/plugin.js +14 -87
  15. package/dist/esm/singlePlayerExpand/plugin.js +30 -0
  16. package/dist/types/index.d.ts +1 -1
  17. package/dist/{types-ts4.5 → types/legacyExpand}/nodeviews/index.d.ts +1 -2
  18. package/dist/types/legacyExpand/plugin.d.ts +3 -0
  19. package/dist/types/legacyExpand/pm-plugins/plugin-factory.d.ts +3 -0
  20. package/dist/types/{toolbar.d.ts → legacyExpand/toolbar.d.ts} +1 -1
  21. package/dist/types/plugin.d.ts +1 -2
  22. package/dist/types/singlePlayerExpand/plugin.d.ts +2 -0
  23. package/dist/types-ts4.5/index.d.ts +1 -1
  24. package/dist/{types → types-ts4.5/legacyExpand}/nodeviews/index.d.ts +1 -2
  25. package/dist/types-ts4.5/legacyExpand/plugin.d.ts +3 -0
  26. package/dist/types-ts4.5/legacyExpand/pm-plugins/plugin-factory.d.ts +3 -0
  27. package/dist/types-ts4.5/{toolbar.d.ts → legacyExpand/toolbar.d.ts} +1 -1
  28. package/dist/types-ts4.5/plugin.d.ts +1 -2
  29. package/dist/types-ts4.5/singlePlayerExpand/plugin.d.ts +2 -0
  30. package/package.json +8 -5
  31. package/dist/types/pm-plugins/plugin-factory.d.ts +0 -3
  32. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +0 -3
  33. /package/dist/cjs/{commands.js → legacyExpand/commands.js} +0 -0
  34. /package/dist/cjs/{pm-plugins → legacyExpand/pm-plugins}/keymap.js +0 -0
  35. /package/dist/cjs/{pm-plugins → legacyExpand/pm-plugins}/main.js +0 -0
  36. /package/dist/cjs/{pm-plugins → legacyExpand/pm-plugins}/plugin-factory.js +0 -0
  37. /package/dist/cjs/{reducer.js → legacyExpand/reducer.js} +0 -0
  38. /package/dist/cjs/{toolbar.js → legacyExpand/toolbar.js} +0 -0
  39. /package/dist/cjs/{types.js → legacyExpand/types.js} +0 -0
  40. /package/dist/cjs/{ui → legacyExpand/ui}/ExpandIconButton.js +0 -0
  41. /package/dist/cjs/{utils.js → legacyExpand/utils.js} +0 -0
  42. /package/dist/es2019/{commands.js → legacyExpand/commands.js} +0 -0
  43. /package/dist/es2019/{pm-plugins → legacyExpand/pm-plugins}/keymap.js +0 -0
  44. /package/dist/es2019/{pm-plugins → legacyExpand/pm-plugins}/main.js +0 -0
  45. /package/dist/es2019/{pm-plugins → legacyExpand/pm-plugins}/plugin-factory.js +0 -0
  46. /package/dist/es2019/{reducer.js → legacyExpand/reducer.js} +0 -0
  47. /package/dist/es2019/{toolbar.js → legacyExpand/toolbar.js} +0 -0
  48. /package/dist/es2019/{types.js → legacyExpand/types.js} +0 -0
  49. /package/dist/es2019/{ui → legacyExpand/ui}/ExpandIconButton.js +0 -0
  50. /package/dist/es2019/{utils.js → legacyExpand/utils.js} +0 -0
  51. /package/dist/esm/{commands.js → legacyExpand/commands.js} +0 -0
  52. /package/dist/esm/{pm-plugins → legacyExpand/pm-plugins}/keymap.js +0 -0
  53. /package/dist/esm/{pm-plugins → legacyExpand/pm-plugins}/main.js +0 -0
  54. /package/dist/esm/{pm-plugins → legacyExpand/pm-plugins}/plugin-factory.js +0 -0
  55. /package/dist/esm/{reducer.js → legacyExpand/reducer.js} +0 -0
  56. /package/dist/esm/{toolbar.js → legacyExpand/toolbar.js} +0 -0
  57. /package/dist/esm/{types.js → legacyExpand/types.js} +0 -0
  58. /package/dist/esm/{ui → legacyExpand/ui}/ExpandIconButton.js +0 -0
  59. /package/dist/esm/{utils.js → legacyExpand/utils.js} +0 -0
  60. /package/dist/types/{commands.d.ts → legacyExpand/commands.d.ts} +0 -0
  61. /package/dist/types/{pm-plugins → legacyExpand/pm-plugins}/keymap.d.ts +0 -0
  62. /package/dist/types/{pm-plugins → legacyExpand/pm-plugins}/main.d.ts +0 -0
  63. /package/dist/types/{reducer.d.ts → legacyExpand/reducer.d.ts} +0 -0
  64. /package/dist/types/{types.d.ts → legacyExpand/types.d.ts} +0 -0
  65. /package/dist/types/{ui → legacyExpand/ui}/ExpandIconButton.d.ts +0 -0
  66. /package/dist/types/{utils.d.ts → legacyExpand/utils.d.ts} +0 -0
  67. /package/dist/types-ts4.5/{commands.d.ts → legacyExpand/commands.d.ts} +0 -0
  68. /package/dist/types-ts4.5/{pm-plugins → legacyExpand/pm-plugins}/keymap.d.ts +0 -0
  69. /package/dist/types-ts4.5/{pm-plugins → legacyExpand/pm-plugins}/main.d.ts +0 -0
  70. /package/dist/types-ts4.5/{reducer.d.ts → legacyExpand/reducer.d.ts} +0 -0
  71. /package/dist/types-ts4.5/{types.d.ts → legacyExpand/types.d.ts} +0 -0
  72. /package/dist/types-ts4.5/{ui → legacyExpand/ui}/ExpandIconButton.d.ts +0 -0
  73. /package/dist/types-ts4.5/{utils.d.ts → legacyExpand/utils.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#89499](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89499) [`1a3ac47ce689`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1a3ac47ce689) - ED-22666 Disable editing when editor in view mode or edtable is false
8
+
9
+ ## 1.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#87870](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87870) [`76711a3e7edd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/76711a3e7edd) - [ED-22839] Refactor expand plugin to use either legacy (current) expand or single player expand (coming soon). Single player expand will only be used if `platform.editor.single-player-expand` is true and livePage is enabled.
14
+
3
15
  ## 1.2.6
4
16
 
5
17
  ### Patch Changes
@@ -24,7 +24,7 @@ var _ExpandIconButton = require("../ui/ExpandIconButton");
24
24
  function buildExpandClassName(type, expanded) {
25
25
  return "".concat(_styles.expandClassNames.prefix, " ").concat(_styles.expandClassNames.type(type), " ").concat(expanded ? _styles.expandClassNames.expanded : '');
26
26
  }
27
- var toDOM = function toDOM(node, __livePage, intl) {
27
+ var toDOM = function toDOM(node, __livePage, intl, editable) {
28
28
  return ['div', {
29
29
  // prettier-ignore
30
30
  'class': buildExpandClassName(node.type.name, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
@@ -50,11 +50,13 @@ var toDOM = function toDOM(node, __livePage, intl) {
50
50
  'class': _styles.expandClassNames.titleInput,
51
51
  value: node.attrs.title,
52
52
  placeholder: intl && intl.formatMessage(_ui.expandMessages.expandPlaceholderText) || _ui.expandMessages.expandPlaceholderText.defaultMessage,
53
- type: 'text'
53
+ type: 'text',
54
+ readonly: !editable ? 'true' : undefined
54
55
  }]]],
55
56
  // prettier-ignore
56
57
  ['div', {
57
- 'class': _styles.expandClassNames.content
58
+ 'class': _styles.expandClassNames.content,
59
+ contenteditable: editable
58
60
  }, 0]];
59
61
  };
60
62
  var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
@@ -361,7 +363,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
361
363
  this.selectNearNode = selectNearNode;
362
364
  this.__livePage = __livePage;
363
365
  this.intl = getIntl();
364
- var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
366
+ var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable)),
365
367
  dom = _DOMSerializer$render.dom,
366
368
  contentDOM = _DOMSerializer$render.contentDOM;
367
369
  this.allowInteractiveExpand = allowInteractiveExpand;
@@ -450,7 +452,18 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
450
452
  }
451
453
  if (this.content) {
452
454
  // Disallow interaction/selection inside when collapsed.
453
- this.content.setAttribute('contenteditable', (0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
455
+ this.content.setAttribute('contenteditable', this.view.editable && ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
456
+ }
457
+ } else {
458
+ if (this.content) {
459
+ this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
460
+ }
461
+ }
462
+ if (this.input) {
463
+ if (!this.view.editable) {
464
+ this.input.setAttribute('readonly', 'true');
465
+ } else {
466
+ this.input.removeAttribute('readonly');
454
467
  }
455
468
  }
456
469
 
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.expandPlugin = void 0;
8
+ Object.defineProperty(exports, "pluginKey", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _pluginFactory.pluginKey;
12
+ }
13
+ });
14
+ var _react = _interopRequireDefault(require("react"));
15
+ var _adfSchema = require("@atlaskit/adf-schema");
16
+ var _analytics = require("@atlaskit/editor-common/analytics");
17
+ var _messages = require("@atlaskit/editor-common/messages");
18
+ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
19
+ var _utils = require("@atlaskit/editor-common/utils");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
+ var _commands = require("./commands");
22
+ var _keymap = require("./pm-plugins/keymap");
23
+ var _main = require("./pm-plugins/main");
24
+ var _toolbar = require("./toolbar");
25
+ var _pluginFactory = require("./pm-plugins/plugin-factory");
26
+ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
27
+ var _api$analytics;
28
+ var _ref$config = _ref.config,
29
+ options = _ref$config === void 0 ? {} : _ref$config,
30
+ api = _ref.api;
31
+ return {
32
+ name: 'expand',
33
+ nodes: function nodes() {
34
+ var nestedExpandNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-extended-nested-expand') ? _adfSchema.extendedNestedExpand : _adfSchema.nestedExpand;
35
+ return [{
36
+ name: 'expand',
37
+ node: _adfSchema.expand
38
+ }, {
39
+ name: 'nestedExpand',
40
+ node: nestedExpandNode
41
+ }];
42
+ },
43
+ actions: {
44
+ insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
45
+ },
46
+ pmPlugins: function pmPlugins() {
47
+ return [{
48
+ name: 'expand',
49
+ plugin: function plugin(_ref2) {
50
+ var _options$allowInterac;
51
+ var dispatch = _ref2.dispatch,
52
+ getIntl = _ref2.getIntl;
53
+ return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
54
+ }
55
+ }, {
56
+ name: 'expandKeymap',
57
+ plugin: function plugin() {
58
+ return (0, _keymap.expandKeymap)(api, {
59
+ __livePage: options.__livePage
60
+ });
61
+ }
62
+ }];
63
+ },
64
+ pluginsOptions: {
65
+ floatingToolbar: (0, _toolbar.getToolbarConfig)(api),
66
+ quickInsert: function quickInsert(_ref3) {
67
+ var formatMessage = _ref3.formatMessage;
68
+ if (options && options.allowInsertion !== true) {
69
+ return [];
70
+ }
71
+ return [{
72
+ id: 'expand',
73
+ title: formatMessage(_messages.toolbarInsertBlockMessages.expand),
74
+ description: formatMessage(_messages.toolbarInsertBlockMessages.expandDescription),
75
+ keywords: ['accordion', 'collapse'],
76
+ priority: 600,
77
+ icon: function icon() {
78
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconExpand, null);
79
+ },
80
+ action: function action(insert, state) {
81
+ var _api$analytics2;
82
+ var node = (0, _commands.createExpandNode)(state);
83
+ if (!node) {
84
+ return false;
85
+ }
86
+ var tr = state.selection.empty ? insert(node) : (0, _utils.createWrapSelectionTransaction)({
87
+ state: state,
88
+ type: node.type
89
+ });
90
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
91
+ action: _analytics.ACTION.INSERTED,
92
+ actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
93
+ actionSubjectId: node.type === state.schema.nodes.nestedExpand ? _analytics.ACTION_SUBJECT_ID.NESTED_EXPAND : _analytics.ACTION_SUBJECT_ID.EXPAND,
94
+ attributes: {
95
+ inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
96
+ },
97
+ eventType: _analytics.EVENT_TYPE.TRACK
98
+ })(tr);
99
+ return tr;
100
+ }
101
+ }];
102
+ }
103
+ }
104
+ };
105
+ };
@@ -1,105 +1,25 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.expandPlugin = void 0;
8
- Object.defineProperty(exports, "pluginKey", {
9
- enumerable: true,
10
- get: function get() {
11
- return _pluginFactory.pluginKey;
12
- }
13
- });
14
- var _react = _interopRequireDefault(require("react"));
15
- var _adfSchema = require("@atlaskit/adf-schema");
16
- var _analytics = require("@atlaskit/editor-common/analytics");
17
- var _messages = require("@atlaskit/editor-common/messages");
18
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
19
- var _utils = require("@atlaskit/editor-common/utils");
20
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
- var _commands = require("./commands");
22
- var _keymap = require("./pm-plugins/keymap");
23
- var _main = require("./pm-plugins/main");
24
- var _toolbar = require("./toolbar");
25
- var _pluginFactory = require("./pm-plugins/plugin-factory");
8
+ var _plugin = require("./legacyExpand/plugin");
9
+ var _plugin2 = require("./singlePlayerExpand/plugin");
26
10
  var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
27
- var _api$analytics;
28
11
  var _ref$config = _ref.config,
29
12
  options = _ref$config === void 0 ? {} : _ref$config,
30
13
  api = _ref.api;
31
- return {
32
- name: 'expand',
33
- nodes: function nodes() {
34
- var nestedExpandNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-extended-nested-expand') ? _adfSchema.extendedNestedExpand : _adfSchema.nestedExpand;
35
- return [{
36
- name: 'expand',
37
- node: _adfSchema.expand
38
- }, {
39
- name: 'nestedExpand',
40
- node: nestedExpandNode
41
- }];
42
- },
43
- actions: {
44
- insertExpand: (0, _commands.insertExpand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
45
- },
46
- pmPlugins: function pmPlugins() {
47
- return [{
48
- name: 'expand',
49
- plugin: function plugin(_ref2) {
50
- var _options$allowInterac;
51
- var dispatch = _ref2.dispatch,
52
- getIntl = _ref2.getIntl;
53
- return (0, _main.createPlugin)(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
54
- }
55
- }, {
56
- name: 'expandKeymap',
57
- plugin: function plugin() {
58
- return (0, _keymap.expandKeymap)(api, {
59
- __livePage: options.__livePage
60
- });
61
- }
62
- }];
63
- },
64
- pluginsOptions: {
65
- floatingToolbar: (0, _toolbar.getToolbarConfig)(api),
66
- quickInsert: function quickInsert(_ref3) {
67
- var formatMessage = _ref3.formatMessage;
68
- if (options && options.allowInsertion !== true) {
69
- return [];
70
- }
71
- return [{
72
- id: 'expand',
73
- title: formatMessage(_messages.toolbarInsertBlockMessages.expand),
74
- description: formatMessage(_messages.toolbarInsertBlockMessages.expandDescription),
75
- keywords: ['accordion', 'collapse'],
76
- priority: 600,
77
- icon: function icon() {
78
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconExpand, null);
79
- },
80
- action: function action(insert, state) {
81
- var _api$analytics2;
82
- var node = (0, _commands.createExpandNode)(state);
83
- if (!node) {
84
- return false;
85
- }
86
- var tr = state.selection.empty ? insert(node) : (0, _utils.createWrapSelectionTransaction)({
87
- state: state,
88
- type: node.type
89
- });
90
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
91
- action: _analytics.ACTION.INSERTED,
92
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
93
- actionSubjectId: node.type === state.schema.nodes.nestedExpand ? _analytics.ACTION_SUBJECT_ID.NESTED_EXPAND : _analytics.ACTION_SUBJECT_ID.EXPAND,
94
- attributes: {
95
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
96
- },
97
- eventType: _analytics.EVENT_TYPE.TRACK
98
- })(tr);
99
- return tr;
100
- }
101
- }];
102
- }
103
- }
104
- };
14
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.single-player-expand') && options !== null && options !== void 0 && options.__livePage) {
15
+ return (0, _plugin2.expandPlugin)({
16
+ config: options,
17
+ api: api
18
+ });
19
+ } else {
20
+ return (0, _plugin.expandPlugin)({
21
+ config: options,
22
+ api: api
23
+ });
24
+ }
105
25
  };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expandPlugin = void 0;
7
+ var _adfSchema = require("@atlaskit/adf-schema");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
+ // TODO: https://product-fabric.atlassian.net/browse/ED-22840
10
+ // In ED-22840 make sure we update the ExpandPlugin type to use singlePlayerExpands own types
11
+
12
+ var expandPlugin = exports.expandPlugin = function expandPlugin() {
13
+ return {
14
+ name: 'expand',
15
+ nodes: function nodes() {
16
+ var nestedExpandNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-extended-nested-expand') ? _adfSchema.extendedNestedExpand : _adfSchema.nestedExpand;
17
+ return [{
18
+ name: 'expand',
19
+ node: _adfSchema.expand
20
+ }, {
21
+ name: 'nestedExpand',
22
+ node: nestedExpandNode
23
+ }];
24
+ },
25
+ actions: {
26
+ insertExpand: function insertExpand() {
27
+ return false;
28
+ }
29
+ },
30
+ pmPlugins: function pmPlugins() {
31
+ return [];
32
+ },
33
+ pluginsOptions: {}
34
+ };
35
+ };
@@ -1 +1,3 @@
1
+ // TODO: Handle type exports for singlePlayerExpandPlugin when they're created
2
+ // https://product-fabric.atlassian.net/browse/ED-22840
1
3
  export { expandPlugin } from './plugin';
@@ -14,7 +14,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
14
14
  function buildExpandClassName(type, expanded) {
15
15
  return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
16
16
  }
17
- const toDOM = (node, __livePage, intl) => ['div', {
17
+ const toDOM = (node, __livePage, intl, editable) => ['div', {
18
18
  // prettier-ignore
19
19
  'class': buildExpandClassName(node.type.name, getBooleanFF('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
20
20
  'data-node-type': node.type.name,
@@ -39,11 +39,13 @@ const toDOM = (node, __livePage, intl) => ['div', {
39
39
  'class': expandClassNames.titleInput,
40
40
  value: node.attrs.title,
41
41
  placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
42
- type: 'text'
42
+ type: 'text',
43
+ readonly: !editable ? 'true' : undefined
43
44
  }]]],
44
45
  // prettier-ignore
45
46
  ['div', {
46
- 'class': expandClassNames.content
47
+ 'class': expandClassNames.content,
48
+ contenteditable: editable
47
49
  }, 0]];
48
50
  export class ExpandNodeView {
49
51
  constructor(node, view, getPos, getIntl, isMobile, selectNearNode, api, allowInteractiveExpand = true, __livePage = false) {
@@ -364,7 +366,7 @@ export class ExpandNodeView {
364
366
  const {
365
367
  dom,
366
368
  contentDOM
367
- } = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl));
369
+ } = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable));
368
370
  this.allowInteractiveExpand = allowInteractiveExpand;
369
371
  this.getPos = getPos;
370
372
  this.view = view;
@@ -441,7 +443,18 @@ export class ExpandNodeView {
441
443
  }
442
444
  if (this.content) {
443
445
  // Disallow interaction/selection inside when collapsed.
444
- this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
446
+ this.content.setAttribute('contenteditable', this.view.editable && (getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
447
+ }
448
+ } else {
449
+ if (this.content) {
450
+ this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
451
+ }
452
+ }
453
+ if (this.input) {
454
+ if (!this.view.editable) {
455
+ this.input.setAttribute('readonly', 'true');
456
+ } else {
457
+ this.input.removeAttribute('readonly');
445
458
  }
446
459
  }
447
460
 
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
6
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { createExpandNode, insertExpand } from './commands';
9
+ import { expandKeymap } from './pm-plugins/keymap';
10
+ import { createPlugin } from './pm-plugins/main';
11
+ import { getToolbarConfig } from './toolbar';
12
+ export { pluginKey } from './pm-plugins/plugin-factory';
13
+ export const expandPlugin = ({
14
+ config: options = {},
15
+ api
16
+ }) => {
17
+ var _api$analytics;
18
+ return {
19
+ name: 'expand',
20
+ nodes() {
21
+ const nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
22
+ return [{
23
+ name: 'expand',
24
+ node: expand
25
+ }, {
26
+ name: 'nestedExpand',
27
+ node: nestedExpandNode
28
+ }];
29
+ },
30
+ actions: {
31
+ insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
32
+ },
33
+ pmPlugins() {
34
+ return [{
35
+ name: 'expand',
36
+ plugin: ({
37
+ dispatch,
38
+ getIntl
39
+ }) => {
40
+ var _options$allowInterac;
41
+ return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
42
+ }
43
+ }, {
44
+ name: 'expandKeymap',
45
+ plugin: () => expandKeymap(api, {
46
+ __livePage: options.__livePage
47
+ })
48
+ }];
49
+ },
50
+ pluginsOptions: {
51
+ floatingToolbar: getToolbarConfig(api),
52
+ quickInsert: ({
53
+ formatMessage
54
+ }) => {
55
+ if (options && options.allowInsertion !== true) {
56
+ return [];
57
+ }
58
+ return [{
59
+ id: 'expand',
60
+ title: formatMessage(messages.expand),
61
+ description: formatMessage(messages.expandDescription),
62
+ keywords: ['accordion', 'collapse'],
63
+ priority: 600,
64
+ icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
65
+ action(insert, state) {
66
+ var _api$analytics2;
67
+ const node = createExpandNode(state);
68
+ if (!node) {
69
+ return false;
70
+ }
71
+ const tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
72
+ state,
73
+ type: node.type
74
+ });
75
+ api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
76
+ action: ACTION.INSERTED,
77
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
78
+ actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
79
+ attributes: {
80
+ inputMethod: INPUT_METHOD.QUICK_INSERT
81
+ },
82
+ eventType: EVENT_TYPE.TRACK
83
+ })(tr);
84
+ return tr;
85
+ }
86
+ }];
87
+ }
88
+ }
89
+ };
90
+ };
@@ -1,90 +1,19 @@
1
- import React from 'react';
2
- import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconExpand } from '@atlaskit/editor-common/quick-insert';
6
- import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
7
1
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
- import { createExpandNode, insertExpand } from './commands';
9
- import { expandKeymap } from './pm-plugins/keymap';
10
- import { createPlugin } from './pm-plugins/main';
11
- import { getToolbarConfig } from './toolbar';
2
+ import { expandPlugin as legacyExpandPlugin } from './legacyExpand/plugin';
3
+ import { expandPlugin as singlePlayerExpandPlugin } from './singlePlayerExpand/plugin';
12
4
  export const expandPlugin = ({
13
5
  config: options = {},
14
6
  api
15
7
  }) => {
16
- var _api$analytics;
17
- return {
18
- name: 'expand',
19
- nodes() {
20
- const nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
21
- return [{
22
- name: 'expand',
23
- node: expand
24
- }, {
25
- name: 'nestedExpand',
26
- node: nestedExpandNode
27
- }];
28
- },
29
- actions: {
30
- insertExpand: insertExpand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
31
- },
32
- pmPlugins() {
33
- return [{
34
- name: 'expand',
35
- plugin: ({
36
- dispatch,
37
- getIntl
38
- }) => {
39
- var _options$allowInterac;
40
- return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
41
- }
42
- }, {
43
- name: 'expandKeymap',
44
- plugin: () => expandKeymap(api, {
45
- __livePage: options.__livePage
46
- })
47
- }];
48
- },
49
- pluginsOptions: {
50
- floatingToolbar: getToolbarConfig(api),
51
- quickInsert: ({
52
- formatMessage
53
- }) => {
54
- if (options && options.allowInsertion !== true) {
55
- return [];
56
- }
57
- return [{
58
- id: 'expand',
59
- title: formatMessage(messages.expand),
60
- description: formatMessage(messages.expandDescription),
61
- keywords: ['accordion', 'collapse'],
62
- priority: 600,
63
- icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
64
- action(insert, state) {
65
- var _api$analytics2;
66
- const node = createExpandNode(state);
67
- if (!node) {
68
- return false;
69
- }
70
- const tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
71
- state,
72
- type: node.type
73
- });
74
- api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
75
- action: ACTION.INSERTED,
76
- actionSubject: ACTION_SUBJECT.DOCUMENT,
77
- actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
78
- attributes: {
79
- inputMethod: INPUT_METHOD.QUICK_INSERT
80
- },
81
- eventType: EVENT_TYPE.TRACK
82
- })(tr);
83
- return tr;
84
- }
85
- }];
86
- }
87
- }
88
- };
89
- };
90
- export { pluginKey } from './pm-plugins/plugin-factory';
8
+ if (getBooleanFF('platform.editor.single-player-expand') && options !== null && options !== void 0 && options.__livePage) {
9
+ return singlePlayerExpandPlugin({
10
+ config: options,
11
+ api
12
+ });
13
+ } else {
14
+ return legacyExpandPlugin({
15
+ config: options,
16
+ api
17
+ });
18
+ }
19
+ };
@@ -0,0 +1,30 @@
1
+ import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+
4
+ // TODO: https://product-fabric.atlassian.net/browse/ED-22840
5
+ // In ED-22840 make sure we update the ExpandPlugin type to use singlePlayerExpands own types
6
+
7
+ export const expandPlugin = () => {
8
+ return {
9
+ name: 'expand',
10
+ nodes() {
11
+ const nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
12
+ return [{
13
+ name: 'expand',
14
+ node: expand
15
+ }, {
16
+ name: 'nestedExpand',
17
+ node: nestedExpandNode
18
+ }];
19
+ },
20
+ actions: {
21
+ insertExpand: () => {
22
+ return false;
23
+ }
24
+ },
25
+ pmPlugins() {
26
+ return [];
27
+ },
28
+ pluginsOptions: {}
29
+ };
30
+ };
package/dist/esm/index.js CHANGED
@@ -1 +1,3 @@
1
+ // TODO: Handle type exports for singlePlayerExpandPlugin when they're created
2
+ // https://product-fabric.atlassian.net/browse/ED-22840
1
3
  export { expandPlugin } from './plugin';
@@ -16,7 +16,7 @@ import { ExpandIconButton } from '../ui/ExpandIconButton';
16
16
  function buildExpandClassName(type, expanded) {
17
17
  return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
18
18
  }
19
- var toDOM = function toDOM(node, __livePage, intl) {
19
+ var toDOM = function toDOM(node, __livePage, intl, editable) {
20
20
  return ['div', {
21
21
  // prettier-ignore
22
22
  'class': buildExpandClassName(node.type.name, getBooleanFF('platform.editor.live-pages-expand-divergence') && __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
@@ -42,11 +42,13 @@ var toDOM = function toDOM(node, __livePage, intl) {
42
42
  'class': expandClassNames.titleInput,
43
43
  value: node.attrs.title,
44
44
  placeholder: intl && intl.formatMessage(expandMessages.expandPlaceholderText) || expandMessages.expandPlaceholderText.defaultMessage,
45
- type: 'text'
45
+ type: 'text',
46
+ readonly: !editable ? 'true' : undefined
46
47
  }]]],
47
48
  // prettier-ignore
48
49
  ['div', {
49
- 'class': expandClassNames.content
50
+ 'class': expandClassNames.content,
51
+ contenteditable: editable
50
52
  }, 0]];
51
53
  };
52
54
  export var ExpandNodeView = /*#__PURE__*/function () {
@@ -353,7 +355,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
353
355
  this.selectNearNode = selectNearNode;
354
356
  this.__livePage = __livePage;
355
357
  this.intl = getIntl();
356
- var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl)),
358
+ var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.__livePage, this.intl, view.editable)),
357
359
  dom = _DOMSerializer$render.dom,
358
360
  contentDOM = _DOMSerializer$render.contentDOM;
359
361
  this.allowInteractiveExpand = allowInteractiveExpand;
@@ -442,7 +444,18 @@ export var ExpandNodeView = /*#__PURE__*/function () {
442
444
  }
443
445
  if (this.content) {
444
446
  // Disallow interaction/selection inside when collapsed.
445
- this.content.setAttribute('contenteditable', getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded);
447
+ this.content.setAttribute('contenteditable', this.view.editable && (getBooleanFF('platform.editor.live-pages-expand-divergence') && this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded));
448
+ }
449
+ } else {
450
+ if (this.content) {
451
+ this.content.setAttribute('contenteditable', this.view.editable ? 'true' : 'false');
452
+ }
453
+ }
454
+ if (this.input) {
455
+ if (!this.view.editable) {
456
+ this.input.setAttribute('readonly', 'true');
457
+ } else {
458
+ this.input.removeAttribute('readonly');
446
459
  }
447
460
  }
448
461
 
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
3
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
6
+ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { createExpandNode, insertExpand } from './commands';
9
+ import { expandKeymap } from './pm-plugins/keymap';
10
+ import { createPlugin } from './pm-plugins/main';
11
+ import { getToolbarConfig } from './toolbar';
12
+ export { pluginKey } from './pm-plugins/plugin-factory';
13
+ export var expandPlugin = function expandPlugin(_ref) {
14
+ var _api$analytics;
15
+ var _ref$config = _ref.config,
16
+ options = _ref$config === void 0 ? {} : _ref$config,
17
+ api = _ref.api;
18
+ return {
19
+ name: 'expand',
20
+ nodes: function nodes() {
21
+ var nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
22
+ return [{
23
+ name: 'expand',
24
+ node: expand
25
+ }, {
26
+ name: 'nestedExpand',
27
+ node: nestedExpandNode
28
+ }];
29
+ },
30
+ actions: {
31
+ insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
32
+ },
33
+ pmPlugins: function pmPlugins() {
34
+ return [{
35
+ name: 'expand',
36
+ plugin: function plugin(_ref2) {
37
+ var _options$allowInterac;
38
+ var dispatch = _ref2.dispatch,
39
+ getIntl = _ref2.getIntl;
40
+ return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
41
+ }
42
+ }, {
43
+ name: 'expandKeymap',
44
+ plugin: function plugin() {
45
+ return expandKeymap(api, {
46
+ __livePage: options.__livePage
47
+ });
48
+ }
49
+ }];
50
+ },
51
+ pluginsOptions: {
52
+ floatingToolbar: getToolbarConfig(api),
53
+ quickInsert: function quickInsert(_ref3) {
54
+ var formatMessage = _ref3.formatMessage;
55
+ if (options && options.allowInsertion !== true) {
56
+ return [];
57
+ }
58
+ return [{
59
+ id: 'expand',
60
+ title: formatMessage(messages.expand),
61
+ description: formatMessage(messages.expandDescription),
62
+ keywords: ['accordion', 'collapse'],
63
+ priority: 600,
64
+ icon: function icon() {
65
+ return /*#__PURE__*/React.createElement(IconExpand, null);
66
+ },
67
+ action: function action(insert, state) {
68
+ var _api$analytics2;
69
+ var node = createExpandNode(state);
70
+ if (!node) {
71
+ return false;
72
+ }
73
+ var tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
74
+ state: state,
75
+ type: node.type
76
+ });
77
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
78
+ action: ACTION.INSERTED,
79
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
80
+ actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
81
+ attributes: {
82
+ inputMethod: INPUT_METHOD.QUICK_INSERT
83
+ },
84
+ eventType: EVENT_TYPE.TRACK
85
+ })(tr);
86
+ return tr;
87
+ }
88
+ }];
89
+ }
90
+ }
91
+ };
92
+ };
@@ -1,92 +1,19 @@
1
- import React from 'react';
2
- import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconExpand } from '@atlaskit/editor-common/quick-insert';
6
- import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
7
1
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
- import { createExpandNode, insertExpand } from './commands';
9
- import { expandKeymap } from './pm-plugins/keymap';
10
- import { createPlugin } from './pm-plugins/main';
11
- import { getToolbarConfig } from './toolbar';
2
+ import { expandPlugin as legacyExpandPlugin } from './legacyExpand/plugin';
3
+ import { expandPlugin as singlePlayerExpandPlugin } from './singlePlayerExpand/plugin';
12
4
  export var expandPlugin = function expandPlugin(_ref) {
13
- var _api$analytics;
14
5
  var _ref$config = _ref.config,
15
6
  options = _ref$config === void 0 ? {} : _ref$config,
16
7
  api = _ref.api;
17
- return {
18
- name: 'expand',
19
- nodes: function nodes() {
20
- var nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
21
- return [{
22
- name: 'expand',
23
- node: expand
24
- }, {
25
- name: 'nestedExpand',
26
- node: nestedExpandNode
27
- }];
28
- },
29
- actions: {
30
- insertExpand: insertExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
31
- },
32
- pmPlugins: function pmPlugins() {
33
- return [{
34
- name: 'expand',
35
- plugin: function plugin(_ref2) {
36
- var _options$allowInterac;
37
- var dispatch = _ref2.dispatch,
38
- getIntl = _ref2.getIntl;
39
- return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
40
- }
41
- }, {
42
- name: 'expandKeymap',
43
- plugin: function plugin() {
44
- return expandKeymap(api, {
45
- __livePage: options.__livePage
46
- });
47
- }
48
- }];
49
- },
50
- pluginsOptions: {
51
- floatingToolbar: getToolbarConfig(api),
52
- quickInsert: function quickInsert(_ref3) {
53
- var formatMessage = _ref3.formatMessage;
54
- if (options && options.allowInsertion !== true) {
55
- return [];
56
- }
57
- return [{
58
- id: 'expand',
59
- title: formatMessage(messages.expand),
60
- description: formatMessage(messages.expandDescription),
61
- keywords: ['accordion', 'collapse'],
62
- priority: 600,
63
- icon: function icon() {
64
- return /*#__PURE__*/React.createElement(IconExpand, null);
65
- },
66
- action: function action(insert, state) {
67
- var _api$analytics2;
68
- var node = createExpandNode(state);
69
- if (!node) {
70
- return false;
71
- }
72
- var tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
73
- state: state,
74
- type: node.type
75
- });
76
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
77
- action: ACTION.INSERTED,
78
- actionSubject: ACTION_SUBJECT.DOCUMENT,
79
- actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
80
- attributes: {
81
- inputMethod: INPUT_METHOD.QUICK_INSERT
82
- },
83
- eventType: EVENT_TYPE.TRACK
84
- })(tr);
85
- return tr;
86
- }
87
- }];
88
- }
89
- }
90
- };
91
- };
92
- export { pluginKey } from './pm-plugins/plugin-factory';
8
+ if (getBooleanFF('platform.editor.single-player-expand') && options !== null && options !== void 0 && options.__livePage) {
9
+ return singlePlayerExpandPlugin({
10
+ config: options,
11
+ api: api
12
+ });
13
+ } else {
14
+ return legacyExpandPlugin({
15
+ config: options,
16
+ api: api
17
+ });
18
+ }
19
+ };
@@ -0,0 +1,30 @@
1
+ import { expand, extendedNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+
4
+ // TODO: https://product-fabric.atlassian.net/browse/ED-22840
5
+ // In ED-22840 make sure we update the ExpandPlugin type to use singlePlayerExpands own types
6
+
7
+ export var expandPlugin = function expandPlugin() {
8
+ return {
9
+ name: 'expand',
10
+ nodes: function nodes() {
11
+ var nestedExpandNode = getBooleanFF('platform.editor.allow-extended-nested-expand') ? extendedNestedExpand : nestedExpand;
12
+ return [{
13
+ name: 'expand',
14
+ node: expand
15
+ }, {
16
+ name: 'nestedExpand',
17
+ node: nestedExpandNode
18
+ }];
19
+ },
20
+ actions: {
21
+ insertExpand: function insertExpand() {
22
+ return false;
23
+ }
24
+ },
25
+ pmPlugins: function pmPlugins() {
26
+ return [];
27
+ },
28
+ pluginsOptions: {}
29
+ };
30
+ };
@@ -1,2 +1,2 @@
1
- export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './types';
1
+ export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './legacyExpand/types';
2
2
  export { expandPlugin } from './plugin';
@@ -1,7 +1,6 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
5
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
7
6
  import type { ExpandPlugin } from '../types';
@@ -0,0 +1,3 @@
1
+ import type { ExpandPlugin } from './types';
2
+ export { pluginKey } from './pm-plugins/plugin-factory';
3
+ export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const pluginKey: PluginKey<any>;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../types").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../types").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState;
@@ -1,3 +1,3 @@
1
1
  import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- import type { ExpandPlugin } from './index';
2
+ import type { ExpandPlugin } from './types';
3
3
  export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -1,3 +1,2 @@
1
- import type { ExpandPlugin } from './types';
1
+ import type { ExpandPlugin } from './legacyExpand/types';
2
2
  export declare const expandPlugin: ExpandPlugin;
3
- export { pluginKey } from './pm-plugins/plugin-factory';
@@ -0,0 +1,2 @@
1
+ import type { ExpandPlugin } from '../legacyExpand/types';
2
+ export declare const expandPlugin: ExpandPlugin;
@@ -1,2 +1,2 @@
1
- export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './types';
1
+ export type { ExpandPlugin, ExpandPluginState, ExpandPluginOptions, } from './legacyExpand/types';
2
2
  export { expandPlugin } from './plugin';
@@ -1,7 +1,6 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
3
+ import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
5
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
7
6
  import type { ExpandPlugin } from '../types';
@@ -0,0 +1,3 @@
1
+ import type { ExpandPlugin } from './types';
2
+ export { pluginKey } from './pm-plugins/plugin-factory';
3
+ export declare const expandPlugin: ExpandPlugin;
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const pluginKey: PluginKey<any>;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../types").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("../types").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../types").ExpandPluginState;
@@ -1,3 +1,3 @@
1
1
  import type { ExtractInjectionAPI, FloatingToolbarHandler } from '@atlaskit/editor-common/types';
2
- import type { ExpandPlugin } from './index';
2
+ import type { ExpandPlugin } from './types';
3
3
  export declare const getToolbarConfig: (api: ExtractInjectionAPI<ExpandPlugin> | undefined) => FloatingToolbarHandler;
@@ -1,3 +1,2 @@
1
- import type { ExpandPlugin } from './types';
1
+ import type { ExpandPlugin } from './legacyExpand/types';
2
2
  export declare const expandPlugin: ExpandPlugin;
3
- export { pluginKey } from './pm-plugins/plugin-factory';
@@ -0,0 +1,2 @@
1
+ import type { ExpandPlugin } from '../legacyExpand/types';
2
+ export declare const expandPlugin: ExpandPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "1.2.6",
3
+ "version": "1.3.1",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^35.8.0",
37
- "@atlaskit/button": "^17.9.0",
38
- "@atlaskit/editor-common": "^78.23.0",
37
+ "@atlaskit/button": "^17.12.0",
38
+ "@atlaskit/editor-common": "^78.26.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.0.0",
41
41
  "@atlaskit/editor-plugin-selection": "^1.1.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/editor-tables": "^2.6.0",
45
45
  "@atlaskit/icon": "^22.1.0",
46
46
  "@atlaskit/platform-feature-flags": "^0.2.0",
47
- "@atlaskit/tooltip": "^18.1.0",
47
+ "@atlaskit/tooltip": "^18.2.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "w3c-keyname": "^2.1.8"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/editor-plugin-content-insertion": "^1.0.0",
60
60
  "@atlaskit/editor-plugin-guideline": "^1.0.0",
61
61
  "@atlaskit/editor-plugin-quick-insert": "^1.0.0",
62
- "@atlaskit/editor-plugin-table": "^7.6.0",
62
+ "@atlaskit/editor-plugin-table": "^7.7.0",
63
63
  "@atlaskit/editor-plugin-type-ahead": "^1.0.0",
64
64
  "@atlaskit/editor-plugin-width": "^1.0.0",
65
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
@@ -107,6 +107,9 @@
107
107
  },
108
108
  "platform.editor.live-pages-expand-divergence": {
109
109
  "type": "boolean"
110
+ },
111
+ "platform.editor.single-player-expand": {
112
+ "type": "boolean"
110
113
  }
111
114
  }
112
115
  }
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("..").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("..").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes