@atlaskit/editor-plugin-list 3.1.1 → 3.1.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,17 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 3.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#66804](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66804) [`107c6d15dda7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/107c6d15dda7) - ED-21802 Disable insert inside nested task list through toolbar and keybinding.
8
+
9
+ ## 3.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#65603](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65603) [`ac8d4b09e18e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ac8d4b09e18e) - ED-21609 Node nesting: Use the new nodespec for list and panel when respective FF's are enabled
14
+
3
15
  ## 3.1.1
4
16
 
5
17
  ### Patch Changes
@@ -120,6 +120,12 @@ var toggleList = exports.toggleList = function toggleList(editorAnalyticsAPI) {
120
120
  return function (inputMethod, listType) {
121
121
  return function (_ref) {
122
122
  var tr = _ref.tr;
123
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-action-in-list')) {
124
+ var taskList = tr.doc.type.schema.nodes.taskList;
125
+ if ((0, _utils2.hasParentNodeOfType)(taskList)(tr.selection)) {
126
+ return tr;
127
+ }
128
+ }
123
129
  var listInsideSelection = (0, _selection2.selectionContainsList)(tr);
124
130
  var listNodeType = tr.doc.type.schema.nodes[listType];
125
131
  var actionSubjectId = listType === 'bulletList' ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _commands = require("./commands");
15
16
  var _inputRules = _interopRequireDefault(require("./pm-plugins/input-rules"));
16
17
  var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
@@ -53,6 +54,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
53
54
  return _main.pluginKey.getState(editorState);
54
55
  },
55
56
  nodes: function nodes() {
57
+ var listItemNode = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-action-in-list') ? _adfSchema.listItemWithTask : _adfSchema.listItem;
56
58
  return [{
57
59
  name: 'bulletList',
58
60
  node: _adfSchema.bulletList
@@ -61,7 +63,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
61
63
  node: _adfSchema.orderedListWithOrder
62
64
  }, {
63
65
  name: 'listItem',
64
- node: _adfSchema.listItem
66
+ node: listItemNode
65
67
  }];
66
68
  },
67
69
  pmPlugins: function pmPlugins() {
@@ -85,8 +85,9 @@ var handleDocChanged = function handleDocChanged(featureFlags) {
85
85
  var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
86
86
  var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
87
87
  bulletList = _tr$doc$type$schema$n.bulletList,
88
- orderedList = _tr$doc$type$schema$n.orderedList;
89
- var listParent = (0, _utils2.findParentNodeOfType)([bulletList, orderedList])(tr.selection);
88
+ orderedList = _tr$doc$type$schema$n.orderedList,
89
+ taskList = _tr$doc$type$schema$n.taskList;
90
+ var listParent = (0, _utils2.findParentNodeOfType)([bulletList, orderedList, taskList])(tr.selection);
90
91
  var bulletListActive = !!listParent && listParent.node.type === bulletList;
91
92
  var orderedListActive = !!listParent && listParent.node.type === orderedList;
92
93
  var bulletListDisabled = !(bulletListActive || orderedListActive || (0, _selection2.isWrappingPossible)(bulletList, tr.selection));
@@ -92,6 +92,14 @@ export const toggleList = editorAnalyticsAPI => (inputMethod, listType) => {
92
92
  return function ({
93
93
  tr
94
94
  }) {
95
+ if (getBooleanFF('platform.editor.allow-action-in-list')) {
96
+ const {
97
+ taskList
98
+ } = tr.doc.type.schema.nodes;
99
+ if (hasParentNodeOfType(taskList)(tr.selection)) {
100
+ return tr;
101
+ }
102
+ }
95
103
  const listInsideSelection = selectionContainsList(tr);
96
104
  const listNodeType = tr.doc.type.schema.nodes[listType];
97
105
  const actionSubjectId = listType === 'bulletList' ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { bulletList, listItem, orderedListWithOrder } from '@atlaskit/adf-schema';
2
+ import { bulletList, listItem, listItemWithTask, orderedListWithOrder } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { listMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { indentList, outdentList, toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './commands';
8
9
  import inputRulePlugin from './pm-plugins/input-rules';
9
10
  import keymapPlugin from './pm-plugins/keymap';
@@ -46,6 +47,7 @@ export const listPlugin = ({
46
47
  return listPluginKey.getState(editorState);
47
48
  },
48
49
  nodes() {
50
+ const listItemNode = getBooleanFF('platform.editor.allow-action-in-list') ? listItemWithTask : listItem;
49
51
  return [{
50
52
  name: 'bulletList',
51
53
  node: bulletList
@@ -54,7 +56,7 @@ export const listPlugin = ({
54
56
  node: orderedListWithOrder
55
57
  }, {
56
58
  name: 'listItem',
57
- node: listItem
59
+ node: listItemNode
58
60
  }];
59
61
  },
60
62
  pmPlugins() {
@@ -74,9 +74,10 @@ const handleDocChanged = featureFlags => (tr, pluginState, editorState) => {
74
74
  const handleSelectionChanged = (tr, pluginState) => {
75
75
  const {
76
76
  bulletList,
77
- orderedList
77
+ orderedList,
78
+ taskList
78
79
  } = tr.doc.type.schema.nodes;
79
- const listParent = findParentNodeOfType([bulletList, orderedList])(tr.selection);
80
+ const listParent = findParentNodeOfType([bulletList, orderedList, taskList])(tr.selection);
80
81
  const bulletListActive = !!listParent && listParent.node.type === bulletList;
81
82
  const orderedListActive = !!listParent && listParent.node.type === orderedList;
82
83
  const bulletListDisabled = !(bulletListActive || orderedListActive || isWrappingPossible(bulletList, tr.selection));
@@ -101,6 +101,12 @@ export var toggleList = function toggleList(editorAnalyticsAPI) {
101
101
  return function (inputMethod, listType) {
102
102
  return function (_ref) {
103
103
  var tr = _ref.tr;
104
+ if (getBooleanFF('platform.editor.allow-action-in-list')) {
105
+ var taskList = tr.doc.type.schema.nodes.taskList;
106
+ if (hasParentNodeOfType(taskList)(tr.selection)) {
107
+ return tr;
108
+ }
109
+ }
104
110
  var listInsideSelection = selectionContainsList(tr);
105
111
  var listNodeType = tr.doc.type.schema.nodes[listType];
106
112
  var actionSubjectId = listType === 'bulletList' ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { bulletList, listItem, orderedListWithOrder } from '@atlaskit/adf-schema';
2
+ import { bulletList, listItem, listItemWithTask, orderedListWithOrder } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
5
5
  import { listMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { indentList, outdentList as _outdentList, toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './commands';
8
9
  import inputRulePlugin from './pm-plugins/input-rules';
9
10
  import keymapPlugin from './pm-plugins/keymap';
@@ -47,6 +48,7 @@ export var listPlugin = function listPlugin(_ref) {
47
48
  return listPluginKey.getState(editorState);
48
49
  },
49
50
  nodes: function nodes() {
51
+ var listItemNode = getBooleanFF('platform.editor.allow-action-in-list') ? listItemWithTask : listItem;
50
52
  return [{
51
53
  name: 'bulletList',
52
54
  node: bulletList
@@ -55,7 +57,7 @@ export var listPlugin = function listPlugin(_ref) {
55
57
  node: orderedListWithOrder
56
58
  }, {
57
59
  name: 'listItem',
58
- node: listItem
60
+ node: listItemNode
59
61
  }];
60
62
  },
61
63
  pmPlugins: function pmPlugins() {
@@ -78,8 +78,9 @@ var handleDocChanged = function handleDocChanged(featureFlags) {
78
78
  var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
79
79
  var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
80
80
  bulletList = _tr$doc$type$schema$n.bulletList,
81
- orderedList = _tr$doc$type$schema$n.orderedList;
82
- var listParent = findParentNodeOfType([bulletList, orderedList])(tr.selection);
81
+ orderedList = _tr$doc$type$schema$n.orderedList,
82
+ taskList = _tr$doc$type$schema$n.taskList;
83
+ var listParent = findParentNodeOfType([bulletList, orderedList, taskList])(tr.selection);
83
84
  var bulletListActive = !!listParent && listParent.node.type === bulletList;
84
85
  var orderedListActive = !!listParent && listParent.node.type === orderedList;
85
86
  var bulletListDisabled = !(bulletListActive || orderedListActive || isWrappingPossible(bulletList, tr.selection));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^35.3.0",
36
- "@atlaskit/editor-common": "^76.35.0",
36
+ "@atlaskit/editor-common": "^76.39.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
39
39
  "@atlaskit/editor-prosemirror": "1.1.0",
@@ -92,6 +92,9 @@
92
92
  "platform-feature-flags": {
93
93
  "platform.editor.ordered-list-auto-join-improvements_mrlv5": {
94
94
  "type": "boolean"
95
+ },
96
+ "platform.editor.allow-action-in-list": {
97
+ "type": "boolean"
95
98
  }
96
99
  }
97
100
  }