@atlaskit/editor-core 172.3.1 → 173.0.0
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 +51 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/index.js +8 -0
- package/dist/cjs/plugins/base/pm-plugins/composition.js +60 -0
- package/dist/cjs/plugins/breakout/index.js +5 -4
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -36
- package/dist/cjs/plugins/collab-edit/plugin-state.js +16 -9
- package/dist/cjs/plugins/collab-edit/utils.js +16 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/cjs/plugins/paste/actions.js +13 -0
- package/dist/cjs/plugins/paste/commands.js +44 -0
- package/dist/cjs/plugins/paste/handlers.js +48 -7
- package/dist/cjs/plugins/paste/index.js +3 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +34 -9
- package/dist/cjs/plugins/paste/pm-plugins/plugin-factory.js +62 -0
- package/dist/cjs/plugins/paste/reducer.js +47 -0
- package/dist/cjs/plugins/paste/types.js +5 -0
- package/dist/cjs/plugins/placeholder/index.js +3 -1
- package/dist/cjs/plugins/placeholder-text/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +4 -1
- package/dist/cjs/plugins/table/commands-with-analytics.js +59 -52
- package/dist/cjs/plugins/table/index.js +53 -36
- package/dist/cjs/plugins/table/toolbar.js +136 -20
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +1 -16
- package/dist/cjs/plugins/type-ahead/constants.js +3 -1
- package/dist/cjs/plugins/type-ahead/messages.js +16 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +143 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +59 -11
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +156 -31
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +55 -29
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/cjs/plugins/type-ahead/utils.js +1 -1
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +8 -0
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +2 -6
- package/dist/cjs/ui/PortalProvider/index.js +26 -32
- package/dist/cjs/utils/index.js +8 -1
- 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/index.js +5 -0
- package/dist/es2019/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/es2019/plugins/breakout/index.js +5 -4
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/es2019/plugins/card/pm-plugins/doc.js +10 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +3 -40
- package/dist/es2019/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/es2019/plugins/collab-edit/utils.js +17 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +15 -7
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +9 -5
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/es2019/plugins/paste/actions.js +6 -0
- package/dist/es2019/plugins/paste/commands.js +27 -0
- package/dist/es2019/plugins/paste/handlers.js +50 -8
- package/dist/es2019/plugins/paste/index.js +3 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +29 -6
- package/dist/es2019/plugins/paste/pm-plugins/plugin-factory.js +33 -0
- package/dist/es2019/plugins/paste/reducer.js +24 -0
- package/dist/es2019/plugins/paste/types.js +1 -0
- package/dist/es2019/plugins/placeholder/index.js +2 -1
- package/dist/es2019/plugins/placeholder-text/index.js +13 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +5 -1
- package/dist/es2019/plugins/table/commands-with-analytics.js +6 -3
- package/dist/es2019/plugins/table/index.js +22 -4
- package/dist/es2019/plugins/table/toolbar.js +118 -14
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -9
- package/dist/es2019/plugins/type-ahead/constants.js +1 -0
- package/dist/es2019/plugins/type-ahead/messages.js +16 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +95 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +49 -12
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +143 -29
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +64 -31
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/es2019/plugins/type-ahead/utils.js +1 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +17 -0
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/es2019/ui/PortalProvider/index.js +5 -8
- package/dist/es2019/utils/index.js +6 -0
- 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/index.js +7 -0
- package/dist/esm/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/esm/plugins/breakout/index.js +5 -4
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/esm/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +3 -37
- package/dist/esm/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/esm/plugins/collab-edit/utils.js +17 -3
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/esm/plugins/paste/actions.js +6 -0
- package/dist/esm/plugins/paste/commands.js +31 -0
- package/dist/esm/plugins/paste/handlers.js +46 -8
- package/dist/esm/plugins/paste/index.js +3 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +27 -6
- package/dist/esm/plugins/paste/pm-plugins/plugin-factory.js +46 -0
- package/dist/esm/plugins/paste/reducer.js +34 -0
- package/dist/esm/plugins/paste/types.js +1 -0
- package/dist/esm/plugins/placeholder/index.js +2 -1
- package/dist/esm/plugins/placeholder-text/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +4 -1
- package/dist/esm/plugins/table/commands-with-analytics.js +56 -49
- package/dist/esm/plugins/table/index.js +54 -37
- package/dist/esm/plugins/table/toolbar.js +124 -15
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -12
- package/dist/esm/plugins/type-ahead/constants.js +1 -0
- package/dist/esm/plugins/type-ahead/messages.js +16 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +129 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +56 -12
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +151 -32
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +54 -31
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/esm/plugins/type-ahead/utils.js +1 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +7 -0
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/esm/ui/PortalProvider/index.js +26 -35
- package/dist/esm/utils/index.js +4 -0
- 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/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types/plugins/paste/actions.d.ts +15 -0
- package/dist/types/plugins/paste/commands.d.ts +16 -0
- package/dist/types/plugins/paste/handlers.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types/plugins/paste/reducer.d.ts +3 -0
- package/dist/types/plugins/paste/types.d.ts +6 -0
- package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types-ts4.0/index.d.ts +1 -1
- package/dist/types-ts4.0/plugins/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types-ts4.0/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types-ts4.0/plugins/paste/actions.d.ts +15 -0
- package/dist/types-ts4.0/plugins/paste/commands.d.ts +16 -0
- package/dist/types-ts4.0/plugins/paste/handlers.d.ts +1 -1
- package/dist/types-ts4.0/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types-ts4.0/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/reducer.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/types.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types-ts4.0/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types-ts4.0/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types-ts4.0/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types-ts4.0/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types-ts4.0/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.0/utils/index.d.ts +1 -0
- package/package.json +31 -32
- package/report.api.md +161 -49
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stopTrackingPastedMacroPositions = exports.startTrackingPastedMacroPositions = void 0;
|
|
7
|
+
|
|
8
|
+
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
9
|
+
|
|
10
|
+
var _actions = require("./actions");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Use this to register macro link positions during a paste operation, that you
|
|
14
|
+
* want to track in a document over time, through any document changes.
|
|
15
|
+
*
|
|
16
|
+
* @param positions a map of string keys (custom position references) and position values e.g. { ['my-key-1']: 11 }
|
|
17
|
+
*
|
|
18
|
+
* **Context**: This is neccessary if there is an async process or an unknown period of time
|
|
19
|
+
* between obtaining an original position, and wanting to know about what its final eventual
|
|
20
|
+
* value. In that scenario, positions will need to be actively tracked and mapped in plugin
|
|
21
|
+
* state so that they can be mapped through any other independent document change transactions being
|
|
22
|
+
* dispatched to the editor that could affect their value.
|
|
23
|
+
*/
|
|
24
|
+
var startTrackingPastedMacroPositions = function startTrackingPastedMacroPositions(pastedMacroPositions) {
|
|
25
|
+
return (0, _pluginFactory.createCommand)(function () {
|
|
26
|
+
return {
|
|
27
|
+
type: _actions.PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS,
|
|
28
|
+
pastedMacroPositions: pastedMacroPositions
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.startTrackingPastedMacroPositions = startTrackingPastedMacroPositions;
|
|
34
|
+
|
|
35
|
+
var stopTrackingPastedMacroPositions = function stopTrackingPastedMacroPositions(pastedMacroPositionKeys) {
|
|
36
|
+
return (0, _pluginFactory.createCommand)(function () {
|
|
37
|
+
return {
|
|
38
|
+
type: _actions.PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS,
|
|
39
|
+
pastedMacroPositionKeys: pastedMacroPositionKeys
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.stopTrackingPastedMacroPositions = stopTrackingPastedMacroPositions;
|
|
@@ -37,6 +37,8 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
37
37
|
|
|
38
38
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
39
39
|
|
|
40
|
+
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
41
|
+
|
|
40
42
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
41
43
|
|
|
42
44
|
var _utils2 = require("../../utils");
|
|
@@ -65,6 +67,10 @@ var _main2 = require("../hyperlink/pm-plugins/main");
|
|
|
65
67
|
|
|
66
68
|
var _edgeCases = require("./edge-cases");
|
|
67
69
|
|
|
70
|
+
var _commands = require("./commands");
|
|
71
|
+
|
|
72
|
+
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
73
|
+
|
|
68
74
|
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; } } }; }
|
|
69
75
|
|
|
70
76
|
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); }
|
|
@@ -376,12 +382,21 @@ function _getSmartLinkAdf() {
|
|
|
376
382
|
return _getSmartLinkAdf.apply(this, arguments);
|
|
377
383
|
}
|
|
378
384
|
|
|
379
|
-
function insertAutoMacro(slice, macro, view) {
|
|
385
|
+
function insertAutoMacro(slice, macro, view, from, to) {
|
|
380
386
|
if (view) {
|
|
381
387
|
// insert the text or linkified/md-converted clipboard data
|
|
382
388
|
var selection = view.state.tr.selection;
|
|
383
|
-
var tr
|
|
384
|
-
var before
|
|
389
|
+
var tr;
|
|
390
|
+
var before;
|
|
391
|
+
|
|
392
|
+
if (typeof from === 'number' && typeof to === 'number') {
|
|
393
|
+
tr = view.state.tr.replaceRange(from, to, slice);
|
|
394
|
+
before = tr.mapping.map(from, -1);
|
|
395
|
+
} else {
|
|
396
|
+
tr = view.state.tr.replaceSelection(slice);
|
|
397
|
+
before = tr.mapping.map(selection.from, -1);
|
|
398
|
+
}
|
|
399
|
+
|
|
385
400
|
view.dispatch(tr); // replace the text with the macro as a separate transaction
|
|
386
401
|
// so the autoconversion generates 2 undo steps
|
|
387
402
|
|
|
@@ -414,16 +429,36 @@ function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverte
|
|
|
414
429
|
* if FF enabled, run through smart links and check for result
|
|
415
430
|
*/
|
|
416
431
|
if (cardsOptions && cardsOptions.resolveBeforeMacros && cardsOptions.resolveBeforeMacros.length) {
|
|
432
|
+
var _startTrackingPastedM;
|
|
433
|
+
|
|
417
434
|
if (cardsOptions.resolveBeforeMacros.indexOf(macro.attrs.extensionKey) < 0) {
|
|
418
435
|
return insertAutoMacro(slice, macro, view);
|
|
419
436
|
}
|
|
420
437
|
|
|
438
|
+
if (!view) {
|
|
439
|
+
throw new Error('View is missing');
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
var trackingId = (0, _v.default)();
|
|
443
|
+
var trackingFrom = "handleMacroAutoConvert-from-".concat(trackingId);
|
|
444
|
+
var trackingTo = "handleMacroAutoConvert-to-".concat(trackingId);
|
|
445
|
+
(0, _commands.startTrackingPastedMacroPositions)((_startTrackingPastedM = {}, (0, _defineProperty2.default)(_startTrackingPastedM, trackingFrom, state.selection.from), (0, _defineProperty2.default)(_startTrackingPastedM, trackingTo, state.selection.to), _startTrackingPastedM))(state, dispatch);
|
|
421
446
|
getSmartLinkAdf(text, 'inline', cardsOptions).then(function () {
|
|
447
|
+
// we use view.state rather than state because state becomes a stale
|
|
448
|
+
// state reference after getSmartLinkAdf's async work
|
|
449
|
+
var _getPastePluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
450
|
+
pastedMacroPositions = _getPastePluginState.pastedMacroPositions;
|
|
451
|
+
|
|
422
452
|
if (dispatch) {
|
|
423
|
-
handleMarkdown(slice)(state, dispatch);
|
|
453
|
+
handleMarkdown(slice, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
|
|
424
454
|
}
|
|
425
455
|
}).catch(function () {
|
|
426
|
-
|
|
456
|
+
var _getPastePluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
457
|
+
pastedMacroPositions = _getPastePluginState2.pastedMacroPositions;
|
|
458
|
+
|
|
459
|
+
insertAutoMacro(slice, macro, view, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo]);
|
|
460
|
+
}).finally(function () {
|
|
461
|
+
(0, _commands.stopTrackingPastedMacroPositions)([trackingFrom, trackingTo])(view.state, dispatch);
|
|
427
462
|
});
|
|
428
463
|
return true;
|
|
429
464
|
}
|
|
@@ -545,10 +580,16 @@ function handleExpandPasteInTable(slice) {
|
|
|
545
580
|
};
|
|
546
581
|
}
|
|
547
582
|
|
|
548
|
-
function handleMarkdown(markdownSlice) {
|
|
583
|
+
function handleMarkdown(markdownSlice, from, to) {
|
|
549
584
|
return function (state, dispatch) {
|
|
550
585
|
var tr = (0, _prosemirrorHistory.closeHistory)(state.tr);
|
|
551
|
-
|
|
586
|
+
|
|
587
|
+
if (typeof from === 'number' && typeof to === 'number') {
|
|
588
|
+
tr.replaceRange(from, to, markdownSlice);
|
|
589
|
+
} else {
|
|
590
|
+
tr.replaceSelection(markdownSlice);
|
|
591
|
+
}
|
|
592
|
+
|
|
552
593
|
(0, _doc.queueCardsFromChangedTr)(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
|
|
553
594
|
|
|
554
595
|
if (dispatch) {
|
|
@@ -19,8 +19,9 @@ var pastePlugin = function pastePlugin(_ref) {
|
|
|
19
19
|
plugin: function plugin(_ref2) {
|
|
20
20
|
var schema = _ref2.schema,
|
|
21
21
|
providerFactory = _ref2.providerFactory,
|
|
22
|
-
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent
|
|
23
|
-
|
|
22
|
+
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
23
|
+
dispatch = _ref2.dispatch;
|
|
24
|
+
return (0, _main.createPlugin)(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory);
|
|
24
25
|
}
|
|
25
26
|
}];
|
|
26
27
|
}
|
|
@@ -14,7 +14,12 @@ Object.defineProperty(exports, "md", {
|
|
|
14
14
|
return _md.md;
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
exports
|
|
17
|
+
Object.defineProperty(exports, "stateKey", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return _pluginFactory.pluginKey;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
18
23
|
|
|
19
24
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
20
25
|
|
|
@@ -24,12 +29,12 @@ var _prosemirrorModel = require("prosemirror-model");
|
|
|
24
29
|
|
|
25
30
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
26
31
|
|
|
27
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
28
|
-
|
|
29
32
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
30
33
|
|
|
31
34
|
var _editorMarkdownTransformer = require("@atlaskit/editor-markdown-transformer");
|
|
32
35
|
|
|
36
|
+
var _slice = require("../../../utils/slice");
|
|
37
|
+
|
|
33
38
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
34
39
|
|
|
35
40
|
var clipboard = _interopRequireWildcard(require("../../../utils/clipboard"));
|
|
@@ -76,22 +81,22 @@ var _utils9 = require("@atlaskit/editor-tables/utils");
|
|
|
76
81
|
|
|
77
82
|
var _step = require("../../../utils/step");
|
|
78
83
|
|
|
84
|
+
var _pluginFactory = require("./plugin-factory");
|
|
85
|
+
|
|
79
86
|
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); }
|
|
80
87
|
|
|
81
88
|
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; }
|
|
82
89
|
|
|
83
90
|
_analytics.sendPasteAnalyticsEvent;
|
|
84
|
-
var stateKey = new _prosemirrorState.PluginKey('pastePlugin');
|
|
85
|
-
exports.stateKey = stateKey;
|
|
86
91
|
|
|
87
|
-
function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
92
|
+
function createPlugin(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
88
93
|
var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _md.md);
|
|
89
94
|
|
|
90
95
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
91
96
|
var textInput = text;
|
|
92
97
|
|
|
93
|
-
if (textInput.includes('
|
|
94
|
-
textInput = textInput.replace(
|
|
98
|
+
if (textInput.includes('\\')) {
|
|
99
|
+
textInput = textInput.replace(/\\/g, '\\\\');
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
var doc = atlassianMarkDownParser.parse((0, _util.escapeLinks)(textInput));
|
|
@@ -155,7 +160,10 @@ function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkificatio
|
|
|
155
160
|
var mostRecentPasteEvent;
|
|
156
161
|
var pastedFromBitBucket = false;
|
|
157
162
|
return new _safePlugin.SafePlugin({
|
|
158
|
-
key:
|
|
163
|
+
key: _pluginFactory.pluginKey,
|
|
164
|
+
state: (0, _pluginFactory.createPluginState)(dispatch, {
|
|
165
|
+
pastedMacroPositions: {}
|
|
166
|
+
}),
|
|
159
167
|
props: {
|
|
160
168
|
// For serialising to plain text
|
|
161
169
|
clipboardTextSerializer: _clipboardTextSerializer.clipboardTextSerializer,
|
|
@@ -350,6 +358,23 @@ function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkificatio
|
|
|
350
358
|
}
|
|
351
359
|
|
|
352
360
|
return (0, _analytics.handleMarkdownWithAnalytics)(view, event, markdownSlice)(state, dispatch);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (isRichText && (0, _utils4.isInsideBlockQuote)(state)) {
|
|
364
|
+
//If pasting inside blockquote
|
|
365
|
+
//Skip the blockquote node and keep remaining nodes as they are
|
|
366
|
+
var blockquote = schema.nodes.blockquote;
|
|
367
|
+
var children = [];
|
|
368
|
+
(0, _slice.mapChildren)(slice.content, function (node) {
|
|
369
|
+
if (node.type === blockquote) {
|
|
370
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
371
|
+
children.push(node.child(i));
|
|
372
|
+
}
|
|
373
|
+
} else {
|
|
374
|
+
children.push(node);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
slice = new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.fromArray(children), slice.openStart, slice.openEnd);
|
|
353
378
|
} // finally, handle rich-text copy-paste
|
|
354
379
|
|
|
355
380
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.pluginKey = exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
15
|
+
|
|
16
|
+
var _pluginStateFactory = require("../../../utils/plugin-state-factory");
|
|
17
|
+
|
|
18
|
+
var _reducer = require("../reducer");
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var pluginKey = new _prosemirrorState.PluginKey('pastePlugin');
|
|
25
|
+
exports.pluginKey = pluginKey;
|
|
26
|
+
|
|
27
|
+
var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(pluginKey, _reducer.reducer, {
|
|
28
|
+
mapping: function mapping(tr, pluginState) {
|
|
29
|
+
if (tr.docChanged) {
|
|
30
|
+
var atLeastOnePositionChanged = false;
|
|
31
|
+
var positionsMappedThroughChanges = Object.entries(pluginState.pastedMacroPositions).reduce(function (acc, _ref) {
|
|
32
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
33
|
+
key = _ref2[0],
|
|
34
|
+
position = _ref2[1];
|
|
35
|
+
|
|
36
|
+
var mappedPosition = tr.mapping.map(position);
|
|
37
|
+
|
|
38
|
+
if (position !== mappedPosition) {
|
|
39
|
+
atLeastOnePositionChanged = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
acc[key] = tr.mapping.map(position);
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
|
|
46
|
+
if (atLeastOnePositionChanged) {
|
|
47
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
48
|
+
pastedMacroPositions: positionsMappedThroughChanges
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return pluginState;
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
createPluginState = _pluginFactory.createPluginState,
|
|
57
|
+
createCommand = _pluginFactory.createCommand,
|
|
58
|
+
getPluginState = _pluginFactory.getPluginState;
|
|
59
|
+
|
|
60
|
+
exports.getPluginState = getPluginState;
|
|
61
|
+
exports.createCommand = createCommand;
|
|
62
|
+
exports.createPluginState = createPluginState;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.reducer = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _actions = require("./actions");
|
|
15
|
+
|
|
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
var reducer = function reducer(state, action) {
|
|
21
|
+
switch (action.type) {
|
|
22
|
+
case _actions.PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS:
|
|
23
|
+
{
|
|
24
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
25
|
+
pastedMacroPositions: _objectSpread(_objectSpread({}, state.pastedMacroPositions), action.pastedMacroPositions)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
case _actions.PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS:
|
|
30
|
+
{
|
|
31
|
+
var filteredMacroPositions = Object.fromEntries(Object.entries(state.pastedMacroPositions).filter(function (_ref) {
|
|
32
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 1),
|
|
33
|
+
key = _ref2[0];
|
|
34
|
+
|
|
35
|
+
return !action.pastedMacroPositionKeys.includes(key);
|
|
36
|
+
}));
|
|
37
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
38
|
+
pastedMacroPositions: filteredMacroPositions
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
default:
|
|
43
|
+
return state;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.reducer = reducer;
|
|
@@ -25,6 +25,8 @@ var _focusHandler = require("../base/pm-plugins/focus-handler");
|
|
|
25
25
|
|
|
26
26
|
var _utils2 = require("../type-ahead/utils");
|
|
27
27
|
|
|
28
|
+
var _composition = require("../base/pm-plugins/composition");
|
|
29
|
+
|
|
28
30
|
var pluginKey = new _prosemirrorState.PluginKey('placeholderPlugin');
|
|
29
31
|
exports.pluginKey = pluginKey;
|
|
30
32
|
|
|
@@ -154,7 +156,7 @@ function createPlugin(defaultPlaceholderText, placeholderHints, bracketPlacehold
|
|
|
154
156
|
placeholderText = _getPlaceholderState.placeholderText,
|
|
155
157
|
pos = _getPlaceholderState.pos;
|
|
156
158
|
|
|
157
|
-
if (hasPlaceholder && placeholderText && pos !== undefined) {
|
|
159
|
+
if (hasPlaceholder && placeholderText && pos !== undefined && !(0, _composition.isComposing)(editorState)) {
|
|
158
160
|
return createPlaceholderDecoration(editorState, placeholderText, pos);
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -97,10 +97,16 @@ function createPlugin(dispatch, options) {
|
|
|
97
97
|
var placeholderNodeType = newState.schema.nodes.placeholder;
|
|
98
98
|
|
|
99
99
|
if (adjacentNode && adjacentNode.type === placeholderNodeType && didPlaceholderExistBeforeTxn) {
|
|
100
|
-
|
|
101
|
-
var wasContentAdded = oldState.selection.$head.pos < newState.selection.$head.pos && !(0, _utils.isNodeEmpty)(newState.selection.$head.nodeBefore);
|
|
100
|
+
var _$newHead$nodeBefore;
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
var $newHead = newState.selection.$head;
|
|
103
|
+
var $oldHead = oldState.selection.$head; // Check that cursor has moved forward in the document **and** that there is content before the cursor
|
|
104
|
+
|
|
105
|
+
var cursorMoved = $oldHead.pos < $newHead.pos;
|
|
106
|
+
var nodeBeforeHasContent = !(0, _utils.isNodeEmpty)($newHead.nodeBefore);
|
|
107
|
+
var nodeBeforeIsInline = (_$newHead$nodeBefore = $newHead.nodeBefore) === null || _$newHead$nodeBefore === void 0 ? void 0 : _$newHead$nodeBefore.type.isInline;
|
|
108
|
+
|
|
109
|
+
if (cursorMoved && (nodeBeforeHasContent || nodeBeforeIsInline)) {
|
|
104
110
|
var _NodeSelection$create = _prosemirrorState.NodeSelection.create(newState.doc, adjacentNodePos),
|
|
105
111
|
$from = _NodeSelection$create.$from,
|
|
106
112
|
$to = _NodeSelection$create.$to;
|
|
@@ -78,8 +78,11 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
|
|
|
78
78
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickOutside", function (event) {
|
|
79
79
|
event.preventDefault();
|
|
80
80
|
_this.inputMethod = InputMethod.blur;
|
|
81
|
+
var selectedText = window.getSelection();
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
if (!selectedText) {
|
|
84
|
+
_this.props.closeStatusPicker();
|
|
85
|
+
}
|
|
83
86
|
});
|
|
84
87
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEscapeKeydown", function (event) {
|
|
85
88
|
event.preventDefault();
|
|
@@ -84,77 +84,83 @@ var emptyMultipleCellsWithAnalytics = function emptyMultipleCellsWithAnalytics(e
|
|
|
84
84
|
exports.emptyMultipleCellsWithAnalytics = emptyMultipleCellsWithAnalytics;
|
|
85
85
|
|
|
86
86
|
var mergeCellsWithAnalytics = function mergeCellsWithAnalytics(editorAnalyticsAPI) {
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var _getSelectedCellInfo2 = (0, _utils2.getSelectedCellInfo)(selection),
|
|
91
|
-
horizontalCells = _getSelectedCellInfo2.horizontalCells,
|
|
92
|
-
verticalCells = _getSelectedCellInfo2.verticalCells,
|
|
93
|
-
totalCells = _getSelectedCellInfo2.totalCells,
|
|
94
|
-
totalRowCount = _getSelectedCellInfo2.totalRowCount,
|
|
95
|
-
totalColumnCount = _getSelectedCellInfo2.totalColumnCount;
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
action: _analytics.TABLE_ACTION.MERGED,
|
|
99
|
-
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
100
|
-
actionSubjectId: null,
|
|
101
|
-
attributes: {
|
|
102
|
-
horizontalCells: horizontalCells,
|
|
103
|
-
verticalCells: verticalCells,
|
|
104
|
-
totalCells: totalCells,
|
|
105
|
-
totalRowCount: totalRowCount,
|
|
106
|
-
totalColumnCount: totalColumnCount
|
|
107
|
-
},
|
|
108
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
109
|
-
};
|
|
110
|
-
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
111
|
-
if (dispatch) {
|
|
112
|
-
dispatch((0, _transforms.mergeCells)(state.tr));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return true;
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
exports.mergeCellsWithAnalytics = mergeCellsWithAnalytics;
|
|
120
|
-
|
|
121
|
-
var splitCellWithAnalytics = function splitCellWithAnalytics(editorAnalyticsAPI) {
|
|
122
|
-
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref3) {
|
|
123
|
-
var selection = _ref3.selection;
|
|
124
|
-
|
|
125
|
-
var _getSelectedCellInfo3 = (0, _utils2.getSelectedCellInfo)(selection),
|
|
126
|
-
totalRowCount = _getSelectedCellInfo3.totalRowCount,
|
|
127
|
-
totalColumnCount = _getSelectedCellInfo3.totalColumnCount;
|
|
87
|
+
return function (inputMethod) {
|
|
88
|
+
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref2) {
|
|
89
|
+
var selection = _ref2.selection;
|
|
128
90
|
|
|
129
|
-
|
|
91
|
+
var _getSelectedCellInfo2 = (0, _utils2.getSelectedCellInfo)(selection),
|
|
92
|
+
horizontalCells = _getSelectedCellInfo2.horizontalCells,
|
|
93
|
+
verticalCells = _getSelectedCellInfo2.verticalCells,
|
|
94
|
+
totalCells = _getSelectedCellInfo2.totalCells,
|
|
95
|
+
totalRowCount = _getSelectedCellInfo2.totalRowCount,
|
|
96
|
+
totalColumnCount = _getSelectedCellInfo2.totalColumnCount;
|
|
130
97
|
|
|
131
|
-
if (cell) {
|
|
132
|
-
var _cell$node$attrs = cell.node.attrs,
|
|
133
|
-
verticalCells = _cell$node$attrs.rowspan,
|
|
134
|
-
horizontalCells = _cell$node$attrs.colspan;
|
|
135
98
|
return {
|
|
136
|
-
action: _analytics.TABLE_ACTION.
|
|
99
|
+
action: _analytics.TABLE_ACTION.MERGED,
|
|
137
100
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
138
101
|
actionSubjectId: null,
|
|
139
102
|
attributes: {
|
|
103
|
+
inputMethod: inputMethod,
|
|
140
104
|
horizontalCells: horizontalCells,
|
|
141
105
|
verticalCells: verticalCells,
|
|
142
|
-
totalCells:
|
|
106
|
+
totalCells: totalCells,
|
|
143
107
|
totalRowCount: totalRowCount,
|
|
144
108
|
totalColumnCount: totalColumnCount
|
|
145
109
|
},
|
|
146
110
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
147
111
|
};
|
|
148
|
-
}
|
|
112
|
+
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
113
|
+
if (dispatch) {
|
|
114
|
+
dispatch((0, _transforms.mergeCells)(state.tr));
|
|
115
|
+
}
|
|
149
116
|
|
|
150
|
-
|
|
151
|
-
|
|
117
|
+
return true;
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
exports.mergeCellsWithAnalytics = mergeCellsWithAnalytics;
|
|
123
|
+
|
|
124
|
+
var splitCellWithAnalytics = function splitCellWithAnalytics(editorAnalyticsAPI) {
|
|
125
|
+
return function (inputMethod) {
|
|
126
|
+
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref3) {
|
|
127
|
+
var selection = _ref3.selection;
|
|
128
|
+
|
|
129
|
+
var _getSelectedCellInfo3 = (0, _utils2.getSelectedCellInfo)(selection),
|
|
130
|
+
totalRowCount = _getSelectedCellInfo3.totalRowCount,
|
|
131
|
+
totalColumnCount = _getSelectedCellInfo3.totalColumnCount;
|
|
132
|
+
|
|
133
|
+
var cell = (0, _utils.findCellClosestToPos)(selection.$anchor);
|
|
134
|
+
|
|
135
|
+
if (cell) {
|
|
136
|
+
var _cell$node$attrs = cell.node.attrs,
|
|
137
|
+
verticalCells = _cell$node$attrs.rowspan,
|
|
138
|
+
horizontalCells = _cell$node$attrs.colspan;
|
|
139
|
+
return {
|
|
140
|
+
action: _analytics.TABLE_ACTION.SPLIT,
|
|
141
|
+
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
142
|
+
actionSubjectId: null,
|
|
143
|
+
attributes: {
|
|
144
|
+
inputMethod: inputMethod,
|
|
145
|
+
horizontalCells: horizontalCells,
|
|
146
|
+
verticalCells: verticalCells,
|
|
147
|
+
totalCells: horizontalCells * verticalCells,
|
|
148
|
+
totalRowCount: totalRowCount,
|
|
149
|
+
totalColumnCount: totalColumnCount
|
|
150
|
+
},
|
|
151
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return;
|
|
156
|
+
})(editorAnalyticsAPI)(_splitCell.splitCell);
|
|
157
|
+
};
|
|
152
158
|
};
|
|
153
159
|
|
|
154
160
|
exports.splitCellWithAnalytics = splitCellWithAnalytics;
|
|
155
161
|
|
|
156
162
|
var setColorWithAnalytics = function setColorWithAnalytics(editorAnalyticsAPI) {
|
|
157
|
-
return function (cellColor, targetCellPosition) {
|
|
163
|
+
return function (inputMethod, cellColor, targetCellPosition) {
|
|
158
164
|
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref4) {
|
|
159
165
|
var selection = _ref4.selection;
|
|
160
166
|
|
|
@@ -170,6 +176,7 @@ var setColorWithAnalytics = function setColorWithAnalytics(editorAnalyticsAPI) {
|
|
|
170
176
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
171
177
|
actionSubjectId: null,
|
|
172
178
|
attributes: {
|
|
179
|
+
inputMethod: inputMethod,
|
|
173
180
|
cellColor: (_adfSchema.tableBackgroundColorPalette.get(cellColor.toLowerCase()) || cellColor).toLowerCase(),
|
|
174
181
|
horizontalCells: horizontalCells,
|
|
175
182
|
verticalCells: verticalCells,
|