@atlaskit/editor-core 185.1.6 → 185.2.2
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 +13 -0
- package/dist/cjs/actions/index.js +2 -2
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -2
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/cjs/messages.js +6 -56
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +2 -2
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/card/pm-plugins/doc.js +9 -11
- package/dist/cjs/plugins/card/pm-plugins/keymap.js +3 -6
- package/dist/cjs/plugins/card/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/card/toolbar.js +12 -15
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -6
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +7 -10
- package/dist/cjs/plugins/card/utils.js +3 -4
- package/dist/cjs/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/cjs/plugins/custom-autoformat/doc.js +1 -1
- package/dist/cjs/plugins/date/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/emoji/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/Toolbar.js +8 -8
- package/dist/cjs/plugins/hyperlink/commands.js +2 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/cjs/plugins/layout/actions.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -2
- package/dist/cjs/plugins/media/toolbar/index.js +9 -8
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -3
- package/dist/cjs/plugins/media/toolbar/linking.js +3 -3
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +6 -8
- package/dist/cjs/plugins/media/utils/media-files.js +8 -7
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/placeholder/index.js +2 -3
- package/dist/cjs/plugins/status/plugin.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +3 -3
- package/dist/cjs/ui/Appearance/Chromeless.js +4 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/Mobile.js +4 -2
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +6 -3
- package/dist/cjs/ui/ContentStyles/index.js +5 -3
- package/dist/cjs/ui/LinkSearch/ToolbarComponents.js +4 -11
- package/dist/cjs/utils/document.js +7 -249
- package/dist/cjs/utils/index.js +1 -23
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/es2019/messages.js +2 -54
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/es2019/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/card/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/card/toolbar.js +7 -9
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/es2019/plugins/card/utils.js +1 -2
- package/dist/es2019/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/es2019/plugins/custom-autoformat/doc.js +1 -1
- package/dist/es2019/plugins/date/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/emoji/index.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/es2019/plugins/hyperlink/commands.js +1 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/es2019/plugins/layout/actions.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/toolbar/index.js +9 -8
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/es2019/plugins/media/toolbar/linking.js +1 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/es2019/plugins/media/utils/media-files.js +4 -3
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/placeholder/index.js +1 -1
- package/dist/es2019/plugins/status/plugin.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/ui/Appearance/Chromeless.js +4 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/Mobile.js +4 -2
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +6 -3
- package/dist/es2019/ui/ContentStyles/index.js +5 -3
- package/dist/es2019/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/es2019/utils/document.js +3 -244
- package/dist/es2019/utils/index.js +1 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/esm/messages.js +2 -54
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/esm/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/card/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/card/toolbar.js +7 -9
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/esm/plugins/card/utils.js +1 -2
- package/dist/esm/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
- package/dist/esm/plugins/date/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/emoji/index.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -1
- package/dist/esm/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/esm/plugins/hyperlink/commands.js +1 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/esm/plugins/layout/actions.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/toolbar/index.js +9 -8
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/esm/plugins/media/toolbar/linking.js +1 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/esm/plugins/media/utils/media-files.js +4 -3
- package/dist/esm/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/placeholder/index.js +1 -1
- package/dist/esm/plugins/status/plugin.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/ui/Appearance/Chromeless.js +4 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +4 -2
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/Mobile.js +4 -2
- package/dist/esm/ui/AppearanceComponents/Mobile.js +6 -3
- package/dist/esm/ui/ContentStyles/index.js +5 -3
- package/dist/esm/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/esm/utils/document.js +6 -240
- package/dist/esm/utils/index.js +1 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types/labs/next/presets/default.d.ts +1 -1
- package/dist/types/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types/messages.d.ts +2 -53
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/plugins/card/toolbar.d.ts +1 -1
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -364
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -0
- package/dist/types/ui/ContentStyles/index.d.ts +3 -3
- package/dist/types/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types/utils/document.d.ts +0 -12
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types-ts4.5/messages.d.ts +2 -53
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types-ts4.5/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +2 -0
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +5 -364
- package/dist/types-ts4.5/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types-ts4.5/ui/AppearanceComponents/Mobile.d.ts +2 -0
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types-ts4.5/utils/document.d.ts +0 -12
- package/dist/types-ts4.5/utils/index.d.ts +1 -2
- package/package.json +9 -10
- package/report.api.md +9 -34
- package/tmp/api-report-tmp.d.ts +7 -33
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +0 -227
- package/dist/cjs/plugins/hyperlink/types.js +0 -5
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +0 -152
- package/dist/cjs/ui/Resizer/index.js +0 -210
- package/dist/cjs/ui/Resizer/styled.js +0 -15
- package/dist/cjs/ui/Resizer/types.js +0 -5
- package/dist/cjs/ui/Resizer/utils.js +0 -21
- package/dist/cjs/utils/filter/privacy-filter.js +0 -55
- package/dist/cjs/utils/linking-utils.js +0 -84
- package/dist/cjs/utils/rich-media-utils.js +0 -130
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +0 -221
- package/dist/es2019/plugins/hyperlink/types.js +0 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +0 -159
- package/dist/es2019/ui/Resizer/index.js +0 -191
- package/dist/es2019/ui/Resizer/styled.js +0 -15
- package/dist/es2019/ui/Resizer/types.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -12
- package/dist/es2019/utils/filter/privacy-filter.js +0 -47
- package/dist/es2019/utils/linking-utils.js +0 -74
- package/dist/es2019/utils/rich-media-utils.js +0 -108
- package/dist/esm/nodeviews/getInlineNodeViewProducer.js +0 -217
- package/dist/esm/plugins/hyperlink/types.js +0 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +0 -144
- package/dist/esm/ui/Resizer/index.js +0 -203
- package/dist/esm/ui/Resizer/styled.js +0 -7
- package/dist/esm/ui/Resizer/types.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -12
- package/dist/esm/utils/filter/privacy-filter.js +0 -48
- package/dist/esm/utils/linking-utils.js +0 -74
- package/dist/esm/utils/rich-media-utils.js +0 -117
- package/dist/types/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types/ui/Resizer/index.d.ts +0 -41
- package/dist/types/ui/Resizer/styled.d.ts +0 -2
- package/dist/types/ui/Resizer/types.d.ts +0 -26
- package/dist/types/ui/Resizer/utils.d.ts +0 -6
- package/dist/types/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types/utils/linking-utils.d.ts +0 -14
- package/dist/types/utils/rich-media-utils.d.ts +0 -8
- package/dist/types-ts4.5/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types-ts4.5/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/Resizer/index.d.ts +0 -41
- package/dist/types-ts4.5/ui/Resizer/styled.d.ts +0 -2
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +0 -26
- package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -6
- package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types-ts4.5/utils/linking-utils.d.ts +0 -14
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +0 -8
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { sanitizeNodeForPrivacy } from '../utils/filter/privacy-filter';
|
|
4
|
-
import { isEmptyParagraph, validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { Fragment } from 'prosemirror-model';
|
|
2
|
+
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
3
|
import { getBreakoutMode } from './node-width';
|
|
6
|
-
import {
|
|
4
|
+
import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
@@ -46,25 +44,6 @@ export function isNodeEmpty(node) {
|
|
|
46
44
|
});
|
|
47
45
|
return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Checks if a node looks like an empty document
|
|
52
|
-
*/
|
|
53
|
-
export function isEmptyDocument(node) {
|
|
54
|
-
const nodeChild = node.content.firstChild;
|
|
55
|
-
if (node.childCount !== 1 || !nodeChild) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return isEmptyParagraph(nodeChild);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Checks to see if the parent node is the document, ie not contained within another entity
|
|
62
|
-
export function hasDocAsParent($anchor) {
|
|
63
|
-
return $anchor.depth === 1;
|
|
64
|
-
}
|
|
65
|
-
export function isProseMirrorSchemaCheckError(error) {
|
|
66
|
-
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
67
|
-
}
|
|
68
47
|
export function isInEmptyLine(state) {
|
|
69
48
|
const {
|
|
70
49
|
selection
|
|
@@ -82,27 +61,6 @@ export function isInEmptyLine(state) {
|
|
|
82
61
|
}
|
|
83
62
|
return isEmptyParagraph(node) && hasDocAsParent($anchor);
|
|
84
63
|
}
|
|
85
|
-
export function bracketTyped(state) {
|
|
86
|
-
const {
|
|
87
|
-
selection
|
|
88
|
-
} = state;
|
|
89
|
-
const {
|
|
90
|
-
$cursor,
|
|
91
|
-
$anchor
|
|
92
|
-
} = selection;
|
|
93
|
-
if (!$cursor) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
const node = $cursor.nodeBefore;
|
|
97
|
-
if (!node) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (node.type.name === 'text' && node.text === '{') {
|
|
101
|
-
const paragraphNode = $anchor.node();
|
|
102
|
-
return paragraphNode.marks.length === 0 && hasDocAsParent($anchor);
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
64
|
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
107
65
|
if (!value) {
|
|
108
66
|
return;
|
|
@@ -113,205 +71,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
|
|
|
113
71
|
}
|
|
114
72
|
return Fragment.from(adfEntities);
|
|
115
73
|
}
|
|
116
|
-
export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
117
|
-
if (!value) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
let node;
|
|
121
|
-
if (typeof value === 'string') {
|
|
122
|
-
try {
|
|
123
|
-
if (contentTransformer) {
|
|
124
|
-
const doc = contentTransformer.parse(value);
|
|
125
|
-
node = doc.toJSON();
|
|
126
|
-
} else {
|
|
127
|
-
node = JSON.parse(value);
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
130
|
-
// eslint-disable-next-line no-console
|
|
131
|
-
console.error(`Error processing value: ${value} isn't a valid JSON`);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
} else {
|
|
135
|
-
node = value;
|
|
136
|
-
}
|
|
137
|
-
if (Array.isArray(node)) {
|
|
138
|
-
// eslint-disable-next-line no-console
|
|
139
|
-
console.error(`Error processing value: ${node} is an array, but it must be an object.`);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
// ProseMirror always require a child under doc
|
|
144
|
-
if (node.type === 'doc') {
|
|
145
|
-
if (Array.isArray(node.content) && node.content.length === 0) {
|
|
146
|
-
node.content.push({
|
|
147
|
-
type: 'paragraph',
|
|
148
|
-
content: []
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
// Just making sure doc is always valid
|
|
152
|
-
if (!node.version) {
|
|
153
|
-
node.version = 1;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (contentTransformer) {
|
|
157
|
-
return Node.fromJSON(schema, node);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
161
|
-
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
162
|
-
let {
|
|
163
|
-
transformedAdf,
|
|
164
|
-
isTransformed
|
|
165
|
-
} = transformMediaLinkMarks(node);
|
|
166
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
167
|
-
dispatchAnalyticsEvent({
|
|
168
|
-
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
169
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
170
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
|
|
175
|
-
// We declared in code mark spec that links and marks should not co-exist on
|
|
176
|
-
// text nodes. This util strips code marks from bad text nodes and preserves links.
|
|
177
|
-
// Otherwise, prosemirror will try to repair the invalid document by stripping links
|
|
178
|
-
// and preserving code marks during content changes.
|
|
179
|
-
({
|
|
180
|
-
transformedAdf,
|
|
181
|
-
isTransformed
|
|
182
|
-
} = transformTextLinkCodeMarks(transformedAdf));
|
|
183
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
184
|
-
dispatchAnalyticsEvent({
|
|
185
|
-
action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
|
|
186
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
187
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
let discardedMarks = [];
|
|
191
|
-
({
|
|
192
|
-
transformedAdf,
|
|
193
|
-
isTransformed,
|
|
194
|
-
discardedMarks
|
|
195
|
-
} = transformDedupeMarks(transformedAdf));
|
|
196
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
197
|
-
dispatchAnalyticsEvent({
|
|
198
|
-
action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
|
|
199
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
200
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
201
|
-
attributes: {
|
|
202
|
-
/** UGC WARNING
|
|
203
|
-
*
|
|
204
|
-
* DO NOT include the `mark` attributes inside, we map here to only
|
|
205
|
-
* extract the mark type as that is the only non-UGC safe information
|
|
206
|
-
* that we can add to event-attributes
|
|
207
|
-
*
|
|
208
|
-
*/
|
|
209
|
-
discardedMarkTypes: discardedMarks.map(mark => mark.type)
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
({
|
|
214
|
-
transformedAdf,
|
|
215
|
-
isTransformed
|
|
216
|
-
} = transformNodesMissingContent(transformedAdf));
|
|
217
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
218
|
-
dispatchAnalyticsEvent({
|
|
219
|
-
action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
|
|
220
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
221
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
({
|
|
225
|
-
transformedAdf,
|
|
226
|
-
isTransformed
|
|
227
|
-
} = transformIndentationMarks(transformedAdf));
|
|
228
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
229
|
-
dispatchAnalyticsEvent({
|
|
230
|
-
action: ACTION.INDENTATION_MARKS_TRANSFORMED,
|
|
231
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
232
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
({
|
|
236
|
-
transformedAdf,
|
|
237
|
-
isTransformed
|
|
238
|
-
} = transformInvalidMediaContent(transformedAdf));
|
|
239
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
240
|
-
dispatchAnalyticsEvent({
|
|
241
|
-
action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
|
|
242
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
243
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
const entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
|
|
247
|
-
let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
|
|
248
|
-
const parsedDoc = Node.fromJSON(schema, newEntity);
|
|
249
|
-
|
|
250
|
-
// throws an error if the document is invalid
|
|
251
|
-
try {
|
|
252
|
-
parsedDoc.check();
|
|
253
|
-
} catch (err) {
|
|
254
|
-
if (dispatchAnalyticsEvent) {
|
|
255
|
-
dispatchAnalyticsEvent({
|
|
256
|
-
action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
|
|
257
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
258
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
259
|
-
attributes: {
|
|
260
|
-
errorStack: err instanceof Error ? err.stack : String(err)
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
throw err;
|
|
265
|
-
}
|
|
266
|
-
if (dispatchAnalyticsEvent) {
|
|
267
|
-
findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
|
|
268
|
-
}
|
|
269
|
-
return parsedDoc;
|
|
270
|
-
} catch (e) {
|
|
271
|
-
if (dispatchAnalyticsEvent) {
|
|
272
|
-
dispatchAnalyticsEvent({
|
|
273
|
-
action: ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
274
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
275
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
276
|
-
nonPrivacySafeAttributes: {
|
|
277
|
-
errorStack: e instanceof Error ? e.stack : String(e)
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// eslint-disable-next-line no-console
|
|
283
|
-
console.error(`Error processing document:\n${e instanceof Error ? e.message : String(e)}\n\n`, JSON.stringify(node));
|
|
284
|
-
if (isProseMirrorSchemaCheckError(e)) {
|
|
285
|
-
throw e;
|
|
286
|
-
}
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
const maySanitizePrivateContent = (entity, providerFactory, sanitizePrivateContent) => {
|
|
291
|
-
if (sanitizePrivateContent && providerFactory) {
|
|
292
|
-
return sanitizeNodeForPrivacy(entity, providerFactory);
|
|
293
|
-
}
|
|
294
|
-
return entity;
|
|
295
|
-
};
|
|
296
|
-
export const getStepRange = transaction => {
|
|
297
|
-
let from = -1;
|
|
298
|
-
let to = -1;
|
|
299
|
-
transaction.mapping.maps.forEach((stepMap, index) => {
|
|
300
|
-
stepMap.forEach((oldStart, oldEnd) => {
|
|
301
|
-
const newStart = transaction.mapping.slice(index).map(oldStart, -1);
|
|
302
|
-
const newEnd = transaction.mapping.slice(index).map(oldEnd);
|
|
303
|
-
from = newStart < from || from === -1 ? newStart : from;
|
|
304
|
-
to = newEnd > to || to === -1 ? newEnd : to;
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
if (from !== -1) {
|
|
308
|
-
return {
|
|
309
|
-
from,
|
|
310
|
-
to
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
return null;
|
|
314
|
-
};
|
|
315
74
|
|
|
316
75
|
/**
|
|
317
76
|
* Find the farthest node given a condition
|
|
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
|
|
|
7
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
8
|
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
-
export { hasVisibleContent, isNodeEmpty,
|
|
10
|
+
export { hasVisibleContent, isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
11
|
export { sanitiseMarksInSelection } from './mark';
|
|
12
12
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
13
|
export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
|
@@ -282,9 +282,6 @@ export const insideTableCell = state => {
|
|
|
282
282
|
} = state.schema.nodes;
|
|
283
283
|
return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
|
|
284
284
|
};
|
|
285
|
-
export const isInLayoutColumn = state => {
|
|
286
|
-
return hasParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
287
|
-
};
|
|
288
285
|
export const isInListItem = state => {
|
|
289
286
|
return hasParentNodeOfType(state.schema.nodes.listItem)(state.selection);
|
|
290
287
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -13,7 +13,8 @@ import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
|
13
13
|
import { toJSON } from '../utils';
|
|
14
14
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
|
|
15
15
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
16
|
-
import { isEmptyDocument,
|
|
16
|
+
import { isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
|
|
17
|
+
import { processRawFragmentValue } from '../utils/document';
|
|
17
18
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
18
19
|
var EditorActions = /*#__PURE__*/function () {
|
|
19
20
|
function EditorActions() {
|
|
@@ -18,7 +18,7 @@ import { editorMessages } from './messages';
|
|
|
18
18
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
20
20
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
21
|
-
import { processRawValue } from '
|
|
21
|
+
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
22
22
|
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
23
23
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
24
24
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
package/dist/esm/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } f
|
|
|
44
44
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
45
45
|
|
|
46
46
|
// Used in editor-test-helpers and mobile bridge
|
|
47
|
-
export { setTextSelection, dedupe, getNodesCount, measurements, hasVisibleContent
|
|
47
|
+
export { setTextSelection, dedupe, getNodesCount, measurements, hasVisibleContent } from './utils';
|
|
48
48
|
export { getListCommands } from './utils/list-commands';
|
|
49
49
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
50
50
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -2,7 +2,7 @@ import { EditorView } from 'prosemirror-view';
|
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
3
|
import { EventDispatcher, createDispatch } from '../../../../../event-dispatcher';
|
|
4
4
|
import { processPluginsList, createPMPlugins } from '../../../../../create-editor/create-editor';
|
|
5
|
-
import { processRawValue } from '
|
|
5
|
+
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { createSchema } from '../../../../../create-editor/create-schema';
|
|
7
7
|
export function createEditor(_ref) {
|
|
8
8
|
var context = _ref.context,
|
package/dist/esm/messages.js
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
1
|
// Common Translations will live here
|
|
2
|
-
import {
|
|
3
|
-
import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
|
|
2
|
+
import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
4
3
|
import { messages as statusMessages } from './plugins/status/nodeviews/messages';
|
|
5
4
|
import { messages as dateMessages } from './plugins/date/nodeviews/messages';
|
|
6
5
|
export { linkMessages };
|
|
7
6
|
export { statusMessages };
|
|
8
7
|
export { dateMessages };
|
|
9
|
-
export
|
|
10
|
-
addLink: {
|
|
11
|
-
id: 'fabric.editor.mediaAddLink',
|
|
12
|
-
defaultMessage: 'Add link',
|
|
13
|
-
description: 'Add link'
|
|
14
|
-
},
|
|
15
|
-
unableToOpenLink: {
|
|
16
|
-
id: 'fabric.editor.unableToOpenLink',
|
|
17
|
-
defaultMessage: 'Unable to open this link',
|
|
18
|
-
description: 'Unable to open this link'
|
|
19
|
-
},
|
|
20
|
-
unlink: {
|
|
21
|
-
id: 'fabric.editor.unlink',
|
|
22
|
-
defaultMessage: 'Unlink',
|
|
23
|
-
description: 'Removes the hyperlink but keeps your text.'
|
|
24
|
-
},
|
|
25
|
-
editLink: {
|
|
26
|
-
id: 'fabric.editor.editLink',
|
|
27
|
-
defaultMessage: 'Edit link',
|
|
28
|
-
description: 'Edit the link, update display text'
|
|
29
|
-
},
|
|
30
|
-
placeholder: {
|
|
31
|
-
id: 'fabric.editor.hyperlinkToolbarPlaceholder',
|
|
32
|
-
defaultMessage: 'Paste or search for link',
|
|
33
|
-
description: 'Paste or search for link'
|
|
34
|
-
},
|
|
35
|
-
linkPlaceholder: {
|
|
36
|
-
id: 'fabric.editor.linkPlaceholder',
|
|
37
|
-
defaultMessage: 'Paste link',
|
|
38
|
-
description: 'Create a new link by pasting a URL.'
|
|
39
|
-
},
|
|
40
|
-
linkAddress: {
|
|
41
|
-
id: 'fabric.editor.linkAddress',
|
|
42
|
-
defaultMessage: 'Link address',
|
|
43
|
-
description: 'Insert the address of the link'
|
|
44
|
-
},
|
|
45
|
-
invalidLink: {
|
|
46
|
-
id: 'fabric.editor.invalidLink',
|
|
47
|
-
defaultMessage: 'Please enter a valid link.',
|
|
48
|
-
description: 'Please enter a valid link.'
|
|
49
|
-
},
|
|
50
|
-
emptyLink: {
|
|
51
|
-
id: 'fabric.editor.emptyLink',
|
|
52
|
-
defaultMessage: 'Please enter a link.',
|
|
53
|
-
description: 'Please enter a link.'
|
|
54
|
-
},
|
|
55
|
-
settingsLink: {
|
|
56
|
-
id: 'fabric.editor.settingsLinks',
|
|
57
|
-
defaultMessage: 'Go to Link Preferences',
|
|
58
|
-
description: 'Go to Link Preferences'
|
|
59
|
-
}
|
|
60
|
-
});
|
|
8
|
+
export { linkToolbarMessages };
|
|
61
9
|
export default commonMessages;
|
|
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { inlineNodeViewClassname } from '
|
|
5
|
+
import { inlineNodeViewClassname } from '@atlaskit/editor-common/react-node-view';
|
|
6
6
|
|
|
7
7
|
// For reasoning behind styles, see comments in:
|
|
8
8
|
// ./getInlineNodeViewProducer -> portalChildren()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { isEmptyDocument } from '
|
|
2
|
+
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { getMobileDimensionsPluginState } from '../../mobile-dimensions/utils';
|
|
4
4
|
export var GUTTER_SIZE_IN_PX = 120; // Default gutter size
|
|
5
5
|
export var GUTTER_SIZE_MOBILE_IN_PX = 36; // Gutter size for Mobile
|
|
@@ -14,7 +14,7 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import rafSchedule from 'raf-schd';
|
|
16
16
|
import { Card } from './genericCard';
|
|
17
|
-
import
|
|
17
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
18
18
|
import { registerCard } from '../pm-plugins/actions';
|
|
19
19
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
20
20
|
export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -21,7 +21,7 @@ import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/e
|
|
|
21
21
|
import { SelectionBasedNodeView } from '../../../nodeviews/';
|
|
22
22
|
import { registerCard } from '../pm-plugins/actions';
|
|
23
23
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
24
|
-
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '
|
|
24
|
+
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
25
25
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
26
26
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
27
27
|
var CardInner = function CardInner(_ref) {
|
|
@@ -6,9 +6,8 @@ import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
|
6
6
|
import { closeHistory } from 'prosemirror-history';
|
|
7
7
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
8
8
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { nodesBetweenChanged, processRawValue } from '
|
|
11
|
-
import { unlinkPayload } from '../../../utils/linking-utils';
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
12
11
|
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
13
12
|
import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
14
13
|
import { queueCards, resolveCard } from './actions';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keymap } from 'prosemirror-keymap';
|
|
2
2
|
import { NodeSelection } from 'prosemirror-state';
|
|
3
|
-
import
|
|
3
|
+
import { bindKeymapWithCommand, moveDown, moveUp } from '@atlaskit/editor-common/keymaps';
|
|
4
4
|
import { findChildren, flatten } from 'prosemirror-utils';
|
|
5
5
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
6
6
|
var lookupPixel = 10;
|
|
@@ -51,8 +51,8 @@ export function cardKeymap(featureFlags) {
|
|
|
51
51
|
|
|
52
52
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
|
|
53
53
|
if (browser.chrome && browser.chrome_version > 90 && featureFlags.chromeCursorHandlerFixedVersion && browser.chrome_version < featureFlags.chromeCursorHandlerFixedVersion) {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
|
|
55
|
+
bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
|
|
56
56
|
}
|
|
57
57
|
return keymap(list);
|
|
58
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import rafSchedule from 'raf-schd';
|
|
4
|
-
import { getInlineNodeViewProducer } from '
|
|
4
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import { BlockCard } from '../nodeviews/blockCard';
|
|
6
6
|
import { EmbedCard } from '../nodeviews/embedCard';
|
|
7
7
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
@@ -9,8 +9,8 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
9
9
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
10
10
|
import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
11
11
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
12
|
-
import {
|
|
13
|
-
import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
|
|
12
|
+
import { buildLayoutButtons } from '@atlaskit/editor-common/card';
|
|
13
|
+
import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { changeSelectedCardToText } from './pm-plugins/doc';
|
|
15
15
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
16
16
|
import { pluginKey } from './pm-plugins/main';
|
|
@@ -20,10 +20,8 @@ import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNo
|
|
|
20
20
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
21
21
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
22
22
|
import { messages } from './messages';
|
|
23
|
-
import buildLayoutButtons from '../../ui/MediaAndEmbedsToolbar';
|
|
24
|
-
import { buildOpenedSettingsPayload, buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
25
23
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
|
|
26
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
24
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
27
25
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
28
26
|
return commandWithMetadata(function (state, dispatch) {
|
|
29
27
|
if (!(state.selection instanceof NodeSelection)) {
|
|
@@ -153,8 +151,8 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
|
153
151
|
return false;
|
|
154
152
|
};
|
|
155
153
|
};
|
|
156
|
-
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, cardOptions) {
|
|
157
|
-
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
154
|
+
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
|
|
155
|
+
return buildLayoutButtons(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
158
156
|
};
|
|
159
157
|
var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
160
158
|
return commandWithMetadata(command, {
|
|
@@ -239,8 +237,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
239
237
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
240
238
|
}]);
|
|
241
239
|
if (currentAppearance === 'embed') {
|
|
242
|
-
var _pluginInjectionApi$d6;
|
|
243
|
-
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, cardOptions);
|
|
240
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
241
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.analytics) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions, cardOptions);
|
|
244
242
|
if (alignmentOptions.length) {
|
|
245
243
|
alignmentOptions.push({
|
|
246
244
|
type: 'separator'
|
|
@@ -12,14 +12,13 @@ import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
|
12
12
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
13
13
|
import HyperlinkToolbar from '../../hyperlink/ui/HyperlinkAddToolbar';
|
|
14
14
|
import { showLinkToolbar, hideLinkToolbar as _hideLinkToolbar } from '../pm-plugins/actions';
|
|
15
|
-
import { INPUT_METHOD, ACTION } from '@atlaskit/editor-common/analytics';
|
|
16
|
-
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '
|
|
15
|
+
import { INPUT_METHOD, ACTION, buildEditLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
18
18
|
import { findCardInfo, displayInfoForCard } from '../utils';
|
|
19
19
|
import { NodeSelection } from 'prosemirror-state';
|
|
20
|
-
import { buildEditLinkPayload } from '../../../utils/linking-utils';
|
|
21
20
|
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
22
|
-
import { linkToolbarMessages } from '
|
|
21
|
+
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
23
22
|
var HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
|
|
24
23
|
export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
25
24
|
_inherits(EditLinkToolbar, _React$Component);
|
|
@@ -17,10 +17,7 @@ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from 'prosemirr
|
|
|
17
17
|
import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } from '@atlaskit/editor-common/ui';
|
|
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
|
-
import { wrapperStyle } from '
|
|
21
|
-
import Resizer from '../../../ui/Resizer';
|
|
22
|
-
import { handleSides, imageAlignmentMap, snapTo } from '../../../ui/Resizer/utils';
|
|
23
|
-
import { calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
20
|
+
import { wrapperStyle, Resizer, handleSides, imageAlignmentMap, snapTo, calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
24
21
|
import { embedSpacingStyles } from './styled';
|
|
25
22
|
var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
26
23
|
_inherits(ResizableEmbedCard, _React$Component);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from 'prosemirror-state';
|
|
2
2
|
import { Slice, Fragment } from 'prosemirror-model';
|
|
3
3
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
4
|
-
import { mapChildren } from '
|
|
5
|
-
import { isSupportedInParent } from '../../utils/nodes';
|
|
4
|
+
import { isSupportedInParent, mapChildren } from '@atlaskit/editor-common/utils';
|
|
6
5
|
export var appearanceForNodeType = function appearanceForNodeType(spec) {
|
|
7
6
|
if (spec.name === 'inlineCard') {
|
|
8
7
|
return 'inline';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { isEmptyDocument } from '
|
|
3
|
+
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
4
4
|
export var pluginKey = new PluginKey('clearMarksOnChangeToEmptyDocumentPlugin');
|
|
5
5
|
export function createPlugin() {
|
|
6
6
|
return new SafePlugin({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { closeHistory } from 'prosemirror-history';
|
|
4
|
-
import { processRawValue } from '
|
|
4
|
+
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { autoformatAction } from './utils';
|
|
6
6
|
export var buildHandler = function buildHandler(_regex, handler) {
|
|
7
7
|
return /*#__PURE__*/function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { DateNodeView } from '../nodeviews/date';
|
|
3
|
-
import { getInlineNodeViewProducer } from '
|
|
3
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
5
5
|
import { reducer, mapping, onSelectionChanged } from './utils';
|
|
6
6
|
import { pluginKey } from './plugin-key';
|
|
@@ -8,7 +8,7 @@ import { emoji } from '@atlaskit/adf-schema';
|
|
|
8
8
|
import { Fragment } from 'prosemirror-model';
|
|
9
9
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
10
10
|
import { EmojiTypeAheadItem, SearchSort, recordSelectionSucceededSli, recordSelectionFailedSli } from '@atlaskit/emoji';
|
|
11
|
-
import { getInlineNodeViewProducer } from '
|
|
11
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
12
12
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
14
14
|
import { IconEmoji } from '../quick-insert/assets';
|
|
@@ -11,7 +11,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
11
11
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
12
12
|
import WithPluginState from '../../ui/WithPluginState';
|
|
13
13
|
import { CONTENT_COMPONENT } from '../analytics/types';
|
|
14
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '
|
|
14
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import { pluginKey as extensionsPluginKey } from '../extension/plugin-key';
|
|
16
16
|
import { pluginKey as editorDisabledPluginKey } from '../editor-disabled';
|
|
17
17
|
import { pluginKey as dataPluginKey } from './pm-plugins/toolbar-data/plugin-key';
|