@atlaskit/editor-plugin-expand 9.0.1 → 9.0.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 +8 -0
- package/README.md +17 -2
- package/dist/cjs/legacyExpand/commands.js +3 -1
- package/dist/cjs/singlePlayerExpand/plugin.js +2 -2
- package/dist/es2019/legacyExpand/commands.js +3 -1
- package/dist/es2019/singlePlayerExpand/plugin.js +2 -2
- package/dist/esm/legacyExpand/commands.js +3 -1
- package/dist/esm/singlePlayerExpand/plugin.js +2 -2
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5985f38f7104e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5985f38f7104e) -
|
|
8
|
+
Update README.md and 0-intro.tsx
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 9.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
# Editor
|
|
1
|
+
# Editor Plugin Expand
|
|
2
2
|
|
|
3
3
|
Expand plugin for @atlaskit/editor-core
|
|
4
4
|
|
|
5
5
|
**Note:** This component is designed for internal Atlassian development.
|
|
6
6
|
External contributors will be able to use this component but will not be able to submit issues.
|
|
7
7
|
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Expand plugin provides collapsible/expandable content sections for the Atlassian Editor. It supports both standard expand nodes and nested expand nodes, enabling users to organize and structure content with accordion-like functionality.
|
|
11
|
+
|
|
12
|
+
## Key features
|
|
13
|
+
|
|
14
|
+
- **Expand and nested expand nodes** - Support for both top-level expand and nested expand content structures
|
|
15
|
+
- **Interactive expand/collapse** - Toggle expand nodes open or closed with configurable interactive behavior
|
|
16
|
+
- **Quick insert integration** - Insert expand nodes via quick insert menu with keywords like 'accordion' and 'collapse'
|
|
17
|
+
- **Range toggle commands** - Programmatically expand or collapse multiple expand nodes across a document range
|
|
18
|
+
- **Floating toolbar** - Context-aware toolbar for expand node manipulation
|
|
19
|
+
- **Keyboard shortcuts** - Keymap support for efficient expand node navigation and manipulation
|
|
20
|
+
- **Configurable insertion** - Control expand node insertion permissions via plugin options
|
|
21
|
+
- **Live Page support** - Special handling for Confluence Live Page editor with divergent behavior
|
|
22
|
+
|
|
8
23
|
## Install
|
|
9
24
|
---
|
|
10
25
|
- **Install** - *yarn add @atlaskit/editor-plugin-expand*
|
|
@@ -27,4 +42,4 @@ Please see [Atlaskit - Editor plugin expand](https://atlaskit.atlassian.com/pack
|
|
|
27
42
|
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
28
43
|
## License
|
|
29
44
|
---
|
|
30
|
-
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#
|
|
45
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
|
|
@@ -15,6 +15,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
15
15
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
17
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
20
|
var _utils4 = require("../utils");
|
|
20
21
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
@@ -163,12 +164,13 @@ var insertExpandWithInputMethod = exports.insertExpandWithInputMethod = function
|
|
|
163
164
|
state: state,
|
|
164
165
|
type: expandNode.type
|
|
165
166
|
});
|
|
167
|
+
var resolvedInputMethod = (0, _platformFeatureFlags.fg)('platform_editor_element_browser_analytic') ? inputMethod : _analytics.INPUT_METHOD.QUICK_INSERT;
|
|
166
168
|
var payload = {
|
|
167
169
|
action: _analytics.ACTION.INSERTED,
|
|
168
170
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
169
171
|
actionSubjectId: (expandNode === null || expandNode === void 0 ? void 0 : expandNode.type) === state.schema.nodes.expand ? _analytics.ACTION_SUBJECT_ID.EXPAND : _analytics.ACTION_SUBJECT_ID.NESTED_EXPAND,
|
|
170
172
|
attributes: {
|
|
171
|
-
inputMethod:
|
|
173
|
+
inputMethod: resolvedInputMethod
|
|
172
174
|
},
|
|
173
175
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
174
176
|
};
|
|
@@ -105,7 +105,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
105
105
|
icon: function icon() {
|
|
106
106
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconExpand, null);
|
|
107
107
|
},
|
|
108
|
-
action: function action(insert, state) {
|
|
108
|
+
action: function action(insert, state, source) {
|
|
109
109
|
var _api$analytics;
|
|
110
110
|
var node = (0, _commands.createExpandNode)(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
111
111
|
if (!node) {
|
|
@@ -120,7 +120,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
120
120
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
121
121
|
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? _analytics.ACTION_SUBJECT_ID.NESTED_EXPAND : _analytics.ACTION_SUBJECT_ID.EXPAND,
|
|
122
122
|
attributes: {
|
|
123
|
-
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
123
|
+
inputMethod: source !== null && source !== void 0 ? source : _analytics.INPUT_METHOD.QUICK_INSERT
|
|
124
124
|
},
|
|
125
125
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
126
126
|
})(tr);
|
|
@@ -7,6 +7,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
7
7
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
12
|
import { isNestedInExpand } from '../utils';
|
|
12
13
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
@@ -150,12 +151,13 @@ export const insertExpandWithInputMethod = editorAnalyticsAPI => inputMethod =>
|
|
|
150
151
|
state,
|
|
151
152
|
type: expandNode.type
|
|
152
153
|
});
|
|
154
|
+
const resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
|
|
153
155
|
const payload = {
|
|
154
156
|
action: ACTION.INSERTED,
|
|
155
157
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
156
158
|
actionSubjectId: (expandNode === null || expandNode === void 0 ? void 0 : expandNode.type) === state.schema.nodes.expand ? ACTION_SUBJECT_ID.EXPAND : ACTION_SUBJECT_ID.NESTED_EXPAND,
|
|
157
159
|
attributes: {
|
|
158
|
-
inputMethod
|
|
160
|
+
inputMethod: resolvedInputMethod
|
|
159
161
|
},
|
|
160
162
|
eventType: EVENT_TYPE.TRACK
|
|
161
163
|
};
|
|
@@ -95,7 +95,7 @@ export let expandPlugin = ({
|
|
|
95
95
|
keywords: ['accordion', 'collapse'],
|
|
96
96
|
priority: 600,
|
|
97
97
|
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
98
|
-
action(insert, state) {
|
|
98
|
+
action(insert, state, source) {
|
|
99
99
|
var _api$analytics;
|
|
100
100
|
const node = createExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
101
101
|
if (!node) {
|
|
@@ -110,7 +110,7 @@ export let expandPlugin = ({
|
|
|
110
110
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
111
111
|
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
112
112
|
attributes: {
|
|
113
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
113
|
+
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
114
114
|
},
|
|
115
115
|
eventType: EVENT_TYPE.TRACK
|
|
116
116
|
})(tr);
|
|
@@ -10,6 +10,7 @@ import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
|
10
10
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import { isNestedInExpand } from '../utils';
|
|
15
16
|
import { createCommand } from './pm-plugins/plugin-factory';
|
|
@@ -156,12 +157,13 @@ export var insertExpandWithInputMethod = function insertExpandWithInputMethod(ed
|
|
|
156
157
|
state: state,
|
|
157
158
|
type: expandNode.type
|
|
158
159
|
});
|
|
160
|
+
var resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
|
|
159
161
|
var payload = {
|
|
160
162
|
action: ACTION.INSERTED,
|
|
161
163
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
162
164
|
actionSubjectId: (expandNode === null || expandNode === void 0 ? void 0 : expandNode.type) === state.schema.nodes.expand ? ACTION_SUBJECT_ID.EXPAND : ACTION_SUBJECT_ID.NESTED_EXPAND,
|
|
163
165
|
attributes: {
|
|
164
|
-
inputMethod:
|
|
166
|
+
inputMethod: resolvedInputMethod
|
|
165
167
|
},
|
|
166
168
|
eventType: EVENT_TYPE.TRACK
|
|
167
169
|
};
|
|
@@ -99,7 +99,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
99
99
|
icon: function icon() {
|
|
100
100
|
return /*#__PURE__*/React.createElement(IconExpand, null);
|
|
101
101
|
},
|
|
102
|
-
action: function action(insert, state) {
|
|
102
|
+
action: function action(insert, state, source) {
|
|
103
103
|
var _api$analytics;
|
|
104
104
|
var node = createExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
105
105
|
if (!node) {
|
|
@@ -114,7 +114,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
114
114
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
115
115
|
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
116
116
|
attributes: {
|
|
117
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
117
|
+
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
118
118
|
},
|
|
119
119
|
eventType: EVENT_TYPE.TRACK
|
|
120
120
|
})(tr);
|
package/dist/types/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type ExpandPluginAction = {
|
|
|
23
23
|
export type ExpandPluginSharedState = {
|
|
24
24
|
allowInsertion?: boolean;
|
|
25
25
|
} | undefined;
|
|
26
|
-
export type InsertMethod = INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.INSERT_MENU;
|
|
26
|
+
export type InsertMethod = INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.TOOLBAR;
|
|
27
27
|
export interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
28
28
|
/**
|
|
29
29
|
* There is expected to be temporary divergence between Live Page editor expand behaviour and the standard expand behaviour.
|
|
@@ -23,7 +23,7 @@ export type ExpandPluginAction = {
|
|
|
23
23
|
export type ExpandPluginSharedState = {
|
|
24
24
|
allowInsertion?: boolean;
|
|
25
25
|
} | undefined;
|
|
26
|
-
export type InsertMethod = INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.INSERT_MENU;
|
|
26
|
+
export type InsertMethod = INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.TOOLBAR;
|
|
27
27
|
export interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
28
28
|
/**
|
|
29
29
|
* There is expected to be temporary divergence between Live Page editor expand behaviour and the standard expand behaviour.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/icon-lab": "^5.17.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^36.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^36.3.0",
|
|
51
51
|
"@atlaskit/tokens": "^11.1.0",
|
|
52
52
|
"@atlaskit/tooltip": "^20.14.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"w3c-keyname": "^2.1.8"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^112.
|
|
59
|
+
"@atlaskit/editor-common": "^112.2.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -99,6 +99,9 @@
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
"platform-feature-flags": {
|
|
102
|
+
"platform_editor_element_browser_analytic": {
|
|
103
|
+
"type": "boolean"
|
|
104
|
+
},
|
|
102
105
|
"platform_editor_adf_with_localid": {
|
|
103
106
|
"type": "boolean"
|
|
104
107
|
},
|