@atlaskit/editor-core 188.12.3 → 188.13.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 +10 -0
- package/dist/cjs/plugins/paste/actions.js +1 -0
- package/dist/cjs/plugins/paste/plugin.js +12 -0
- package/dist/cjs/plugins/paste/pm-plugins/main.js +20 -2
- package/dist/cjs/plugins/paste/reducer.js +6 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/paste/actions.js +1 -0
- package/dist/es2019/plugins/paste/plugin.js +12 -0
- package/dist/es2019/plugins/paste/pm-plugins/main.js +21 -3
- package/dist/es2019/plugins/paste/reducer.js +7 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/paste/actions.js +1 -0
- package/dist/esm/plugins/paste/plugin.js +12 -0
- package/dist/esm/plugins/paste/pm-plugins/main.js +21 -3
- package/dist/esm/plugins/paste/reducer.js +6 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/paste/actions.d.ts +8 -2
- package/dist/types/plugins/paste/reducer.d.ts +2 -2
- package/dist/types-ts4.5/plugins/paste/actions.d.ts +8 -2
- package/dist/types-ts4.5/plugins/paste/reducer.d.ts +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41895](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41895) [`96066a06792`](https://bitbucket.org/atlassian/atlassian-frontend/commits/96066a06792) - ED-20524: Adding shared state for paste plugin which will be used by new paste options toolbar plugin
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 188.12.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -7,5 +7,6 @@ exports.PastePluginActionTypes = void 0;
|
|
|
7
7
|
var PastePluginActionTypes = exports.PastePluginActionTypes = /*#__PURE__*/function (PastePluginActionTypes) {
|
|
8
8
|
PastePluginActionTypes["START_TRACKING_PASTED_MACRO_POSITIONS"] = "START_TRACKING_PASTED_MACRO_POSITIONS";
|
|
9
9
|
PastePluginActionTypes["STOP_TRACKING_PASTED_MACRO_POSITIONS"] = "STOP_TRACKING_PASTED_MACRO_POSITIONS";
|
|
10
|
+
PastePluginActionTypes["ON_PASTE"] = "ON_PASTE";
|
|
10
11
|
return PastePluginActionTypes;
|
|
11
12
|
}({});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pastePlugin = void 0;
|
|
7
7
|
var _main = require("./pm-plugins/main");
|
|
8
|
+
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
8
9
|
var pastePlugin = exports.pastePlugin = function pastePlugin(_ref) {
|
|
9
10
|
var _api$featureFlags;
|
|
10
11
|
var config = _ref.config,
|
|
@@ -26,6 +27,17 @@ var pastePlugin = exports.pastePlugin = function pastePlugin(_ref) {
|
|
|
26
27
|
return (0, _main.createPlugin)(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory);
|
|
27
28
|
}
|
|
28
29
|
}];
|
|
30
|
+
},
|
|
31
|
+
getSharedState: function getSharedState(editorState) {
|
|
32
|
+
if (!editorState) {
|
|
33
|
+
return {
|
|
34
|
+
lastContentPasted: null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
var pluginState = _pluginFactory.pluginKey.getState(editorState);
|
|
38
|
+
return {
|
|
39
|
+
lastContentPasted: pluginState.lastContentPasted
|
|
40
|
+
};
|
|
29
41
|
}
|
|
30
42
|
};
|
|
31
43
|
};
|
|
@@ -36,6 +36,7 @@ var _clipboardTextSerializer = require("./clipboard-text-serializer");
|
|
|
36
36
|
var _tinyMCE = require("../util/tinyMCE");
|
|
37
37
|
var _pluginFactory = require("./plugin-factory");
|
|
38
38
|
var _utils5 = require("@atlaskit/editor-prosemirror/utils");
|
|
39
|
+
var _actions = require("../actions");
|
|
39
40
|
// TODO: ED-20519 It requires full analytics extraction to use the plugin injection API
|
|
40
41
|
|
|
41
42
|
// TODO: ED-20519 It requires annotation extraction to use the plugin injection API
|
|
@@ -100,7 +101,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
100
101
|
return new _safePlugin.SafePlugin({
|
|
101
102
|
key: _pluginFactory.pluginKey,
|
|
102
103
|
state: (0, _pluginFactory.createPluginState)(dispatch, {
|
|
103
|
-
pastedMacroPositions: {}
|
|
104
|
+
pastedMacroPositions: {},
|
|
105
|
+
lastContentPasted: null
|
|
104
106
|
}),
|
|
105
107
|
props: {
|
|
106
108
|
// For serialising to plain text
|
|
@@ -180,7 +182,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
180
182
|
}
|
|
181
183
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
182
184
|
var dispatch = function dispatch(tr) {
|
|
183
|
-
var _state$doc$resolve$no;
|
|
185
|
+
var _state$doc$resolve$no, _input;
|
|
184
186
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
185
187
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
186
188
|
// to be atomic
|
|
@@ -215,6 +217,22 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
215
217
|
action: isPlainText ? _analytics.ACTION.PASTED_AS_PLAIN : _analytics.ACTION.PASTED,
|
|
216
218
|
inputMethod: _analytics.INPUT_METHOD.CLIPBOARD
|
|
217
219
|
});
|
|
220
|
+
var pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
221
|
+
var pasteEndPos = tr.selection.to;
|
|
222
|
+
var contentPasted = {
|
|
223
|
+
pasteStartPos: pasteStartPos,
|
|
224
|
+
pasteEndPos: pasteEndPos,
|
|
225
|
+
text: text,
|
|
226
|
+
isShiftPressed: Boolean(view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
227
|
+
isPlainText: Boolean(isPlainText),
|
|
228
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
229
|
+
pastedAt: Date.now(),
|
|
230
|
+
pasteSource: (0, _util.getPasteSource)(event)
|
|
231
|
+
};
|
|
232
|
+
tr.setMeta(_pluginFactory.pluginKey, {
|
|
233
|
+
type: _actions.PastePluginActionTypes.ON_PASTE,
|
|
234
|
+
contentPasted: contentPasted
|
|
235
|
+
});
|
|
218
236
|
view.dispatch(tr);
|
|
219
237
|
};
|
|
220
238
|
slice = (0, _handlers.handleParagraphBlockMarks)(state, slice);
|
|
@@ -29,6 +29,12 @@ var reducer = exports.reducer = function reducer(state, action) {
|
|
|
29
29
|
pastedMacroPositions: filteredMacroPositions
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
case _actions.PastePluginActionTypes.ON_PASTE:
|
|
33
|
+
{
|
|
34
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
35
|
+
lastContentPasted: action.contentPasted
|
|
36
|
+
});
|
|
37
|
+
}
|
|
32
38
|
default:
|
|
33
39
|
return state;
|
|
34
40
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.
|
|
8
|
+
var version = exports.version = "188.13.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export let PastePluginActionTypes = /*#__PURE__*/function (PastePluginActionTypes) {
|
|
2
2
|
PastePluginActionTypes["START_TRACKING_PASTED_MACRO_POSITIONS"] = "START_TRACKING_PASTED_MACRO_POSITIONS";
|
|
3
3
|
PastePluginActionTypes["STOP_TRACKING_PASTED_MACRO_POSITIONS"] = "STOP_TRACKING_PASTED_MACRO_POSITIONS";
|
|
4
|
+
PastePluginActionTypes["ON_PASTE"] = "ON_PASTE";
|
|
4
5
|
return PastePluginActionTypes;
|
|
5
6
|
}({});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
|
+
import { pluginKey } from './pm-plugins/plugin-factory';
|
|
2
3
|
export const pastePlugin = ({
|
|
3
4
|
config,
|
|
4
5
|
api
|
|
@@ -21,6 +22,17 @@ export const pastePlugin = ({
|
|
|
21
22
|
dispatch
|
|
22
23
|
}) => createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory)
|
|
23
24
|
}];
|
|
25
|
+
},
|
|
26
|
+
getSharedState: editorState => {
|
|
27
|
+
if (!editorState) {
|
|
28
|
+
return {
|
|
29
|
+
lastContentPasted: null
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const pluginState = pluginKey.getState(editorState);
|
|
33
|
+
return {
|
|
34
|
+
lastContentPasted: pluginState.lastContentPasted
|
|
35
|
+
};
|
|
24
36
|
}
|
|
25
37
|
};
|
|
26
38
|
};
|
|
@@ -9,7 +9,7 @@ import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/
|
|
|
9
9
|
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { md, isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
|
|
11
11
|
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
|
|
12
|
-
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
12
|
+
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline, getPasteSource } from '../util';
|
|
13
13
|
import { transformSliceNestedExpandToExpand, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
14
14
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
15
15
|
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
@@ -24,6 +24,7 @@ import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMC
|
|
|
24
24
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
25
25
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
26
26
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
27
|
+
import { PastePluginActionTypes } from '../actions';
|
|
27
28
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
28
29
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
29
30
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
@@ -61,7 +62,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
61
62
|
return new SafePlugin({
|
|
62
63
|
key: stateKey,
|
|
63
64
|
state: createPluginState(dispatch, {
|
|
64
|
-
pastedMacroPositions: {}
|
|
65
|
+
pastedMacroPositions: {},
|
|
66
|
+
lastContentPasted: null
|
|
65
67
|
}),
|
|
66
68
|
props: {
|
|
67
69
|
// For serialising to plain text
|
|
@@ -144,7 +146,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
144
146
|
}
|
|
145
147
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
146
148
|
const dispatch = tr => {
|
|
147
|
-
var _state$doc$resolve$no;
|
|
149
|
+
var _state$doc$resolve$no, _input;
|
|
148
150
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
149
151
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
150
152
|
// to be atomic
|
|
@@ -181,6 +183,22 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
181
183
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
182
184
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
183
185
|
});
|
|
186
|
+
const pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
187
|
+
const pasteEndPos = tr.selection.to;
|
|
188
|
+
const contentPasted = {
|
|
189
|
+
pasteStartPos,
|
|
190
|
+
pasteEndPos,
|
|
191
|
+
text,
|
|
192
|
+
isShiftPressed: Boolean(view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
193
|
+
isPlainText: Boolean(isPlainText),
|
|
194
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
195
|
+
pastedAt: Date.now(),
|
|
196
|
+
pasteSource: getPasteSource(event)
|
|
197
|
+
};
|
|
198
|
+
tr.setMeta(stateKey, {
|
|
199
|
+
type: PastePluginActionTypes.ON_PASTE,
|
|
200
|
+
contentPasted
|
|
201
|
+
});
|
|
184
202
|
view.dispatch(tr);
|
|
185
203
|
};
|
|
186
204
|
slice = handleParagraphBlockMarks(state, slice);
|
|
@@ -19,6 +19,13 @@ export const reducer = (state, action) => {
|
|
|
19
19
|
pastedMacroPositions: filteredMacroPositions
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
case ActionTypes.ON_PASTE:
|
|
23
|
+
{
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
lastContentPasted: action.contentPasted
|
|
27
|
+
};
|
|
28
|
+
}
|
|
22
29
|
default:
|
|
23
30
|
return state;
|
|
24
31
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export var PastePluginActionTypes = /*#__PURE__*/function (PastePluginActionTypes) {
|
|
2
2
|
PastePluginActionTypes["START_TRACKING_PASTED_MACRO_POSITIONS"] = "START_TRACKING_PASTED_MACRO_POSITIONS";
|
|
3
3
|
PastePluginActionTypes["STOP_TRACKING_PASTED_MACRO_POSITIONS"] = "STOP_TRACKING_PASTED_MACRO_POSITIONS";
|
|
4
|
+
PastePluginActionTypes["ON_PASTE"] = "ON_PASTE";
|
|
4
5
|
return PastePluginActionTypes;
|
|
5
6
|
}({});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
|
+
import { pluginKey } from './pm-plugins/plugin-factory';
|
|
2
3
|
export var pastePlugin = function pastePlugin(_ref) {
|
|
3
4
|
var _api$featureFlags;
|
|
4
5
|
var config = _ref.config,
|
|
@@ -20,6 +21,17 @@ export var pastePlugin = function pastePlugin(_ref) {
|
|
|
20
21
|
return createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory);
|
|
21
22
|
}
|
|
22
23
|
}];
|
|
24
|
+
},
|
|
25
|
+
getSharedState: function getSharedState(editorState) {
|
|
26
|
+
if (!editorState) {
|
|
27
|
+
return {
|
|
28
|
+
lastContentPasted: null
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var pluginState = pluginKey.getState(editorState);
|
|
32
|
+
return {
|
|
33
|
+
lastContentPasted: pluginState.lastContentPasted
|
|
34
|
+
};
|
|
23
35
|
}
|
|
24
36
|
};
|
|
25
37
|
};
|
|
@@ -11,7 +11,7 @@ import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/
|
|
|
11
11
|
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { md, isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
|
|
13
13
|
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
|
|
14
|
-
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
14
|
+
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline, getPasteSource } from '../util';
|
|
15
15
|
import { transformSliceNestedExpandToExpand, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
16
16
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
17
17
|
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
@@ -26,6 +26,7 @@ import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMC
|
|
|
26
26
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
27
27
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
28
28
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
29
|
+
import { PastePluginActionTypes } from '../actions';
|
|
29
30
|
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
30
31
|
var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
31
32
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
@@ -86,7 +87,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
86
87
|
return new SafePlugin({
|
|
87
88
|
key: stateKey,
|
|
88
89
|
state: createPluginState(dispatch, {
|
|
89
|
-
pastedMacroPositions: {}
|
|
90
|
+
pastedMacroPositions: {},
|
|
91
|
+
lastContentPasted: null
|
|
90
92
|
}),
|
|
91
93
|
props: {
|
|
92
94
|
// For serialising to plain text
|
|
@@ -166,7 +168,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
166
168
|
}
|
|
167
169
|
// creating a custom dispatch because we want to add a meta whenever we do a paste.
|
|
168
170
|
var dispatch = function dispatch(tr) {
|
|
169
|
-
var _state$doc$resolve$no;
|
|
171
|
+
var _state$doc$resolve$no, _input;
|
|
170
172
|
// https://product-fabric.atlassian.net/browse/ED-12633
|
|
171
173
|
// don't add closeHistory call if we're pasting a text inside placeholder text as we want the whole action
|
|
172
174
|
// to be atomic
|
|
@@ -201,6 +203,22 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
201
203
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
202
204
|
inputMethod: INPUT_METHOD.CLIPBOARD
|
|
203
205
|
});
|
|
206
|
+
var pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
|
|
207
|
+
var pasteEndPos = tr.selection.to;
|
|
208
|
+
var contentPasted = {
|
|
209
|
+
pasteStartPos: pasteStartPos,
|
|
210
|
+
pasteEndPos: pasteEndPos,
|
|
211
|
+
text: text,
|
|
212
|
+
isShiftPressed: Boolean(view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
|
|
213
|
+
isPlainText: Boolean(isPlainText),
|
|
214
|
+
pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
|
|
215
|
+
pastedAt: Date.now(),
|
|
216
|
+
pasteSource: getPasteSource(event)
|
|
217
|
+
};
|
|
218
|
+
tr.setMeta(stateKey, {
|
|
219
|
+
type: PastePluginActionTypes.ON_PASTE,
|
|
220
|
+
contentPasted: contentPasted
|
|
221
|
+
});
|
|
204
222
|
view.dispatch(tr);
|
|
205
223
|
};
|
|
206
224
|
slice = handleParagraphBlockMarks(state, slice);
|
|
@@ -22,6 +22,12 @@ export var reducer = function reducer(state, action) {
|
|
|
22
22
|
pastedMacroPositions: filteredMacroPositions
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
case ActionTypes.ON_PASTE:
|
|
26
|
+
{
|
|
27
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
28
|
+
lastContentPasted: action.contentPasted
|
|
29
|
+
});
|
|
30
|
+
}
|
|
25
31
|
default:
|
|
26
32
|
return state;
|
|
27
33
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
1
2
|
export declare enum PastePluginActionTypes {
|
|
2
3
|
START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
|
|
3
|
-
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS"
|
|
4
|
+
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
|
|
5
|
+
ON_PASTE = "ON_PASTE"
|
|
4
6
|
}
|
|
5
7
|
export interface StartTrackingPastedMacroPositions {
|
|
6
8
|
type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
|
|
@@ -8,8 +10,12 @@ export interface StartTrackingPastedMacroPositions {
|
|
|
8
10
|
[key: string]: number;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
13
|
+
export interface OnPaste {
|
|
14
|
+
type: PastePluginActionTypes.ON_PASTE;
|
|
15
|
+
contentPasted: LastContentPasted;
|
|
16
|
+
}
|
|
11
17
|
export interface StopTrackingPastedMacroPositions {
|
|
12
18
|
type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
|
|
13
19
|
pastedMacroPositionKeys: string[];
|
|
14
20
|
}
|
|
15
|
-
export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions;
|
|
21
|
+
export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions | OnPaste;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PastePluginState as State } from './types';
|
|
2
|
-
import { PastePluginAction as Action } from './actions';
|
|
1
|
+
import type { PastePluginState as State } from './types';
|
|
2
|
+
import type { PastePluginAction as Action } from './actions';
|
|
3
3
|
export declare const reducer: (state: State, action: Action) => State;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
1
2
|
export declare enum PastePluginActionTypes {
|
|
2
3
|
START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
|
|
3
|
-
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS"
|
|
4
|
+
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
|
|
5
|
+
ON_PASTE = "ON_PASTE"
|
|
4
6
|
}
|
|
5
7
|
export interface StartTrackingPastedMacroPositions {
|
|
6
8
|
type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
|
|
@@ -8,8 +10,12 @@ export interface StartTrackingPastedMacroPositions {
|
|
|
8
10
|
[key: string]: number;
|
|
9
11
|
};
|
|
10
12
|
}
|
|
13
|
+
export interface OnPaste {
|
|
14
|
+
type: PastePluginActionTypes.ON_PASTE;
|
|
15
|
+
contentPasted: LastContentPasted;
|
|
16
|
+
}
|
|
11
17
|
export interface StopTrackingPastedMacroPositions {
|
|
12
18
|
type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
|
|
13
19
|
pastedMacroPositionKeys: string[];
|
|
14
20
|
}
|
|
15
|
-
export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions;
|
|
21
|
+
export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions | OnPaste;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PastePluginState as State } from './types';
|
|
2
|
-
import { PastePluginAction as Action } from './actions';
|
|
1
|
+
import type { PastePluginState as State } from './types';
|
|
2
|
+
import type { PastePluginAction as Action } from './actions';
|
|
3
3
|
export declare const reducer: (state: State, action: Action) => State;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "188.
|
|
3
|
+
"version": "188.13.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@atlaskit/editor-plugin-list": "^1.3.0",
|
|
87
87
|
"@atlaskit/editor-plugin-media": "^0.3.0",
|
|
88
88
|
"@atlaskit/editor-plugin-mentions": "^0.1.0",
|
|
89
|
-
"@atlaskit/editor-plugin-paste": "^0.0
|
|
89
|
+
"@atlaskit/editor-plugin-paste": "^0.1.0",
|
|
90
90
|
"@atlaskit/editor-plugin-placeholder": "^0.1.0",
|
|
91
91
|
"@atlaskit/editor-plugin-quick-insert": "^0.2.0",
|
|
92
92
|
"@atlaskit/editor-plugin-rule": "^0.1.0",
|