@atlaskit/editor-plugin-paste 7.1.0 → 7.2.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 +12 -0
- package/dist/cjs/pastePlugin.js +3 -2
- package/dist/cjs/pm-plugins/clipboard-text-serializer.js +45 -0
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/es2019/pastePlugin.js +3 -2
- package/dist/es2019/pm-plugins/clipboard-text-serializer.js +44 -0
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/esm/pastePlugin.js +3 -2
- package/dist/esm/pm-plugins/clipboard-text-serializer.js +44 -0
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/types/pm-plugins/clipboard-text-serializer.d.ts +15 -0
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/clipboard-text-serializer.d.ts +15 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste
|
|
2
2
|
|
|
3
|
+
## 7.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`801013048753f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/801013048753f) -
|
|
8
|
+
[https://product-fabric.atlassian.net/browse/ED-20833](ED-20833) - added serialization of the date
|
|
9
|
+
into text when copying in the editor
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 7.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/pastePlugin.js
CHANGED
|
@@ -26,8 +26,9 @@ var pastePlugin = exports.pastePlugin = function pastePlugin(_ref) {
|
|
|
26
26
|
var schema = _ref3.schema,
|
|
27
27
|
providerFactory = _ref3.providerFactory,
|
|
28
28
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
29
|
-
dispatch = _ref3.dispatch
|
|
30
|
-
|
|
29
|
+
dispatch = _ref3.dispatch,
|
|
30
|
+
getIntl = _ref3.getIntl;
|
|
31
|
+
return (0, _main.createPlugin)(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, getIntl, cardOptions, sanitizePrivateContent, providerFactory);
|
|
31
32
|
}
|
|
32
33
|
}, {
|
|
33
34
|
name: 'moveAnalyticsPlugin',
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.clipboardTextSerializer = clipboardTextSerializer;
|
|
7
|
+
exports.createClipboardTextSerializer = createClipboardTextSerializer;
|
|
8
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
7
9
|
/**
|
|
8
10
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
9
11
|
* section of the clipboard on copy.
|
|
@@ -13,6 +15,9 @@ exports.clipboardTextSerializer = clipboardTextSerializer;
|
|
|
13
15
|
* By default (without this function passed to the editor), the editor uses
|
|
14
16
|
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
15
17
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
18
|
+
*
|
|
19
|
+
* @todo Remove when `platform_editor_date_to_text` FF is removed.
|
|
20
|
+
* Also, rename the file to `create-clipboard-text-serializer.ts`.
|
|
16
21
|
*/
|
|
17
22
|
function clipboardTextSerializer(slice) {
|
|
18
23
|
var blockSeparator = '\n\n';
|
|
@@ -38,4 +43,44 @@ function clipboardTextSerializer(slice) {
|
|
|
38
43
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
39
44
|
}
|
|
40
45
|
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
50
|
+
* section of the clipboard on copy.
|
|
51
|
+
* The current implementation is bare bones - only inlineCards, blockCards and mentions are tested (they
|
|
52
|
+
* previously were empty on plain text copy).
|
|
53
|
+
*
|
|
54
|
+
* By default (without this function passed to the editor), the editor uses
|
|
55
|
+
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
56
|
+
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
57
|
+
*/
|
|
58
|
+
function createClipboardTextSerializer(intl) {
|
|
59
|
+
return function (slice) {
|
|
60
|
+
var blockSeparator = '\n\n';
|
|
61
|
+
return slice.content.textBetween(0, slice.content.size, blockSeparator, function (leafNode) {
|
|
62
|
+
var _leafNode$text2;
|
|
63
|
+
switch (leafNode.type.name) {
|
|
64
|
+
case 'hardBreak':
|
|
65
|
+
return '\n';
|
|
66
|
+
case 'text':
|
|
67
|
+
return leafNode.text;
|
|
68
|
+
case 'inlineCard':
|
|
69
|
+
return leafNode.attrs.url;
|
|
70
|
+
case 'blockCard':
|
|
71
|
+
return leafNode.attrs.url;
|
|
72
|
+
// Note: Due to relying on an async fetch of the Mention name by the Node's React component,
|
|
73
|
+
// pasting a mention does not actually work for the in-product Mention implementation.
|
|
74
|
+
// However, this is also true of the previous implementation.
|
|
75
|
+
// Bug ticket: https://product-fabric.atlassian.net/browse/ED-23076
|
|
76
|
+
case 'mention':
|
|
77
|
+
return leafNode.attrs.text;
|
|
78
|
+
case 'date':
|
|
79
|
+
return (0, _utils.timestampToString)(leafNode.attrs.timestamp, intl);
|
|
80
|
+
default:
|
|
81
|
+
// Unsupported node
|
|
82
|
+
return (_leafNode$text2 = leafNode.text) !== null && _leafNode$text2 !== void 0 ? _leafNode$text2 : '';
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
41
86
|
}
|
|
@@ -66,7 +66,7 @@ function isSharePointUrl(url) {
|
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
69
|
+
function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, getIntl, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
70
70
|
var _pluginInjectionApi$a;
|
|
71
71
|
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
72
72
|
var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _paste.md);
|
|
@@ -126,7 +126,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
126
126
|
}),
|
|
127
127
|
props: {
|
|
128
128
|
// For serialising to plain text
|
|
129
|
-
clipboardTextSerializer: _clipboardTextSerializer.clipboardTextSerializer,
|
|
129
|
+
clipboardTextSerializer: (0, _platformFeatureFlags.fg)('platform_editor_date_to_text') ? (0, _clipboardTextSerializer.createClipboardTextSerializer)(getIntl()) : _clipboardTextSerializer.clipboardTextSerializer,
|
|
130
130
|
handleDOMEvents: {
|
|
131
131
|
// note
|
|
132
132
|
paste: function paste(view, event) {
|
|
@@ -22,8 +22,9 @@ export const pastePlugin = ({
|
|
|
22
22
|
schema,
|
|
23
23
|
providerFactory,
|
|
24
24
|
dispatchAnalyticsEvent,
|
|
25
|
-
dispatch
|
|
26
|
-
|
|
25
|
+
dispatch,
|
|
26
|
+
getIntl
|
|
27
|
+
}) => createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, getIntl, cardOptions, sanitizePrivateContent, providerFactory)
|
|
27
28
|
}, {
|
|
28
29
|
name: 'moveAnalyticsPlugin',
|
|
29
30
|
plugin: ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { timestampToString } from '@atlaskit/editor-common/utils';
|
|
1
2
|
/**
|
|
2
3
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
3
4
|
* section of the clipboard on copy.
|
|
@@ -7,6 +8,9 @@
|
|
|
7
8
|
* By default (without this function passed to the editor), the editor uses
|
|
8
9
|
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
9
10
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
11
|
+
*
|
|
12
|
+
* @todo Remove when `platform_editor_date_to_text` FF is removed.
|
|
13
|
+
* Also, rename the file to `create-clipboard-text-serializer.ts`.
|
|
10
14
|
*/
|
|
11
15
|
export function clipboardTextSerializer(slice) {
|
|
12
16
|
const blockSeparator = '\n\n';
|
|
@@ -32,4 +36,44 @@ export function clipboardTextSerializer(slice) {
|
|
|
32
36
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
33
37
|
}
|
|
34
38
|
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
43
|
+
* section of the clipboard on copy.
|
|
44
|
+
* The current implementation is bare bones - only inlineCards, blockCards and mentions are tested (they
|
|
45
|
+
* previously were empty on plain text copy).
|
|
46
|
+
*
|
|
47
|
+
* By default (without this function passed to the editor), the editor uses
|
|
48
|
+
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
49
|
+
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
50
|
+
*/
|
|
51
|
+
export function createClipboardTextSerializer(intl) {
|
|
52
|
+
return slice => {
|
|
53
|
+
const blockSeparator = '\n\n';
|
|
54
|
+
return slice.content.textBetween(0, slice.content.size, blockSeparator, leafNode => {
|
|
55
|
+
var _leafNode$text2;
|
|
56
|
+
switch (leafNode.type.name) {
|
|
57
|
+
case 'hardBreak':
|
|
58
|
+
return '\n';
|
|
59
|
+
case 'text':
|
|
60
|
+
return leafNode.text;
|
|
61
|
+
case 'inlineCard':
|
|
62
|
+
return leafNode.attrs.url;
|
|
63
|
+
case 'blockCard':
|
|
64
|
+
return leafNode.attrs.url;
|
|
65
|
+
// Note: Due to relying on an async fetch of the Mention name by the Node's React component,
|
|
66
|
+
// pasting a mention does not actually work for the in-product Mention implementation.
|
|
67
|
+
// However, this is also true of the previous implementation.
|
|
68
|
+
// Bug ticket: https://product-fabric.atlassian.net/browse/ED-23076
|
|
69
|
+
case 'mention':
|
|
70
|
+
return leafNode.attrs.text;
|
|
71
|
+
case 'date':
|
|
72
|
+
return timestampToString(leafNode.attrs.timestamp, intl);
|
|
73
|
+
default:
|
|
74
|
+
// Unsupported node
|
|
75
|
+
return (_leafNode$text2 = leafNode.text) !== null && _leafNode$text2 !== void 0 ? _leafNode$text2 : '';
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
};
|
|
35
79
|
}
|
|
@@ -20,7 +20,7 @@ import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
|
20
20
|
import { splitParagraphs, upgradeTextToLists } from '../editor-commands/commands';
|
|
21
21
|
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../pm-plugins/media';
|
|
22
22
|
import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handleNestedTablePasteWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
|
|
23
|
-
import { clipboardTextSerializer } from './clipboard-text-serializer';
|
|
23
|
+
import { createClipboardTextSerializer, clipboardTextSerializer } from './clipboard-text-serializer';
|
|
24
24
|
import { createPluginState, pluginKey as stateKey } from './plugin-factory';
|
|
25
25
|
import { escapeBackslashAndLinksExceptCodeBlock, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
|
|
26
26
|
import { handleVSCodeBlock } from './util/edge-cases/handleVSCodeBlock';
|
|
@@ -54,7 +54,7 @@ export function isSharePointUrl(url) {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
57
|
+
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, getIntl, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
58
58
|
var _pluginInjectionApi$a;
|
|
59
59
|
const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
60
60
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
@@ -91,7 +91,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
91
91
|
}),
|
|
92
92
|
props: {
|
|
93
93
|
// For serialising to plain text
|
|
94
|
-
clipboardTextSerializer,
|
|
94
|
+
clipboardTextSerializer: fg('platform_editor_date_to_text') ? createClipboardTextSerializer(getIntl()) : clipboardTextSerializer,
|
|
95
95
|
handleDOMEvents: {
|
|
96
96
|
// note
|
|
97
97
|
paste: (view, event) => {
|
package/dist/esm/pastePlugin.js
CHANGED
|
@@ -20,8 +20,9 @@ export var pastePlugin = function pastePlugin(_ref) {
|
|
|
20
20
|
var schema = _ref3.schema,
|
|
21
21
|
providerFactory = _ref3.providerFactory,
|
|
22
22
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
23
|
-
dispatch = _ref3.dispatch
|
|
24
|
-
|
|
23
|
+
dispatch = _ref3.dispatch,
|
|
24
|
+
getIntl = _ref3.getIntl;
|
|
25
|
+
return createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, getIntl, cardOptions, sanitizePrivateContent, providerFactory);
|
|
25
26
|
}
|
|
26
27
|
}, {
|
|
27
28
|
name: 'moveAnalyticsPlugin',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { timestampToString } from '@atlaskit/editor-common/utils';
|
|
1
2
|
/**
|
|
2
3
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
3
4
|
* section of the clipboard on copy.
|
|
@@ -7,6 +8,9 @@
|
|
|
7
8
|
* By default (without this function passed to the editor), the editor uses
|
|
8
9
|
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
9
10
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
11
|
+
*
|
|
12
|
+
* @todo Remove when `platform_editor_date_to_text` FF is removed.
|
|
13
|
+
* Also, rename the file to `create-clipboard-text-serializer.ts`.
|
|
10
14
|
*/
|
|
11
15
|
export function clipboardTextSerializer(slice) {
|
|
12
16
|
var blockSeparator = '\n\n';
|
|
@@ -32,4 +36,44 @@ export function clipboardTextSerializer(slice) {
|
|
|
32
36
|
return (_leafNode$text = leafNode.text) !== null && _leafNode$text !== void 0 ? _leafNode$text : '';
|
|
33
37
|
}
|
|
34
38
|
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
43
|
+
* section of the clipboard on copy.
|
|
44
|
+
* The current implementation is bare bones - only inlineCards, blockCards and mentions are tested (they
|
|
45
|
+
* previously were empty on plain text copy).
|
|
46
|
+
*
|
|
47
|
+
* By default (without this function passed to the editor), the editor uses
|
|
48
|
+
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
49
|
+
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
50
|
+
*/
|
|
51
|
+
export function createClipboardTextSerializer(intl) {
|
|
52
|
+
return function (slice) {
|
|
53
|
+
var blockSeparator = '\n\n';
|
|
54
|
+
return slice.content.textBetween(0, slice.content.size, blockSeparator, function (leafNode) {
|
|
55
|
+
var _leafNode$text2;
|
|
56
|
+
switch (leafNode.type.name) {
|
|
57
|
+
case 'hardBreak':
|
|
58
|
+
return '\n';
|
|
59
|
+
case 'text':
|
|
60
|
+
return leafNode.text;
|
|
61
|
+
case 'inlineCard':
|
|
62
|
+
return leafNode.attrs.url;
|
|
63
|
+
case 'blockCard':
|
|
64
|
+
return leafNode.attrs.url;
|
|
65
|
+
// Note: Due to relying on an async fetch of the Mention name by the Node's React component,
|
|
66
|
+
// pasting a mention does not actually work for the in-product Mention implementation.
|
|
67
|
+
// However, this is also true of the previous implementation.
|
|
68
|
+
// Bug ticket: https://product-fabric.atlassian.net/browse/ED-23076
|
|
69
|
+
case 'mention':
|
|
70
|
+
return leafNode.attrs.text;
|
|
71
|
+
case 'date':
|
|
72
|
+
return timestampToString(leafNode.attrs.timestamp, intl);
|
|
73
|
+
default:
|
|
74
|
+
// Unsupported node
|
|
75
|
+
return (_leafNode$text2 = leafNode.text) !== null && _leafNode$text2 !== void 0 ? _leafNode$text2 : '';
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
};
|
|
35
79
|
}
|
|
@@ -25,7 +25,7 @@ import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
|
25
25
|
import { splitParagraphs, upgradeTextToLists } from '../editor-commands/commands';
|
|
26
26
|
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../pm-plugins/media';
|
|
27
27
|
import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handleNestedTablePasteWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
|
|
28
|
-
import { clipboardTextSerializer } from './clipboard-text-serializer';
|
|
28
|
+
import { createClipboardTextSerializer, clipboardTextSerializer } from './clipboard-text-serializer';
|
|
29
29
|
import { createPluginState, pluginKey as stateKey } from './plugin-factory';
|
|
30
30
|
import { escapeBackslashAndLinksExceptCodeBlock, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
|
|
31
31
|
import { handleVSCodeBlock } from './util/edge-cases/handleVSCodeBlock';
|
|
@@ -57,7 +57,7 @@ export function isSharePointUrl(url) {
|
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
60
|
+
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, getIntl, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
61
61
|
var _pluginInjectionApi$a;
|
|
62
62
|
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
63
63
|
var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
@@ -117,7 +117,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
117
117
|
}),
|
|
118
118
|
props: {
|
|
119
119
|
// For serialising to plain text
|
|
120
|
-
clipboardTextSerializer: clipboardTextSerializer,
|
|
120
|
+
clipboardTextSerializer: fg('platform_editor_date_to_text') ? createClipboardTextSerializer(getIntl()) : clipboardTextSerializer,
|
|
121
121
|
handleDOMEvents: {
|
|
122
122
|
// note
|
|
123
123
|
paste: function paste(view, event) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
/**
|
|
3
4
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
@@ -8,5 +9,19 @@ import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
8
9
|
* By default (without this function passed to the editor), the editor uses
|
|
9
10
|
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
10
11
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
12
|
+
*
|
|
13
|
+
* @todo Remove when `platform_editor_date_to_text` FF is removed.
|
|
14
|
+
* Also, rename the file to `create-clipboard-text-serializer.ts`.
|
|
11
15
|
*/
|
|
12
16
|
export declare function clipboardTextSerializer(slice: Slice): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
19
|
+
* section of the clipboard on copy.
|
|
20
|
+
* The current implementation is bare bones - only inlineCards, blockCards and mentions are tested (they
|
|
21
|
+
* previously were empty on plain text copy).
|
|
22
|
+
*
|
|
23
|
+
* By default (without this function passed to the editor), the editor uses
|
|
24
|
+
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
25
|
+
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
26
|
+
*/
|
|
27
|
+
export declare function createClipboardTextSerializer(intl: IntlShape): (slice: Slice) => string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
3
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
@@ -9,4 +10,4 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
9
10
|
import type { PastePlugin } from '../index';
|
|
10
11
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
11
12
|
export declare function isSharePointUrl(url: string | undefined): boolean;
|
|
12
|
-
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
13
|
+
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
/**
|
|
3
4
|
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
@@ -8,5 +9,19 @@ import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
8
9
|
* By default (without this function passed to the editor), the editor uses
|
|
9
10
|
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
10
11
|
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
12
|
+
*
|
|
13
|
+
* @todo Remove when `platform_editor_date_to_text` FF is removed.
|
|
14
|
+
* Also, rename the file to `create-clipboard-text-serializer.ts`.
|
|
11
15
|
*/
|
|
12
16
|
export declare function clipboardTextSerializer(slice: Slice): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a plain text serialization of a given slice. This is used for populating the plain text
|
|
19
|
+
* section of the clipboard on copy.
|
|
20
|
+
* The current implementation is bare bones - only inlineCards, blockCards and mentions are tested (they
|
|
21
|
+
* previously were empty on plain text copy).
|
|
22
|
+
*
|
|
23
|
+
* By default (without this function passed to the editor), the editor uses
|
|
24
|
+
* `slice.content.textBetween(0, slice.content.size, "\n\n")`
|
|
25
|
+
* (see https://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextSerializer)
|
|
26
|
+
*/
|
|
27
|
+
export declare function createClipboardTextSerializer(intl: IntlShape): (slice: Slice) => string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
3
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
@@ -9,4 +10,4 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
9
10
|
import type { PastePlugin } from '../index';
|
|
10
11
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
11
12
|
export declare function isSharePointUrl(url: string | undefined): boolean;
|
|
12
|
-
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
13
|
+
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@atlaskit/tmp-editor-statsig": "^13.6.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
|
+
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
50
51
|
"uuid": "^3.1.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@af/visual-regression": "workspace:^",
|
|
59
|
-
"@atlaskit/editor-plugin-block-type": "^
|
|
60
|
+
"@atlaskit/editor-plugin-block-type": "^10.0.0",
|
|
60
61
|
"@atlaskit/editor-plugin-history": "^6.0.0",
|
|
61
62
|
"@atlaskit/editor-plugin-type-ahead": "^6.3.0",
|
|
62
63
|
"@atlaskit/ssr": "workspace:^",
|
|
@@ -126,6 +127,9 @@
|
|
|
126
127
|
},
|
|
127
128
|
"platform_editor_paste_code_fence_spaces": {
|
|
128
129
|
"type": "boolean"
|
|
130
|
+
},
|
|
131
|
+
"platform_editor_date_to_text": {
|
|
132
|
+
"type": "boolean"
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
}
|