@atlaskit/editor-plugin-expand 7.3.0 → 7.4.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 +13 -0
- package/dist/cjs/editor-commands/toggleExpandRange.js +24 -0
- package/dist/cjs/legacyExpand/nodeviews/index.js +2 -1
- package/dist/cjs/legacyExpand/plugin.js +3 -1
- package/dist/cjs/singlePlayerExpand/commands.js +5 -2
- package/dist/cjs/singlePlayerExpand/node-views/index.js +2 -0
- package/dist/cjs/singlePlayerExpand/plugin.js +3 -1
- package/dist/es2019/editor-commands/toggleExpandRange.js +17 -0
- package/dist/es2019/legacyExpand/nodeviews/index.js +2 -0
- package/dist/es2019/legacyExpand/plugin.js +3 -1
- package/dist/es2019/singlePlayerExpand/commands.js +5 -1
- package/dist/es2019/singlePlayerExpand/node-views/index.js +2 -0
- package/dist/es2019/singlePlayerExpand/plugin.js +3 -1
- package/dist/esm/editor-commands/toggleExpandRange.js +18 -0
- package/dist/esm/legacyExpand/nodeviews/index.js +2 -0
- package/dist/esm/legacyExpand/plugin.js +3 -1
- package/dist/esm/singlePlayerExpand/commands.js +5 -1
- package/dist/esm/singlePlayerExpand/node-views/index.js +2 -0
- package/dist/esm/singlePlayerExpand/plugin.js +3 -1
- package/dist/types/editor-commands/toggleExpandRange.d.ts +2 -0
- package/dist/types/types.d.ts +28 -0
- package/dist/types-ts4.5/editor-commands/toggleExpandRange.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +28 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 7.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 7.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`fd552090f0285`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd552090f0285) -
|
|
14
|
+
Introduce new toggle expand command API to toggle expands across a range.
|
|
15
|
+
|
|
3
16
|
## 7.3.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toggleExpandRange = void 0;
|
|
7
|
+
var _expand = require("@atlaskit/editor-common/expand");
|
|
8
|
+
var toggleExpandRange = exports.toggleExpandRange = function toggleExpandRange(from, to) {
|
|
9
|
+
var open = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
10
|
+
return function (_ref) {
|
|
11
|
+
var tr = _ref.tr;
|
|
12
|
+
var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
|
|
13
|
+
expand = _tr$doc$type$schema$n.expand,
|
|
14
|
+
nestedExpand = _tr$doc$type$schema$n.nestedExpand;
|
|
15
|
+
var fromClamped = from && from >= 0 ? from : 0;
|
|
16
|
+
var toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
17
|
+
tr.doc.nodesBetween(fromClamped, toClamped, function (node) {
|
|
18
|
+
if ([expand, nestedExpand].includes(node.type)) {
|
|
19
|
+
_expand.expandedState.set(node, open);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -25,7 +25,7 @@ var _renderExpandButton = require("../../ui/renderExpandButton");
|
|
|
25
25
|
var _commands = require("../commands");
|
|
26
26
|
var _ExpandIconButton = require("../ui/ExpandIconButton");
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
29
29
|
function buildExpandClassName(type, expanded) {
|
|
30
30
|
return "".concat(_styles.expandClassNames.prefix, " ").concat(_styles.expandClassNames.type(type), " ").concat(expanded ? _styles.expandClassNames.expanded : '');
|
|
31
31
|
}
|
|
@@ -450,6 +450,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
450
450
|
this.input = this.dom.querySelector(".".concat(_styles.expandClassNames.titleInput));
|
|
451
451
|
this.titleContainer = this.dom.querySelector(".".concat(_styles.expandClassNames.titleContainer));
|
|
452
452
|
this.content = this.dom.querySelector(".".concat(_styles.expandClassNames.content));
|
|
453
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
453
454
|
this.renderKey = (0, _v.default)();
|
|
454
455
|
if ((0, _expValEquals.expValEquals)('platform_editor_native_expand_button', 'isEnabled', true)) {
|
|
455
456
|
this.renderNativeIcon(this.node);
|
|
@@ -14,6 +14,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
14
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
17
|
+
var _toggleExpandRange = require("../editor-commands/toggleExpandRange");
|
|
17
18
|
var _ExpandBlockMenuItem = require("../ui/ExpandBlockMenuItem");
|
|
18
19
|
var _commands = require("./commands");
|
|
19
20
|
var _keymap = require("./pm-plugins/keymap");
|
|
@@ -57,7 +58,8 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
57
58
|
commands: {
|
|
58
59
|
toggleExpandWithMatch: function toggleExpandWithMatch(selection) {
|
|
59
60
|
return (0, _commands.toggleExpandWithMatch)(selection);
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
toggleExpandRange: _toggleExpandRange.toggleExpandRange
|
|
61
63
|
},
|
|
62
64
|
pmPlugins: function pmPlugins() {
|
|
63
65
|
return [{
|
|
@@ -21,7 +21,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
21
21
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
22
|
var _utils4 = require("../utils");
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
25
25
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
26
26
|
var createExpandNode = exports.createExpandNode = function createExpandNode(state) {
|
|
27
27
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -34,8 +34,11 @@ var createExpandNode = exports.createExpandNode = function createExpandNode(stat
|
|
|
34
34
|
var isSelectionInExpand = (0, _utils4.isNestedInExpand)(state);
|
|
35
35
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
36
36
|
var expandNode = (0, _platformFeatureFlags.fg)('platform_editor_adf_with_localid') ? expandType.createAndFill(addLocalId ? {
|
|
37
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
37
38
|
localId: (0, _v.default)()
|
|
38
|
-
} : {},
|
|
39
|
+
} : {},
|
|
40
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
41
|
+
paragraph.createAndFill(addLocalId ? {
|
|
39
42
|
localId: (0, _v.default)()
|
|
40
43
|
} : {})) : expandType.createAndFill({});
|
|
41
44
|
if (setExpandedState) {
|
|
@@ -26,6 +26,7 @@ var _commands = require("../commands");
|
|
|
26
26
|
var _ExpandButton = require("../ui/ExpandButton");
|
|
27
27
|
var _NodeView = require("../ui/NodeView");
|
|
28
28
|
var _utils2 = require("../utils");
|
|
29
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
29
30
|
var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
30
31
|
function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
|
|
31
32
|
var _this = this,
|
|
@@ -416,6 +417,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
416
417
|
this.icon = this.dom.querySelector(".".concat(_styles.expandClassNames.icon));
|
|
417
418
|
this.input = this.dom.querySelector(".".concat(_styles.expandClassNames.titleInput));
|
|
418
419
|
this.titleContainer = this.dom.querySelector(".".concat(_styles.expandClassNames.titleContainer));
|
|
420
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
419
421
|
this.renderKey = (0, _v.default)();
|
|
420
422
|
this.content = this.dom.querySelector(".".concat(_styles.expandClassNames.content));
|
|
421
423
|
if (!_expand.expandedState.has(this.node)) {
|
|
@@ -14,6 +14,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
14
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
17
|
+
var _toggleExpandRange = require("../editor-commands/toggleExpandRange");
|
|
17
18
|
var _ExpandBlockMenuItem = require("../ui/ExpandBlockMenuItem");
|
|
18
19
|
var _commands = require("./commands");
|
|
19
20
|
var _keymap = require("./pm-plugins/keymap");
|
|
@@ -56,7 +57,8 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
56
57
|
commands: {
|
|
57
58
|
toggleExpandWithMatch: function toggleExpandWithMatch(selection) {
|
|
58
59
|
return (0, _commands.toggleExpandWithMatch)(selection);
|
|
59
|
-
}
|
|
60
|
+
},
|
|
61
|
+
toggleExpandRange: _toggleExpandRange.toggleExpandRange
|
|
60
62
|
},
|
|
61
63
|
pmPlugins: function pmPlugins() {
|
|
62
64
|
return [{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
export const toggleExpandRange = (from, to, open = true) => ({
|
|
3
|
+
tr
|
|
4
|
+
}) => {
|
|
5
|
+
const {
|
|
6
|
+
expand,
|
|
7
|
+
nestedExpand
|
|
8
|
+
} = tr.doc.type.schema.nodes;
|
|
9
|
+
const fromClamped = from && from >= 0 ? from : 0;
|
|
10
|
+
const toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
11
|
+
tr.doc.nodesBetween(fromClamped, toClamped, node => {
|
|
12
|
+
if ([expand, nestedExpand].includes(node.type)) {
|
|
13
|
+
expandedState.set(node, open);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid/v4';
|
|
4
5
|
import { keyName } from 'w3c-keyname';
|
|
5
6
|
import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
@@ -451,6 +452,7 @@ export class ExpandNodeView {
|
|
|
451
452
|
this.input = this.dom.querySelector(`.${expandClassNames.titleInput}`);
|
|
452
453
|
this.titleContainer = this.dom.querySelector(`.${expandClassNames.titleContainer}`);
|
|
453
454
|
this.content = this.dom.querySelector(`.${expandClassNames.content}`);
|
|
455
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
454
456
|
this.renderKey = uuid();
|
|
455
457
|
if (expValEquals('platform_editor_native_expand_button', 'isEnabled', true)) {
|
|
456
458
|
this.renderNativeIcon(this.node);
|
|
@@ -7,6 +7,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
|
+
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
10
11
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
11
12
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch } from './commands';
|
|
12
13
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -49,7 +50,8 @@ export let expandPlugin = ({
|
|
|
49
50
|
insertExpandWithInputMethod: insertExpandWithInputMethod(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
50
51
|
},
|
|
51
52
|
commands: {
|
|
52
|
-
toggleExpandWithMatch: selection => toggleExpandWithMatch(selection)
|
|
53
|
+
toggleExpandWithMatch: selection => toggleExpandWithMatch(selection),
|
|
54
|
+
toggleExpandRange
|
|
53
55
|
},
|
|
54
56
|
pmPlugins() {
|
|
55
57
|
return [{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
1
2
|
import uuid from 'uuid/v4';
|
|
2
3
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
3
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
@@ -24,8 +25,11 @@ export const createExpandNode = (state, setExpandedState = true, addLocalId) =>
|
|
|
24
25
|
const isSelectionInExpand = isNestedInExpand(state);
|
|
25
26
|
const expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
26
27
|
const expandNode = fg('platform_editor_adf_with_localid') ? expandType.createAndFill(addLocalId ? {
|
|
28
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
27
29
|
localId: uuid()
|
|
28
|
-
} : {},
|
|
30
|
+
} : {},
|
|
31
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
32
|
+
paragraph.createAndFill(addLocalId ? {
|
|
29
33
|
localId: uuid()
|
|
30
34
|
} : {})) : expandType.createAndFill({});
|
|
31
35
|
if (setExpandedState) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid/v4';
|
|
4
5
|
import { keyName } from 'w3c-keyname';
|
|
5
6
|
import { expandedState, isExpandCollapsed } from '@atlaskit/editor-common/expand';
|
|
@@ -415,6 +416,7 @@ export class ExpandNodeView {
|
|
|
415
416
|
this.icon = this.dom.querySelector(`.${expandClassNames.icon}`);
|
|
416
417
|
this.input = this.dom.querySelector(`.${expandClassNames.titleInput}`);
|
|
417
418
|
this.titleContainer = this.dom.querySelector(`.${expandClassNames.titleContainer}`);
|
|
419
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
418
420
|
this.renderKey = uuid();
|
|
419
421
|
this.content = this.dom.querySelector(`.${expandClassNames.content}`);
|
|
420
422
|
if (!expandedState.has(this.node)) {
|
|
@@ -7,6 +7,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
|
+
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
10
11
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
11
12
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch, wrapSelectionAndSetExpandedState } from './commands';
|
|
12
13
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -48,7 +49,8 @@ export let expandPlugin = ({
|
|
|
48
49
|
insertExpandWithInputMethod: insertExpandWithInputMethod(api)
|
|
49
50
|
},
|
|
50
51
|
commands: {
|
|
51
|
-
toggleExpandWithMatch: selection => toggleExpandWithMatch(selection)
|
|
52
|
+
toggleExpandWithMatch: selection => toggleExpandWithMatch(selection),
|
|
53
|
+
toggleExpandRange
|
|
52
54
|
},
|
|
53
55
|
pmPlugins() {
|
|
54
56
|
return [{
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
+
export var toggleExpandRange = function toggleExpandRange(from, to) {
|
|
3
|
+
var open = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
4
|
+
return function (_ref) {
|
|
5
|
+
var tr = _ref.tr;
|
|
6
|
+
var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
|
|
7
|
+
expand = _tr$doc$type$schema$n.expand,
|
|
8
|
+
nestedExpand = _tr$doc$type$schema$n.nestedExpand;
|
|
9
|
+
var fromClamped = from && from >= 0 ? from : 0;
|
|
10
|
+
var toClamped = to && to <= tr.doc.content.size ? to : tr.doc.content.size;
|
|
11
|
+
tr.doc.nodesBetween(fromClamped, toClamped, function (node) {
|
|
12
|
+
if ([expand, nestedExpand].includes(node.type)) {
|
|
13
|
+
expandedState.set(node, open);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -4,6 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import React from 'react';
|
|
7
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
7
8
|
import uuid from 'uuid/v4';
|
|
8
9
|
import { keyName } from 'w3c-keyname';
|
|
9
10
|
import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
@@ -442,6 +443,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
442
443
|
this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
|
|
443
444
|
this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
|
|
444
445
|
this.content = this.dom.querySelector(".".concat(expandClassNames.content));
|
|
446
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
445
447
|
this.renderKey = uuid();
|
|
446
448
|
if (expValEquals('platform_editor_native_expand_button', 'isEnabled', true)) {
|
|
447
449
|
this.renderNativeIcon(this.node);
|
|
@@ -7,6 +7,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
|
+
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
10
11
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
11
12
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch as _toggleExpandWithMatch } from './commands';
|
|
12
13
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -51,7 +52,8 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
51
52
|
commands: {
|
|
52
53
|
toggleExpandWithMatch: function toggleExpandWithMatch(selection) {
|
|
53
54
|
return _toggleExpandWithMatch(selection);
|
|
54
|
-
}
|
|
55
|
+
},
|
|
56
|
+
toggleExpandRange: toggleExpandRange
|
|
55
57
|
},
|
|
56
58
|
pmPlugins: function pmPlugins() {
|
|
57
59
|
return [{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
5
|
import uuid from 'uuid/v4';
|
|
5
6
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
6
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
@@ -28,8 +29,11 @@ export var createExpandNode = function createExpandNode(state) {
|
|
|
28
29
|
var isSelectionInExpand = isNestedInExpand(state);
|
|
29
30
|
var expandType = isSelectionInTable || isSelectionInExpand ? nestedExpand : expand;
|
|
30
31
|
var expandNode = fg('platform_editor_adf_with_localid') ? expandType.createAndFill(addLocalId ? {
|
|
32
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
31
33
|
localId: uuid()
|
|
32
|
-
} : {},
|
|
34
|
+
} : {},
|
|
35
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
36
|
+
paragraph.createAndFill(addLocalId ? {
|
|
33
37
|
localId: uuid()
|
|
34
38
|
} : {})) : expandType.createAndFill({});
|
|
35
39
|
if (setExpandedState) {
|
|
@@ -2,6 +2,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import React from 'react';
|
|
5
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
5
6
|
import uuid from 'uuid/v4';
|
|
6
7
|
import { keyName } from 'w3c-keyname';
|
|
7
8
|
import { expandedState, isExpandCollapsed } from '@atlaskit/editor-common/expand';
|
|
@@ -408,6 +409,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
408
409
|
this.icon = this.dom.querySelector(".".concat(expandClassNames.icon));
|
|
409
410
|
this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
|
|
410
411
|
this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
|
|
412
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
411
413
|
this.renderKey = uuid();
|
|
412
414
|
this.content = this.dom.querySelector(".".concat(expandClassNames.content));
|
|
413
415
|
if (!expandedState.has(this.node)) {
|
|
@@ -7,6 +7,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
|
+
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
10
11
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
11
12
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch as _toggleExpandWithMatch, wrapSelectionAndSetExpandedState } from './commands';
|
|
12
13
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -50,7 +51,8 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
50
51
|
commands: {
|
|
51
52
|
toggleExpandWithMatch: function toggleExpandWithMatch(selection) {
|
|
52
53
|
return _toggleExpandWithMatch(selection);
|
|
53
|
-
}
|
|
54
|
+
},
|
|
55
|
+
toggleExpandRange: toggleExpandRange
|
|
54
56
|
},
|
|
55
57
|
pmPlugins: function pmPlugins() {
|
|
56
58
|
return [{
|
package/dist/types/types.d.ts
CHANGED
|
@@ -68,6 +68,34 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
68
68
|
* Toggle the expand or nested expand node open
|
|
69
69
|
*/
|
|
70
70
|
toggleExpandWithMatch: (selection: Selection) => EditorCommand;
|
|
71
|
+
/**
|
|
72
|
+
* Expand or collapse a range of expand nodes. With no parameters
|
|
73
|
+
*
|
|
74
|
+
*
|
|
75
|
+
* @param from Starting range (defaults to 0)
|
|
76
|
+
* @param to Ending range (defaults to the document size)
|
|
77
|
+
* @param open Boolean to open (defaults to opening expands)
|
|
78
|
+
* @returns EditorCommand to be executed
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* // Opens all the expands on the page
|
|
83
|
+
* editorAPI.core.actions.execute(
|
|
84
|
+
* editorAPI.expand.commands.toggleExpandRange()
|
|
85
|
+
* )
|
|
86
|
+
*
|
|
87
|
+
* // Closes all the expands between positions 0 and 34 on the page
|
|
88
|
+
* editorAPI.core.actions.execute(
|
|
89
|
+
* editorAPI.expand.commands.toggleExpandRange(0, 34, false)
|
|
90
|
+
* )
|
|
91
|
+
*
|
|
92
|
+
* // Closes all the expands on the page
|
|
93
|
+
* editorAPI.core.actions.execute(
|
|
94
|
+
* editorAPI.expand.commands.toggleExpandRange(undefined, undefined, false)
|
|
95
|
+
* )
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
toggleExpandRange: (from?: number, to?: number, open?: boolean) => EditorCommand;
|
|
71
99
|
};
|
|
72
100
|
dependencies: ExpandPluginDependencies;
|
|
73
101
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
@@ -68,6 +68,34 @@ export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
|
68
68
|
* Toggle the expand or nested expand node open
|
|
69
69
|
*/
|
|
70
70
|
toggleExpandWithMatch: (selection: Selection) => EditorCommand;
|
|
71
|
+
/**
|
|
72
|
+
* Expand or collapse a range of expand nodes. With no parameters
|
|
73
|
+
*
|
|
74
|
+
*
|
|
75
|
+
* @param from Starting range (defaults to 0)
|
|
76
|
+
* @param to Ending range (defaults to the document size)
|
|
77
|
+
* @param open Boolean to open (defaults to opening expands)
|
|
78
|
+
* @returns EditorCommand to be executed
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* // Opens all the expands on the page
|
|
83
|
+
* editorAPI.core.actions.execute(
|
|
84
|
+
* editorAPI.expand.commands.toggleExpandRange()
|
|
85
|
+
* )
|
|
86
|
+
*
|
|
87
|
+
* // Closes all the expands between positions 0 and 34 on the page
|
|
88
|
+
* editorAPI.core.actions.execute(
|
|
89
|
+
* editorAPI.expand.commands.toggleExpandRange(0, 34, false)
|
|
90
|
+
* )
|
|
91
|
+
*
|
|
92
|
+
* // Closes all the expands on the page
|
|
93
|
+
* editorAPI.core.actions.execute(
|
|
94
|
+
* editorAPI.expand.commands.toggleExpandRange(undefined, undefined, false)
|
|
95
|
+
* )
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
toggleExpandRange: (from?: number, to?: number, open?: boolean) => EditorCommand;
|
|
71
99
|
};
|
|
72
100
|
dependencies: ExpandPluginDependencies;
|
|
73
101
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/adf-schema": "^51.3.2",
|
|
33
33
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
34
|
-
"@atlaskit/button": "^23.
|
|
34
|
+
"@atlaskit/button": "^23.6.0",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-block-menu": "^5.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-decorations": "^6.1.0",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"@atlaskit/icon-lab": "^5.11.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
50
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
52
|
-
"@atlaskit/tokens": "^
|
|
53
|
-
"@atlaskit/tooltip": "^20.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^13.32.0",
|
|
52
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
53
|
+
"@atlaskit/tooltip": "^20.8.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
56
56
|
"uuid": "^3.1.0",
|
|
57
57
|
"w3c-keyname": "^2.1.8"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^110.
|
|
60
|
+
"@atlaskit/editor-common": "^110.24.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"react-intl-next": "npm:react-intl@^5.18.1"
|