@atlaskit/editor-core 187.28.0 → 187.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/cjs/create-editor/create-plugins-list.js +2 -2
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/base/index.js +7 -126
- package/dist/cjs/plugins/base/plugin.js +140 -0
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +3 -9
- package/dist/cjs/plugins/index.js +2 -2
- package/dist/cjs/plugins/list/index.js +17 -0
- package/dist/cjs/plugins/list/utils/find.js +4 -3
- package/dist/cjs/plugins/paste/handlers.js +27 -3
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +58 -36
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +8 -9
- package/dist/cjs/test-utils.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +19 -18
- package/dist/cjs/ui/ToolbarFeedback/index.js +22 -16
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/es2019/create-editor/create-plugins-list.js +1 -1
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/base/index.js +2 -104
- package/dist/es2019/plugins/base/plugin.js +109 -0
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -4
- package/dist/es2019/plugins/index.js +1 -1
- package/dist/es2019/plugins/list/index.js +19 -0
- package/dist/es2019/plugins/list/utils/find.js +2 -2
- package/dist/es2019/plugins/paste/handlers.js +27 -3
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +62 -38
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +5 -6
- package/dist/es2019/test-utils.js +1 -1
- package/dist/es2019/ui/ContentStyles/index.js +25 -3
- package/dist/es2019/ui/ToolbarFeedback/index.js +14 -9
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/esm/create-editor/create-plugins-list.js +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/base/index.js +2 -123
- package/dist/esm/plugins/base/plugin.js +128 -0
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -4
- package/dist/esm/plugins/index.js +1 -1
- package/dist/esm/plugins/list/index.js +19 -0
- package/dist/esm/plugins/list/utils/find.js +2 -2
- package/dist/esm/plugins/paste/handlers.js +25 -3
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +60 -37
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +6 -6
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +3 -3
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +5 -6
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +6 -5
- package/dist/esm/ui/ToolbarFeedback/index.js +20 -14
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/base/index.d.ts +4 -16
- package/dist/types/plugins/base/plugin.d.ts +23 -0
- package/dist/types/plugins/base/pm-plugins/scroll-gutter.d.ts +0 -3
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/list/types.d.ts +1 -8
- package/dist/types/plugins/list/utils/find.d.ts +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +4 -2
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -2
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +4 -1
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +3 -3
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -2
- package/dist/types/ui/ToolbarFeedback/index.d.ts +1 -19
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/base/index.d.ts +4 -18
- package/dist/types-ts4.5/plugins/base/plugin.d.ts +25 -0
- package/dist/types-ts4.5/plugins/base/pm-plugins/scroll-gutter.d.ts +0 -3
- package/dist/types-ts4.5/plugins/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/types.d.ts +1 -8
- package/dist/types-ts4.5/plugins/list/utils/find.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +4 -2
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +5 -2
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +4 -1
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +3 -3
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +3 -2
- package/dist/types-ts4.5/ui/ToolbarFeedback/index.d.ts +1 -19
- package/package.json +2 -2
- package/report.api.md +4 -58
- package/tmp/api-report-tmp.d.ts +4 -47
- package/dist/cjs/plugins/list/styles.js +0 -15
- package/dist/cjs/utils/list-commands.js +0 -17
- package/dist/cjs/utils/lists.js +0 -31
- package/dist/es2019/plugins/list/styles.js +0 -26
- package/dist/es2019/utils/list-commands.js +0 -11
- package/dist/es2019/utils/lists.js +0 -26
- package/dist/esm/plugins/list/styles.js +0 -7
- package/dist/esm/utils/list-commands.js +0 -11
- package/dist/esm/utils/lists.js +0 -24
- package/dist/types/plugins/list/styles.d.ts +0 -1
- package/dist/types/utils/list-commands.d.ts +0 -6
- package/dist/types/utils/lists.d.ts +0 -2
- package/dist/types-ts4.5/plugins/list/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/list-commands.d.ts +0 -6
- package/dist/types-ts4.5/utils/lists.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.28.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`79c0b7e6821`](https://bitbucket.org/atlassian/atlassian-frontend/commits/79c0b7e6821) - Decouple `base` plugin from `editor-core`
|
|
8
|
+
- [`5d6ec9ac49c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5d6ec9ac49c) - ED-19330 Decouple list plugin from editor-core
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 187.28.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -38,7 +38,6 @@ var _getParticipantsCount = require("../plugins/collab-edit/get-participants-cou
|
|
|
38
38
|
var _trackTransactions = require("../utils/performance/track-transactions");
|
|
39
39
|
var _countNodes2 = require("../utils/count-nodes");
|
|
40
40
|
var _consts = require("./consts");
|
|
41
|
-
var _contextIdentifier = require("../plugins/base/pm-plugins/context-identifier");
|
|
42
41
|
var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
|
|
43
42
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
44
43
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
@@ -402,9 +401,10 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
402
401
|
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && (0, _utils.shouldForceTracking)();
|
|
403
402
|
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? (0, _utils.getAnalyticsEventSeverity)(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : _consts.PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : _consts.PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
404
403
|
if (_this.view) {
|
|
405
|
-
var
|
|
404
|
+
var _this$pluginInjection, _this$experienceStore10;
|
|
406
405
|
var nodes = (0, _document.getNodesCount)(_this.view.state.doc);
|
|
407
406
|
var ttfb = (0, _utils.getResponseEndTime)();
|
|
407
|
+
var contextIdentifier = (_this$pluginInjection = _this.pluginInjectionAPI.api().dependencies.base) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.sharedState.currentState();
|
|
408
408
|
_this.dispatchAnalyticsEvent({
|
|
409
409
|
action: _analytics.ACTION.PROSEMIRROR_RENDERED,
|
|
410
410
|
actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
|
|
@@ -414,7 +414,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
414
414
|
nodes: nodes,
|
|
415
415
|
ttfb: ttfb,
|
|
416
416
|
severity: _this.proseMirrorRenderedSeverity,
|
|
417
|
-
objectId:
|
|
417
|
+
objectId: contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId,
|
|
418
418
|
distortedDuration: distortedDuration
|
|
419
419
|
},
|
|
420
420
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
@@ -10,7 +10,7 @@ exports.getDefaultPresetOptionsFromEditorProps = getDefaultPresetOptionsFromEdit
|
|
|
10
10
|
exports.getScrollGutterOptions = getScrollGutterOptions;
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _universal = _interopRequireDefault(require("../labs/next/presets/universal"));
|
|
13
|
-
var
|
|
13
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
14
|
var _isFullPage = require("../utils/is-full-page");
|
|
15
15
|
var _featureFlagsFromProps = require("./feature-flags-from-props");
|
|
16
16
|
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; }
|
|
@@ -38,7 +38,7 @@ function getScrollGutterOptions(props) {
|
|
|
38
38
|
},
|
|
39
39
|
allowCustomScrollHandler: false,
|
|
40
40
|
persistScrollGutter: persistScrollGutter,
|
|
41
|
-
gutterSize:
|
|
41
|
+
gutterSize: _utils.GUTTER_SIZE_MOBILE_IN_PX
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
return undefined;
|
package/dist/cjs/index.js
CHANGED
|
@@ -269,12 +269,6 @@ Object.defineProperty(exports, "getDefaultPresetOptionsFromEditorProps", {
|
|
|
269
269
|
return _createEditor.getDefaultPresetOptionsFromEditorProps;
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
|
-
Object.defineProperty(exports, "getListCommands", {
|
|
273
|
-
enumerable: true,
|
|
274
|
-
get: function get() {
|
|
275
|
-
return _listCommands.getListCommands;
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
272
|
Object.defineProperty(exports, "getNodesCount", {
|
|
279
273
|
enumerable: true,
|
|
280
274
|
get: function get() {
|
|
@@ -542,7 +536,6 @@ var _history = require("./plugins/history");
|
|
|
542
536
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
543
537
|
var _commands6 = require("./plugins/mobile-dimensions/commands");
|
|
544
538
|
var _utils = require("./utils");
|
|
545
|
-
var _listCommands = require("./utils/list-commands");
|
|
546
539
|
var _createEditor = require("./create-editor");
|
|
547
540
|
var _actions3 = _interopRequireDefault(require("./actions"));
|
|
548
541
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
@@ -13,7 +13,7 @@ var _editorPluginHyperlink = require("@atlaskit/editor-plugin-hyperlink");
|
|
|
13
13
|
var _editorPluginTextFormatting = require("@atlaskit/editor-plugin-text-formatting");
|
|
14
14
|
var _editorPluginWidth = require("@atlaskit/editor-plugin-width");
|
|
15
15
|
var _unsupportedContent = _interopRequireDefault(require("../../../plugins/unsupported-content"));
|
|
16
|
-
var _base =
|
|
16
|
+
var _base = require("../../../plugins/base");
|
|
17
17
|
var _editorPluginFocus = require("@atlaskit/editor-plugin-focus");
|
|
18
18
|
var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
|
|
19
19
|
var _typeAhead = _interopRequireDefault(require("../../../plugins/type-ahead"));
|
|
@@ -62,7 +62,7 @@ function createDefaultPreset(options) {
|
|
|
62
62
|
}]);
|
|
63
63
|
}
|
|
64
64
|
return builder;
|
|
65
|
-
}).add([_paste.default, options.paste]).add(_clipboard.default).add(_editorPluginFocus.focusPlugin).add(_editorPluginComposition.compositionPlugin).add([_base.
|
|
65
|
+
}).add([_paste.default, options.paste]).add(_clipboard.default).add(_editorPluginFocus.focusPlugin).add(_editorPluginComposition.compositionPlugin).add([_base.basePlugin, options.base]).add(_editorPluginDecorations.decorationsPlugin).maybeAdd(_undoRedo.default, function (p, builder) {
|
|
66
66
|
var _options$featureFlags;
|
|
67
67
|
// The undo redo plugin needs to be add before the blockTypePlugin
|
|
68
68
|
if ((_options$featureFlags = options.featureFlags) !== null && _options$featureFlags !== void 0 && _options$featureFlags.undoRedoButtons) {
|
|
@@ -4,129 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
var _filterSteps = _interopRequireDefault(require("./pm-plugins/filter-steps"));
|
|
15
|
-
var _fixChrome88Selection = _interopRequireDefault(require("./pm-plugins/fix-chrome-88-selection"));
|
|
16
|
-
var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
|
|
17
|
-
var _contextIdentifier = _interopRequireDefault(require("./pm-plugins/context-identifier"));
|
|
18
|
-
var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
|
|
19
|
-
var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cursor-target"));
|
|
20
|
-
var _scrollGutter = _interopRequireDefault(require("./pm-plugins/scroll-gutter"));
|
|
21
|
-
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
22
|
-
var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
|
|
23
|
-
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; }
|
|
24
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
25
|
-
// Chrome >= 88
|
|
26
|
-
var isChromeWithSelectionBug = _utils.browser.chrome && _utils.browser.chrome_version >= 88;
|
|
27
|
-
exports.isChromeWithSelectionBug = isChromeWithSelectionBug;
|
|
28
|
-
var basePlugin = function basePlugin(options, api) {
|
|
29
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
30
|
-
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
31
|
-
return {
|
|
32
|
-
name: 'base',
|
|
33
|
-
pmPlugins: function pmPlugins() {
|
|
34
|
-
var plugins = [{
|
|
35
|
-
name: 'filterStepsPlugin',
|
|
36
|
-
plugin: function plugin(_ref) {
|
|
37
|
-
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
38
|
-
return (0, _filterSteps.default)(dispatchAnalyticsEvent);
|
|
39
|
-
}
|
|
40
|
-
}];
|
|
41
|
-
|
|
42
|
-
// In Chrome, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
43
|
-
// the cursor appears at the right most point of the parent container.
|
|
44
|
-
// In Firefox, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
45
|
-
// no cursor is presented to users.
|
|
46
|
-
// In Safari, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
47
|
-
// it is not possible to navigate with arrow keys.
|
|
48
|
-
// This plugin works around the issues by inserting decorations between
|
|
49
|
-
// inline nodes which are set as contenteditable, and have a zero width space.
|
|
50
|
-
plugins.push({
|
|
51
|
-
name: 'inlineCursorTargetPlugin',
|
|
52
|
-
plugin: function plugin() {
|
|
53
|
-
return options && options.allowInlineCursorTarget ? (0, _inlineCursorTarget.default)() : undefined;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
plugins.push({
|
|
57
|
-
name: 'newlinePreserveMarksPlugin',
|
|
58
|
-
plugin: _newlinePreserveMarks.default
|
|
59
|
-
}, {
|
|
60
|
-
name: 'frozenEditor',
|
|
61
|
-
plugin: function plugin(_ref2) {
|
|
62
|
-
var _options$inputTrackin;
|
|
63
|
-
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
|
|
64
|
-
return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? (0, _frozenEditor.default)(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
name: 'history',
|
|
68
|
-
plugin: function plugin() {
|
|
69
|
-
return (0, _history.history)();
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
// should be last :(
|
|
73
|
-
{
|
|
74
|
-
name: 'codeBlockIndent',
|
|
75
|
-
plugin: function plugin() {
|
|
76
|
-
return (0, _keymaps.keymap)(_objectSpread(_objectSpread({}, _commands.baseKeymap), {}, {
|
|
77
|
-
'Mod-[': function Mod() {
|
|
78
|
-
return true;
|
|
79
|
-
},
|
|
80
|
-
'Mod-]': function Mod() {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
name: 'contextIdentifier',
|
|
87
|
-
plugin: function plugin(_ref3) {
|
|
88
|
-
var dispatch = _ref3.dispatch,
|
|
89
|
-
providerFactory = _ref3.providerFactory;
|
|
90
|
-
return (0, _contextIdentifier.default)(dispatch, providerFactory);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (options && options.allowScrollGutter) {
|
|
94
|
-
plugins.push({
|
|
95
|
-
name: 'scrollGutterPlugin',
|
|
96
|
-
plugin: function plugin() {
|
|
97
|
-
return (0, _scrollGutter.default)(options.allowScrollGutter);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (isChromeWithSelectionBug && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
102
|
-
plugins.push({
|
|
103
|
-
name: 'fixChrome88SelectionPlugin',
|
|
104
|
-
plugin: function plugin() {
|
|
105
|
-
return (0, _fixChrome88Selection.default)();
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
plugins.push({
|
|
110
|
-
name: 'disableSpellcheckingPlugin',
|
|
111
|
-
plugin: function plugin() {
|
|
112
|
-
return (0, _disableSpellChecking.default)(featureFlags);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return plugins;
|
|
116
|
-
},
|
|
117
|
-
nodes: function nodes() {
|
|
118
|
-
return [{
|
|
119
|
-
name: 'doc',
|
|
120
|
-
node: _adfSchema.doc
|
|
121
|
-
}, {
|
|
122
|
-
name: 'paragraph',
|
|
123
|
-
node: _adfSchema.paragraph
|
|
124
|
-
}, {
|
|
125
|
-
name: 'text',
|
|
126
|
-
node: _adfSchema.text
|
|
127
|
-
}];
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
var _default = basePlugin;
|
|
132
|
-
exports.default = _default;
|
|
7
|
+
Object.defineProperty(exports, "basePlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _plugin.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.isChromeWithSelectionBug = exports.default = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
11
|
+
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
15
|
+
var _filterSteps = _interopRequireDefault(require("./pm-plugins/filter-steps"));
|
|
16
|
+
var _fixChrome88Selection = _interopRequireDefault(require("./pm-plugins/fix-chrome-88-selection"));
|
|
17
|
+
var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
|
|
18
|
+
var _contextIdentifier = _interopRequireWildcard(require("./pm-plugins/context-identifier"));
|
|
19
|
+
var _newlinePreserveMarks = _interopRequireDefault(require("./pm-plugins/newline-preserve-marks"));
|
|
20
|
+
var _inlineCursorTarget = _interopRequireDefault(require("./pm-plugins/inline-cursor-target"));
|
|
21
|
+
var _scrollGutter = _interopRequireDefault(require("./pm-plugins/scroll-gutter"));
|
|
22
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
23
|
+
var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
|
|
24
|
+
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); }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
28
|
+
// Chrome >= 88
|
|
29
|
+
var isChromeWithSelectionBug = _utils.browser.chrome && _utils.browser.chrome_version >= 88;
|
|
30
|
+
exports.isChromeWithSelectionBug = isChromeWithSelectionBug;
|
|
31
|
+
var basePlugin = function basePlugin(options, api) {
|
|
32
|
+
var _api$dependencies, _api$dependencies$fea;
|
|
33
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
34
|
+
return {
|
|
35
|
+
name: 'base',
|
|
36
|
+
getSharedState: function getSharedState(editorState) {
|
|
37
|
+
return {
|
|
38
|
+
contextIdentifier: (0, _contextIdentifier.getContextIdentifier)(editorState)
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
pmPlugins: function pmPlugins() {
|
|
42
|
+
var plugins = [{
|
|
43
|
+
name: 'filterStepsPlugin',
|
|
44
|
+
plugin: function plugin(_ref) {
|
|
45
|
+
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
|
|
46
|
+
return (0, _filterSteps.default)(dispatchAnalyticsEvent);
|
|
47
|
+
}
|
|
48
|
+
}];
|
|
49
|
+
|
|
50
|
+
// In Chrome, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
51
|
+
// the cursor appears at the right most point of the parent container.
|
|
52
|
+
// In Firefox, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
53
|
+
// no cursor is presented to users.
|
|
54
|
+
// In Safari, when the selection is placed between adjacent nodes which are not contenteditatble
|
|
55
|
+
// it is not possible to navigate with arrow keys.
|
|
56
|
+
// This plugin works around the issues by inserting decorations between
|
|
57
|
+
// inline nodes which are set as contenteditable, and have a zero width space.
|
|
58
|
+
plugins.push({
|
|
59
|
+
name: 'inlineCursorTargetPlugin',
|
|
60
|
+
plugin: function plugin() {
|
|
61
|
+
return options && options.allowInlineCursorTarget ? (0, _inlineCursorTarget.default)() : undefined;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
plugins.push({
|
|
65
|
+
name: 'newlinePreserveMarksPlugin',
|
|
66
|
+
plugin: _newlinePreserveMarks.default
|
|
67
|
+
}, {
|
|
68
|
+
name: 'frozenEditor',
|
|
69
|
+
plugin: function plugin(_ref2) {
|
|
70
|
+
var _options$inputTrackin;
|
|
71
|
+
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
|
|
72
|
+
return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? (0, _frozenEditor.default)(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
name: 'history',
|
|
76
|
+
plugin: function plugin() {
|
|
77
|
+
return (0, _history.history)();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// should be last :(
|
|
81
|
+
{
|
|
82
|
+
name: 'codeBlockIndent',
|
|
83
|
+
plugin: function plugin() {
|
|
84
|
+
return (0, _keymaps.keymap)(_objectSpread(_objectSpread({}, _commands.baseKeymap), {}, {
|
|
85
|
+
'Mod-[': function Mod() {
|
|
86
|
+
return true;
|
|
87
|
+
},
|
|
88
|
+
'Mod-]': function Mod() {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
name: 'contextIdentifier',
|
|
95
|
+
plugin: function plugin(_ref3) {
|
|
96
|
+
var dispatch = _ref3.dispatch,
|
|
97
|
+
providerFactory = _ref3.providerFactory;
|
|
98
|
+
return (0, _contextIdentifier.default)(dispatch, providerFactory);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
if (options && options.allowScrollGutter) {
|
|
102
|
+
plugins.push({
|
|
103
|
+
name: 'scrollGutterPlugin',
|
|
104
|
+
plugin: function plugin() {
|
|
105
|
+
return (0, _scrollGutter.default)(options.allowScrollGutter);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (isChromeWithSelectionBug && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.disable-chrome-88-selection-fix_uk53m')) {
|
|
110
|
+
plugins.push({
|
|
111
|
+
name: 'fixChrome88SelectionPlugin',
|
|
112
|
+
plugin: function plugin() {
|
|
113
|
+
return (0, _fixChrome88Selection.default)();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
plugins.push({
|
|
118
|
+
name: 'disableSpellcheckingPlugin',
|
|
119
|
+
plugin: function plugin() {
|
|
120
|
+
return (0, _disableSpellChecking.default)(featureFlags);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return plugins;
|
|
124
|
+
},
|
|
125
|
+
nodes: function nodes() {
|
|
126
|
+
return [{
|
|
127
|
+
name: 'doc',
|
|
128
|
+
node: _adfSchema.doc
|
|
129
|
+
}, {
|
|
130
|
+
name: 'paragraph',
|
|
131
|
+
node: _adfSchema.paragraph
|
|
132
|
+
}, {
|
|
133
|
+
name: 'text',
|
|
134
|
+
node: _adfSchema.text
|
|
135
|
+
}];
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
var _default = basePlugin;
|
|
140
|
+
exports.default = _default;
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _utils2 = require("../../mobile-dimensions/utils");
|
|
10
|
-
var GUTTER_SIZE_IN_PX = 120; // Default gutter size
|
|
11
|
-
exports.GUTTER_SIZE_IN_PX = GUTTER_SIZE_IN_PX;
|
|
12
|
-
var GUTTER_SIZE_MOBILE_IN_PX = 36; // Gutter size for Mobile
|
|
13
|
-
exports.GUTTER_SIZE_MOBILE_IN_PX = GUTTER_SIZE_MOBILE_IN_PX;
|
|
14
|
-
var GUTTER_SELECTOR = '#editor-scroll-gutter';
|
|
15
|
-
exports.GUTTER_SELECTOR = GUTTER_SELECTOR;
|
|
16
10
|
var MIN_TAP_SIZE_IN_PX = 40;
|
|
17
11
|
function supportsIntersectionObserver() {
|
|
18
12
|
if (typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {
|
|
@@ -42,7 +36,7 @@ function listenForGutterVisibilityChanges(scrollElement, gutterIsVisible) {
|
|
|
42
36
|
function createGutter(gutterSize) {
|
|
43
37
|
var gutter = document.createElement('div');
|
|
44
38
|
gutter.style.paddingBottom = "".concat(gutterSize, "px");
|
|
45
|
-
gutter.id = GUTTER_SELECTOR.substr(1);
|
|
39
|
+
gutter.id = _utils.GUTTER_SELECTOR.substr(1);
|
|
46
40
|
var initialized = false;
|
|
47
41
|
var mounted = false;
|
|
48
42
|
var currentParent = null;
|
|
@@ -149,7 +143,7 @@ var _default = function _default() {
|
|
|
149
143
|
var getScrollElement = pluginOptions.getScrollElement,
|
|
150
144
|
allowCustomScrollHandler = pluginOptions.allowCustomScrollHandler,
|
|
151
145
|
_pluginOptions$gutter = pluginOptions.gutterSize,
|
|
152
|
-
gutterSize = _pluginOptions$gutter === void 0 ? GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
146
|
+
gutterSize = _pluginOptions$gutter === void 0 ? _utils.GUTTER_SIZE_IN_PX : _pluginOptions$gutter;
|
|
153
147
|
if (!getScrollElement) {
|
|
154
148
|
return undefined;
|
|
155
149
|
}
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "avatarGroupPlugin", {
|
|
|
32
32
|
Object.defineProperty(exports, "basePlugin", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function get() {
|
|
35
|
-
return _base.
|
|
35
|
+
return _base.basePlugin;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "beforePrimaryToolbarPlugin", {
|
|
@@ -371,7 +371,7 @@ Object.defineProperty(exports, "viewUpdateSubscriptionPlugin", {
|
|
|
371
371
|
return _viewUpdateSubscription.default;
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
|
-
var _base =
|
|
374
|
+
var _base = require("./base");
|
|
375
375
|
var _blockType = _interopRequireWildcard(require("./block-type"));
|
|
376
376
|
var _betterTypeHistory = _interopRequireDefault(require("./better-type-history"));
|
|
377
377
|
var _clearMarksOnChangeToEmptyDocument = _interopRequireDefault(require("./clear-marks-on-change-to-empty-document"));
|
|
@@ -14,6 +14,9 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
14
14
|
var _analytics = require("../analytics");
|
|
15
15
|
var _keymaps = require("../../keymaps");
|
|
16
16
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
17
|
+
var _selection = require("./utils/selection");
|
|
18
|
+
var _commands = require("./commands");
|
|
19
|
+
var _find = require("./utils/find");
|
|
17
20
|
/*
|
|
18
21
|
Toolbar buttons to bullet and ordered list can be found in
|
|
19
22
|
packages/editor/editor-core/src/plugins/toolbar-lists-indentation/ui/Toolbar.tsx
|
|
@@ -24,6 +27,20 @@ var listPlugin = function listPlugin(options, api) {
|
|
|
24
27
|
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions;
|
|
25
28
|
return {
|
|
26
29
|
name: 'list',
|
|
30
|
+
actions: {
|
|
31
|
+
indentList: (0, _commands.indentList)(editorAnalyticsAPI),
|
|
32
|
+
outdentList: (0, _commands.outdentList)(editorAnalyticsAPI),
|
|
33
|
+
toggleOrderedList: (0, _commands.toggleOrderedList)(editorAnalyticsAPI),
|
|
34
|
+
toggleBulletList: (0, _commands.toggleBulletList)(editorAnalyticsAPI),
|
|
35
|
+
isInsideListItem: _selection.isInsideListItem,
|
|
36
|
+
findRootParentListNode: _find.findRootParentListNode
|
|
37
|
+
},
|
|
38
|
+
getSharedState: function getSharedState(editorState) {
|
|
39
|
+
if (!editorState) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return _main.pluginKey.getState(editorState);
|
|
43
|
+
},
|
|
27
44
|
nodes: function nodes() {
|
|
28
45
|
return [{
|
|
29
46
|
name: 'bulletList',
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.findFirstParentListItemNode = findFirstParentListItemNode;
|
|
7
7
|
exports.findFirstParentListNode = findFirstParentListNode;
|
|
8
|
-
exports.findRootParentListNode =
|
|
8
|
+
exports.findRootParentListNode = void 0;
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
11
11
|
function findFirstParentListNode($pos) {
|
|
@@ -44,7 +44,7 @@ function findFirstParentListItemNode($pos) {
|
|
|
44
44
|
pos: listItemNodePosition.pos
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function findRootParentListNode($pos) {
|
|
47
|
+
var findRootParentListNode = function findRootParentListNode($pos) {
|
|
48
48
|
var doc = $pos.doc;
|
|
49
49
|
if ($pos.pos + 1 > doc.content.size) {
|
|
50
50
|
return null;
|
|
@@ -64,4 +64,5 @@ function findRootParentListNode($pos) {
|
|
|
64
64
|
}
|
|
65
65
|
var listNodePosition = doc.resolve(parentList.pos);
|
|
66
66
|
return findRootParentListNode(listNodePosition);
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
|
+
exports.findRootParentListNode = findRootParentListNode;
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.doesSelectionWhichStartsOrEndsInListContainEntireList = void 0;
|
|
7
8
|
exports.flattenNestedListInSlice = flattenNestedListInSlice;
|
|
8
9
|
exports.handleCodeBlock = handleCodeBlock;
|
|
9
10
|
exports.handleExpandPasteInTable = handleExpandPasteInTable;
|
|
@@ -41,7 +42,6 @@ var _utils4 = require("@atlaskit/editor-common/utils");
|
|
|
41
42
|
var _edgeCases = require("./edge-cases");
|
|
42
43
|
var _commands = require("./commands");
|
|
43
44
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
44
|
-
var _lists = require("../../utils/lists");
|
|
45
45
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
46
46
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
47
47
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -247,7 +247,31 @@ function handlePasteNonNestableBlockNodesIntoList(slice) {
|
|
|
247
247
|
return false;
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
var doesSelectionWhichStartsOrEndsInListContainEntireList = function doesSelectionWhichStartsOrEndsInListContainEntireList(selection, findRootParentListNode) {
|
|
251
|
+
var $from = selection.$from,
|
|
252
|
+
$to = selection.$to,
|
|
253
|
+
from = selection.from,
|
|
254
|
+
to = selection.to;
|
|
255
|
+
var selectionParentListItemNodeResolvedPos = findRootParentListNode ? findRootParentListNode($from) || findRootParentListNode($to) : null;
|
|
256
|
+
var selectionParentListNode = selectionParentListItemNodeResolvedPos === null || selectionParentListItemNodeResolvedPos === void 0 ? void 0 : selectionParentListItemNodeResolvedPos.parent;
|
|
257
|
+
if (!selectionParentListItemNodeResolvedPos || !selectionParentListNode) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
var startOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + $from.depth - 1 : selectionParentListItemNodeResolvedPos.pos + $to.depth - 1;
|
|
261
|
+
var endOfEntireList = $from.pos < $to.pos ? selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $to.depth - 1 : selectionParentListItemNodeResolvedPos.pos + selectionParentListNode.nodeSize - $from.depth - 1;
|
|
262
|
+
if (!startOfEntireList || !endOfEntireList) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
if (from < to) {
|
|
266
|
+
return startOfEntireList >= $from.pos && endOfEntireList <= $to.pos;
|
|
267
|
+
} else if (from > to) {
|
|
268
|
+
return startOfEntireList >= $to.pos && endOfEntireList <= $from.pos;
|
|
269
|
+
} else {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
exports.doesSelectionWhichStartsOrEndsInListContainEntireList = doesSelectionWhichStartsOrEndsInListContainEntireList;
|
|
274
|
+
function handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode) {
|
|
251
275
|
return function (state, dispatch) {
|
|
252
276
|
var schema = state.schema,
|
|
253
277
|
tr = state.tr;
|
|
@@ -256,7 +280,7 @@ function handlePastePanelOrDecisionContentIntoList(slice) {
|
|
|
256
280
|
var blockNode = slice.content.firstChild;
|
|
257
281
|
var isSliceWholeNode = slice.openStart === 0 && slice.openEnd === 0;
|
|
258
282
|
var selectionParentListItemNode = selection.$to.node(selection.$to.depth - 1);
|
|
259
|
-
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !(
|
|
283
|
+
var sliceIsWholeNodeButShouldNotReplaceSelection = isSliceWholeNode && !doesSelectionWhichStartsOrEndsInListContainEntireList(selection, findRootParentListNode);
|
|
260
284
|
if (!selectionParentListItemNode || (selectionParentListItemNode === null || selectionParentListItemNode === void 0 ? void 0 : selectionParentListItemNode.type) !== schema.nodes.listItem || !blockNode || !['panel', 'decisionList'].includes(blockNode === null || blockNode === void 0 ? void 0 : blockNode.type.name) || slice.content.childCount > 1 || (blockNode === null || blockNode === void 0 ? void 0 : blockNode.content.firstChild) === undefined || sliceIsWholeNodeButShouldNotReplaceSelection) {
|
|
261
285
|
return false;
|
|
262
286
|
}
|
|
@@ -305,10 +305,10 @@ function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
|
305
305
|
};
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice) {
|
|
308
|
+
var handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, findRootParentListNode) {
|
|
309
309
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
310
310
|
type: _analytics.PasteTypes.richText
|
|
311
|
-
}))((0, _handlers.handlePastePanelOrDecisionContentIntoList)(slice));
|
|
311
|
+
}))((0, _handlers.handlePastePanelOrDecisionContentIntoList)(slice, findRootParentListNode));
|
|
312
312
|
};
|
|
313
313
|
exports.handlePastePanelOrDecisionIntoListWithAnalytics = handlePastePanelOrDecisionIntoListWithAnalytics;
|
|
314
314
|
var handlePasteNonNestableBlockNodesIntoListWithAnalytics = function handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice) {
|
|
@@ -309,7 +309,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
309
309
|
|
|
310
310
|
// finally, handle rich-text copy-paste
|
|
311
311
|
if (isRichText) {
|
|
312
|
-
var _pluginInjectionApi$d6, _pluginInjectionApi$d7;
|
|
312
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
313
313
|
// linkify the text where possible
|
|
314
314
|
slice = (0, _utils.linkifyContent)(state.schema)(slice);
|
|
315
315
|
if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
@@ -374,7 +374,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
374
374
|
if ((0, _analytics.handlePasteIntoCaptionWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
375
375
|
return true;
|
|
376
376
|
}
|
|
377
|
-
if ((0, _analytics.handlePastePanelOrDecisionIntoListWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
377
|
+
if ((0, _analytics.handlePastePanelOrDecisionIntoListWithAnalytics)(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d8 = pluginInjectionApi.dependencies.list) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions.findRootParentListNode)(state, dispatch)) {
|
|
378
378
|
return true;
|
|
379
379
|
}
|
|
380
380
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && (0, _analytics.handlePasteNonNestableBlockNodesIntoListWithAnalytics)(view, event, slice)(state, dispatch)) {
|