@atlaskit/editor-core 187.8.7 → 187.8.11
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/index.js +0 -6
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
- package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/list/actions/conversions.js +5 -5
- package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
- package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
- package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
- package/dist/cjs/plugins/list/commands/index.js +8 -10
- package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
- package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
- package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
- package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
- package/dist/cjs/plugins/list/utils/analytics.js +1 -35
- package/dist/cjs/plugins/list/utils/indentation.js +2 -20
- package/dist/cjs/plugins/list/utils/node.js +2 -106
- package/dist/cjs/plugins/list/utils/selection.js +3 -54
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
- package/dist/cjs/plugins/text-formatting/index.js +23 -21
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/cjs/utils/commands.js +3 -109
- package/dist/cjs/utils/document.js +1 -26
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/actions/conversions.js +2 -2
- package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
- package/dist/es2019/plugins/list/commands/index.js +4 -5
- package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
- package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +0 -36
- package/dist/es2019/plugins/list/utils/indentation.js +0 -18
- package/dist/es2019/plugins/list/utils/node.js +3 -89
- package/dist/es2019/plugins/list/utils/selection.js +1 -52
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-formatting/index.js +15 -10
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/es2019/utils/commands.js +2 -102
- package/dist/es2019/utils/document.js +1 -26
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/actions/conversions.js +2 -2
- package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/esm/plugins/list/commands/indent-list.js +3 -4
- package/dist/esm/plugins/list/commands/index.js +4 -5
- package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
- package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +0 -32
- package/dist/esm/plugins/list/utils/indentation.js +0 -17
- package/dist/esm/plugins/list/utils/node.js +3 -81
- package/dist/esm/plugins/list/utils/selection.js +3 -51
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-formatting/index.js +23 -21
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/esm/utils/commands.js +2 -100
- package/dist/esm/utils/document.js +1 -26
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types/plugins/list/commands/index.d.ts +2 -1
- package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types/plugins/list/utils/node.d.ts +2 -17
- package/dist/types/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
- package/dist/types/utils/commands.d.ts +3 -32
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
- package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
- package/dist/types-ts4.5/utils/commands.d.ts +3 -38
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +0 -3
- package/tmp/api-report-tmp.d.ts +0 -3
- package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
- package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
- package/dist/esm/plugins/list/utils/replace-content.js +0 -17
- package/dist/esm/utils/prosemirror/autojoin.js +0 -63
- package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
- package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
|
@@ -46,15 +46,20 @@ const textFormatting = (options = {}, api) => ({
|
|
|
46
46
|
plugin: () => textFormattingCursorPlugin
|
|
47
47
|
}, {
|
|
48
48
|
name: 'textFormattingInputRule',
|
|
49
|
+
// Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
|
|
49
50
|
plugin: ({
|
|
50
51
|
schema,
|
|
51
52
|
featureFlags
|
|
52
|
-
}) =>
|
|
53
|
+
}) => {
|
|
54
|
+
var _api$dependencies$ana2;
|
|
55
|
+
return textFormattingInputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
56
|
+
}
|
|
53
57
|
}, {
|
|
54
58
|
name: 'textFormattingSmartRule',
|
|
55
|
-
plugin: ({
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
plugin: () => {
|
|
60
|
+
var _api$dependencies$ana3;
|
|
61
|
+
return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions) : undefined;
|
|
62
|
+
}
|
|
58
63
|
}, {
|
|
59
64
|
name: 'textFormattingClear',
|
|
60
65
|
plugin: ({
|
|
@@ -63,16 +68,16 @@ const textFormatting = (options = {}, api) => ({
|
|
|
63
68
|
}, {
|
|
64
69
|
name: 'textFormattingClearKeymap',
|
|
65
70
|
plugin: () => {
|
|
66
|
-
var _api$dependencies$
|
|
67
|
-
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
71
|
+
var _api$dependencies$ana4;
|
|
72
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
|
|
68
73
|
}
|
|
69
74
|
}, {
|
|
70
75
|
name: 'textFormattingKeymap',
|
|
71
76
|
plugin: ({
|
|
72
77
|
schema
|
|
73
78
|
}) => {
|
|
74
|
-
var _api$dependencies$
|
|
75
|
-
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
79
|
+
var _api$dependencies$ana5;
|
|
80
|
+
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
|
|
76
81
|
}
|
|
77
82
|
}];
|
|
78
83
|
},
|
|
@@ -90,7 +95,7 @@ const textFormatting = (options = {}, api) => ({
|
|
|
90
95
|
clearFormattingPluginState: clearFormattingPluginKey
|
|
91
96
|
},
|
|
92
97
|
render: () => {
|
|
93
|
-
var _api$dependencies$
|
|
98
|
+
var _api$dependencies$ana6;
|
|
94
99
|
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
95
100
|
editorState: editorView.state,
|
|
96
101
|
popupsMountPoint: popupsMountPoint,
|
|
@@ -100,7 +105,7 @@ const textFormatting = (options = {}, api) => ({
|
|
|
100
105
|
editorView: editorView,
|
|
101
106
|
isToolbarDisabled: disabled,
|
|
102
107
|
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
103
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$
|
|
108
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
|
|
104
109
|
});
|
|
105
110
|
}
|
|
106
111
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ruleWithAnalytics } from '../../../utils/input-rules';
|
|
2
1
|
import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
3
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import { transformSmartCharsMentionsAndEmojis } from '@atlaskit/editor-common/mark';
|
|
4
|
+
import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
|
5
5
|
var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
|
|
6
6
|
ValidAutoformatChars["STRONG"] = "__";
|
|
7
7
|
ValidAutoformatChars["STRIKE"] = "~~";
|
|
@@ -144,8 +144,8 @@ export const codeRegex = buildRegex(ValidAutoformatChars.CODE);
|
|
|
144
144
|
* @param {Schema} schema
|
|
145
145
|
* @returns {InputRuleWrapper[]}
|
|
146
146
|
*/
|
|
147
|
-
function getStrongInputRules(schema) {
|
|
148
|
-
const ruleWithStrongAnalytics =
|
|
147
|
+
function getStrongInputRules(schema, editorAnalyticsAPI) {
|
|
148
|
+
const ruleWithStrongAnalytics = inputRuleWithAnalytics({
|
|
149
149
|
action: ACTION.FORMATTED,
|
|
150
150
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
151
151
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
|
|
@@ -153,7 +153,7 @@ function getStrongInputRules(schema) {
|
|
|
153
153
|
attributes: {
|
|
154
154
|
inputMethod: INPUT_METHOD.FORMATTING
|
|
155
155
|
}
|
|
156
|
-
})
|
|
156
|
+
}, editorAnalyticsAPI);
|
|
157
157
|
// **string** or __strong__ should bold the text
|
|
158
158
|
const doubleUnderscoreRule = createRule(strongRegex1, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG));
|
|
159
159
|
const doubleAsterixRule = createRule(strongRegex2, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG_MARKDOWN));
|
|
@@ -166,8 +166,8 @@ function getStrongInputRules(schema) {
|
|
|
166
166
|
* @param {Schema} schema
|
|
167
167
|
* @returns {InputRuleWrapper[]}
|
|
168
168
|
*/
|
|
169
|
-
function getItalicInputRules(schema) {
|
|
170
|
-
const ruleWithItalicAnalytics =
|
|
169
|
+
function getItalicInputRules(schema, editorAnalyticsAPI) {
|
|
170
|
+
const ruleWithItalicAnalytics = inputRuleWithAnalytics({
|
|
171
171
|
action: ACTION.FORMATTED,
|
|
172
172
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
173
173
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
|
|
@@ -175,7 +175,7 @@ function getItalicInputRules(schema) {
|
|
|
175
175
|
attributes: {
|
|
176
176
|
inputMethod: INPUT_METHOD.FORMATTING
|
|
177
177
|
}
|
|
178
|
-
})
|
|
178
|
+
}, editorAnalyticsAPI);
|
|
179
179
|
const underscoreRule = createRule(italicRegex1, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC));
|
|
180
180
|
const asterixRule = createRule(italicRegex2, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC_MARKDOWN));
|
|
181
181
|
return [ruleWithItalicAnalytics(underscoreRule), ruleWithItalicAnalytics(asterixRule)];
|
|
@@ -187,8 +187,8 @@ function getItalicInputRules(schema) {
|
|
|
187
187
|
* @param {Schema} schema
|
|
188
188
|
* @returns {InputRuleWrapper[]}
|
|
189
189
|
*/
|
|
190
|
-
function getStrikeInputRules(schema) {
|
|
191
|
-
const ruleWithStrikeAnalytics =
|
|
190
|
+
function getStrikeInputRules(schema, editorAnalyticsAPI) {
|
|
191
|
+
const ruleWithStrikeAnalytics = inputRuleWithAnalytics({
|
|
192
192
|
action: ACTION.FORMATTED,
|
|
193
193
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
194
194
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
|
|
@@ -196,7 +196,7 @@ function getStrikeInputRules(schema) {
|
|
|
196
196
|
attributes: {
|
|
197
197
|
inputMethod: INPUT_METHOD.FORMATTING
|
|
198
198
|
}
|
|
199
|
-
})
|
|
199
|
+
}, editorAnalyticsAPI);
|
|
200
200
|
const doubleTildeRule = createRule(strikeRegex, addMark(schema.marks.strike, schema, ValidAutoformatChars.STRIKE));
|
|
201
201
|
return [ruleWithStrikeAnalytics(doubleTildeRule)];
|
|
202
202
|
}
|
|
@@ -207,8 +207,8 @@ function getStrikeInputRules(schema) {
|
|
|
207
207
|
* @param {Schema} schema
|
|
208
208
|
* @returns {InputRuleWrapper[]}
|
|
209
209
|
*/
|
|
210
|
-
function getCodeInputRules(schema) {
|
|
211
|
-
const ruleWithCodeAnalytics =
|
|
210
|
+
function getCodeInputRules(schema, editorAnalyticsAPI) {
|
|
211
|
+
const ruleWithCodeAnalytics = inputRuleWithAnalytics({
|
|
212
212
|
action: ACTION.FORMATTED,
|
|
213
213
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
214
214
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
|
|
@@ -216,23 +216,25 @@ function getCodeInputRules(schema) {
|
|
|
216
216
|
attributes: {
|
|
217
217
|
inputMethod: INPUT_METHOD.FORMATTING
|
|
218
218
|
}
|
|
219
|
-
})
|
|
219
|
+
}, editorAnalyticsAPI);
|
|
220
220
|
const backTickRule = createRule(codeRegex, addMark(schema.marks.code, schema, ValidAutoformatChars.CODE));
|
|
221
221
|
return [ruleWithCodeAnalytics(backTickRule)];
|
|
222
222
|
}
|
|
223
|
-
export function inputRulePlugin(schema,
|
|
223
|
+
export function inputRulePlugin(schema,
|
|
224
|
+
// Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
|
|
225
|
+
_featureFlags, editorAnalyticsAPI) {
|
|
224
226
|
const rules = [];
|
|
225
227
|
if (schema.marks.strong) {
|
|
226
|
-
rules.push(...getStrongInputRules(schema));
|
|
228
|
+
rules.push(...getStrongInputRules(schema, editorAnalyticsAPI));
|
|
227
229
|
}
|
|
228
230
|
if (schema.marks.em) {
|
|
229
|
-
rules.push(...getItalicInputRules(schema));
|
|
231
|
+
rules.push(...getItalicInputRules(schema, editorAnalyticsAPI));
|
|
230
232
|
}
|
|
231
233
|
if (schema.marks.strike) {
|
|
232
|
-
rules.push(...getStrikeInputRules(schema));
|
|
234
|
+
rules.push(...getStrikeInputRules(schema, editorAnalyticsAPI));
|
|
233
235
|
}
|
|
234
236
|
if (schema.marks.code) {
|
|
235
|
-
rules.push(...getCodeInputRules(schema));
|
|
237
|
+
rules.push(...getCodeInputRules(schema, editorAnalyticsAPI));
|
|
236
238
|
}
|
|
237
239
|
if (rules.length !== 0) {
|
|
238
240
|
return createPlugin('text-formatting', rules);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { ruleWithAnalytics } from '../../../utils/input-rules';
|
|
3
2
|
import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
4
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, PUNC, SYMBOL } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates an InputRuleHandler that will match on a regular expression of the
|
|
@@ -77,8 +77,8 @@ function createSingleQuotesRules() {
|
|
|
77
77
|
/**
|
|
78
78
|
* Get replacement rules related to product
|
|
79
79
|
*/
|
|
80
|
-
function getProductRules() {
|
|
81
|
-
const productRuleWithAnalytics = product =>
|
|
80
|
+
function getProductRules(editorAnalyticsAPI) {
|
|
81
|
+
const productRuleWithAnalytics = product => inputRuleWithAnalytics((_, match) => ({
|
|
82
82
|
action: ACTION.SUBSTITUTED,
|
|
83
83
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
84
84
|
actionSubjectId: ACTION_SUBJECT_ID.PRODUCT_NAME,
|
|
@@ -87,7 +87,7 @@ function getProductRules() {
|
|
|
87
87
|
product,
|
|
88
88
|
originalSpelling: match[2]
|
|
89
89
|
}
|
|
90
|
-
}));
|
|
90
|
+
}), editorAnalyticsAPI);
|
|
91
91
|
return createReplacementRules({
|
|
92
92
|
Atlassian: /(\s+|^)(atlassian)(\s)$/,
|
|
93
93
|
Jira: /(\s+|^)(jira|JIRA)(\s)$/,
|
|
@@ -100,13 +100,13 @@ function getProductRules() {
|
|
|
100
100
|
/**
|
|
101
101
|
* Get replacement rules related to symbol
|
|
102
102
|
*/
|
|
103
|
-
function getSymbolRules() {
|
|
103
|
+
function getSymbolRules(editorAnalyticsAPI) {
|
|
104
104
|
const symbolToString = {
|
|
105
105
|
'→': SYMBOL.ARROW_RIGHT,
|
|
106
106
|
'←': SYMBOL.ARROW_LEFT,
|
|
107
107
|
'↔︎': SYMBOL.ARROW_DOUBLE
|
|
108
108
|
};
|
|
109
|
-
const symbolRuleWithAnalytics = symbol =>
|
|
109
|
+
const symbolRuleWithAnalytics = symbol => inputRuleWithAnalytics({
|
|
110
110
|
action: ACTION.SUBSTITUTED,
|
|
111
111
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
112
112
|
actionSubjectId: ACTION_SUBJECT_ID.SYMBOL,
|
|
@@ -114,7 +114,7 @@ function getSymbolRules() {
|
|
|
114
114
|
attributes: {
|
|
115
115
|
symbol: symbolToString[symbol]
|
|
116
116
|
}
|
|
117
|
-
})
|
|
117
|
+
}, editorAnalyticsAPI);
|
|
118
118
|
return createReplacementRules({
|
|
119
119
|
'→': /(\s+|^)(--?>)(\s)$/,
|
|
120
120
|
'←': /(\s+|^)(<--?)(\s)$/,
|
|
@@ -125,15 +125,14 @@ function getSymbolRules() {
|
|
|
125
125
|
/**
|
|
126
126
|
* Get replacement rules related to punctuation
|
|
127
127
|
*/
|
|
128
|
-
function getPunctuationRules() {
|
|
128
|
+
function getPunctuationRules(editorAnalyticsAPI) {
|
|
129
129
|
const punctuationToString = {
|
|
130
130
|
'–': PUNC.DASH,
|
|
131
131
|
'…': PUNC.ELLIPSIS,
|
|
132
|
-
'“': PUNC.QUOTE_DOUBLE,
|
|
133
132
|
'”': PUNC.QUOTE_DOUBLE,
|
|
134
133
|
[PUNC.QUOTE_SINGLE]: PUNC.QUOTE_SINGLE
|
|
135
134
|
};
|
|
136
|
-
const punctuationRuleWithAnalytics = punctuation =>
|
|
135
|
+
const punctuationRuleWithAnalytics = punctuation => inputRuleWithAnalytics({
|
|
137
136
|
action: ACTION.SUBSTITUTED,
|
|
138
137
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
139
138
|
actionSubjectId: ACTION_SUBJECT_ID.PUNC,
|
|
@@ -141,7 +140,7 @@ function getPunctuationRules() {
|
|
|
141
140
|
attributes: {
|
|
142
141
|
punctuation: punctuationToString[punctuation]
|
|
143
142
|
}
|
|
144
|
-
})
|
|
143
|
+
}, editorAnalyticsAPI);
|
|
145
144
|
const dashEllipsisRules = createReplacementRules({
|
|
146
145
|
'–': /(\s+|^)(--)(\s)$/,
|
|
147
146
|
'…': /()(\.\.\.)$/
|
|
@@ -153,4 +152,4 @@ function getPunctuationRules() {
|
|
|
153
152
|
const singleQuoteRules = createSingleQuotesRules();
|
|
154
153
|
return [...dashEllipsisRules, ...doubleQuoteRules, ...singleQuoteRules.map(rule => punctuationRuleWithAnalytics(PUNC.QUOTE_SINGLE)(rule))];
|
|
155
154
|
}
|
|
156
|
-
export default (
|
|
155
|
+
export default (editorAnalyticsAPI => createPlugin('text-formatting:smart-input', [...getProductRules(editorAnalyticsAPI), ...getSymbolRules(editorAnalyticsAPI), ...getPunctuationRules(editorAnalyticsAPI)]));
|
|
@@ -2,9 +2,10 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { shallowEqual } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { isInsideListItem } from '../../list/utils/selection';
|
|
6
6
|
import { getCurrentIndentLevel as getTaskListIndentLevel, getTaskItemIndex, isInsideTask } from '../../tasks-and-decisions/pm-plugins/helpers';
|
|
7
7
|
import { isIndentationAllowed, MAX_INDENTATION_LEVEL } from '../../indentation/commands';
|
|
8
|
+
import { getListItemAttributes } from '@atlaskit/editor-common/lists';
|
|
8
9
|
export const pluginKey = new PluginKey('indentationButtonsPlugin');
|
|
9
10
|
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
10
11
|
const state = {
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
4
|
-
const isEmptySelectionAtStart = state => {
|
|
5
|
-
const {
|
|
6
|
-
empty,
|
|
7
|
-
$from
|
|
8
|
-
} = state.selection;
|
|
9
|
-
return empty && ($from.parentOffset === 0 || state.selection instanceof GapCursorSelection);
|
|
10
|
-
};
|
|
11
|
-
const isEmptySelectionAtEnd = state => {
|
|
12
|
-
const {
|
|
13
|
-
empty,
|
|
14
|
-
$from
|
|
15
|
-
} = state.selection;
|
|
16
|
-
return empty && ($from.end() === $from.pos || state.selection instanceof GapCursorSelection);
|
|
17
|
-
};
|
|
18
3
|
const isFirstChildOfParent = state => {
|
|
19
4
|
const {
|
|
20
5
|
$from
|
|
@@ -69,44 +54,6 @@ const withScrollIntoView = command => (state, dispatch, view) => command(state,
|
|
|
69
54
|
dispatch(tr);
|
|
70
55
|
}
|
|
71
56
|
}, view);
|
|
72
|
-
/**
|
|
73
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
74
|
-
* the next node, or reach the end of the document.
|
|
75
|
-
*
|
|
76
|
-
* @param $startPos Position to start walking from.
|
|
77
|
-
*/
|
|
78
|
-
const walkNextNode = $startPos => {
|
|
79
|
-
let $pos = $startPos;
|
|
80
|
-
|
|
81
|
-
// invariant 1: don't walk past the end of the document
|
|
82
|
-
// invariant 2: we are at the beginning or
|
|
83
|
-
// we haven't walked to the start of *any* node
|
|
84
|
-
// parentOffset includes textOffset.
|
|
85
|
-
while ($pos.pos < $pos.doc.nodeSize - 2 && ($pos.pos === $startPos.pos || $pos.parentOffset > 0)) {
|
|
86
|
-
$pos = $pos.doc.resolve($pos.pos + 1);
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
$pos: $pos,
|
|
90
|
-
foundNode: $pos.pos < $pos.doc.nodeSize - 2
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
96
|
-
* the previous node, or reach the start of the document.
|
|
97
|
-
*
|
|
98
|
-
* @param $startPos Position to start walking from.
|
|
99
|
-
*/
|
|
100
|
-
const walkPrevNode = $startPos => {
|
|
101
|
-
let $pos = $startPos;
|
|
102
|
-
while ($pos.pos > 0 && ($pos.pos === $startPos.pos || $pos.parentOffset < $pos.parent.nodeSize - 2)) {
|
|
103
|
-
$pos = $pos.doc.resolve($pos.pos - 1);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
$pos: $pos,
|
|
107
|
-
foundNode: $pos.pos > 0
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
57
|
|
|
111
58
|
/**
|
|
112
59
|
* Insert content, delete a range and create a new selection
|
|
@@ -118,57 +65,10 @@ const walkPrevNode = $startPos => {
|
|
|
118
65
|
* @param deletions the ranges to delete
|
|
119
66
|
*/
|
|
120
67
|
|
|
121
|
-
const insertContentDeleteRange = (tr, getSelectionResolvedPos, insertions, deletions) => {
|
|
122
|
-
insertions.forEach(contentInsert => {
|
|
123
|
-
let [content, pos] = contentInsert;
|
|
124
|
-
tr.insert(tr.mapping.map(pos), content);
|
|
125
|
-
});
|
|
126
|
-
deletions.forEach(deleteRange => {
|
|
127
|
-
let [firstPos, lastPos] = deleteRange;
|
|
128
|
-
tr.delete(tr.mapping.map(firstPos), tr.mapping.map(lastPos));
|
|
129
|
-
});
|
|
130
|
-
tr.setSelection(new TextSelection(getSelectionResolvedPos(tr)));
|
|
131
|
-
};
|
|
132
68
|
const selectNode = pos => (state, dispatch) => {
|
|
133
69
|
if (dispatch) {
|
|
134
70
|
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
135
71
|
}
|
|
136
72
|
return true;
|
|
137
73
|
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
141
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
142
|
-
*
|
|
143
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
144
|
-
* @returns PM Command
|
|
145
|
-
*/
|
|
146
|
-
const deleteEmptyParagraphAndMoveBlockUp = canNextNodeMoveUp => {
|
|
147
|
-
return (state, dispatch, view) => {
|
|
148
|
-
const {
|
|
149
|
-
selection: {
|
|
150
|
-
$from: {
|
|
151
|
-
pos,
|
|
152
|
-
parent
|
|
153
|
-
},
|
|
154
|
-
$head,
|
|
155
|
-
empty
|
|
156
|
-
},
|
|
157
|
-
tr,
|
|
158
|
-
doc
|
|
159
|
-
} = state;
|
|
160
|
-
const {
|
|
161
|
-
$pos
|
|
162
|
-
} = walkNextNode($head);
|
|
163
|
-
const nextPMNode = doc.nodeAt($pos.pos - 1);
|
|
164
|
-
if (empty && nextPMNode && canNextNodeMoveUp(nextPMNode) && isEmptyParagraph(parent) && view !== null && view !== void 0 && view.endOfTextblock('right')) {
|
|
165
|
-
tr.deleteRange(pos - 1, pos + 1);
|
|
166
|
-
if (dispatch) {
|
|
167
|
-
dispatch(tr);
|
|
168
|
-
}
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
export { isEmptySelectionAtStart, isEmptySelectionAtEnd, isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, walkNextNode, walkPrevNode, insertContentDeleteRange, selectNode, deleteEmptyParagraphAndMoveBlockUp };
|
|
74
|
+
export { isFirstChildOfParent, isNthParentOfType, findCutBefore, withScrollIntoView, selectNode };
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
2
|
import { getBreakoutMode } from './node-width';
|
|
4
|
-
import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
8
|
-
*/
|
|
9
|
-
export function hasVisibleContent(node) {
|
|
10
|
-
const isInlineNodeHasVisibleContent = inlineNode => {
|
|
11
|
-
return inlineNode.isText ? !!inlineNode.textContent.trim() : inlineNode.type.name !== 'hardBreak';
|
|
12
|
-
};
|
|
13
|
-
if (node.isInline) {
|
|
14
|
-
return isInlineNodeHasVisibleContent(node);
|
|
15
|
-
} else if (node.isBlock && (node.isLeaf || node.isAtom)) {
|
|
16
|
-
return true;
|
|
17
|
-
} else if (!node.childCount) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
for (let index = 0; index < node.childCount; index++) {
|
|
21
|
-
const child = node.child(index);
|
|
22
|
-
const invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
23
|
-
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
3
|
+
import { processRawValue, hasDocAsParent, getStepRange, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
29
4
|
|
|
30
5
|
/**
|
|
31
6
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
|
|
|
7
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
8
|
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
-
export {
|
|
10
|
+
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
11
|
export { sanitiseMarksInSelection } from './mark';
|
|
12
12
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
13
|
export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } f
|
|
|
42
42
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
43
43
|
|
|
44
44
|
// Used in editor-test-helpers and mobile bridge
|
|
45
|
-
export { setTextSelection, dedupe, getNodesCount, measurements
|
|
45
|
+
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
46
46
|
export { getListCommands } from './utils/list-commands';
|
|
47
47
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
48
48
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import {
|
|
4
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { isSelectionEndOfParagraph } from '../../../utils';
|
|
6
6
|
export var newlinePreserveMarksKey = new PluginKey('newlinePreserveMarksPlugin');
|
|
7
7
|
var isSelectionAligned = function isSelectionAligned(state) {
|
|
@@ -5,7 +5,7 @@ import * as commands from '../../../commands';
|
|
|
5
5
|
import * as blockTypes from '../types';
|
|
6
6
|
import { keymap } from '../../../utils/keymap';
|
|
7
7
|
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockTypesWithAnalytics } from '../commands';
|
|
8
|
-
import { deleteEmptyParagraphAndMoveBlockUp } from '
|
|
8
|
+
import { deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { INPUT_METHOD } from '../../analytics';
|
|
10
10
|
import { isNodeAWrappingBlockNode } from '../utils';
|
|
11
11
|
var backspace = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
|
@@ -3,7 +3,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { getCursor } from '../../../utils';
|
|
6
|
-
import {
|
|
6
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isCursorBeforeClosingCharacter, isClosingCharacter } from '../ide-ux/paired-character-handling';
|
|
8
8
|
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bracket-handling';
|
|
9
9
|
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
|
|
@@ -6,7 +6,7 @@ import { TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
8
8
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { createSelectionClickHandler } from '../../selection/utils';
|
|
11
11
|
import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from '../actions';
|
|
12
12
|
import { pluginKey } from './plugin-key';
|
|
@@ -2,8 +2,8 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isEmptyParagraph, isListNode } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { joinSiblingLists } from '@atlaskit/editor-common/lists';
|
|
7
7
|
import { findFirstParentListNode } from '../utils/find';
|
|
8
8
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
9
9
|
export function convertListType(_ref) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import {
|
|
4
|
+
import { normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
5
5
|
import { findFirstParentListItemNode } from '../utils/find';
|
|
6
|
-
import {
|
|
6
|
+
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
8
8
|
export var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
9
9
|
var originalSelection = tr.selection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LIST_TEXT_SCENARIOS } from '../../analytics';
|
|
2
|
-
import { isParagraphNode, isListNode, isListItemNode } from '
|
|
2
|
+
import { isParagraphNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
4
4
|
import { joinParagrapWithList, joinSiblingListItems, joinNestedListWithParentListItem, joinListItemWithParentNestedList, joinListItemWithParagraph } from './join-list-items-scenarios';
|
|
5
5
|
export var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange, isListNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { isListNode } from '../../utils/node';
|
|
4
3
|
// Case for when a users selection is at the end of a paragraph, the paragraph
|
|
5
4
|
// is followed by a list, and they delete forward
|
|
6
5
|
export var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of greater indentation
|
|
4
4
|
export var joinListItemWithParentNestedList = function joinListItemWithParentNestedList(_ref) {
|
|
5
5
|
var tr = _ref.tr,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of lower indentation
|
|
4
4
|
export var joinNestedListWithParentListItem = function joinNestedListWithParentListItem(_ref) {
|
|
5
5
|
var tr = _ref.tr,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
2
|
//Case for two adjacent nodes with the first being a list item and the last being a paragraph
|
|
3
3
|
export var joinParagrapWithList = function joinParagrapWithList(_ref) {
|
|
4
4
|
var tr = _ref.tr,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
2
|
//Case for two adjacent list items of the same indentation
|
|
3
3
|
export var joinSiblingListItems = function joinSiblingListItems(_ref) {
|
|
4
4
|
var tr = _ref.tr,
|
|
@@ -4,10 +4,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { NodeRange, Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { liftTarget, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
7
|
-
import { getOrderFromOrderedListNode } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import {
|
|
7
|
+
import { getOrderFromOrderedListNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
8
|
+
import { joinSiblingLists, JoinDirection, normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
9
9
|
import { findFirstParentListItemNode, findRootParentListNode } from '../utils/find';
|
|
10
|
-
import {
|
|
10
|
+
import { createListNodeRange } from '../utils/selection';
|
|
11
11
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
12
12
|
import { storeRestartListsAttributes, getRestartListsAttributes } from '../utils/analytics';
|
|
13
13
|
import { OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, Slice, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { ReplaceAroundStep, findWrapping, canSplit } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import { autoJoinTr } from '
|
|
3
|
+
import { autoJoinTr } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
5
5
|
import { isWrappingPossible } from '../utils/selection';
|
|
6
6
|
|
|
@@ -2,13 +2,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { hasValidListIndentationLevel } from '
|
|
5
|
+
import { hasValidListIndentationLevel, getListItemAttributes, getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
6
6
|
import { indentListItemsSelected as indentListAction } from '../actions/indent-list-items-selected';
|
|
7
|
-
import { isBulletList } from '
|
|
7
|
+
import { isBulletList } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { findFirstParentListNode } from '../utils/find';
|
|
9
9
|
import { MAX_NESTED_LIST_INDENTATION } from '../types';
|
|
10
|
-
import { isInsideListItem, isInsideTableCell
|
|
11
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
10
|
+
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
12
11
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
13
12
|
export var indentList = function indentList(editorAnalyticsAPI) {
|
|
14
13
|
return function () {
|