@atlaskit/editor-core 185.6.5 → 185.8.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 +20 -0
- package/dist/cjs/plugins/card/index.js +14 -0
- package/dist/cjs/plugins/card/nodeviews/datasource.js +2 -4
- package/dist/cjs/plugins/card/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +46 -0
- package/dist/cjs/plugins/card/toolbar.js +4 -5
- package/dist/cjs/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +24 -20
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +2 -2
- package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +2 -2
- package/dist/cjs/plugins/card/utils.js +2 -30
- package/dist/cjs/plugins/hyperlink/Toolbar.js +18 -30
- package/dist/cjs/plugins/hyperlink/commands.js +7 -3
- package/dist/cjs/plugins/hyperlink/index.js +9 -2
- package/dist/cjs/plugins/hyperlink/pm-plugins/toolbar-buttons.js +41 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +6 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +8 -4
- package/dist/cjs/plugins/media/index.js +9 -1
- package/dist/cjs/plugins/media/toolbar/index.js +3 -3
- package/dist/cjs/plugins/media/utils/media-common.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +12 -12
- package/dist/cjs/plugins/paste/index.js +1 -1
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +12 -8
- package/dist/cjs/plugins/paste/pm-plugins/main.js +18 -17
- package/dist/cjs/plugins/paste/util/index.js +29 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -4
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/index.js +12 -0
- package/dist/es2019/plugins/card/nodeviews/datasource.js +1 -2
- package/dist/es2019/plugins/card/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +36 -0
- package/dist/es2019/plugins/card/toolbar.js +4 -3
- package/dist/es2019/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +12 -13
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +1 -1
- package/dist/es2019/plugins/card/utils.js +0 -28
- package/dist/es2019/plugins/hyperlink/Toolbar.js +21 -30
- package/dist/es2019/plugins/hyperlink/commands.js +6 -3
- package/dist/es2019/plugins/hyperlink/index.js +9 -2
- package/dist/es2019/plugins/hyperlink/pm-plugins/toolbar-buttons.js +37 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +11 -4
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +13 -5
- package/dist/es2019/plugins/media/index.js +10 -2
- package/dist/es2019/plugins/media/toolbar/index.js +1 -1
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +12 -13
- package/dist/es2019/plugins/paste/index.js +1 -1
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +24 -12
- package/dist/es2019/plugins/paste/pm-plugins/main.js +11 -10
- package/dist/es2019/plugins/paste/util/index.js +28 -1
- package/dist/es2019/ui/ContentStyles/index.js +1 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/index.js +14 -0
- package/dist/esm/plugins/card/nodeviews/datasource.js +1 -2
- package/dist/esm/plugins/card/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +38 -0
- package/dist/esm/plugins/card/toolbar.js +4 -3
- package/dist/esm/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.js +5 -3
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +14 -13
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -1
- package/dist/esm/plugins/card/ui/SmallerEditIcon.js +1 -1
- package/dist/esm/plugins/card/utils.js +0 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +19 -30
- package/dist/esm/plugins/hyperlink/commands.js +6 -3
- package/dist/esm/plugins/hyperlink/index.js +9 -2
- package/dist/esm/plugins/hyperlink/pm-plugins/toolbar-buttons.js +32 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +7 -4
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +9 -5
- package/dist/esm/plugins/media/index.js +10 -2
- package/dist/esm/plugins/media/toolbar/index.js +1 -1
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +12 -13
- package/dist/esm/plugins/paste/index.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +12 -8
- package/dist/esm/plugins/paste/pm-plugins/main.js +11 -10
- package/dist/esm/plugins/paste/util/index.js +27 -1
- package/dist/esm/ui/ContentStyles/index.js +1 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +6 -0
- package/dist/types/labs/next/presets/default.d.ts +12 -0
- package/dist/types/labs/next/presets/mobile.d.ts +6 -0
- package/dist/types/plugins/card/index.d.ts +5 -1
- package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -1
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -1
- package/dist/types/plugins/card/types.d.ts +2 -3
- package/dist/types/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +7 -5
- package/dist/types/plugins/card/utils.d.ts +1 -3
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +3 -2
- package/dist/types/plugins/hyperlink/commands.d.ts +2 -0
- package/dist/types/plugins/hyperlink/index.d.ts +11 -0
- package/dist/types/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +19 -0
- package/dist/types/plugins/paste/handlers.d.ts +6 -5
- package/dist/types/plugins/paste/index.d.ts +6 -2
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +6 -5
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/paste/util/index.d.ts +2 -0
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +6 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +12 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +6 -0
- package/dist/types-ts4.5/plugins/card/index.d.ts +5 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/{hyperlink → card/ui}/HyperlinkToolbarAppearance.d.ts +2 -0
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +7 -5
- package/dist/types-ts4.5/plugins/card/utils.d.ts +1 -3
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -0
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +19 -0
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +6 -5
- package/dist/types-ts4.5/plugins/paste/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +6 -5
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/plugins/paste/util/index.d.ts +2 -0
- package/package.json +12 -9
- package/dist/cjs/plugins/card/messages.js +0 -90
- package/dist/cjs/plugins/card/styles.js +0 -18
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +0 -63
- package/dist/cjs/plugins/card/ui/assets/card.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/embed.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/inline.js +0 -30
- package/dist/cjs/plugins/card/ui/assets/url.js +0 -32
- package/dist/cjs/plugins/card/ui/link-toolbar-button-group-options.js +0 -52
- package/dist/cjs/plugins/card/ui/styled.js +0 -16
- package/dist/cjs/plugins/card/ui/types.js +0 -5
- package/dist/es2019/plugins/card/messages.js +0 -83
- package/dist/es2019/plugins/card/styles.js +0 -132
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +0 -61
- package/dist/es2019/plugins/card/ui/assets/card.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/embed.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/inline.js +0 -22
- package/dist/es2019/plugins/card/ui/assets/url.js +0 -24
- package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +0 -45
- package/dist/es2019/plugins/card/ui/styled.js +0 -27
- package/dist/es2019/plugins/card/ui/types.js +0 -1
- package/dist/esm/plugins/card/messages.js +0 -83
- package/dist/esm/plugins/card/styles.js +0 -10
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +0 -56
- package/dist/esm/plugins/card/ui/assets/card.js +0 -22
- package/dist/esm/plugins/card/ui/assets/embed.js +0 -22
- package/dist/esm/plugins/card/ui/assets/inline.js +0 -22
- package/dist/esm/plugins/card/ui/assets/url.js +0 -24
- package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +0 -45
- package/dist/esm/plugins/card/ui/styled.js +0 -6
- package/dist/esm/plugins/card/ui/types.js +0 -1
- package/dist/types/plugins/card/messages.d.ts +0 -82
- package/dist/types/plugins/card/styles.d.ts +0 -2
- package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +0 -16
- package/dist/types/plugins/card/ui/assets/card.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/embed.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/inline.d.ts +0 -3
- package/dist/types/plugins/card/ui/assets/url.d.ts +0 -3
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +0 -5
- package/dist/types/plugins/card/ui/styled.d.ts +0 -3
- package/dist/types/plugins/card/ui/types.d.ts +0 -12
- package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -82
- package/dist/types-ts4.5/plugins/card/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarButtonGroup.d.ts +0 -16
- package/dist/types-ts4.5/plugins/card/ui/assets/card.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/embed.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/inline.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/assets/url.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +0 -5
- package/dist/types-ts4.5/plugins/card/ui/styled.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/ui/types.d.ts +0 -12
|
@@ -7,7 +7,6 @@ import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
|
7
7
|
import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell, isInListItem } from '../../utils';
|
|
8
8
|
import { mapSlice } from '../../utils/slice';
|
|
9
9
|
import { INPUT_METHOD } from '../analytics';
|
|
10
|
-
import { queueCardsFromChangedTr } from '../card/pm-plugins/doc';
|
|
11
10
|
import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
|
|
12
11
|
import { linkifyContent } from '@atlaskit/editor-common/utils';
|
|
13
12
|
import { runMacroAutoConvert } from '../macro';
|
|
@@ -20,7 +19,6 @@ import { insertSliceForLists } from './edge-cases';
|
|
|
20
19
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
21
20
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
22
21
|
import { doesSelectionWhichStartsOrEndsInListContainEntireList } from '../../utils/lists';
|
|
23
|
-
|
|
24
22
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
25
23
|
export function handleMention(slice, schema) {
|
|
26
24
|
return mapSlice(slice, node => {
|
|
@@ -35,7 +33,7 @@ export function handleMention(slice, schema) {
|
|
|
35
33
|
return node;
|
|
36
34
|
});
|
|
37
35
|
}
|
|
38
|
-
export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
36
|
+
export function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
|
|
39
37
|
return (state, dispatch) => {
|
|
40
38
|
var _slice$content$firstC, _transformedSlice$con;
|
|
41
39
|
const {
|
|
@@ -109,7 +107,7 @@ export function handlePasteIntoTaskOrDecisionOrPanel(slice) {
|
|
|
109
107
|
// This maintains both the selection (destination) and the slice (paste content).
|
|
110
108
|
safeInsert(transformedSlice.content)(tr).scrollIntoView();
|
|
111
109
|
}
|
|
112
|
-
queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
110
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
113
111
|
if (dispatch) {
|
|
114
112
|
dispatch(tr);
|
|
115
113
|
}
|
|
@@ -345,7 +343,7 @@ export function handlePasteAsPlainText(slice, _event) {
|
|
|
345
343
|
return false;
|
|
346
344
|
};
|
|
347
345
|
}
|
|
348
|
-
export function handlePastePreservingMarks(slice) {
|
|
346
|
+
export function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
|
|
349
347
|
return (state, dispatch) => {
|
|
350
348
|
const {
|
|
351
349
|
schema,
|
|
@@ -389,7 +387,7 @@ export function handlePastePreservingMarks(slice) {
|
|
|
389
387
|
// special case for plainTextSlice & linkMark: merge into existing link
|
|
390
388
|
if (isPlainTextSlice && linkMark.isInSet(selectionMarks) && selectionMarks.length === 1) {
|
|
391
389
|
const tr = closeHistory(state.tr).replaceSelectionWith(slice.content.firstChild.firstChild, true).setStoredMarks(selectionMarks).scrollIntoView();
|
|
392
|
-
queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
390
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
393
391
|
if (dispatch) {
|
|
394
392
|
dispatch(tr);
|
|
395
393
|
}
|
|
@@ -401,7 +399,7 @@ export function handlePastePreservingMarks(slice) {
|
|
|
401
399
|
if (hasOnlyNodesOfType(bulletList, hardBreak, heading, listItem, paragraph, text, emoji, mention, orderedList)(slice)) {
|
|
402
400
|
const transformedSlice = applyTextMarksToSlice(schema, selectionMarks)(slice);
|
|
403
401
|
const tr = closeHistory(state.tr).replaceSelection(transformedSlice).setStoredMarks(selectionMarks).scrollIntoView();
|
|
404
|
-
queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
402
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
405
403
|
if (dispatch) {
|
|
406
404
|
dispatch(tr);
|
|
407
405
|
}
|
|
@@ -439,7 +437,7 @@ function insertAutoMacro(slice, macro, view, from, to) {
|
|
|
439
437
|
}
|
|
440
438
|
return false;
|
|
441
439
|
}
|
|
442
|
-
export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverter) {
|
|
440
|
+
export function handleMacroAutoConvert(text, slice, queueCardsFromChangedTr, cardsOptions, extensionAutoConverter) {
|
|
443
441
|
return (state, dispatch, view) => {
|
|
444
442
|
let macro = null;
|
|
445
443
|
|
|
@@ -480,7 +478,7 @@ export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoC
|
|
|
480
478
|
pastedMacroPositions
|
|
481
479
|
} = getPastePluginState(view.state);
|
|
482
480
|
if (dispatch) {
|
|
483
|
-
handleMarkdown(slice, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
|
|
481
|
+
handleMarkdown(slice, queueCardsFromChangedTr, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
|
|
484
482
|
}
|
|
485
483
|
}).catch(() => {
|
|
486
484
|
const {
|
|
@@ -596,7 +594,7 @@ export function handleExpandPasteInTable(slice) {
|
|
|
596
594
|
return false;
|
|
597
595
|
};
|
|
598
596
|
}
|
|
599
|
-
export function handleMarkdown(markdownSlice, from, to) {
|
|
597
|
+
export function handleMarkdown(markdownSlice, queueCardsFromChangedTr, from, to) {
|
|
600
598
|
return (state, dispatch) => {
|
|
601
599
|
const tr = closeHistory(state.tr);
|
|
602
600
|
const pastesFrom = typeof from === 'number' ? from : tr.selection.from;
|
|
@@ -606,7 +604,7 @@ export function handleMarkdown(markdownSlice, from, to) {
|
|
|
606
604
|
tr.replaceSelection(markdownSlice);
|
|
607
605
|
}
|
|
608
606
|
tr.setSelection(TextSelection.near(tr.doc.resolve(pastesFrom + markdownSlice.size), -1));
|
|
609
|
-
queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
607
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
610
608
|
if (dispatch) {
|
|
611
609
|
dispatch(tr.scrollIntoView());
|
|
612
610
|
}
|
|
@@ -748,7 +746,7 @@ export function flattenNestedListInSlice(slice) {
|
|
|
748
746
|
const contentWithFlattenedList = slice.content.replaceChild(0, listToFlatten.type.createChecked(listToFlatten.attrs, leafListItems));
|
|
749
747
|
return new Slice(contentWithFlattenedList, slice.openEnd, slice.openEnd);
|
|
750
748
|
}
|
|
751
|
-
export function handleRichText(slice) {
|
|
749
|
+
export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
752
750
|
return (state, dispatch) => {
|
|
753
751
|
var _slice$content, _slice$content2, _firstChildOfSlice$ty, _lastChildOfSlice$typ, _panelParentOverCurre;
|
|
754
752
|
const {
|
|
@@ -825,8 +823,9 @@ export function handleRichText(slice) {
|
|
|
825
823
|
tr.scrollIntoView();
|
|
826
824
|
|
|
827
825
|
// queue link cards, ignoring any errors
|
|
826
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
|
|
828
827
|
if (dispatch) {
|
|
829
|
-
dispatch(
|
|
828
|
+
dispatch(tr);
|
|
830
829
|
}
|
|
831
830
|
return true;
|
|
832
831
|
};
|
|
@@ -15,7 +15,7 @@ const pastePlugin = ({
|
|
|
15
15
|
providerFactory,
|
|
16
16
|
dispatchAnalyticsEvent,
|
|
17
17
|
dispatch
|
|
18
|
-
}) => createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory)
|
|
18
|
+
}) => createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, api, cardOptions, sanitizePrivateContent, providerFactory)
|
|
19
19
|
}];
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -226,9 +226,12 @@ export const handlePasteAsPlainTextWithAnalytics = (view, event, slice) => injec
|
|
|
226
226
|
type: PasteTypes.plain,
|
|
227
227
|
asPlain: true
|
|
228
228
|
}))(handlePasteAsPlainText(slice, event));
|
|
229
|
-
export const handlePasteIntoTaskAndDecisionWithAnalytics = (view, event, slice, type) =>
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
export const handlePasteIntoTaskAndDecisionWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
|
|
230
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
231
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
232
|
+
type
|
|
233
|
+
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.queueCardsFromChangedTr));
|
|
234
|
+
};
|
|
232
235
|
export const handlePasteIntoCaptionWithAnalytics = (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
233
236
|
type
|
|
234
237
|
}))(handlePasteIntoCaption(slice));
|
|
@@ -238,15 +241,24 @@ export const handleCodeBlockWithAnalytics = (view, event, slice, text) => inject
|
|
|
238
241
|
export const handleMediaSingleWithAnalytics = (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
239
242
|
type
|
|
240
243
|
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD)(slice));
|
|
241
|
-
export const handlePastePreservingMarksWithAnalytics = (view, event, slice, type) =>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
export const
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
export const handlePastePreservingMarksWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
|
|
245
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
246
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
247
|
+
type
|
|
248
|
+
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.queueCardsFromChangedTr));
|
|
249
|
+
};
|
|
250
|
+
export const handleMarkdownWithAnalytics = (view, event, slice, pluginInjectionApi) => {
|
|
251
|
+
var _pluginInjectionApi$d5, _pluginInjectionApi$d6;
|
|
252
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
253
|
+
type: PasteTypes.markdown
|
|
254
|
+
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d5 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : (_pluginInjectionApi$d6 = _pluginInjectionApi$d5.actions) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.queueCardsFromChangedTr));
|
|
255
|
+
};
|
|
256
|
+
export const handleRichTextWithAnalytics = (view, event, slice, pluginInjectionApi) => {
|
|
257
|
+
var _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
258
|
+
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
259
|
+
type: PasteTypes.richText
|
|
260
|
+
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.actions) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.queueCardsFromChangedTr));
|
|
261
|
+
};
|
|
250
262
|
function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
251
263
|
return mainCommand => {
|
|
252
264
|
return (state, dispatch, view) => {
|
|
@@ -7,7 +7,7 @@ import { mapChildren } from '../../../utils/slice';
|
|
|
7
7
|
import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
|
|
8
8
|
import * as clipboard from '../../../utils/clipboard';
|
|
9
9
|
import { transformSliceForMedia } from '../../media/utils/media-single';
|
|
10
|
-
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks } from '../util';
|
|
10
|
+
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
11
11
|
import { linkifyContent } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
13
13
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
@@ -19,7 +19,6 @@ import { measureRender } from '@atlaskit/editor-common/utils';
|
|
|
19
19
|
import { transformSliceToCorrectMediaWrapper, unwrapNestedMediaElements } from '../../media/utils/media-common';
|
|
20
20
|
import { upgradeTextToLists, splitParagraphs } from '../../list/transforms';
|
|
21
21
|
import { md } from '@atlaskit/editor-common/paste';
|
|
22
|
-
import { transformUnsupportedBlockCardToInline } from '../../card/utils';
|
|
23
22
|
import { transformSliceToDecisionList } from '../../tasks-and-decisions/utils';
|
|
24
23
|
import { containsAnyAnnotations, stripNonExistingAnnotations } from '../../annotation/utils';
|
|
25
24
|
import { pluginKey as betterTypePluginKey } from '../../base/pm-plugins/better-type-history';
|
|
@@ -30,7 +29,7 @@ import { extractSliceFromStep } from '../../../utils/step';
|
|
|
30
29
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
31
30
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
32
31
|
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
33
|
-
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
32
|
+
export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
|
|
34
33
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
35
34
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
36
35
|
let textInput = text;
|
|
@@ -208,13 +207,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
208
207
|
// force a "paste as plain text" action by clearing the markdownSlice.
|
|
209
208
|
markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
|
|
210
209
|
if (markdownSlice) {
|
|
210
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
211
211
|
// linkify text prior to converting to macro
|
|
212
212
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
213
213
|
return true;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// run macro autoconvert prior to other conversions
|
|
217
|
-
if (handleMacroAutoConvert(text, markdownSlice, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
217
|
+
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
218
218
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
219
219
|
sendPasteAnalyticsEvent(view, event, markdownSlice, {
|
|
220
220
|
type: PasteTypes.markdown
|
|
@@ -237,7 +237,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
237
237
|
if (slice.openStart === 0 && selectionParentNode && edgeCaseNodeTypes.includes(selectionParentType)) {
|
|
238
238
|
slice.openStart = 1;
|
|
239
239
|
}
|
|
240
|
-
if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText)(state, dispatch)) {
|
|
240
|
+
if (handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, isPlainText ? PasteTypes.plain : PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
241
241
|
return true;
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -254,10 +254,10 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
254
254
|
|
|
255
255
|
// If the clipboard only contains plain text, attempt to parse it as Markdown
|
|
256
256
|
if (isPlainText && markdownSlice) {
|
|
257
|
-
if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
257
|
+
if (handlePastePreservingMarksWithAnalytics(view, event, markdownSlice, PasteTypes.markdown, pluginInjectionApi)(state, dispatch)) {
|
|
258
258
|
return true;
|
|
259
259
|
}
|
|
260
|
-
return handleMarkdownWithAnalytics(view, event, markdownSlice)(state, dispatch);
|
|
260
|
+
return handleMarkdownWithAnalytics(view, event, markdownSlice, pluginInjectionApi)(state, dispatch);
|
|
261
261
|
}
|
|
262
262
|
if (isRichText && isInsideBlockQuote(state)) {
|
|
263
263
|
//If pasting inside blockquote
|
|
@@ -280,6 +280,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
280
280
|
|
|
281
281
|
// finally, handle rich-text copy-paste
|
|
282
282
|
if (isRichText) {
|
|
283
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
283
284
|
// linkify the text where possible
|
|
284
285
|
slice = linkifyContent(state.schema)(slice);
|
|
285
286
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
@@ -287,7 +288,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
// run macro autoconvert prior to other conversions
|
|
290
|
-
if (handleMacroAutoConvert(text, slice, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
291
|
+
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
291
292
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
292
293
|
sendPasteAnalyticsEvent(view, event, slice, {
|
|
293
294
|
type: PasteTypes.richText
|
|
@@ -311,7 +312,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
// ED-4732
|
|
314
|
-
if (handlePastePreservingMarksWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
315
|
+
if (handlePastePreservingMarksWithAnalytics(view, event, slice, PasteTypes.richText, pluginInjectionApi)(state, dispatch)) {
|
|
315
316
|
return true;
|
|
316
317
|
}
|
|
317
318
|
|
|
@@ -347,7 +348,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
347
348
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
348
349
|
return true;
|
|
349
350
|
}
|
|
350
|
-
return handleRichTextWithAnalytics(view, event, slice)(state, dispatch);
|
|
351
|
+
return handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi)(state, dispatch);
|
|
351
352
|
}
|
|
352
353
|
return false;
|
|
353
354
|
},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Slice, Mark } from 'prosemirror-model';
|
|
1
|
+
import { Slice, Mark, Fragment } from 'prosemirror-model';
|
|
2
2
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
3
3
|
import { ACTION_SUBJECT, addAnalytics, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '../../analytics';
|
|
4
4
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
5
5
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
6
6
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { sortByOrderWithTypeName } from '../../../create-editor/sort-by-order';
|
|
8
|
+
import { isSupportedInParent, mapChildren } from '@atlaskit/editor-common/utils';
|
|
8
9
|
export function isPastedFromWord(html) {
|
|
9
10
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
|
|
10
11
|
}
|
|
@@ -179,4 +180,30 @@ export const addReplaceSelectedTableAnalytics = (state, tr) => {
|
|
|
179
180
|
return tr;
|
|
180
181
|
}
|
|
181
182
|
return state.tr;
|
|
183
|
+
};
|
|
184
|
+
export const transformUnsupportedBlockCardToInline = (slice, state, cardOptions) => {
|
|
185
|
+
const {
|
|
186
|
+
blockCard,
|
|
187
|
+
inlineCard
|
|
188
|
+
} = state.schema.nodes;
|
|
189
|
+
const children = [];
|
|
190
|
+
mapChildren(slice.content, (node, i, frag) => {
|
|
191
|
+
var _cardOptions$allowBlo;
|
|
192
|
+
if (node.type === blockCard && !isBlockCardSupported(state, frag, (_cardOptions$allowBlo = cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards) !== null && _cardOptions$allowBlo !== void 0 ? _cardOptions$allowBlo : false)) {
|
|
193
|
+
children.push(inlineCard.createChecked(node.attrs, node.content, node.marks));
|
|
194
|
+
} else {
|
|
195
|
+
children.push(node);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return new Slice(Fragment.fromArray(children), slice.openStart, slice.openEnd);
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Function to determine if a block card is supported by the editor
|
|
202
|
+
* @param state
|
|
203
|
+
* @param frag
|
|
204
|
+
* @param allowBlockCards
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
const isBlockCardSupported = (state, frag, allowBlockCards) => {
|
|
208
|
+
return allowBlockCards && isSupportedInParent(state, frag);
|
|
182
209
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { jsx, css, useTheme } from '@emotion/react';
|
|
4
|
-
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles, smartCardStyles, embedCardStyles } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { editorFontSize } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
|
|
7
7
|
import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
@@ -27,9 +27,7 @@ import { ClassNames } from '../../plugins/media/pm-plugins/alt-text/style';
|
|
|
27
27
|
import { findReplaceStyles } from '../../plugins/find-replace/styles';
|
|
28
28
|
import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
|
|
29
29
|
import { statusStyles } from '../../plugins/status/styles';
|
|
30
|
-
import { smartCardStyles } from '../../plugins/card/styles';
|
|
31
30
|
import { dateStyles } from '../../plugins/date/styles';
|
|
32
|
-
import { embedCardStyles } from '../../plugins/card/ui/styled';
|
|
33
31
|
import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
|
|
34
32
|
const contentStyles = props => css`
|
|
35
33
|
.ProseMirror {
|
package/dist/es2019/version.json
CHANGED
|
@@ -7,9 +7,12 @@ import { createPlugin } from './pm-plugins/main';
|
|
|
7
7
|
import { floatingToolbar } from './toolbar';
|
|
8
8
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
9
9
|
import { cardKeymap } from './pm-plugins/keymap';
|
|
10
|
+
import { queueCardsFromChangedTr, changeSelectedCardToLink, setSelectedCardAppearance } from './pm-plugins/doc';
|
|
11
|
+
import { hideLinkToolbar } from './pm-plugins/actions';
|
|
10
12
|
import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
|
|
11
13
|
import LayoutButton from './ui/LayoutButton';
|
|
12
14
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
15
|
+
import { mountHyperlinkPlugin } from './pm-plugins/mountHyperlink';
|
|
13
16
|
var cardPlugin = function cardPlugin(options, api) {
|
|
14
17
|
var _api$dependencies, _api$dependencies$fea;
|
|
15
18
|
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
@@ -53,6 +56,11 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
53
56
|
allowWrapping: allowWrapping,
|
|
54
57
|
allowAlignment: allowAlignment
|
|
55
58
|
}), api)
|
|
59
|
+
}, {
|
|
60
|
+
name: 'cardHyperlink',
|
|
61
|
+
plugin: function plugin() {
|
|
62
|
+
return mountHyperlinkPlugin(api, options);
|
|
63
|
+
}
|
|
56
64
|
}];
|
|
57
65
|
plugins.push({
|
|
58
66
|
name: 'cardKeymap',
|
|
@@ -81,6 +89,12 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
81
89
|
boundariesElement: popupsBoundariesElement
|
|
82
90
|
}));
|
|
83
91
|
},
|
|
92
|
+
actions: {
|
|
93
|
+
hideLinkToolbar: hideLinkToolbar,
|
|
94
|
+
queueCardsFromChangedTr: queueCardsFromChangedTr,
|
|
95
|
+
changeSelectedCardToLink: changeSelectedCardToLink,
|
|
96
|
+
setSelectedCardAppearance: setSelectedCardAppearance
|
|
97
|
+
},
|
|
84
98
|
pluginsOptions: {
|
|
85
99
|
floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api)
|
|
86
100
|
}
|
|
@@ -15,9 +15,8 @@ import PropTypes from 'prop-types';
|
|
|
15
15
|
import { css, jsx } from '@emotion/react';
|
|
16
16
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
17
17
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
18
|
-
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
18
|
+
import { SmartCardSharedCssClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
19
19
|
import { calcBreakoutWidthPx } from '@atlaskit/editor-common/utils';
|
|
20
|
-
export var DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
|
|
21
20
|
var containerStyles = css({
|
|
22
21
|
height: '500px',
|
|
23
22
|
overflow: 'auto'
|
|
@@ -11,7 +11,8 @@ import reducer from './reducers';
|
|
|
11
11
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
12
12
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
13
13
|
import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
|
|
14
|
-
import {
|
|
14
|
+
import { Datasource } from '../nodeviews/datasource';
|
|
15
|
+
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
15
16
|
import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
|
|
16
17
|
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
17
18
|
export { pluginKey } from './plugin-key';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
|
|
4
|
+
export var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
5
|
+
return new SafePlugin({
|
|
6
|
+
view: function view(editorView) {
|
|
7
|
+
requestAnimationFrame(function () {
|
|
8
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
9
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.hyperlink) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.prependToolbarButtons({
|
|
10
|
+
items: function items(state, intl, providerFactory, link) {
|
|
11
|
+
return [{
|
|
12
|
+
type: 'custom',
|
|
13
|
+
fallback: [],
|
|
14
|
+
render: function render(editorView) {
|
|
15
|
+
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
16
|
+
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
|
|
17
|
+
key: "link-appearance",
|
|
18
|
+
url: link,
|
|
19
|
+
intl: intl,
|
|
20
|
+
editorView: editorView,
|
|
21
|
+
editorState: state,
|
|
22
|
+
cardOptions: options,
|
|
23
|
+
providerFactory: providerFactory,
|
|
24
|
+
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
25
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions,
|
|
26
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}];
|
|
30
|
+
},
|
|
31
|
+
onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions.hideLinkToolbar,
|
|
32
|
+
view: editorView
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -19,8 +19,8 @@ import { editDatasource, buildEditLinkToolbar, editLink, editLinkToolbarConfig,
|
|
|
19
19
|
import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNodeType } from './utils';
|
|
20
20
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
21
21
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
22
|
-
import { messages } from '
|
|
23
|
-
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from '
|
|
22
|
+
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
23
|
+
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
24
24
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
25
25
|
import { SmallerEditIcon } from './ui/SmallerEditIcon';
|
|
26
26
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
@@ -277,7 +277,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
277
277
|
allowEmbeds: allowEmbeds,
|
|
278
278
|
allowBlockCards: allowBlockCards,
|
|
279
279
|
platform: platform,
|
|
280
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
280
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
281
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions
|
|
281
282
|
});
|
|
282
283
|
}
|
|
283
284
|
}, {
|
|
@@ -11,7 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { Component } from 'react';
|
|
14
|
-
import { LinkToolbarAppearance } from '
|
|
14
|
+
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
15
15
|
export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
16
16
|
_inherits(HyperlinkToolbarAppearance, _Component);
|
|
17
17
|
var _super = _createSuper(HyperlinkToolbarAppearance);
|
|
@@ -139,7 +139,8 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
139
139
|
editorState = _this$props.editorState,
|
|
140
140
|
cardOptions = _this$props.cardOptions,
|
|
141
141
|
platform = _this$props.platform,
|
|
142
|
-
editorAnalyticsApi = _this$props.editorAnalyticsApi
|
|
142
|
+
editorAnalyticsApi = _this$props.editorAnalyticsApi,
|
|
143
|
+
cardActions = _this$props.cardActions;
|
|
143
144
|
var supportedUrlsMap = this.state.supportedUrlsMap;
|
|
144
145
|
if (!supportedUrlsMap.get(url)) {
|
|
145
146
|
return null;
|
|
@@ -153,7 +154,8 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
153
154
|
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
154
155
|
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
155
156
|
platform: platform,
|
|
156
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
157
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
158
|
+
cardActions: cardActions
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
}]);
|
|
@@ -9,17 +9,13 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
import
|
|
12
|
+
import React from 'react';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import { Fragment } from 'prosemirror-model';
|
|
15
|
-
import
|
|
16
|
-
import nodeNames from '@atlaskit/editor-common/messages';
|
|
15
|
+
import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
17
17
|
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
18
|
-
import {
|
|
19
|
-
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
20
|
-
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
21
|
-
import { getButtonGroupOption } from './link-toolbar-button-group-options';
|
|
22
|
-
import { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
|
|
18
|
+
import { getButtonGroupOption, LinkToolbarButtonGroup, commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
23
19
|
export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
24
20
|
_inherits(LinkToolbarAppearance, _React$Component);
|
|
25
21
|
var _super = _createSuper(LinkToolbarAppearance);
|
|
@@ -31,6 +27,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
31
27
|
}
|
|
32
28
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
29
|
_defineProperty(_assertThisInitialized(_this), "renderDropdown", function (view, cardContext) {
|
|
30
|
+
var _cardActions$setSelec, _cardActions$setSelec2, _cardActions$changeSe, _cardActions$setSelec3;
|
|
34
31
|
var _this$props = _this.props,
|
|
35
32
|
url = _this$props.url,
|
|
36
33
|
intl = _this$props.intl,
|
|
@@ -40,8 +37,12 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
40
37
|
_this$props$allowBloc = _this$props.allowBlockCards,
|
|
41
38
|
allowBlockCards = _this$props$allowBloc === void 0 ? true : _this$props$allowBloc,
|
|
42
39
|
platform = _this$props.platform,
|
|
43
|
-
editorAnalyticsApi = _this$props.editorAnalyticsApi
|
|
40
|
+
editorAnalyticsApi = _this$props.editorAnalyticsApi,
|
|
41
|
+
cardActions = _this$props.cardActions;
|
|
44
42
|
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
|
|
43
|
+
var defaultCommand = function defaultCommand() {
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
45
46
|
if (url) {
|
|
46
47
|
var _cardContext$store, _urlState$error;
|
|
47
48
|
var urlState = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
|
|
@@ -54,7 +55,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
54
55
|
var embedOption = allowEmbeds && preview && {
|
|
55
56
|
appearance: 'embed',
|
|
56
57
|
title: intl.formatMessage(messages.embed),
|
|
57
|
-
onClick: setSelectedCardAppearance('embed', editorAnalyticsApi),
|
|
58
|
+
onClick: (_cardActions$setSelec = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('embed', editorAnalyticsApi)) !== null && _cardActions$setSelec !== void 0 ? _cardActions$setSelec : defaultCommand,
|
|
58
59
|
selected: currentAppearance === 'embed',
|
|
59
60
|
hidden: false,
|
|
60
61
|
testId: 'embed-appearance',
|
|
@@ -64,7 +65,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
64
65
|
var blockCardOption = allowBlockCards && {
|
|
65
66
|
appearance: 'block',
|
|
66
67
|
title: intl.formatMessage(messages.block),
|
|
67
|
-
onClick: setSelectedCardAppearance('block', editorAnalyticsApi),
|
|
68
|
+
onClick: (_cardActions$setSelec2 = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('block', editorAnalyticsApi)) !== null && _cardActions$setSelec2 !== void 0 ? _cardActions$setSelec2 : defaultCommand,
|
|
68
69
|
selected: currentAppearance === 'block',
|
|
69
70
|
testId: 'block-appearance',
|
|
70
71
|
disabled: !isBlockCardLinkSupportedInParent,
|
|
@@ -72,7 +73,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
72
73
|
};
|
|
73
74
|
var options = [{
|
|
74
75
|
title: intl.formatMessage(messages.url),
|
|
75
|
-
onClick: commandWithMetadata(changeSelectedCardToLink(url, url, true, undefined, undefined, editorAnalyticsApi), {
|
|
76
|
+
onClick: commandWithMetadata((_cardActions$changeSe = cardActions === null || cardActions === void 0 ? void 0 : cardActions.changeSelectedCardToLink(url, url, true, undefined, undefined, editorAnalyticsApi)) !== null && _cardActions$changeSe !== void 0 ? _cardActions$changeSe : defaultCommand, {
|
|
76
77
|
action: ACTION.CHANGED_TYPE
|
|
77
78
|
}),
|
|
78
79
|
selected: !currentAppearance,
|
|
@@ -80,7 +81,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
80
81
|
}, {
|
|
81
82
|
appearance: 'inline',
|
|
82
83
|
title: intl.formatMessage(messages.inline),
|
|
83
|
-
onClick: setSelectedCardAppearance('inline', editorAnalyticsApi),
|
|
84
|
+
onClick: (_cardActions$setSelec3 = cardActions === null || cardActions === void 0 ? void 0 : cardActions.setSelectedCardAppearance('inline', editorAnalyticsApi)) !== null && _cardActions$setSelec3 !== void 0 ? _cardActions$setSelec3 : defaultCommand,
|
|
84
85
|
selected: currentAppearance === 'inline',
|
|
85
86
|
testId: 'inline-appearance'
|
|
86
87
|
}];
|
|
@@ -18,7 +18,7 @@ import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } f
|
|
|
18
18
|
import { akEditorMediaResizeHandlerPaddingWide, akEditorBreakoutPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
20
20
|
import { wrapperStyle, Resizer, handleSides, imageAlignmentMap, snapTo, calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
21
|
-
import { embedSpacingStyles } from '
|
|
21
|
+
import { embedSpacingStyles } from '@atlaskit/editor-common/styles';
|
|
22
22
|
var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
23
23
|
_inherits(ResizableEmbedCard, _React$Component);
|
|
24
24
|
var _super = _createSuper(ResizableEmbedCard);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import EditIcon from '@atlaskit/icon/glyph/edit';
|
|
4
|
-
import { editIconStyles } from '
|
|
4
|
+
import { editIconStyles } from '@atlaskit/editor-common/styles';
|
|
5
5
|
export var SmallerEditIcon = function SmallerEditIcon() {
|
|
6
6
|
return jsx("div", {
|
|
7
7
|
css: editIconStyles
|