@atlaskit/editor-core 189.3.22 → 189.3.24
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 +14 -0
- package/dist/cjs/plugins/find-replace/ui/Find.js +5 -2
- package/dist/cjs/plugins/find-replace/ui/styles.js +9 -6
- package/dist/cjs/plugins/indentation/commands/index.js +5 -5
- package/dist/cjs/plugins/indentation/index.js +26 -2
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/index.js +8 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +34 -37
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +14 -57
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +2 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +3 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +3 -43
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/Find.js +6 -3
- package/dist/es2019/plugins/find-replace/ui/styles.js +8 -5
- package/dist/es2019/plugins/indentation/commands/index.js +3 -3
- package/dist/es2019/plugins/indentation/index.js +49 -17
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +8 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +14 -20
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -52
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +3 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +1 -42
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/find-replace/ui/Find.js +6 -3
- package/dist/esm/plugins/find-replace/ui/styles.js +8 -5
- package/dist/esm/plugins/indentation/commands/index.js +3 -3
- package/dist/esm/plugins/indentation/index.js +26 -2
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/index.js +8 -1
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -38
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +11 -55
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +3 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +11 -15
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +2 -42
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/find-replace/ui/styles.d.ts +1 -0
- package/dist/types/plugins/indentation/commands/index.d.ts +1 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +1 -1
- package/dist/types/plugins/indentation/index.d.ts +14 -2
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +18 -2
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
- package/dist/types-ts4.5/plugins/find-replace/ui/styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +1 -2
- package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +1 -1
- package/dist/types-ts4.5/plugins/indentation/index.d.ts +14 -2
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +18 -2
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +15 -11
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +2 -1
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanel.d.ts +4 -3
- package/package.json +2 -2
- package/dist/cjs/plugins/indentation/messages.js +0 -21
- package/dist/es2019/plugins/indentation/messages.js +0 -14
- package/dist/esm/plugins/indentation/messages.js +0 -14
- package/dist/types/plugins/indentation/messages.d.ts +0 -12
- package/dist/types-ts4.5/plugins/indentation/messages.d.ts +0 -12
- /package/dist/cjs/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
- /package/dist/es2019/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
- /package/dist/esm/{utils → plugins/indentation}/getAttrsWithChangesRecorder.js +0 -0
- /package/dist/types/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → plugins/indentation}/getAttrsWithChangesRecorder.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.3.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42256](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42256) [`9c1a79051b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9c1a79051b6) - Avoid submitting certain attributes for config panel analytic events
|
|
8
|
+
|
|
9
|
+
## 189.3.23
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42651](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42651) [`92e9957a8bf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/92e9957a8bf) - [ux] [ECA11Y-148] Added screen reader announcement for Find and Replace search results count
|
|
14
|
+
- [#43111](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43111) [`d71dda4f834`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d71dda4f834) - Decouple indentation plugin from editor-core.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 189.3.22
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -272,10 +272,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
272
272
|
onBlur: this.props.onFindBlur,
|
|
273
273
|
onCompositionStart: this.handleCompositionStart,
|
|
274
274
|
onCompositionEnd: this.handleCompositionEnd
|
|
275
|
-
}),
|
|
275
|
+
}), (0, _react2.jsx)("div", {
|
|
276
|
+
css: _styles.countWrapperStyles,
|
|
277
|
+
"aria-live": "polite"
|
|
278
|
+
}, findText && (0, _react2.jsx)("span", {
|
|
276
279
|
"data-testid": "textfield-count",
|
|
277
280
|
css: _styles.countStyles
|
|
278
|
-
}, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
281
|
+
}, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
279
282
|
title: this.matchCase,
|
|
280
283
|
icon: this.matchCaseIcon,
|
|
281
284
|
onClick: this.handleMatchCaseClick,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.wrapperStyles = exports.sectionWrapperStyles = exports.ruleStyles = exports.replaceSectionButtonStyles = exports.countStyles = void 0;
|
|
7
|
+
exports.wrapperStyles = exports.sectionWrapperStyles = exports.ruleStyles = exports.replaceSectionButtonStyles = exports.countWrapperStyles = exports.countStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -12,13 +12,13 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
12
12
|
var _templateObject;
|
|
13
13
|
/** @jsx jsx */
|
|
14
14
|
var replaceSectionButtonStyles = exports.replaceSectionButtonStyles = (0, _react.css)({
|
|
15
|
-
marginLeft:
|
|
15
|
+
marginLeft: "var(--ds-space-050, 4px)"
|
|
16
16
|
});
|
|
17
17
|
var ruleStyles = exports.ruleStyles = (0, _react.css)({
|
|
18
18
|
width: '100%',
|
|
19
19
|
border: 'none',
|
|
20
20
|
backgroundColor: "".concat("var(--ds-border, ".concat(_colors.N30A, ")")),
|
|
21
|
-
margin:
|
|
21
|
+
margin: "var(--ds-space-050, 4px)".concat(" 0px"),
|
|
22
22
|
height: '1px',
|
|
23
23
|
borderRadius: '1px'
|
|
24
24
|
});
|
|
@@ -26,7 +26,7 @@ var wrapperStyles = exports.wrapperStyles = (0, _react.css)({
|
|
|
26
26
|
display: 'flex',
|
|
27
27
|
flexDirection: 'column',
|
|
28
28
|
'> *:not(#replace-hr-element)': {
|
|
29
|
-
margin:
|
|
29
|
+
margin: "0px ".concat("var(--ds-space-050, 4px)")
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
var sectionWrapperStyles = exports.sectionWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n\n & > * {\n display: inline-flex;\n height: 32px;\n flex: 0 0 auto;\n }\n\n & > [data-ds--text-field--container] {\n display: flex;\n flex: 1 1 auto;\n }\n"])));
|
|
@@ -36,6 +36,9 @@ var countStyles = exports.countStyles = (0, _react.css)({
|
|
|
36
36
|
flex: '0 0 auto',
|
|
37
37
|
justifyContent: 'center',
|
|
38
38
|
alignItems: 'center',
|
|
39
|
-
marginLeft:
|
|
40
|
-
marginRight:
|
|
39
|
+
marginLeft: "var(--ds-space-050, 4px)",
|
|
40
|
+
marginRight: "var(--ds-space-100, 8px)"
|
|
41
|
+
});
|
|
42
|
+
var countWrapperStyles = exports.countWrapperStyles = (0, _react.css)({
|
|
43
|
+
alignItems: 'center'
|
|
41
44
|
});
|
|
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.removeIndentation = exports.isIndentationAllowed = exports.getOutdentCommand = exports.getIndentCommand =
|
|
8
|
-
var _commands = require("
|
|
7
|
+
exports.removeIndentation = exports.isIndentationAllowed = exports.getOutdentCommand = exports.getIndentCommand = void 0;
|
|
8
|
+
var _commands = require("@atlaskit/editor-common/commands");
|
|
9
9
|
var _utils = require("./utils");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
-
var _getAttrsWithChangesRecorder = _interopRequireDefault(require("
|
|
12
|
-
var
|
|
11
|
+
var _getAttrsWithChangesRecorder = _interopRequireDefault(require("../getAttrsWithChangesRecorder"));
|
|
12
|
+
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
13
13
|
var isIndentationAllowed = exports.isIndentationAllowed = function isIndentationAllowed(schema, node) {
|
|
14
14
|
var _schema$nodes = schema.nodes,
|
|
15
15
|
paragraph = _schema$nodes.paragraph,
|
|
@@ -79,7 +79,7 @@ var getIndentAttrs = function getIndentAttrs(oldAttr) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
var level = oldAttr.level;
|
|
82
|
-
if (level >= MAX_INDENTATION_LEVEL) {
|
|
82
|
+
if (level >= _indentation.MAX_INDENTATION_LEVEL) {
|
|
83
83
|
return undefined; // Max indentation level reached, do nothing.
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
8
8
|
var _keymap = require("./pm-plugins/keymap");
|
|
9
|
+
var _commands = require("./commands");
|
|
10
|
+
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
9
11
|
var indentationPlugin = function indentationPlugin(_ref) {
|
|
12
|
+
var _api$analytics, _api$analytics2;
|
|
10
13
|
var api = _ref.api;
|
|
11
14
|
return {
|
|
12
15
|
name: 'indentation',
|
|
@@ -16,12 +19,33 @@ var indentationPlugin = function indentationPlugin(_ref) {
|
|
|
16
19
|
mark: _adfSchema.indentation
|
|
17
20
|
}];
|
|
18
21
|
},
|
|
22
|
+
actions: {
|
|
23
|
+
indentParagraphOrHeading: (0, _commands.getIndentCommand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
24
|
+
outdentParagraphOrHeading: (0, _commands.getOutdentCommand)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
25
|
+
},
|
|
26
|
+
getSharedState: function getSharedState(editorState) {
|
|
27
|
+
var _ref2;
|
|
28
|
+
if (!editorState) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
var selection = editorState.tr.selection,
|
|
32
|
+
indentation = editorState.schema.marks.indentation;
|
|
33
|
+
var node = selection.$from.node();
|
|
34
|
+
var indentationMark = node.marks.find(function (mark) {
|
|
35
|
+
return mark.type === indentation;
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
isIndentationAllowed: (0, _commands.isIndentationAllowed)(editorState.schema, node),
|
|
39
|
+
indentDisabled: (_ref2 = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= _indentation.MAX_INDENTATION_LEVEL) !== null && _ref2 !== void 0 ? _ref2 : false,
|
|
40
|
+
outdentDisabled: !indentationMark
|
|
41
|
+
};
|
|
42
|
+
},
|
|
19
43
|
pmPlugins: function pmPlugins() {
|
|
20
44
|
return [{
|
|
21
45
|
name: 'indentationKeymap',
|
|
22
46
|
plugin: function plugin() {
|
|
23
|
-
var _api$
|
|
24
|
-
return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$
|
|
47
|
+
var _api$analytics3;
|
|
48
|
+
return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
25
49
|
}
|
|
26
50
|
}];
|
|
27
51
|
}
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
exports.keymapPlugin = keymapPlugin;
|
|
8
8
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
|
-
var _utils = require("
|
|
10
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _commands = require("../commands");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
function keymapPlugin(editorAnalyticsAPI) {
|
|
@@ -18,6 +18,8 @@ var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
|
|
|
18
18
|
var _main = require("./pm-plugins/main");
|
|
19
19
|
var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
|
|
20
20
|
var _ToolbarTask = _interopRequireDefault(require("./ui/ToolbarTask"));
|
|
21
|
+
var _helpers = require("./pm-plugins/helpers");
|
|
22
|
+
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
21
23
|
var _templateObject;
|
|
22
24
|
/** @jsx jsx */
|
|
23
25
|
var taskDecisionToolbarGroup = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
|
|
@@ -64,8 +66,13 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
64
66
|
return undefined;
|
|
65
67
|
}
|
|
66
68
|
var pluginState = _pluginKey.stateKey.getState(editorState);
|
|
69
|
+
var indentLevel = (0, _helpers.getCurrentIndentLevel)(editorState.selection) || 0;
|
|
70
|
+
var itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
|
|
67
71
|
return {
|
|
68
|
-
focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
|
|
72
|
+
focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
|
|
73
|
+
isInsideTask: (0, _helpers.isInsideTask)(editorState),
|
|
74
|
+
indentDisabled: itemIndex === 0 || indentLevel >= _indentation.MAX_INDENTATION_LEVEL,
|
|
75
|
+
outdentDisabled: indentLevel <= 1
|
|
69
76
|
};
|
|
70
77
|
},
|
|
71
78
|
pmPlugins: function pmPlugins() {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
8
|
+
exports.PrimaryToolbarComponent = PrimaryToolbarComponent;
|
|
7
9
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
12
|
var _ui = _interopRequireDefault(require("./ui"));
|
|
11
13
|
var _types = require("../../ui/Toolbar/types");
|
|
12
14
|
var _indentationButtons = require("./pm-plugins/indentation-buttons");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
17
|
var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
|
|
14
18
|
var _api$featureFlags;
|
|
15
19
|
var config = _ref.config,
|
|
@@ -28,28 +32,14 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
|
|
|
28
32
|
}
|
|
29
33
|
return _indentationButtons.pluginKey.getState(editorState);
|
|
30
34
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation,
|
|
40
|
-
api: api
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}];
|
|
44
|
-
},
|
|
45
|
-
primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
|
|
46
|
-
var editorView = _ref4.editorView,
|
|
47
|
-
popupsMountPoint = _ref4.popupsMountPoint,
|
|
48
|
-
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
49
|
-
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
50
|
-
toolbarSize = _ref4.toolbarSize,
|
|
51
|
-
disabled = _ref4.disabled,
|
|
52
|
-
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
|
|
35
|
+
primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
|
|
36
|
+
var editorView = _ref3.editorView,
|
|
37
|
+
popupsMountPoint = _ref3.popupsMountPoint,
|
|
38
|
+
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
39
|
+
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
40
|
+
toolbarSize = _ref3.toolbarSize,
|
|
41
|
+
disabled = _ref3.disabled,
|
|
42
|
+
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
|
|
53
43
|
var isSmall = toolbarSize < _types.ToolbarSize.L;
|
|
54
44
|
return /*#__PURE__*/_react.default.createElement(PrimaryToolbarComponent, {
|
|
55
45
|
featureFlags: featureFlags,
|
|
@@ -61,25 +51,31 @@ var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref)
|
|
|
61
51
|
disabled: disabled,
|
|
62
52
|
editorView: editorView,
|
|
63
53
|
showIndentationButtons: showIndentationButtons,
|
|
64
|
-
pluginInjectionApi: api
|
|
54
|
+
pluginInjectionApi: api,
|
|
55
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
65
56
|
});
|
|
66
57
|
}
|
|
67
58
|
};
|
|
68
59
|
};
|
|
69
|
-
function PrimaryToolbarComponent(
|
|
70
|
-
var featureFlags =
|
|
71
|
-
popupsMountPoint =
|
|
72
|
-
popupsBoundariesElement =
|
|
73
|
-
popupsScrollableElement =
|
|
74
|
-
isSmall =
|
|
75
|
-
isToolbarReducedSpacing =
|
|
76
|
-
disabled =
|
|
77
|
-
editorView =
|
|
78
|
-
showIndentationButtons =
|
|
79
|
-
pluginInjectionApi =
|
|
80
|
-
|
|
60
|
+
function PrimaryToolbarComponent(_ref4) {
|
|
61
|
+
var featureFlags = _ref4.featureFlags,
|
|
62
|
+
popupsMountPoint = _ref4.popupsMountPoint,
|
|
63
|
+
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
64
|
+
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
65
|
+
isSmall = _ref4.isSmall,
|
|
66
|
+
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
|
|
67
|
+
disabled = _ref4.disabled,
|
|
68
|
+
editorView = _ref4.editorView,
|
|
69
|
+
showIndentationButtons = _ref4.showIndentationButtons,
|
|
70
|
+
pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
71
|
+
allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
|
|
72
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['list', 'indentation', 'taskDecision']),
|
|
81
73
|
listState = _useSharedPluginState.listState,
|
|
82
|
-
|
|
74
|
+
indentationState = _useSharedPluginState.indentationState,
|
|
75
|
+
taskDecisionState = _useSharedPluginState.taskDecisionState;
|
|
76
|
+
var toolbarListsIndentationState = (0, _react.useMemo)(function () {
|
|
77
|
+
return (0, _indentationButtons.getIndentationButtonsState)(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
|
|
78
|
+
}, [editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem]);
|
|
83
79
|
if (!listState) {
|
|
84
80
|
return null;
|
|
85
81
|
}
|
|
@@ -99,6 +95,7 @@ function PrimaryToolbarComponent(_ref5) {
|
|
|
99
95
|
showIndentationButtons: !!showIndentationButtons,
|
|
100
96
|
indentDisabled: toolbarListsIndentationState.indentDisabled,
|
|
101
97
|
outdentDisabled: toolbarListsIndentationState.outdentDisabled,
|
|
98
|
+
indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
|
|
102
99
|
pluginInjectionApi: pluginInjectionApi
|
|
103
100
|
});
|
|
104
101
|
}
|
|
@@ -3,35 +3,33 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getIndentationButtonsState = getIndentationButtonsState;
|
|
7
|
+
exports.pluginKey = void 0;
|
|
7
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
9
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
11
|
-
var _helpers = require("../../tasks-and-decisions/pm-plugins/helpers");
|
|
12
|
-
var _commands = require("../../indentation/commands");
|
|
13
10
|
var _lists = require("@atlaskit/editor-common/lists");
|
|
11
|
+
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
14
12
|
var pluginKey = exports.pluginKey = new _state.PluginKey('indentationButtonsPlugin');
|
|
15
|
-
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation,
|
|
13
|
+
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
|
|
14
|
+
var _indentationState$isI;
|
|
16
15
|
var state = {
|
|
17
16
|
indentDisabled: true,
|
|
18
17
|
outdentDisabled: true,
|
|
19
18
|
node: null
|
|
20
19
|
};
|
|
21
20
|
var selection = editorState.selection;
|
|
22
|
-
var node = selection.$from.node();
|
|
23
21
|
|
|
24
22
|
// Handle bullet and numbered lists seperately as they do
|
|
25
23
|
// not use the indentation mark.
|
|
26
24
|
// Check for lists before paragraphs and headings in case
|
|
27
25
|
// the selection is in a list nested in a layout column.
|
|
28
|
-
if (
|
|
26
|
+
if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
|
|
29
27
|
var _getListItemAttribute = (0, _lists.getListItemAttributes)(selection.$head),
|
|
30
28
|
indentLevel = _getListItemAttribute.indentLevel,
|
|
31
29
|
itemIndex = _getListItemAttribute.itemIndex;
|
|
32
30
|
return {
|
|
33
31
|
// List indent levels are zero indexed so we need to subtract 1
|
|
34
|
-
indentDisabled: itemIndex === 0 || indentLevel >=
|
|
32
|
+
indentDisabled: itemIndex === 0 || indentLevel >= _indentation.MAX_INDENTATION_LEVEL - 1,
|
|
35
33
|
outdentDisabled: false,
|
|
36
34
|
node: 'list'
|
|
37
35
|
};
|
|
@@ -39,12 +37,10 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
39
37
|
|
|
40
38
|
// Handle tasks seperately as they do not use the indentation mark
|
|
41
39
|
// and have different behaviour for outdent compared to lists
|
|
42
|
-
if (
|
|
43
|
-
var _indentLevel = (0, _helpers.getCurrentIndentLevel)(selection) || 0;
|
|
44
|
-
var _itemIndex = (0, _helpers.getTaskItemIndex)(editorState);
|
|
40
|
+
if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
|
|
45
41
|
return {
|
|
46
|
-
indentDisabled:
|
|
47
|
-
outdentDisabled:
|
|
42
|
+
indentDisabled: taskDecisionState.indentDisabled,
|
|
43
|
+
outdentDisabled: taskDecisionState.outdentDisabled,
|
|
48
44
|
node: 'taskList'
|
|
49
45
|
};
|
|
50
46
|
}
|
|
@@ -52,51 +48,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
52
48
|
var isInLayoutNode = (0, _utils.hasParentNodeOfType)(editorState.schema.nodes.layoutColumn)(selection) &&
|
|
53
49
|
// depth of non-nested paragraphs and headings in layouts will always be 3
|
|
54
50
|
selection.$from.depth === 3;
|
|
55
|
-
if (allowHeadingAndParagraphIndentation && (0
|
|
56
|
-
var indentationMark = node.marks.find(function (mark) {
|
|
57
|
-
return mark.type === editorState.schema.marks.indentation;
|
|
58
|
-
});
|
|
59
|
-
if (!indentationMark) {
|
|
60
|
-
return {
|
|
61
|
-
outdentDisabled: true,
|
|
62
|
-
indentDisabled: false,
|
|
63
|
-
node: 'paragraph_heading'
|
|
64
|
-
};
|
|
65
|
-
}
|
|
51
|
+
if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
|
|
66
52
|
return {
|
|
67
|
-
indentDisabled:
|
|
68
|
-
outdentDisabled:
|
|
53
|
+
indentDisabled: indentationState.indentDisabled,
|
|
54
|
+
outdentDisabled: indentationState.outdentDisabled,
|
|
69
55
|
node: 'paragraph_heading'
|
|
70
56
|
};
|
|
71
57
|
}
|
|
72
58
|
return state;
|
|
73
|
-
}
|
|
74
|
-
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
75
|
-
var dispatch = _ref.dispatch,
|
|
76
|
-
showIndentationButtons = _ref.showIndentationButtons,
|
|
77
|
-
allowHeadingAndParagraphIndentation = _ref.allowHeadingAndParagraphIndentation,
|
|
78
|
-
api = _ref.api;
|
|
79
|
-
return new _safePlugin.SafePlugin({
|
|
80
|
-
state: {
|
|
81
|
-
init: function init(_config, state) {
|
|
82
|
-
var initialState = {
|
|
83
|
-
indentDisabled: true,
|
|
84
|
-
outdentDisabled: true,
|
|
85
|
-
node: null
|
|
86
|
-
};
|
|
87
|
-
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
|
|
88
|
-
},
|
|
89
|
-
apply: function apply(_tr, pluginState, _oldState, newState) {
|
|
90
|
-
if (showIndentationButtons) {
|
|
91
|
-
var state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
|
|
92
|
-
if (!(0, _utils2.shallowEqual)(pluginState, state)) {
|
|
93
|
-
dispatch(pluginKey, state);
|
|
94
|
-
return state;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return pluginState;
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
key: pluginKey
|
|
101
|
-
});
|
|
102
|
-
};
|
|
59
|
+
}
|
|
@@ -15,7 +15,6 @@ var _outdent = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/outde
|
|
|
15
15
|
var _keymaps = require("../../../keymaps");
|
|
16
16
|
var _ToolbarButton = _interopRequireWildcard(require("../../../ui/ToolbarButton"));
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
|
-
var _messages2 = require("../../indentation/messages");
|
|
19
18
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
20
19
|
var _keymaps2 = require("@atlaskit/editor-common/keymaps");
|
|
21
20
|
var _react2 = require("react");
|
|
@@ -40,8 +39,8 @@ function Toolbar(props) {
|
|
|
40
39
|
onItemActivated = props.onItemActivated;
|
|
41
40
|
var labelUnorderedList = formatMessage(_messages.listMessages.unorderedList);
|
|
42
41
|
var labelOrderedList = formatMessage(_messages.listMessages.orderedList);
|
|
43
|
-
var indentMessage = formatMessage(
|
|
44
|
-
var outdentMessage = formatMessage(
|
|
42
|
+
var indentMessage = formatMessage(_messages.indentationMessages.indent);
|
|
43
|
+
var outdentMessage = formatMessage(_messages.indentationMessages.outdent);
|
|
45
44
|
var isIndentButtonFocused = document.activeElement === indentButtonRef.current;
|
|
46
45
|
var isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
|
|
47
46
|
var handleOnItemActivated = function handleOnItemActivated(buttonName) {
|
|
@@ -17,7 +17,6 @@ var _ToolbarButton = _interopRequireDefault(require("../../../ui/ToolbarButton")
|
|
|
17
17
|
var _styles = require("../../../ui/styles");
|
|
18
18
|
var _styles2 = require("@atlaskit/editor-common/styles");
|
|
19
19
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
|
-
var _messages2 = require("../../indentation/messages");
|
|
21
20
|
/** @jsx jsx */
|
|
22
21
|
|
|
23
22
|
function ToolbarDropdown(props) {
|
|
@@ -137,8 +136,8 @@ function useItems(props) {
|
|
|
137
136
|
}, (0, _keymaps.tooltip)(_keymaps.toggleOrderedList))
|
|
138
137
|
}];
|
|
139
138
|
if (props.showIndentationButtons) {
|
|
140
|
-
var labelIndent = formatMessage(
|
|
141
|
-
var labelOutdent = formatMessage(
|
|
139
|
+
var labelIndent = formatMessage(_messages.indentationMessages.indent);
|
|
140
|
+
var labelOutdent = formatMessage(_messages.indentationMessages.outdent);
|
|
142
141
|
items.push({
|
|
143
142
|
key: 'outdent',
|
|
144
143
|
content: labelOutdent,
|
|
@@ -24,6 +24,7 @@ function ToolbarListsIndentation(props) {
|
|
|
24
24
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
25
25
|
indentDisabled = props.indentDisabled,
|
|
26
26
|
outdentDisabled = props.outdentDisabled,
|
|
27
|
+
indentationStateNode = props.indentationStateNode,
|
|
27
28
|
featureFlags = props.featureFlags,
|
|
28
29
|
pluginInjectionApi = props.pluginInjectionApi;
|
|
29
30
|
if (isSmall) {
|
|
@@ -41,7 +42,7 @@ function ToolbarListsIndentation(props) {
|
|
|
41
42
|
indentDisabled: indentDisabled,
|
|
42
43
|
outdentDisabled: outdentDisabled,
|
|
43
44
|
disabled: disabled,
|
|
44
|
-
onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi),
|
|
45
|
+
onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode),
|
|
45
46
|
featureFlags: featureFlags
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -56,7 +57,7 @@ function ToolbarListsIndentation(props) {
|
|
|
56
57
|
indentDisabled: indentDisabled,
|
|
57
58
|
outdentDisabled: outdentDisabled,
|
|
58
59
|
disabled: disabled,
|
|
59
|
-
onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi),
|
|
60
|
+
onItemActivated: (0, _onItemActivated.onItemActivated)(pluginInjectionApi, indentationStateNode),
|
|
60
61
|
featureFlags: featureFlags
|
|
61
62
|
});
|
|
62
63
|
}
|
|
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.onItemActivated = void 0;
|
|
7
|
-
var _commands = require("../../indentation/commands");
|
|
8
7
|
var _keymaps = require("../../tasks-and-decisions/pm-plugins/keymaps");
|
|
9
8
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var
|
|
11
|
-
var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi) {
|
|
9
|
+
var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode) {
|
|
12
10
|
return function (_ref) {
|
|
13
11
|
var buttonName = _ref.buttonName,
|
|
14
12
|
editorView = _ref.editorView;
|
|
@@ -21,35 +19,33 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
21
19
|
break;
|
|
22
20
|
case 'indent':
|
|
23
21
|
{
|
|
24
|
-
var
|
|
25
|
-
var node = (_indentationButtonsPl = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
|
|
22
|
+
var node = indentationStateNode;
|
|
26
23
|
if (node === 'paragraph_heading') {
|
|
27
|
-
var _pluginInjectionApi$
|
|
28
|
-
|
|
24
|
+
var _pluginInjectionApi$i;
|
|
25
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i === void 0 || _pluginInjectionApi$i.actions.indentParagraphOrHeading(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
29
26
|
}
|
|
30
27
|
if (node === 'list') {
|
|
31
28
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
32
29
|
}
|
|
33
30
|
if (node === 'taskList') {
|
|
34
|
-
var _pluginInjectionApi$
|
|
35
|
-
(0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
31
|
+
var _pluginInjectionApi$a;
|
|
32
|
+
(0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
36
33
|
}
|
|
37
34
|
break;
|
|
38
35
|
}
|
|
39
36
|
case 'outdent':
|
|
40
37
|
{
|
|
41
|
-
var
|
|
42
|
-
var _node = (_indentationButtonsPl2 = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
|
|
38
|
+
var _node = indentationStateNode;
|
|
43
39
|
if (_node === 'paragraph_heading') {
|
|
44
|
-
var _pluginInjectionApi$
|
|
45
|
-
|
|
40
|
+
var _pluginInjectionApi$i2;
|
|
41
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i2 = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i2 === void 0 || _pluginInjectionApi$i2.actions.outdentParagraphOrHeading(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
46
42
|
}
|
|
47
43
|
if (_node === 'list') {
|
|
48
44
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
49
45
|
}
|
|
50
46
|
if (_node === 'taskList') {
|
|
51
|
-
var _pluginInjectionApi$
|
|
52
|
-
(0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
47
|
+
var _pluginInjectionApi$a2;
|
|
48
|
+
(0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
53
49
|
}
|
|
54
50
|
break;
|
|
55
51
|
}
|
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -37,14 +36,10 @@ var _WithPluginState = _interopRequireDefault(require("../WithPluginState"));
|
|
|
37
36
|
var _FormContent = _interopRequireDefault(require("./FormContent"));
|
|
38
37
|
var _messages = require("./messages");
|
|
39
38
|
var _FormErrorBoundary = require("./FormErrorBoundary");
|
|
40
|
-
var _excluded = ["page", "labels", "types", "name", "width"];
|
|
41
39
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
42
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
-
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; }
|
|
44
|
-
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; }
|
|
45
41
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
46
42
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
-
var LOGGED_MACRO_KEYS = ['children', 'recently-updated', 'excerpt'];
|
|
48
43
|
function ConfigForm(_ref) {
|
|
49
44
|
var canSave = _ref.canSave,
|
|
50
45
|
errorMessage = _ref.errorMessage,
|
|
@@ -342,50 +337,15 @@ var ConfigPanel = /*#__PURE__*/function (_React$Component) {
|
|
|
342
337
|
var _this$props4 = this.props,
|
|
343
338
|
createAnalyticsEvent = _this$props4.createAnalyticsEvent,
|
|
344
339
|
extensionManifest = _this$props4.extensionManifest;
|
|
345
|
-
var currentParameters = this.state.currentParameters;
|
|
346
|
-
|
|
347
|
-
// PGXT-4393 We need to collect configuration analytics for the macros in LOGGED_MACRO_KEYS.
|
|
348
|
-
// This function takes the parameters and filters out anything which might have UGC.
|
|
349
|
-
var getMacroParameters = function getMacroParameters() {
|
|
350
|
-
var page = currentParameters.page,
|
|
351
|
-
labels = currentParameters.labels,
|
|
352
|
-
types = currentParameters.types,
|
|
353
|
-
name = currentParameters.name,
|
|
354
|
-
width = currentParameters.width,
|
|
355
|
-
safeParams = (0, _objectWithoutProperties2.default)(currentParameters, _excluded);
|
|
356
|
-
var ugcFreeParams = _objectSpread({}, safeParams);
|
|
357
|
-
// Parse types field as an array of valid content types and include in the result
|
|
358
|
-
if (types) {
|
|
359
|
-
var contentTypes = ['page', 'blogpost', 'comment', 'attachment'];
|
|
360
|
-
var parsedTypes = types.split(',').map(function (type) {
|
|
361
|
-
return type.trim();
|
|
362
|
-
}).filter(function (type) {
|
|
363
|
-
return contentTypes.includes(type);
|
|
364
|
-
});
|
|
365
|
-
ugcFreeParams = _objectSpread({
|
|
366
|
-
types: parsedTypes
|
|
367
|
-
}, ugcFreeParams);
|
|
368
|
-
}
|
|
369
|
-
// Since width is a raw string input, parse then return
|
|
370
|
-
if (width) {
|
|
371
|
-
var parsedWidth = parseFloat(width);
|
|
372
|
-
ugcFreeParams = _objectSpread({
|
|
373
|
-
width: parsedWidth
|
|
374
|
-
}, ugcFreeParams);
|
|
375
|
-
}
|
|
376
|
-
return ugcFreeParams;
|
|
377
|
-
};
|
|
378
340
|
(0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)({
|
|
379
341
|
payload: {
|
|
380
342
|
action: _analytics.ACTION.CLOSED,
|
|
381
343
|
actionSubject: _analytics.ACTION_SUBJECT.CONFIG_PANEL,
|
|
382
344
|
eventType: _analytics.EVENT_TYPE.UI,
|
|
383
|
-
attributes:
|
|
345
|
+
attributes: {
|
|
384
346
|
extensionKey: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.key,
|
|
385
347
|
extensionType: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.type
|
|
386
|
-
}
|
|
387
|
-
parameters: getMacroParameters()
|
|
388
|
-
} : {})
|
|
348
|
+
}
|
|
389
349
|
}
|
|
390
350
|
});
|
|
391
351
|
}
|