@atlaskit/editor-core 185.2.0 → 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 +7 -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/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/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/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/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/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 +4 -5
- 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
|
@@ -4,30 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.bracketTyped = bracketTyped;
|
|
8
7
|
exports.findFarthestParentNode = void 0;
|
|
9
8
|
exports.getChangedNodes = getChangedNodes;
|
|
10
9
|
exports.getChangedNodesIn = getChangedNodesIn;
|
|
11
10
|
exports.getChildBreakoutModes = getChildBreakoutModes;
|
|
12
11
|
exports.getNodesCount = getNodesCount;
|
|
13
|
-
exports.getStepRange = void 0;
|
|
14
|
-
exports.hasDocAsParent = hasDocAsParent;
|
|
15
12
|
exports.hasVisibleContent = hasVisibleContent;
|
|
16
|
-
exports.isEmptyDocument = isEmptyDocument;
|
|
17
13
|
exports.isInEmptyLine = isInEmptyLine;
|
|
18
14
|
exports.isNodeEmpty = isNodeEmpty;
|
|
19
|
-
exports.isProseMirrorSchemaCheckError = isProseMirrorSchemaCheckError;
|
|
20
15
|
exports.isSelectionEndOfParagraph = void 0;
|
|
21
16
|
exports.nodesBetweenChanged = nodesBetweenChanged;
|
|
22
17
|
exports.processRawFragmentValue = processRawFragmentValue;
|
|
23
|
-
exports.processRawValue = processRawValue;
|
|
24
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
25
19
|
var _prosemirrorModel = require("prosemirror-model");
|
|
26
|
-
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
27
|
-
var _privacyFilter = require("../utils/filter/privacy-filter");
|
|
28
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
29
21
|
var _nodeWidth = require("./node-width");
|
|
30
|
-
var _enums = require("../plugins/analytics/types/enums");
|
|
31
22
|
/**
|
|
32
23
|
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
33
24
|
*/
|
|
@@ -71,25 +62,6 @@ function isNodeEmpty(node) {
|
|
|
71
62
|
return !!childNode.childCount && !(childNode.childCount === 1 && (0, _utils.isEmptyParagraph)(childNode.firstChild)) || childNode.isAtom;
|
|
72
63
|
}).length;
|
|
73
64
|
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Checks if a node looks like an empty document
|
|
77
|
-
*/
|
|
78
|
-
function isEmptyDocument(node) {
|
|
79
|
-
var nodeChild = node.content.firstChild;
|
|
80
|
-
if (node.childCount !== 1 || !nodeChild) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
return (0, _utils.isEmptyParagraph)(nodeChild);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Checks to see if the parent node is the document, ie not contained within another entity
|
|
87
|
-
function hasDocAsParent($anchor) {
|
|
88
|
-
return $anchor.depth === 1;
|
|
89
|
-
}
|
|
90
|
-
function isProseMirrorSchemaCheckError(error) {
|
|
91
|
-
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
92
|
-
}
|
|
93
65
|
function isInEmptyLine(state) {
|
|
94
66
|
var selection = state.selection;
|
|
95
67
|
var _ref = selection,
|
|
@@ -102,32 +74,14 @@ function isInEmptyLine(state) {
|
|
|
102
74
|
if (!node) {
|
|
103
75
|
return false;
|
|
104
76
|
}
|
|
105
|
-
return (0, _utils.isEmptyParagraph)(node) && hasDocAsParent($anchor);
|
|
106
|
-
}
|
|
107
|
-
function bracketTyped(state) {
|
|
108
|
-
var selection = state.selection;
|
|
109
|
-
var _ref2 = selection,
|
|
110
|
-
$cursor = _ref2.$cursor,
|
|
111
|
-
$anchor = _ref2.$anchor;
|
|
112
|
-
if (!$cursor) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
var node = $cursor.nodeBefore;
|
|
116
|
-
if (!node) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (node.type.name === 'text' && node.text === '{') {
|
|
120
|
-
var paragraphNode = $anchor.node();
|
|
121
|
-
return paragraphNode.marks.length === 0 && hasDocAsParent($anchor);
|
|
122
|
-
}
|
|
123
|
-
return false;
|
|
77
|
+
return (0, _utils.isEmptyParagraph)(node) && (0, _utils.hasDocAsParent)($anchor);
|
|
124
78
|
}
|
|
125
79
|
function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
126
80
|
if (!value) {
|
|
127
81
|
return;
|
|
128
82
|
}
|
|
129
83
|
var adfEntities = value.map(function (item) {
|
|
130
|
-
return processRawValue(schema, item, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent);
|
|
84
|
+
return (0, _utils.processRawValue)(schema, item, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent);
|
|
131
85
|
}).filter(function (item) {
|
|
132
86
|
return Boolean(item);
|
|
133
87
|
});
|
|
@@ -136,207 +90,11 @@ function processRawFragmentValue(schema, value, providerFactory, sanitizePrivate
|
|
|
136
90
|
}
|
|
137
91
|
return _prosemirrorModel.Fragment.from(adfEntities);
|
|
138
92
|
}
|
|
139
|
-
function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
140
|
-
if (!value) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
var node;
|
|
144
|
-
if (typeof value === 'string') {
|
|
145
|
-
try {
|
|
146
|
-
if (contentTransformer) {
|
|
147
|
-
var doc = contentTransformer.parse(value);
|
|
148
|
-
node = doc.toJSON();
|
|
149
|
-
} else {
|
|
150
|
-
node = JSON.parse(value);
|
|
151
|
-
}
|
|
152
|
-
} catch (e) {
|
|
153
|
-
// eslint-disable-next-line no-console
|
|
154
|
-
console.error("Error processing value: ".concat(value, " isn't a valid JSON"));
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
node = value;
|
|
159
|
-
}
|
|
160
|
-
if (Array.isArray(node)) {
|
|
161
|
-
// eslint-disable-next-line no-console
|
|
162
|
-
console.error("Error processing value: ".concat(node, " is an array, but it must be an object."));
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
try {
|
|
166
|
-
// ProseMirror always require a child under doc
|
|
167
|
-
if (node.type === 'doc') {
|
|
168
|
-
if (Array.isArray(node.content) && node.content.length === 0) {
|
|
169
|
-
node.content.push({
|
|
170
|
-
type: 'paragraph',
|
|
171
|
-
content: []
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
// Just making sure doc is always valid
|
|
175
|
-
if (!node.version) {
|
|
176
|
-
node.version = 1;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (contentTransformer) {
|
|
180
|
-
return _prosemirrorModel.Node.fromJSON(schema, node);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
184
|
-
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
185
|
-
var _transformMediaLinkMa = (0, _transforms.transformMediaLinkMarks)(node),
|
|
186
|
-
transformedAdf = _transformMediaLinkMa.transformedAdf,
|
|
187
|
-
isTransformed = _transformMediaLinkMa.isTransformed;
|
|
188
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
189
|
-
dispatchAnalyticsEvent({
|
|
190
|
-
action: _enums.ACTION.MEDIA_LINK_TRANSFORMED,
|
|
191
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
192
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
|
|
197
|
-
// We declared in code mark spec that links and marks should not co-exist on
|
|
198
|
-
// text nodes. This util strips code marks from bad text nodes and preserves links.
|
|
199
|
-
// Otherwise, prosemirror will try to repair the invalid document by stripping links
|
|
200
|
-
// and preserving code marks during content changes.
|
|
201
|
-
var _transformTextLinkCod = (0, _transforms.transformTextLinkCodeMarks)(transformedAdf);
|
|
202
|
-
transformedAdf = _transformTextLinkCod.transformedAdf;
|
|
203
|
-
isTransformed = _transformTextLinkCod.isTransformed;
|
|
204
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
205
|
-
dispatchAnalyticsEvent({
|
|
206
|
-
action: _enums.ACTION.TEXT_LINK_MARK_TRANSFORMED,
|
|
207
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
208
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
var discardedMarks = [];
|
|
212
|
-
var _transformDedupeMarks = (0, _transforms.transformDedupeMarks)(transformedAdf);
|
|
213
|
-
transformedAdf = _transformDedupeMarks.transformedAdf;
|
|
214
|
-
isTransformed = _transformDedupeMarks.isTransformed;
|
|
215
|
-
discardedMarks = _transformDedupeMarks.discardedMarks;
|
|
216
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
217
|
-
dispatchAnalyticsEvent({
|
|
218
|
-
action: _enums.ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
|
|
219
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
220
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
221
|
-
attributes: {
|
|
222
|
-
/** UGC WARNING
|
|
223
|
-
*
|
|
224
|
-
* DO NOT include the `mark` attributes inside, we map here to only
|
|
225
|
-
* extract the mark type as that is the only non-UGC safe information
|
|
226
|
-
* that we can add to event-attributes
|
|
227
|
-
*
|
|
228
|
-
*/
|
|
229
|
-
discardedMarkTypes: discardedMarks.map(function (mark) {
|
|
230
|
-
return mark.type;
|
|
231
|
-
})
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
var _transformNodesMissin = (0, _transforms.transformNodesMissingContent)(transformedAdf);
|
|
236
|
-
transformedAdf = _transformNodesMissin.transformedAdf;
|
|
237
|
-
isTransformed = _transformNodesMissin.isTransformed;
|
|
238
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
239
|
-
dispatchAnalyticsEvent({
|
|
240
|
-
action: _enums.ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
|
|
241
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
242
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
var _transformIndentation = (0, _transforms.transformIndentationMarks)(transformedAdf);
|
|
246
|
-
transformedAdf = _transformIndentation.transformedAdf;
|
|
247
|
-
isTransformed = _transformIndentation.isTransformed;
|
|
248
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
249
|
-
dispatchAnalyticsEvent({
|
|
250
|
-
action: _enums.ACTION.INDENTATION_MARKS_TRANSFORMED,
|
|
251
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
252
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
var _transformInvalidMedi = (0, _transforms.transformInvalidMediaContent)(transformedAdf);
|
|
256
|
-
transformedAdf = _transformInvalidMedi.transformedAdf;
|
|
257
|
-
isTransformed = _transformInvalidMedi.isTransformed;
|
|
258
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
259
|
-
dispatchAnalyticsEvent({
|
|
260
|
-
action: _enums.ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
|
|
261
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
262
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
var entity = (0, _utils.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent);
|
|
266
|
-
var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
|
|
267
|
-
var parsedDoc = _prosemirrorModel.Node.fromJSON(schema, newEntity);
|
|
268
|
-
|
|
269
|
-
// throws an error if the document is invalid
|
|
270
|
-
try {
|
|
271
|
-
parsedDoc.check();
|
|
272
|
-
} catch (err) {
|
|
273
|
-
if (dispatchAnalyticsEvent) {
|
|
274
|
-
dispatchAnalyticsEvent({
|
|
275
|
-
action: _enums.ACTION.INVALID_PROSEMIRROR_DOCUMENT,
|
|
276
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
277
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
278
|
-
attributes: {
|
|
279
|
-
errorStack: err instanceof Error ? err.stack : String(err)
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
throw err;
|
|
284
|
-
}
|
|
285
|
-
if (dispatchAnalyticsEvent) {
|
|
286
|
-
(0, _utils.findAndTrackUnsupportedContentNodes)(parsedDoc, schema, dispatchAnalyticsEvent);
|
|
287
|
-
}
|
|
288
|
-
return parsedDoc;
|
|
289
|
-
} catch (e) {
|
|
290
|
-
if (dispatchAnalyticsEvent) {
|
|
291
|
-
dispatchAnalyticsEvent({
|
|
292
|
-
action: _enums.ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
293
|
-
actionSubject: _enums.ACTION_SUBJECT.EDITOR,
|
|
294
|
-
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
295
|
-
nonPrivacySafeAttributes: {
|
|
296
|
-
errorStack: e instanceof Error ? e.stack : String(e)
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// eslint-disable-next-line no-console
|
|
302
|
-
console.error("Error processing document:\n".concat(e instanceof Error ? e.message : String(e), "\n\n"), JSON.stringify(node));
|
|
303
|
-
if (isProseMirrorSchemaCheckError(e)) {
|
|
304
|
-
throw e;
|
|
305
|
-
}
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
var maySanitizePrivateContent = function maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent) {
|
|
310
|
-
if (sanitizePrivateContent && providerFactory) {
|
|
311
|
-
return (0, _privacyFilter.sanitizeNodeForPrivacy)(entity, providerFactory);
|
|
312
|
-
}
|
|
313
|
-
return entity;
|
|
314
|
-
};
|
|
315
|
-
var getStepRange = function getStepRange(transaction) {
|
|
316
|
-
var from = -1;
|
|
317
|
-
var to = -1;
|
|
318
|
-
transaction.mapping.maps.forEach(function (stepMap, index) {
|
|
319
|
-
stepMap.forEach(function (oldStart, oldEnd) {
|
|
320
|
-
var newStart = transaction.mapping.slice(index).map(oldStart, -1);
|
|
321
|
-
var newEnd = transaction.mapping.slice(index).map(oldEnd);
|
|
322
|
-
from = newStart < from || from === -1 ? newStart : from;
|
|
323
|
-
to = newEnd > to || to === -1 ? newEnd : to;
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
if (from !== -1) {
|
|
327
|
-
return {
|
|
328
|
-
from: from,
|
|
329
|
-
to: to
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
return null;
|
|
333
|
-
};
|
|
334
93
|
|
|
335
94
|
/**
|
|
336
95
|
* Find the farthest node given a condition
|
|
337
96
|
* @param predicate Function to check the node
|
|
338
97
|
*/
|
|
339
|
-
exports.getStepRange = getStepRange;
|
|
340
98
|
var findFarthestParentNode = function findFarthestParentNode(predicate) {
|
|
341
99
|
return function ($pos) {
|
|
342
100
|
var candidate = null;
|
|
@@ -359,11 +117,11 @@ var isSelectionEndOfParagraph = function isSelectionEndOfParagraph(state) {
|
|
|
359
117
|
return state.selection.$to.parent.type === state.schema.nodes.paragraph && state.selection.$to.pos === state.doc.resolve(state.selection.$to.pos).end();
|
|
360
118
|
};
|
|
361
119
|
exports.isSelectionEndOfParagraph = isSelectionEndOfParagraph;
|
|
362
|
-
function getChangedNodesIn(
|
|
363
|
-
var tr =
|
|
364
|
-
doc =
|
|
120
|
+
function getChangedNodesIn(_ref2) {
|
|
121
|
+
var tr = _ref2.tr,
|
|
122
|
+
doc = _ref2.doc;
|
|
365
123
|
var nodes = [];
|
|
366
|
-
var stepRange = getStepRange(tr);
|
|
124
|
+
var stepRange = (0, _utils.getStepRange)(tr);
|
|
367
125
|
if (!stepRange) {
|
|
368
126
|
return nodes;
|
|
369
127
|
}
|
|
@@ -384,7 +142,7 @@ function getChangedNodes(tr) {
|
|
|
384
142
|
});
|
|
385
143
|
}
|
|
386
144
|
function nodesBetweenChanged(tr, f, startPos) {
|
|
387
|
-
var stepRange = getStepRange(tr);
|
|
145
|
+
var stepRange = (0, _utils.getStepRange)(tr);
|
|
388
146
|
if (!stepRange) {
|
|
389
147
|
return;
|
|
390
148
|
}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -30,12 +30,6 @@ Object.defineProperty(exports, "getNodesCount", {
|
|
|
30
30
|
return _document.getNodesCount;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
Object.defineProperty(exports, "getStepRange", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function get() {
|
|
36
|
-
return _document.getStepRange;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
33
|
exports.hasOpenEnd = void 0;
|
|
40
34
|
Object.defineProperty(exports, "hasVisibleContent", {
|
|
41
35
|
enumerable: true,
|
|
@@ -56,13 +50,7 @@ Object.defineProperty(exports, "isElementInTableCell", {
|
|
|
56
50
|
return _utils.isElementInTableCell;
|
|
57
51
|
}
|
|
58
52
|
});
|
|
59
|
-
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function get() {
|
|
62
|
-
return _document.isEmptyDocument;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
exports.isInsideBlockQuote = exports.isInListItem = exports.isInLayoutColumn = exports.isEmptyNode = void 0;
|
|
53
|
+
exports.isInsideBlockQuote = exports.isInListItem = exports.isEmptyNode = void 0;
|
|
66
54
|
Object.defineProperty(exports, "isLastItemMediaGroup", {
|
|
67
55
|
enumerable: true,
|
|
68
56
|
get: function get() {
|
|
@@ -128,12 +116,6 @@ Object.defineProperty(exports, "nonNullable", {
|
|
|
128
116
|
}
|
|
129
117
|
});
|
|
130
118
|
exports.pipe = pipe;
|
|
131
|
-
Object.defineProperty(exports, "processRawValue", {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function get() {
|
|
134
|
-
return _document.processRawValue;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
119
|
Object.defineProperty(exports, "sanitiseMarksInSelection", {
|
|
138
120
|
enumerable: true,
|
|
139
121
|
get: function get() {
|
|
@@ -442,10 +424,6 @@ var insideTableCell = function insideTableCell(state) {
|
|
|
442
424
|
return (0, _prosemirrorUtils.hasParentNodeOfType)([tableCell, tableHeader])(state.selection);
|
|
443
425
|
};
|
|
444
426
|
exports.insideTableCell = insideTableCell;
|
|
445
|
-
var isInLayoutColumn = function isInLayoutColumn(state) {
|
|
446
|
-
return (0, _prosemirrorUtils.hasParentNodeOfType)(state.schema.nodes.layoutSection)(state.selection);
|
|
447
|
-
};
|
|
448
|
-
exports.isInLayoutColumn = isInLayoutColumn;
|
|
449
427
|
var isInListItem = function isInListItem(state) {
|
|
450
428
|
return (0, _prosemirrorUtils.hasParentNodeOfType)(state.schema.nodes.listItem)(state.selection);
|
|
451
429
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.2.
|
|
9
|
+
var version = "185.2.2";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -9,7 +9,8 @@ import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
|
9
9
|
import { toJSON } from '../utils';
|
|
10
10
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel } from '../utils/action';
|
|
11
11
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
12
|
-
import { isEmptyDocument,
|
|
12
|
+
import { isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { processRawFragmentValue } from '../utils/document';
|
|
13
14
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
14
15
|
export default class EditorActions {
|
|
15
16
|
constructor() {
|
|
@@ -7,7 +7,7 @@ import { editorMessages } from './messages';
|
|
|
7
7
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
9
9
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
10
|
-
import { processRawValue } from '
|
|
10
|
+
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
12
12
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
13
13
|
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
package/dist/es2019/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({
|
|
8
8
|
context,
|
package/dist/es2019/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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
3
|
-
import { inlineNodeViewClassname } from '
|
|
3
|
+
import { inlineNodeViewClassname } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
|
|
5
5
|
// For reasoning behind styles, see comments in:
|
|
6
6
|
// ./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 const GUTTER_SIZE_IN_PX = 120; // Default gutter size
|
|
5
5
|
export const GUTTER_SIZE_MOBILE_IN_PX = 36; // Gutter size for Mobile
|
|
@@ -6,7 +6,7 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import rafSchedule from 'raf-schd';
|
|
8
8
|
import { Card } from './genericCard';
|
|
9
|
-
import
|
|
9
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
10
|
import { registerCard } from '../pm-plugins/actions';
|
|
11
11
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
12
12
|
export class BlockCardComponent extends React.PureComponent {
|
|
@@ -10,7 +10,7 @@ import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/e
|
|
|
10
10
|
import { SelectionBasedNodeView } from '../../../nodeviews/';
|
|
11
11
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
12
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
13
|
-
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '
|
|
13
|
+
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
14
14
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
15
15
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
16
16
|
const CardInner = ({
|
|
@@ -2,9 +2,8 @@ import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
|
2
2
|
import { closeHistory } from 'prosemirror-history';
|
|
3
3
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
4
4
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
5
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { nodesBetweenChanged, processRawValue } from '
|
|
7
|
-
import { unlinkPayload } from '../../../utils/linking-utils';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
8
7
|
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
9
8
|
import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
10
9
|
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
|
const lookupPixel = 10;
|
|
@@ -52,8 +52,8 @@ export function cardKeymap(featureFlags) {
|
|
|
52
52
|
|
|
53
53
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
|
|
54
54
|
if (browser.chrome && browser.chrome_version > 90 && featureFlags.chromeCursorHandlerFixedVersion && browser.chrome_version < featureFlags.chromeCursorHandlerFixedVersion) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
|
|
56
|
+
bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
|
|
57
57
|
}
|
|
58
58
|
return keymap(list);
|
|
59
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import rafSchedule from 'raf-schd';
|
|
3
|
-
import { getInlineNodeViewProducer } from '
|
|
3
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import { BlockCard } from '../nodeviews/blockCard';
|
|
5
5
|
import { EmbedCard } from '../nodeviews/embedCard';
|
|
6
6
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
@@ -5,8 +5,8 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
5
5
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
6
6
|
import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
7
7
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
8
|
-
import {
|
|
9
|
-
import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import { buildLayoutButtons } from '@atlaskit/editor-common/card';
|
|
9
|
+
import commonMessages, { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { changeSelectedCardToText } from './pm-plugins/doc';
|
|
11
11
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
12
12
|
import { pluginKey } from './pm-plugins/main';
|
|
@@ -16,10 +16,8 @@ import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNo
|
|
|
16
16
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
17
17
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
18
18
|
import { messages } from './messages';
|
|
19
|
-
import buildLayoutButtons from '../../ui/MediaAndEmbedsToolbar';
|
|
20
|
-
import { buildOpenedSettingsPayload, buildVisitedLinkPayload } from '../../utils/linking-utils';
|
|
21
19
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
|
|
22
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
20
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
23
21
|
export const removeCard = editorAnalyticsApi => commandWithMetadata((state, dispatch) => {
|
|
24
22
|
if (!(state.selection instanceof NodeSelection)) {
|
|
25
23
|
return false;
|
|
@@ -158,8 +156,8 @@ const unlinkCard = (node, state, editorAnalyticsApi) => {
|
|
|
158
156
|
}
|
|
159
157
|
return () => false;
|
|
160
158
|
};
|
|
161
|
-
const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, cardOptions) => {
|
|
162
|
-
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);
|
|
159
|
+
const buildAlignmentOptions = (state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) => {
|
|
160
|
+
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);
|
|
163
161
|
};
|
|
164
162
|
const withToolbarMetadata = command => commandWithMetadata(command, {
|
|
165
163
|
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
@@ -247,8 +245,8 @@ const generateToolbarItems = (state, featureFlags, intl, providerFactory, cardOp
|
|
|
247
245
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
248
246
|
}];
|
|
249
247
|
if (currentAppearance === 'embed') {
|
|
250
|
-
var _pluginInjectionApi$d6;
|
|
251
|
-
const 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);
|
|
248
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
249
|
+
const 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);
|
|
252
250
|
if (alignmentOptions.length) {
|
|
253
251
|
alignmentOptions.push({
|
|
254
252
|
type: 'separator'
|
|
@@ -4,14 +4,13 @@ import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
|
4
4
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
5
5
|
import HyperlinkToolbar from '../../hyperlink/ui/HyperlinkAddToolbar';
|
|
6
6
|
import { showLinkToolbar, hideLinkToolbar } from '../pm-plugins/actions';
|
|
7
|
-
import { INPUT_METHOD, ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '
|
|
7
|
+
import { INPUT_METHOD, ACTION, buildEditLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
10
10
|
import { findCardInfo, displayInfoForCard } from '../utils';
|
|
11
11
|
import { NodeSelection } from 'prosemirror-state';
|
|
12
|
-
import { buildEditLinkPayload } from '../../../utils/linking-utils';
|
|
13
12
|
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
14
|
-
import { linkToolbarMessages } from '
|
|
13
|
+
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
15
14
|
const HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
|
|
16
15
|
export class EditLinkToolbar extends React.Component {
|
|
17
16
|
constructor(...args) {
|
|
@@ -7,10 +7,7 @@ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from 'prosemirr
|
|
|
7
7
|
import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { akEditorMediaResizeHandlerPaddingWide, akEditorBreakoutPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
10
|
-
import { wrapperStyle } from '
|
|
11
|
-
import Resizer from '../../../ui/Resizer';
|
|
12
|
-
import { handleSides, imageAlignmentMap, snapTo } from '../../../ui/Resizer/utils';
|
|
13
|
-
import { calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { wrapperStyle, Resizer, handleSides, imageAlignmentMap, snapTo, calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
14
11
|
import { embedSpacingStyles } from './styled';
|
|
15
12
|
export default class ResizableEmbedCard extends React.Component {
|
|
16
13
|
constructor(...args) {
|