@atlaskit/editor-plugin-expand 10.0.0 → 11.0.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.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/editor-commands/toggleExpandRange.js +21 -2
- package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +40 -0
- package/dist/cjs/ui/ExpandBlockMenuItem.js +2 -2
- package/dist/es2019/editor-commands/toggleExpandRange.js +20 -1
- package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +40 -0
- package/dist/es2019/ui/ExpandBlockMenuItem.js +1 -1
- package/dist/esm/editor-commands/toggleExpandRange.js +20 -1
- package/dist/esm/singlePlayerExpand/pm-plugins/main.js +40 -0
- package/dist/esm/ui/ExpandBlockMenuItem.js +1 -1
- package/dist/types/editor-commands/toggleExpandRange.d.ts +1 -0
- package/dist/types/legacyExpand/nodeviews/index.d.ts +1 -1
- package/dist/types/legacyExpand/pm-plugins/main.d.ts +1 -1
- package/dist/types/legacyExpand/ui/ExpandIconButton.d.ts +1 -1
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/dist/types/singlePlayerExpand/pm-plugins/main.d.ts +1 -1
- package/dist/types/singlePlayerExpand/ui/ExpandButton.d.ts +1 -1
- package/dist/types/singlePlayerExpand/ui/NodeView.d.ts +1 -1
- package/dist/types/ui/renderExpandButton.d.ts +1 -1
- package/dist/types-ts4.5/editor-commands/toggleExpandRange.d.ts +1 -0
- package/dist/types-ts4.5/legacyExpand/nodeviews/index.d.ts +1 -1
- package/dist/types-ts4.5/legacyExpand/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/legacyExpand/ui/ExpandIconButton.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/ui/ExpandButton.d.ts +1 -1
- package/dist/types-ts4.5/singlePlayerExpand/ui/NodeView.d.ts +1 -1
- package/dist/types-ts4.5/ui/renderExpandButton.d.ts +1 -1
- package/package.json +17 -13
- package/report.api.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 11.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c50b6810de5a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c50b6810de5a3) -
|
|
8
|
+
Fix `toggleExpandRange` to set a `forceExpandOpen` node decoration via transaction meta (gated by
|
|
9
|
+
`platform_editor_expand_force_open_decoration`) so `ExpandNodeView.update()` correctly opens
|
|
10
|
+
expands visually regardless of whether the `platform_editor_aifc_expand_collapses_oncreate_fix`
|
|
11
|
+
experiment is active. Also returns `null` when no expand nodes are found or no state changes, and
|
|
12
|
+
removes stray debug `console.log` statements.
|
|
13
|
+
|
|
14
|
+
## 11.0.0
|
|
15
|
+
|
|
16
|
+
### Major Changes
|
|
17
|
+
|
|
18
|
+
- [`901c87a57486e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/901c87a57486e) -
|
|
19
|
+
Removed `react-intl-next` alias and replaced all usages with `react-intl` directly.
|
|
20
|
+
|
|
21
|
+
What changed: The `react-intl-next` npm alias (which resolved to `react-intl@^5`) has been
|
|
22
|
+
removed. All imports now reference `react-intl` directly, and `peerDependencies` have been updated
|
|
23
|
+
to `"^5.25.1 || ^6.0.0 || ^7.0.0"`.
|
|
24
|
+
|
|
25
|
+
How consumer should update their code: Ensure `react-intl` is installed at a version satisfying
|
|
26
|
+
`^5.25.1 || ^6.0.0 || ^7.0.0`. If your application was using `react-intl-next` as an npm alias, it
|
|
27
|
+
can be safely removed. Replace any remaining `react-intl-next` imports with `react-intl`.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 10.0.0
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.toggleExpandRange = void 0;
|
|
6
|
+
exports.toggleExpandRange = exports.TOGGLE_EXPAND_RANGE_META_KEY = void 0;
|
|
7
7
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
|
+
var TOGGLE_EXPAND_RANGE_META_KEY = exports.TOGGLE_EXPAND_RANGE_META_KEY = 'toggleExpandRange';
|
|
9
11
|
var toggleExpandRange = exports.toggleExpandRange = function toggleExpandRange(from, to) {
|
|
10
12
|
var open = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
11
13
|
return function (_ref) {
|
|
@@ -15,11 +17,28 @@ var toggleExpandRange = exports.toggleExpandRange = function toggleExpandRange(f
|
|
|
15
17
|
nestedExpand = _tr$doc$type$schema$n.nestedExpand;
|
|
16
18
|
var fromClamped = from && from >= 0 ? from : 0;
|
|
17
19
|
var toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
18
|
-
|
|
20
|
+
var positions = [];
|
|
21
|
+
tr.doc.nodesBetween(fromClamped, toClamped, function (node, pos) {
|
|
19
22
|
if ([expand, nestedExpand].includes(node.type)) {
|
|
20
23
|
_expand.expandedState.set(node, open);
|
|
24
|
+
positions.push(pos);
|
|
21
25
|
}
|
|
22
26
|
});
|
|
27
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
28
|
+
if (positions.length === 0) {
|
|
29
|
+
// No expand nodes found in the range — nothing to dispatch.
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Set meta so the expand PM plugin can add node decorations.
|
|
34
|
+
// This ensures ExpandNodeView.update() receives the decoration and visually
|
|
35
|
+
// opens or closes the expand, even when the experiment below is disabled.
|
|
36
|
+
tr.setMeta(TOGGLE_EXPAND_RANGE_META_KEY, {
|
|
37
|
+
positions: positions,
|
|
38
|
+
open: open
|
|
39
|
+
});
|
|
40
|
+
return tr;
|
|
41
|
+
}
|
|
23
42
|
if ((0, _expValEquals.expValEquals)('platform_editor_aifc_expand_collapses_oncreate_fix', 'isEnabled', true)) {
|
|
24
43
|
return tr;
|
|
25
44
|
}
|
|
@@ -13,6 +13,9 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
14
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
|
+
var _view2 = require("@atlaskit/editor-prosemirror/view");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _toggleExpandRange = require("../../editor-commands/toggleExpandRange");
|
|
16
19
|
var _nodeViews = _interopRequireDefault(require("../node-views"));
|
|
17
20
|
// Ignored via go/ees005
|
|
18
21
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -32,7 +35,44 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
32
35
|
var isMobile = false;
|
|
33
36
|
return new _safePlugin.SafePlugin({
|
|
34
37
|
key: pluginKey,
|
|
38
|
+
state: {
|
|
39
|
+
init: function init() {
|
|
40
|
+
return _view2.DecorationSet.empty;
|
|
41
|
+
},
|
|
42
|
+
apply: function apply(tr, decorationSet) {
|
|
43
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
44
|
+
return _view2.DecorationSet.empty;
|
|
45
|
+
}
|
|
46
|
+
var meta = tr.getMeta(_toggleExpandRange.TOGGLE_EXPAND_RANGE_META_KEY);
|
|
47
|
+
if (meta && meta.positions.length > 0) {
|
|
48
|
+
// Add node decorations for each expand node that was toggled.
|
|
49
|
+
// ExpandNodeView.update() uses these decorations to detect it needs to
|
|
50
|
+
// visually open or close, even when expandedState was set before the
|
|
51
|
+
// transaction replaced the node objects.
|
|
52
|
+
// We do NOT map or carry forward existing decorations — we start fresh
|
|
53
|
+
// each time the meta is present.
|
|
54
|
+
var decorations = meta.positions.map(function (pos) {
|
|
55
|
+
var _tr$doc$nodeAt$nodeSi, _tr$doc$nodeAt;
|
|
56
|
+
return _view2.Decoration.node(pos, pos + ((_tr$doc$nodeAt$nodeSi = (_tr$doc$nodeAt = tr.doc.nodeAt(pos)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.nodeSize) !== null && _tr$doc$nodeAt$nodeSi !== void 0 ? _tr$doc$nodeAt$nodeSi : 0), {}, {
|
|
57
|
+
forceExpandOpen: meta.open
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return _view2.DecorationSet.create(tr.doc, decorations);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Map existing decorations through document changes.
|
|
64
|
+
// They will be naturally cleared when they no longer match any node
|
|
65
|
+
// (e.g. if the expand is deleted), or on the next toggleExpandRange call.
|
|
66
|
+
return decorationSet.map(tr.mapping, tr.doc);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
35
69
|
props: {
|
|
70
|
+
decorations: function decorations(state) {
|
|
71
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return pluginKey.getState(state);
|
|
75
|
+
},
|
|
36
76
|
nodeViews: {
|
|
37
77
|
expand: (0, _nodeViews.default)({
|
|
38
78
|
getIntl: getIntl,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.createExpandBlockMenuItem = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
@@ -14,7 +14,7 @@ var _expandElement = _interopRequireDefault(require("@atlaskit/icon-lab/core/exp
|
|
|
14
14
|
var NODE_NAME = 'expand';
|
|
15
15
|
var ExpandBlockMenuItem = function ExpandBlockMenuItem(_ref) {
|
|
16
16
|
var api = _ref.api;
|
|
17
|
-
var _useIntl = (0,
|
|
17
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
18
18
|
formatMessage = _useIntl.formatMessage;
|
|
19
19
|
var handleClick = function handleClick(event) {
|
|
20
20
|
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
export const TOGGLE_EXPAND_RANGE_META_KEY = 'toggleExpandRange';
|
|
3
5
|
export const toggleExpandRange = (from, to, open = true) => ({
|
|
4
6
|
tr
|
|
5
7
|
}) => {
|
|
@@ -9,11 +11,28 @@ export const toggleExpandRange = (from, to, open = true) => ({
|
|
|
9
11
|
} = tr.doc.type.schema.nodes;
|
|
10
12
|
const fromClamped = from && from >= 0 ? from : 0;
|
|
11
13
|
const toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
12
|
-
|
|
14
|
+
const positions = [];
|
|
15
|
+
tr.doc.nodesBetween(fromClamped, toClamped, (node, pos) => {
|
|
13
16
|
if ([expand, nestedExpand].includes(node.type)) {
|
|
14
17
|
expandedState.set(node, open);
|
|
18
|
+
positions.push(pos);
|
|
15
19
|
}
|
|
16
20
|
});
|
|
21
|
+
if (fg('platform_editor_show_diff_scroll_navigation')) {
|
|
22
|
+
if (positions.length === 0) {
|
|
23
|
+
// No expand nodes found in the range — nothing to dispatch.
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Set meta so the expand PM plugin can add node decorations.
|
|
28
|
+
// This ensures ExpandNodeView.update() receives the decoration and visually
|
|
29
|
+
// opens or closes the expand, even when the experiment below is disabled.
|
|
30
|
+
tr.setMeta(TOGGLE_EXPAND_RANGE_META_KEY, {
|
|
31
|
+
positions,
|
|
32
|
+
open
|
|
33
|
+
});
|
|
34
|
+
return tr;
|
|
35
|
+
}
|
|
17
36
|
if (expValEquals('platform_editor_aifc_expand_collapses_oncreate_fix', 'isEnabled', true)) {
|
|
18
37
|
return tr;
|
|
19
38
|
}
|
|
@@ -3,6 +3,9 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { TOGGLE_EXPAND_RANGE_META_KEY } from '../../editor-commands/toggleExpandRange';
|
|
6
9
|
// Ignored via go/ees005
|
|
7
10
|
// eslint-disable-next-line import/no-named-as-default
|
|
8
11
|
import ExpandNodeView from '../node-views';
|
|
@@ -15,7 +18,44 @@ export const createPlugin = (dispatch, getIntl, appearance = 'full-page', useLon
|
|
|
15
18
|
const isMobile = false;
|
|
16
19
|
return new SafePlugin({
|
|
17
20
|
key: pluginKey,
|
|
21
|
+
state: {
|
|
22
|
+
init() {
|
|
23
|
+
return DecorationSet.empty;
|
|
24
|
+
},
|
|
25
|
+
apply(tr, decorationSet) {
|
|
26
|
+
if (!fg('platform_editor_show_diff_scroll_navigation')) {
|
|
27
|
+
return DecorationSet.empty;
|
|
28
|
+
}
|
|
29
|
+
const meta = tr.getMeta(TOGGLE_EXPAND_RANGE_META_KEY);
|
|
30
|
+
if (meta && meta.positions.length > 0) {
|
|
31
|
+
// Add node decorations for each expand node that was toggled.
|
|
32
|
+
// ExpandNodeView.update() uses these decorations to detect it needs to
|
|
33
|
+
// visually open or close, even when expandedState was set before the
|
|
34
|
+
// transaction replaced the node objects.
|
|
35
|
+
// We do NOT map or carry forward existing decorations — we start fresh
|
|
36
|
+
// each time the meta is present.
|
|
37
|
+
const decorations = meta.positions.map(pos => {
|
|
38
|
+
var _tr$doc$nodeAt$nodeSi, _tr$doc$nodeAt;
|
|
39
|
+
return Decoration.node(pos, pos + ((_tr$doc$nodeAt$nodeSi = (_tr$doc$nodeAt = tr.doc.nodeAt(pos)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.nodeSize) !== null && _tr$doc$nodeAt$nodeSi !== void 0 ? _tr$doc$nodeAt$nodeSi : 0), {}, {
|
|
40
|
+
forceExpandOpen: meta.open
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return DecorationSet.create(tr.doc, decorations);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Map existing decorations through document changes.
|
|
47
|
+
// They will be naturally cleared when they no longer match any node
|
|
48
|
+
// (e.g. if the expand is deleted), or on the next toggleExpandRange call.
|
|
49
|
+
return decorationSet.map(tr.mapping, tr.doc);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
18
52
|
props: {
|
|
53
|
+
decorations(state) {
|
|
54
|
+
if (!fg('platform_editor_show_diff_scroll_navigation')) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return pluginKey.getState(state);
|
|
58
|
+
},
|
|
19
59
|
nodeViews: {
|
|
20
60
|
expand: ExpandNodeView({
|
|
21
61
|
getIntl,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
export var TOGGLE_EXPAND_RANGE_META_KEY = 'toggleExpandRange';
|
|
3
5
|
export var toggleExpandRange = function toggleExpandRange(from, to) {
|
|
4
6
|
var open = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
5
7
|
return function (_ref) {
|
|
@@ -9,11 +11,28 @@ export var toggleExpandRange = function toggleExpandRange(from, to) {
|
|
|
9
11
|
nestedExpand = _tr$doc$type$schema$n.nestedExpand;
|
|
10
12
|
var fromClamped = from && from >= 0 ? from : 0;
|
|
11
13
|
var toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
12
|
-
|
|
14
|
+
var positions = [];
|
|
15
|
+
tr.doc.nodesBetween(fromClamped, toClamped, function (node, pos) {
|
|
13
16
|
if ([expand, nestedExpand].includes(node.type)) {
|
|
14
17
|
expandedState.set(node, open);
|
|
18
|
+
positions.push(pos);
|
|
15
19
|
}
|
|
16
20
|
});
|
|
21
|
+
if (fg('platform_editor_show_diff_scroll_navigation')) {
|
|
22
|
+
if (positions.length === 0) {
|
|
23
|
+
// No expand nodes found in the range — nothing to dispatch.
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Set meta so the expand PM plugin can add node decorations.
|
|
28
|
+
// This ensures ExpandNodeView.update() receives the decoration and visually
|
|
29
|
+
// opens or closes the expand, even when the experiment below is disabled.
|
|
30
|
+
tr.setMeta(TOGGLE_EXPAND_RANGE_META_KEY, {
|
|
31
|
+
positions: positions,
|
|
32
|
+
open: open
|
|
33
|
+
});
|
|
34
|
+
return tr;
|
|
35
|
+
}
|
|
17
36
|
if (expValEquals('platform_editor_aifc_expand_collapses_oncreate_fix', 'isEnabled', true)) {
|
|
18
37
|
return tr;
|
|
19
38
|
}
|
|
@@ -3,6 +3,9 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { transformSliceExpandToNestedExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { TOGGLE_EXPAND_RANGE_META_KEY } from '../../editor-commands/toggleExpandRange';
|
|
6
9
|
// Ignored via go/ees005
|
|
7
10
|
// eslint-disable-next-line import/no-named-as-default
|
|
8
11
|
import ExpandNodeView from '../node-views';
|
|
@@ -21,7 +24,44 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
|
21
24
|
var isMobile = false;
|
|
22
25
|
return new SafePlugin({
|
|
23
26
|
key: pluginKey,
|
|
27
|
+
state: {
|
|
28
|
+
init: function init() {
|
|
29
|
+
return DecorationSet.empty;
|
|
30
|
+
},
|
|
31
|
+
apply: function apply(tr, decorationSet) {
|
|
32
|
+
if (!fg('platform_editor_show_diff_scroll_navigation')) {
|
|
33
|
+
return DecorationSet.empty;
|
|
34
|
+
}
|
|
35
|
+
var meta = tr.getMeta(TOGGLE_EXPAND_RANGE_META_KEY);
|
|
36
|
+
if (meta && meta.positions.length > 0) {
|
|
37
|
+
// Add node decorations for each expand node that was toggled.
|
|
38
|
+
// ExpandNodeView.update() uses these decorations to detect it needs to
|
|
39
|
+
// visually open or close, even when expandedState was set before the
|
|
40
|
+
// transaction replaced the node objects.
|
|
41
|
+
// We do NOT map or carry forward existing decorations — we start fresh
|
|
42
|
+
// each time the meta is present.
|
|
43
|
+
var decorations = meta.positions.map(function (pos) {
|
|
44
|
+
var _tr$doc$nodeAt$nodeSi, _tr$doc$nodeAt;
|
|
45
|
+
return Decoration.node(pos, pos + ((_tr$doc$nodeAt$nodeSi = (_tr$doc$nodeAt = tr.doc.nodeAt(pos)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.nodeSize) !== null && _tr$doc$nodeAt$nodeSi !== void 0 ? _tr$doc$nodeAt$nodeSi : 0), {}, {
|
|
46
|
+
forceExpandOpen: meta.open
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return DecorationSet.create(tr.doc, decorations);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Map existing decorations through document changes.
|
|
53
|
+
// They will be naturally cleared when they no longer match any node
|
|
54
|
+
// (e.g. if the expand is deleted), or on the next toggleExpandRange call.
|
|
55
|
+
return decorationSet.map(tr.mapping, tr.doc);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
24
58
|
props: {
|
|
59
|
+
decorations: function decorations(state) {
|
|
60
|
+
if (!fg('platform_editor_show_diff_scroll_navigation')) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return pluginKey.getState(state);
|
|
64
|
+
},
|
|
25
65
|
nodeViews: {
|
|
26
66
|
expand: ExpandNodeView({
|
|
27
67
|
getIntl: getIntl,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
3
|
import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
3
|
import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
|
|
4
4
|
export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape, titleReadOnly?: boolean, contentEditable?: boolean) => DOMOutputSpec;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
3
|
import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
3
|
import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
|
|
4
4
|
export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape, titleReadOnly?: boolean, contentEditable?: boolean) => DOMOutputSpec;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/adf-schema": "^52.5.0",
|
|
33
33
|
"@atlaskit/button": "^23.11.0",
|
|
34
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
35
|
-
"@atlaskit/editor-plugin-block-controls": "^
|
|
36
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
37
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
38
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
39
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
40
|
-
"@atlaskit/editor-plugin-local-id": "^
|
|
41
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
42
|
-
"@atlaskit/editor-plugin-selection-marker": "^
|
|
34
|
+
"@atlaskit/editor-plugin-analytics": "^10.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-block-controls": "^11.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-block-menu": "^9.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-decorations": "^10.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-editor-disabled": "^10.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^12.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-local-id": "^8.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-selection": "^10.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-selection-marker": "^10.0.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
46
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
46
|
+
"@atlaskit/editor-toolbar": "^1.0.0",
|
|
47
47
|
"@atlaskit/icon": "^34.2.0",
|
|
48
48
|
"@atlaskit/icon-lab": "^6.5.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -57,13 +57,14 @@
|
|
|
57
57
|
"w3c-keyname": "^2.1.8"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^
|
|
60
|
+
"@atlaskit/editor-common": "^114.0.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
|
-
"react-intl
|
|
63
|
+
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@testing-library/react": "^16.3.0",
|
|
67
|
+
"react-intl": "^6.6.2",
|
|
67
68
|
"react-test-renderer": "^18.2.0"
|
|
68
69
|
},
|
|
69
70
|
"techstack": {
|
|
@@ -108,6 +109,9 @@
|
|
|
108
109
|
},
|
|
109
110
|
"platform_editor_block_menu_v2_patch_3": {
|
|
110
111
|
"type": "boolean"
|
|
112
|
+
},
|
|
113
|
+
"platform_editor_show_diff_scroll_navigation": {
|
|
114
|
+
"type": "boolean"
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
}
|
package/report.api.md
CHANGED