@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
|
@@ -9,7 +9,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
|
9
9
|
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
10
10
|
import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
|
|
11
11
|
import Textfield from '@atlaskit/textfield';
|
|
12
|
-
import { countStyles, sectionWrapperStyles } from './styles';
|
|
12
|
+
import { countStyles, countWrapperStyles, sectionWrapperStyles } from './styles';
|
|
13
13
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
15
15
|
import rafSchd from 'raf-schd';
|
|
@@ -250,10 +250,13 @@ class Find extends React.Component {
|
|
|
250
250
|
onBlur: this.props.onFindBlur,
|
|
251
251
|
onCompositionStart: this.handleCompositionStart,
|
|
252
252
|
onCompositionEnd: this.handleCompositionEnd
|
|
253
|
-
}),
|
|
253
|
+
}), jsx("div", {
|
|
254
|
+
css: countWrapperStyles,
|
|
255
|
+
"aria-live": "polite"
|
|
256
|
+
}, findText && jsx("span", {
|
|
254
257
|
"data-testid": "textfield-count",
|
|
255
258
|
css: countStyles
|
|
256
|
-
}, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && jsx(FindReplaceTooltipButton, {
|
|
259
|
+
}, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
|
|
257
260
|
title: this.matchCase,
|
|
258
261
|
icon: this.matchCaseIcon,
|
|
259
262
|
onClick: this.handleMatchCaseClick,
|
|
@@ -3,13 +3,13 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import { N60, N30A } from '@atlaskit/theme/colors';
|
|
4
4
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
export const replaceSectionButtonStyles = css({
|
|
6
|
-
marginLeft:
|
|
6
|
+
marginLeft: "var(--ds-space-050, 4px)"
|
|
7
7
|
});
|
|
8
8
|
export const ruleStyles = css({
|
|
9
9
|
width: '100%',
|
|
10
10
|
border: 'none',
|
|
11
11
|
backgroundColor: `${`var(--ds-border, ${N30A})`}`,
|
|
12
|
-
margin:
|
|
12
|
+
margin: `${"var(--ds-space-050, 4px)"} 0px`,
|
|
13
13
|
height: '1px',
|
|
14
14
|
borderRadius: '1px'
|
|
15
15
|
});
|
|
@@ -17,7 +17,7 @@ export const wrapperStyles = css({
|
|
|
17
17
|
display: 'flex',
|
|
18
18
|
flexDirection: 'column',
|
|
19
19
|
'> *:not(#replace-hr-element)': {
|
|
20
|
-
margin:
|
|
20
|
+
margin: `0px ${"var(--ds-space-050, 4px)"}`
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
export const sectionWrapperStyles = css`
|
|
@@ -40,6 +40,9 @@ export const countStyles = css({
|
|
|
40
40
|
flex: '0 0 auto',
|
|
41
41
|
justifyContent: 'center',
|
|
42
42
|
alignItems: 'center',
|
|
43
|
-
marginLeft:
|
|
44
|
-
marginRight:
|
|
43
|
+
marginLeft: "var(--ds-space-050, 4px)",
|
|
44
|
+
marginRight: "var(--ds-space-100, 8px)"
|
|
45
|
+
});
|
|
46
|
+
export const countWrapperStyles = css({
|
|
47
|
+
alignItems: 'center'
|
|
45
48
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { toggleBlockMark } from '
|
|
1
|
+
import { toggleBlockMark } from '@atlaskit/editor-common/commands';
|
|
2
2
|
import { createAnalyticsDispatch } from './utils';
|
|
3
3
|
import { INDENT_DIRECTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import getAttrsWithChangesRecorder from '
|
|
5
|
-
|
|
4
|
+
import getAttrsWithChangesRecorder from '../getAttrsWithChangesRecorder';
|
|
5
|
+
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
6
6
|
export const isIndentationAllowed = (schema, node) => {
|
|
7
7
|
const {
|
|
8
8
|
nodes: {
|
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
import { indentation } from '@atlaskit/adf-schema';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
3
|
+
import { getOutdentCommand, getIndentCommand, isIndentationAllowed } from './commands';
|
|
4
|
+
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
3
5
|
const indentationPlugin = ({
|
|
4
6
|
api
|
|
5
|
-
}) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
}) => {
|
|
8
|
+
var _api$analytics, _api$analytics2;
|
|
9
|
+
return {
|
|
10
|
+
name: 'indentation',
|
|
11
|
+
marks() {
|
|
12
|
+
return [{
|
|
13
|
+
name: 'indentation',
|
|
14
|
+
mark: indentation
|
|
15
|
+
}];
|
|
16
|
+
},
|
|
17
|
+
actions: {
|
|
18
|
+
indentParagraphOrHeading: getIndentCommand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
19
|
+
outdentParagraphOrHeading: getOutdentCommand(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
20
|
+
},
|
|
21
|
+
getSharedState(editorState) {
|
|
22
|
+
var _ref;
|
|
23
|
+
if (!editorState) {
|
|
24
|
+
return undefined;
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
const {
|
|
27
|
+
tr: {
|
|
28
|
+
selection
|
|
29
|
+
},
|
|
30
|
+
schema: {
|
|
31
|
+
marks: {
|
|
32
|
+
indentation
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} = editorState;
|
|
36
|
+
const node = selection.$from.node();
|
|
37
|
+
const indentationMark = node.marks.find(mark => mark.type === indentation);
|
|
38
|
+
return {
|
|
39
|
+
isIndentationAllowed: isIndentationAllowed(editorState.schema, node),
|
|
40
|
+
indentDisabled: (_ref = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= MAX_INDENTATION_LEVEL) !== null && _ref !== void 0 ? _ref : false,
|
|
41
|
+
outdentDisabled: !indentationMark
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
pmPlugins() {
|
|
45
|
+
return [{
|
|
46
|
+
name: 'indentationKeymap',
|
|
47
|
+
plugin: () => {
|
|
48
|
+
var _api$analytics3;
|
|
49
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
50
|
+
}
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
23
55
|
export default indentationPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import { isTextSelection } from '
|
|
3
|
+
import { isTextSelection } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
export function keymapPlugin(editorAnalyticsAPI) {
|
|
@@ -11,6 +11,8 @@ import keymap from './pm-plugins/keymaps';
|
|
|
11
11
|
import { createPlugin } from './pm-plugins/main';
|
|
12
12
|
import ToolbarDecision from './ui/ToolbarDecision';
|
|
13
13
|
import ToolbarTask from './ui/ToolbarTask';
|
|
14
|
+
import { getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
15
|
+
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
14
16
|
const taskDecisionToolbarGroup = css`
|
|
15
17
|
display: flex;
|
|
16
18
|
`;
|
|
@@ -57,8 +59,13 @@ const tasksAndDecisionsPlugin = ({
|
|
|
57
59
|
return undefined;
|
|
58
60
|
}
|
|
59
61
|
const pluginState = taskPluginKey.getState(editorState);
|
|
62
|
+
const indentLevel = getCurrentIndentLevel(editorState.selection) || 0;
|
|
63
|
+
const itemIndex = getTaskItemIndex(editorState);
|
|
60
64
|
return {
|
|
61
|
-
focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null
|
|
65
|
+
focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
|
|
66
|
+
isInsideTask: isInsideTask(editorState),
|
|
67
|
+
indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
|
|
68
|
+
outdentDisabled: indentLevel <= 1
|
|
62
69
|
};
|
|
63
70
|
},
|
|
64
71
|
pmPlugins() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import ToolbarListsIndentation from './ui';
|
|
4
4
|
import { ToolbarSize } from '../../ui/Toolbar/types';
|
|
5
|
-
import {
|
|
5
|
+
import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
|
|
6
6
|
import { pluginKey as indentationButtonPluginKey } from './pm-plugins/indentation-buttons';
|
|
7
7
|
const toolbarListsIndentationPlugin = ({
|
|
8
8
|
config,
|
|
@@ -22,19 +22,6 @@ const toolbarListsIndentationPlugin = ({
|
|
|
22
22
|
}
|
|
23
23
|
return indentationButtonPluginKey.getState(editorState);
|
|
24
24
|
},
|
|
25
|
-
pmPlugins() {
|
|
26
|
-
return [{
|
|
27
|
-
name: 'indentationButtons',
|
|
28
|
-
plugin: ({
|
|
29
|
-
dispatch
|
|
30
|
-
}) => indentationButtonsPlugin({
|
|
31
|
-
dispatch,
|
|
32
|
-
showIndentationButtons,
|
|
33
|
-
allowHeadingAndParagraphIndentation,
|
|
34
|
-
api
|
|
35
|
-
})
|
|
36
|
-
}];
|
|
37
|
-
},
|
|
38
25
|
primaryToolbarComponent({
|
|
39
26
|
editorView,
|
|
40
27
|
popupsMountPoint,
|
|
@@ -55,12 +42,13 @@ const toolbarListsIndentationPlugin = ({
|
|
|
55
42
|
disabled: disabled,
|
|
56
43
|
editorView: editorView,
|
|
57
44
|
showIndentationButtons: showIndentationButtons,
|
|
58
|
-
pluginInjectionApi: api
|
|
45
|
+
pluginInjectionApi: api,
|
|
46
|
+
allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
|
|
59
47
|
});
|
|
60
48
|
}
|
|
61
49
|
};
|
|
62
50
|
};
|
|
63
|
-
function PrimaryToolbarComponent({
|
|
51
|
+
export function PrimaryToolbarComponent({
|
|
64
52
|
featureFlags,
|
|
65
53
|
popupsMountPoint,
|
|
66
54
|
popupsBoundariesElement,
|
|
@@ -70,12 +58,17 @@ function PrimaryToolbarComponent({
|
|
|
70
58
|
disabled,
|
|
71
59
|
editorView,
|
|
72
60
|
showIndentationButtons,
|
|
73
|
-
pluginInjectionApi
|
|
61
|
+
pluginInjectionApi,
|
|
62
|
+
allowHeadingAndParagraphIndentation
|
|
74
63
|
}) {
|
|
75
64
|
const {
|
|
76
65
|
listState,
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
indentationState,
|
|
67
|
+
taskDecisionState
|
|
68
|
+
} = useSharedPluginState(pluginInjectionApi, ['list', 'indentation', 'taskDecision']);
|
|
69
|
+
const toolbarListsIndentationState = useMemo(() => {
|
|
70
|
+
return getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
|
|
71
|
+
}, [editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem]);
|
|
79
72
|
if (!listState) {
|
|
80
73
|
return null;
|
|
81
74
|
}
|
|
@@ -95,6 +88,7 @@ function PrimaryToolbarComponent({
|
|
|
95
88
|
showIndentationButtons: !!showIndentationButtons,
|
|
96
89
|
indentDisabled: toolbarListsIndentationState.indentDisabled,
|
|
97
90
|
outdentDisabled: toolbarListsIndentationState.outdentDisabled,
|
|
91
|
+
indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
|
|
98
92
|
pluginInjectionApi: pluginInjectionApi
|
|
99
93
|
});
|
|
100
94
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import { shallowEqual } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
|
|
6
|
-
import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
|
|
7
3
|
import { getListItemAttributes } from '@atlaskit/editor-common/lists';
|
|
4
|
+
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
8
5
|
export const pluginKey = new PluginKey('indentationButtonsPlugin');
|
|
9
|
-
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation,
|
|
6
|
+
export function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
|
|
7
|
+
var _indentationState$isI;
|
|
10
8
|
const state = {
|
|
11
9
|
indentDisabled: true,
|
|
12
10
|
outdentDisabled: true,
|
|
@@ -15,13 +13,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
15
13
|
const {
|
|
16
14
|
selection
|
|
17
15
|
} = editorState;
|
|
18
|
-
const node = selection.$from.node();
|
|
19
16
|
|
|
20
17
|
// Handle bullet and numbered lists seperately as they do
|
|
21
18
|
// not use the indentation mark.
|
|
22
19
|
// Check for lists before paragraphs and headings in case
|
|
23
20
|
// the selection is in a list nested in a layout column.
|
|
24
|
-
if (
|
|
21
|
+
if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
|
|
25
22
|
const {
|
|
26
23
|
indentLevel,
|
|
27
24
|
itemIndex
|
|
@@ -36,12 +33,10 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
36
33
|
|
|
37
34
|
// Handle tasks seperately as they do not use the indentation mark
|
|
38
35
|
// and have different behaviour for outdent compared to lists
|
|
39
|
-
if (isInsideTask
|
|
40
|
-
const indentLevel = getTaskListIndentLevel(selection) || 0;
|
|
41
|
-
const itemIndex = getTaskItemIndex(editorState);
|
|
36
|
+
if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
|
|
42
37
|
return {
|
|
43
|
-
indentDisabled:
|
|
44
|
-
outdentDisabled:
|
|
38
|
+
indentDisabled: taskDecisionState.indentDisabled,
|
|
39
|
+
outdentDisabled: taskDecisionState.outdentDisabled,
|
|
45
40
|
node: 'taskList'
|
|
46
41
|
};
|
|
47
42
|
}
|
|
@@ -49,48 +44,12 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
49
44
|
const isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) &&
|
|
50
45
|
// depth of non-nested paragraphs and headings in layouts will always be 3
|
|
51
46
|
selection.$from.depth === 3;
|
|
52
|
-
if (allowHeadingAndParagraphIndentation &&
|
|
53
|
-
const indentationMark = node.marks.find(mark => mark.type === editorState.schema.marks.indentation);
|
|
54
|
-
if (!indentationMark) {
|
|
55
|
-
return {
|
|
56
|
-
outdentDisabled: true,
|
|
57
|
-
indentDisabled: false,
|
|
58
|
-
node: 'paragraph_heading'
|
|
59
|
-
};
|
|
60
|
-
}
|
|
47
|
+
if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
|
|
61
48
|
return {
|
|
62
|
-
indentDisabled:
|
|
63
|
-
outdentDisabled:
|
|
49
|
+
indentDisabled: indentationState.indentDisabled,
|
|
50
|
+
outdentDisabled: indentationState.outdentDisabled,
|
|
64
51
|
node: 'paragraph_heading'
|
|
65
52
|
};
|
|
66
53
|
}
|
|
67
54
|
return state;
|
|
68
|
-
}
|
|
69
|
-
export const createPlugin = ({
|
|
70
|
-
dispatch,
|
|
71
|
-
showIndentationButtons,
|
|
72
|
-
allowHeadingAndParagraphIndentation,
|
|
73
|
-
api
|
|
74
|
-
}) => new SafePlugin({
|
|
75
|
-
state: {
|
|
76
|
-
init(_config, state) {
|
|
77
|
-
const initialState = {
|
|
78
|
-
indentDisabled: true,
|
|
79
|
-
outdentDisabled: true,
|
|
80
|
-
node: null
|
|
81
|
-
};
|
|
82
|
-
return showIndentationButtons ? getIndentationButtonsState(state, allowHeadingAndParagraphIndentation, api) : initialState;
|
|
83
|
-
},
|
|
84
|
-
apply(_tr, pluginState, _oldState, newState) {
|
|
85
|
-
if (showIndentationButtons) {
|
|
86
|
-
const state = getIndentationButtonsState(newState, allowHeadingAndParagraphIndentation, api);
|
|
87
|
-
if (!shallowEqual(pluginState, state)) {
|
|
88
|
-
dispatch(pluginKey, state);
|
|
89
|
-
return state;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return pluginState;
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
key: pluginKey
|
|
96
|
-
});
|
|
55
|
+
}
|
|
@@ -7,8 +7,7 @@ import IndentIcon from '@atlaskit/icon/glyph/editor/indent';
|
|
|
7
7
|
import OutdentIcon from '@atlaskit/icon/glyph/editor/outdent';
|
|
8
8
|
import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, ToolTipContent, tooltip } from '../../../keymaps';
|
|
9
9
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../ui/ToolbarButton';
|
|
10
|
-
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import { messages as indentationMessages } from '../../indentation/messages';
|
|
10
|
+
import { listMessages as messages, indentationMessages } from '@atlaskit/editor-common/messages';
|
|
12
11
|
import { separatorStyles, buttonGroupStyle } from '@atlaskit/editor-common/styles';
|
|
13
12
|
import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
14
13
|
import { useEffect, useRef } from 'react';
|
|
@@ -10,8 +10,7 @@ import ToolbarButton from '../../../ui/ToolbarButton';
|
|
|
10
10
|
import { shortcutStyle } from '../../../ui/styles';
|
|
11
11
|
import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
|
|
13
|
-
import { listMessages } from '@atlaskit/editor-common/messages';
|
|
14
|
-
import { messages as indentationMessages } from '../../indentation/messages';
|
|
13
|
+
import { listMessages, indentationMessages } from '@atlaskit/editor-common/messages';
|
|
15
14
|
export function ToolbarDropdown(props) {
|
|
16
15
|
const {
|
|
17
16
|
formatMessage
|
|
@@ -18,6 +18,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
18
18
|
popupsScrollableElement,
|
|
19
19
|
indentDisabled,
|
|
20
20
|
outdentDisabled,
|
|
21
|
+
indentationStateNode,
|
|
21
22
|
featureFlags,
|
|
22
23
|
pluginInjectionApi
|
|
23
24
|
} = props;
|
|
@@ -36,7 +37,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
36
37
|
indentDisabled: indentDisabled,
|
|
37
38
|
outdentDisabled: outdentDisabled,
|
|
38
39
|
disabled: disabled,
|
|
39
|
-
onItemActivated: onItemActivated(pluginInjectionApi),
|
|
40
|
+
onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
|
|
40
41
|
featureFlags: featureFlags
|
|
41
42
|
});
|
|
42
43
|
}
|
|
@@ -51,7 +52,7 @@ export default function ToolbarListsIndentation(props) {
|
|
|
51
52
|
indentDisabled: indentDisabled,
|
|
52
53
|
outdentDisabled: outdentDisabled,
|
|
53
54
|
disabled: disabled,
|
|
54
|
-
onItemActivated: onItemActivated(pluginInjectionApi),
|
|
55
|
+
onItemActivated: onItemActivated(pluginInjectionApi, indentationStateNode),
|
|
55
56
|
featureFlags: featureFlags
|
|
56
57
|
});
|
|
57
58
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { getIndentCommand as indentParagraphOrHeading, getOutdentCommand as outdentParagraphOrHeading } from '../../indentation/commands';
|
|
2
1
|
import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
|
|
3
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
|
|
5
|
-
export const onItemActivated = pluginInjectionApi => ({
|
|
3
|
+
export const onItemActivated = (pluginInjectionApi, indentationStateNode) => ({
|
|
6
4
|
buttonName,
|
|
7
5
|
editorView
|
|
8
6
|
}) => {
|
|
@@ -15,35 +13,33 @@ export const onItemActivated = pluginInjectionApi => ({
|
|
|
15
13
|
break;
|
|
16
14
|
case 'indent':
|
|
17
15
|
{
|
|
18
|
-
|
|
19
|
-
const node = (_indentationButtonsPl = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
|
|
16
|
+
const node = indentationStateNode;
|
|
20
17
|
if (node === 'paragraph_heading') {
|
|
21
|
-
var _pluginInjectionApi$
|
|
22
|
-
|
|
18
|
+
var _pluginInjectionApi$i;
|
|
19
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.indentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
23
20
|
}
|
|
24
21
|
if (node === 'list') {
|
|
25
22
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
|
|
26
23
|
}
|
|
27
24
|
if (node === 'taskList') {
|
|
28
|
-
var _pluginInjectionApi$
|
|
29
|
-
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
25
|
+
var _pluginInjectionApi$a;
|
|
26
|
+
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
30
27
|
}
|
|
31
28
|
break;
|
|
32
29
|
}
|
|
33
30
|
case 'outdent':
|
|
34
31
|
{
|
|
35
|
-
|
|
36
|
-
const node = (_indentationButtonsPl2 = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
|
|
32
|
+
const node = indentationStateNode;
|
|
37
33
|
if (node === 'paragraph_heading') {
|
|
38
|
-
var _pluginInjectionApi$
|
|
39
|
-
|
|
34
|
+
var _pluginInjectionApi$i2;
|
|
35
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i2 = pluginInjectionApi.indentation) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.actions.outdentParagraphOrHeading(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
40
36
|
}
|
|
41
37
|
if (node === 'list') {
|
|
42
38
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
|
|
43
39
|
}
|
|
44
40
|
if (node === 'taskList') {
|
|
45
|
-
var _pluginInjectionApi$
|
|
46
|
-
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
41
|
+
var _pluginInjectionApi$a2;
|
|
42
|
+
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
47
43
|
}
|
|
48
44
|
break;
|
|
49
45
|
}
|
|
@@ -21,7 +21,6 @@ import WithPluginState from '../WithPluginState';
|
|
|
21
21
|
import FormContent from './FormContent';
|
|
22
22
|
import { messages } from './messages';
|
|
23
23
|
import { FormErrorBoundary } from './FormErrorBoundary';
|
|
24
|
-
const LOGGED_MACRO_KEYS = ['children', 'recently-updated', 'excerpt'];
|
|
25
24
|
function ConfigForm({
|
|
26
25
|
canSave,
|
|
27
26
|
errorMessage,
|
|
@@ -279,43 +278,6 @@ class ConfigPanel extends React.Component {
|
|
|
279
278
|
createAnalyticsEvent,
|
|
280
279
|
extensionManifest
|
|
281
280
|
} = this.props;
|
|
282
|
-
const {
|
|
283
|
-
currentParameters
|
|
284
|
-
} = this.state;
|
|
285
|
-
|
|
286
|
-
// PGXT-4393 We need to collect configuration analytics for the macros in LOGGED_MACRO_KEYS.
|
|
287
|
-
// This function takes the parameters and filters out anything which might have UGC.
|
|
288
|
-
const getMacroParameters = () => {
|
|
289
|
-
const {
|
|
290
|
-
page,
|
|
291
|
-
labels,
|
|
292
|
-
types,
|
|
293
|
-
name,
|
|
294
|
-
width,
|
|
295
|
-
...safeParams
|
|
296
|
-
} = currentParameters;
|
|
297
|
-
let ugcFreeParams = {
|
|
298
|
-
...safeParams
|
|
299
|
-
};
|
|
300
|
-
// Parse types field as an array of valid content types and include in the result
|
|
301
|
-
if (types) {
|
|
302
|
-
const contentTypes = ['page', 'blogpost', 'comment', 'attachment'];
|
|
303
|
-
const parsedTypes = types.split(',').map(type => type.trim()).filter(type => contentTypes.includes(type));
|
|
304
|
-
ugcFreeParams = {
|
|
305
|
-
types: parsedTypes,
|
|
306
|
-
...ugcFreeParams
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
// Since width is a raw string input, parse then return
|
|
310
|
-
if (width) {
|
|
311
|
-
const parsedWidth = parseFloat(width);
|
|
312
|
-
ugcFreeParams = {
|
|
313
|
-
width: parsedWidth,
|
|
314
|
-
...ugcFreeParams
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
return ugcFreeParams;
|
|
318
|
-
};
|
|
319
281
|
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
320
282
|
payload: {
|
|
321
283
|
action: ACTION.CLOSED,
|
|
@@ -323,10 +285,7 @@ class ConfigPanel extends React.Component {
|
|
|
323
285
|
eventType: EVENT_TYPE.UI,
|
|
324
286
|
attributes: {
|
|
325
287
|
extensionKey: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.key,
|
|
326
|
-
extensionType: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.type
|
|
327
|
-
...(extensionManifest !== null && extensionManifest !== void 0 && extensionManifest.key && LOGGED_MACRO_KEYS.includes(extensionManifest.key) ? {
|
|
328
|
-
parameters: getMacroParameters()
|
|
329
|
-
} : {})
|
|
288
|
+
extensionType: extensionManifest === null || extensionManifest === void 0 ? void 0 : extensionManifest.type
|
|
330
289
|
}
|
|
331
290
|
}
|
|
332
291
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "189.3.
|
|
2
|
+
export const version = "189.3.24";
|
|
@@ -17,7 +17,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
|
17
17
|
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
18
18
|
import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
|
|
19
19
|
import Textfield from '@atlaskit/textfield';
|
|
20
|
-
import { countStyles, sectionWrapperStyles } from './styles';
|
|
20
|
+
import { countStyles, countWrapperStyles, sectionWrapperStyles } from './styles';
|
|
21
21
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
22
22
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
23
23
|
import rafSchd from 'raf-schd';
|
|
@@ -266,10 +266,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
266
266
|
onBlur: this.props.onFindBlur,
|
|
267
267
|
onCompositionStart: this.handleCompositionStart,
|
|
268
268
|
onCompositionEnd: this.handleCompositionEnd
|
|
269
|
-
}),
|
|
269
|
+
}), jsx("div", {
|
|
270
|
+
css: countWrapperStyles,
|
|
271
|
+
"aria-live": "polite"
|
|
272
|
+
}, findText && jsx("span", {
|
|
270
273
|
"data-testid": "textfield-count",
|
|
271
274
|
css: countStyles
|
|
272
|
-
}, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && jsx(FindReplaceTooltipButton, {
|
|
275
|
+
}, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
|
|
273
276
|
title: this.matchCase,
|
|
274
277
|
icon: this.matchCaseIcon,
|
|
275
278
|
onClick: this.handleMatchCaseClick,
|
|
@@ -5,13 +5,13 @@ import { css } from '@emotion/react';
|
|
|
5
5
|
import { N60, N30A } from '@atlaskit/theme/colors';
|
|
6
6
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
export var replaceSectionButtonStyles = css({
|
|
8
|
-
marginLeft:
|
|
8
|
+
marginLeft: "var(--ds-space-050, 4px)"
|
|
9
9
|
});
|
|
10
10
|
export var ruleStyles = css({
|
|
11
11
|
width: '100%',
|
|
12
12
|
border: 'none',
|
|
13
13
|
backgroundColor: "".concat("var(--ds-border, ".concat(N30A, ")")),
|
|
14
|
-
margin:
|
|
14
|
+
margin: "var(--ds-space-050, 4px)".concat(" 0px"),
|
|
15
15
|
height: '1px',
|
|
16
16
|
borderRadius: '1px'
|
|
17
17
|
});
|
|
@@ -19,7 +19,7 @@ export var wrapperStyles = css({
|
|
|
19
19
|
display: 'flex',
|
|
20
20
|
flexDirection: 'column',
|
|
21
21
|
'> *:not(#replace-hr-element)': {
|
|
22
|
-
margin:
|
|
22
|
+
margin: "0px ".concat("var(--ds-space-050, 4px)")
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
export var sectionWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
@@ -29,6 +29,9 @@ export var countStyles = css({
|
|
|
29
29
|
flex: '0 0 auto',
|
|
30
30
|
justifyContent: 'center',
|
|
31
31
|
alignItems: 'center',
|
|
32
|
-
marginLeft:
|
|
33
|
-
marginRight:
|
|
32
|
+
marginLeft: "var(--ds-space-050, 4px)",
|
|
33
|
+
marginRight: "var(--ds-space-100, 8px)"
|
|
34
|
+
});
|
|
35
|
+
export var countWrapperStyles = css({
|
|
36
|
+
alignItems: 'center'
|
|
34
37
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { toggleBlockMark } from '
|
|
1
|
+
import { toggleBlockMark } from '@atlaskit/editor-common/commands';
|
|
2
2
|
import { createAnalyticsDispatch } from './utils';
|
|
3
3
|
import { INDENT_DIRECTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import getAttrsWithChangesRecorder from '
|
|
5
|
-
|
|
4
|
+
import getAttrsWithChangesRecorder from '../getAttrsWithChangesRecorder';
|
|
5
|
+
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
6
6
|
export var isIndentationAllowed = function isIndentationAllowed(schema, node) {
|
|
7
7
|
var _schema$nodes = schema.nodes,
|
|
8
8
|
paragraph = _schema$nodes.paragraph,
|