@atlaskit/editor-core 185.2.25 → 185.2.27
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/editor-next/editor-internal.js +3 -3
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/labs/next/Editor.js +3 -3
- package/dist/cjs/nodeviews/index.js +1 -16
- package/dist/cjs/plugins/annotation/index.js +31 -21
- package/dist/cjs/plugins/annotation/nodeviews/index.js +2 -2
- package/dist/cjs/plugins/base/index.js +0 -6
- package/dist/cjs/plugins/caption/index.js +1 -2
- package/dist/cjs/plugins/caption/nodeviews/index.js +3 -3
- package/dist/cjs/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/extension/nodeviews/extension.js +2 -2
- package/dist/cjs/plugins/jira-issue/index.js +2 -2
- package/dist/cjs/plugins/media/index.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +25 -19
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +3 -3
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +16 -10
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +25 -8
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +6 -4
- package/dist/cjs/test-utils.js +0 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/editor-next/editor-internal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/Editor.js +1 -1
- package/dist/es2019/nodeviews/index.js +1 -2
- package/dist/es2019/plugins/annotation/index.js +34 -23
- package/dist/es2019/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/es2019/plugins/base/index.js +0 -4
- package/dist/es2019/plugins/caption/index.js +1 -4
- package/dist/es2019/plugins/caption/nodeviews/index.js +2 -2
- package/dist/es2019/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
- package/dist/es2019/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/es2019/plugins/jira-issue/index.js +1 -1
- package/dist/es2019/plugins/media/index.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +21 -14
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +13 -9
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +28 -11
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/test-utils.js +0 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/editor-next/editor-internal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/Editor.js +1 -1
- package/dist/esm/nodeviews/index.js +1 -2
- package/dist/esm/plugins/annotation/index.js +32 -22
- package/dist/esm/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/esm/plugins/base/index.js +0 -6
- package/dist/esm/plugins/caption/index.js +1 -2
- package/dist/esm/plugins/caption/nodeviews/index.js +2 -2
- package/dist/esm/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/esm/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/esm/plugins/jira-issue/index.js +1 -1
- package/dist/esm/plugins/media/index.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -18
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +15 -9
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +26 -9
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/test-utils.js +0 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types/nodeviews/index.d.ts +0 -2
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types/plugins/media/types.d.ts +4 -0
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types/test-utils.d.ts +0 -1
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/test-utils.d.ts +0 -1
- package/package.json +3 -3
- package/report.api.md +20 -85
- package/tmp/api-report-tmp.d.ts +18 -68
- package/dist/cjs/nodeviews/ReactNodeView.js +0 -224
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +0 -169
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +0 -72
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +0 -43
- package/dist/cjs/ui/PortalProvider/index.js +0 -252
- package/dist/es2019/nodeviews/ReactNodeView.js +0 -170
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +0 -158
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +0 -48
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +0 -37
- package/dist/es2019/ui/PortalProvider/index.js +0 -184
- package/dist/esm/nodeviews/ReactNodeView.js +0 -217
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +0 -163
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +0 -62
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +0 -36
- package/dist/esm/ui/PortalProvider/index.js +0 -242
- package/dist/types/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types/ui/PortalProvider/index.d.ts +0 -51
- package/dist/types-ts4.5/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types-ts4.5/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types-ts4.5/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +0 -51
|
@@ -40,6 +40,7 @@ var _utils2 = require("../../../utils");
|
|
|
40
40
|
var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
|
|
41
41
|
var _reactIntlNext = require("react-intl-next");
|
|
42
42
|
var _mediaTaskManager = require("./mediaTaskManager");
|
|
43
|
+
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
43
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
44
45
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
46
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -638,7 +639,6 @@ var createPlugin = function createPlugin(_schema, options, reactContext, getIntl
|
|
|
638
639
|
// we shift it to the media single parent as other code is opinionated about
|
|
639
640
|
// the selection landing there. In particular the caption insertion and selection
|
|
640
641
|
// action.
|
|
641
|
-
|
|
642
642
|
return newState.tr.setSelection(_prosemirrorState.NodeSelection.create(newState.doc, transaction.selection.$from.pos - 1));
|
|
643
643
|
}
|
|
644
644
|
}
|
|
@@ -662,12 +662,29 @@ var createPlugin = function createPlugin(_schema, options, reactContext, getIntl
|
|
|
662
662
|
},
|
|
663
663
|
props: {
|
|
664
664
|
decorations: function decorations(state) {
|
|
665
|
+
// Use this to indicate that the media node is selected
|
|
666
|
+
var mediaNodes = [];
|
|
667
|
+
var schema = state.schema,
|
|
668
|
+
$anchor = state.selection.$anchor,
|
|
669
|
+
doc = state.doc;
|
|
670
|
+
|
|
671
|
+
// Find any media nodes in the current selection
|
|
672
|
+
if (state.selection instanceof _prosemirrorState.TextSelection || state.selection instanceof _prosemirrorState.AllSelection || state.selection instanceof _prosemirrorState.NodeSelection || state.selection instanceof _cellSelection.CellSelection) {
|
|
673
|
+
doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
674
|
+
if (node.type === schema.nodes.media) {
|
|
675
|
+
mediaNodes.push(_prosemirrorView.Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
676
|
+
type: 'media',
|
|
677
|
+
selected: true
|
|
678
|
+
}));
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
return true;
|
|
682
|
+
});
|
|
683
|
+
}
|
|
665
684
|
var pluginState = getMediaPluginState(state);
|
|
666
685
|
if (!pluginState.showDropzone) {
|
|
667
|
-
return;
|
|
686
|
+
return _prosemirrorView.DecorationSet.create(state.doc, mediaNodes);
|
|
668
687
|
}
|
|
669
|
-
var schema = state.schema,
|
|
670
|
-
$anchor = state.selection.$anchor;
|
|
671
688
|
|
|
672
689
|
// When a media is already selected
|
|
673
690
|
if (state.selection instanceof _prosemirrorState.NodeSelection) {
|
|
@@ -676,20 +693,20 @@ var createPlugin = function createPlugin(_schema, options, reactContext, getIntl
|
|
|
676
693
|
var deco = _prosemirrorView.Decoration.node(state.selection.from, state.selection.to, {
|
|
677
694
|
class: 'richMedia-selected'
|
|
678
695
|
});
|
|
679
|
-
return _prosemirrorView.DecorationSet.create(state.doc, [deco]);
|
|
696
|
+
return _prosemirrorView.DecorationSet.create(state.doc, [deco].concat(mediaNodes));
|
|
680
697
|
}
|
|
681
|
-
return;
|
|
698
|
+
return _prosemirrorView.DecorationSet.create(state.doc, mediaNodes);
|
|
682
699
|
}
|
|
683
700
|
var pos = $anchor.pos;
|
|
684
701
|
if ($anchor.parent.type !== schema.nodes.paragraph && $anchor.parent.type !== schema.nodes.codeBlock) {
|
|
685
702
|
pos = (0, _prosemirrorTransform.insertPoint)(state.doc, pos, schema.nodes.mediaGroup);
|
|
686
703
|
}
|
|
687
704
|
if (pos === null || pos === undefined) {
|
|
688
|
-
return;
|
|
705
|
+
return _prosemirrorView.DecorationSet.create(state.doc, mediaNodes);
|
|
689
706
|
}
|
|
690
707
|
var dropPlaceholders = [_prosemirrorView.Decoration.widget(pos, dropPlaceholder, {
|
|
691
708
|
key: 'drop-placeholder'
|
|
692
|
-
})];
|
|
709
|
+
})].concat(mediaNodes);
|
|
693
710
|
return _prosemirrorView.DecorationSet.create(state.doc, dropPlaceholders);
|
|
694
711
|
},
|
|
695
712
|
nodeViews: options.nodeViews,
|
|
@@ -12,7 +12,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
12
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var
|
|
15
|
+
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
16
16
|
var _Decision = _interopRequireDefault(require("../ui/Decision"));
|
|
17
17
|
var _utils = require("../../type-ahead/utils");
|
|
18
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -77,7 +77,7 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
77
77
|
}
|
|
78
78
|
}]);
|
|
79
79
|
return Decision;
|
|
80
|
-
}(
|
|
80
|
+
}(_reactNodeView.default);
|
|
81
81
|
var decisionItemNodeView = function decisionItemNodeView(portalProviderAPI, eventDispatcher) {
|
|
82
82
|
return function (node, view, getPos) {
|
|
83
83
|
var hasIntlContext = true;
|
|
@@ -16,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
18
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
19
|
-
var
|
|
19
|
+
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
20
20
|
var _WithPluginState = _interopRequireDefault(require("../../../ui/WithPluginState"));
|
|
21
21
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
22
22
|
var _Task = _interopRequireDefault(require("../ui/Task"));
|
|
@@ -159,7 +159,7 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
159
159
|
}
|
|
160
160
|
}]);
|
|
161
161
|
return Task;
|
|
162
|
-
}(
|
|
162
|
+
}(_reactNodeView.default);
|
|
163
163
|
function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory) {
|
|
164
164
|
return function (node, view, getPos) {
|
|
165
165
|
var hasIntlContext = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -9,8 +10,9 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
9
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
11
12
|
var _unsupportedInlineNodeView = require("./unsupported-inline-node-view");
|
|
12
|
-
var
|
|
13
|
-
|
|
13
|
+
var _reactNodeView = _interopRequireWildcard(require("@atlaskit/editor-common/react-node-view"));
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
16
|
var pluginKey = new _prosemirrorState.PluginKey('unsupportedContentPlugin');
|
|
15
17
|
exports.pluginKey = pluginKey;
|
|
16
18
|
var createPlugin = function createPlugin(pmPluginFactoryParams) {
|
|
@@ -22,7 +24,7 @@ var createPlugin = function createPlugin(pmPluginFactoryParams) {
|
|
|
22
24
|
key: pluginKey,
|
|
23
25
|
props: {
|
|
24
26
|
nodeViews: {
|
|
25
|
-
confluenceUnsupportedBlock:
|
|
27
|
+
confluenceUnsupportedBlock: _reactNodeView.default.fromComponent(_ui.UnsupportedBlock, portalProviderAPI, eventDispatcher, {
|
|
26
28
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
27
29
|
}, undefined, hasIntlContext),
|
|
28
30
|
confluenceUnsupportedInline: (0, _reactNodeView.getInlineNodeViewProducer)({
|
|
@@ -32,7 +34,7 @@ var createPlugin = function createPlugin(pmPluginFactoryParams) {
|
|
|
32
34
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
33
35
|
}
|
|
34
36
|
}),
|
|
35
|
-
unsupportedBlock:
|
|
37
|
+
unsupportedBlock: _reactNodeView.default.fromComponent(_ui.UnsupportedBlock, portalProviderAPI, eventDispatcher, {
|
|
36
38
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
37
39
|
}, undefined, hasIntlContext),
|
|
38
40
|
unsupportedInline: (0, _reactNodeView.getInlineNodeViewProducer)({
|
package/dist/cjs/test-utils.js
CHANGED
|
@@ -22,12 +22,6 @@ Object.defineProperty(exports, "GapCursorSide", {
|
|
|
22
22
|
return _selection.Side;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
Object.defineProperty(exports, "PortalProviderAPI", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _PortalProvider.PortalProviderAPI;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
25
|
exports.createPMSchemaAndPlugins = void 0;
|
|
32
26
|
Object.defineProperty(exports, "createTypeAheadTools", {
|
|
33
27
|
enumerable: true,
|
|
@@ -47,7 +41,6 @@ var _base = _interopRequireDefault(require("./plugins/base"));
|
|
|
47
41
|
var _pluginKey = require("./plugins/analytics/plugin-key");
|
|
48
42
|
var _api = require("./plugins/type-ahead/api");
|
|
49
43
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
50
|
-
var _PortalProvider = require("./ui/PortalProvider");
|
|
51
44
|
var _eventDispatcher = require("./event-dispatcher");
|
|
52
45
|
var _selection = require("./plugins/selection/gap-cursor/selection");
|
|
53
46
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -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.27";
|
|
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
|
@@ -10,7 +10,7 @@ import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from
|
|
|
10
10
|
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import EditorContext from '../ui/EditorContext';
|
|
13
|
-
import { PortalProviderWithThemeProviders, PortalRenderer } from '
|
|
13
|
+
import { PortalProviderWithThemeProviders, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
|
|
14
14
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
15
15
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
16
16
|
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
package/dist/es2019/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
|
51
51
|
export { default as EditorActions } from './actions';
|
|
52
52
|
// Re-export from provider factory to not cause a breaking change
|
|
53
53
|
|
|
54
|
-
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '
|
|
54
|
+
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
|
|
55
55
|
export { GapCursorSelection, Side as GapCursorSide } from './plugins/selection/gap-cursor-selection';
|
|
56
56
|
export { selectionPluginKey } from './plugins/mobile-selection';
|
|
57
57
|
export { insertExpand } from './plugins/expand/commands';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IntlProvider } from 'react-intl-next';
|
|
4
|
-
import { PortalRenderer, PortalProvider } from '
|
|
4
|
+
import { PortalRenderer, PortalProvider } from '@atlaskit/editor-common/portal-provider';
|
|
5
5
|
import { EditorInternal } from './internal/components/EditorInternal';
|
|
6
6
|
import { usePresetContext, PresetProvider } from './internal/context/preset-context';
|
|
7
7
|
import { EditorSharedConfigConsumer, useEditorSharedConfig } from './internal/context/shared-config';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { SelectionBasedNodeView } from './SelectionBasedNodeView';
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { annotation } from '@atlaskit/adf-schema';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
-
import { stateKey as reactPluginKey } from '../../plugins/base/pm-plugins/react-nodeview';
|
|
5
3
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
6
4
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
5
|
import { AnnotationUpdateEmitter } from './update-provider';
|
|
8
|
-
import { getPluginState
|
|
6
|
+
import { getPluginState } from './utils';
|
|
9
7
|
import { buildToolbar } from './toolbar';
|
|
10
8
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
11
|
-
|
|
9
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
const annotationPlugin = (annotationProviders, api) => {
|
|
12
11
|
return {
|
|
13
12
|
name: 'annotation',
|
|
14
13
|
marks() {
|
|
@@ -17,6 +16,12 @@ const annotationPlugin = annotationProviders => {
|
|
|
17
16
|
mark: annotation
|
|
18
17
|
}];
|
|
19
18
|
},
|
|
19
|
+
getSharedState(editorState) {
|
|
20
|
+
if (!editorState) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return getPluginState(editorState);
|
|
24
|
+
},
|
|
20
25
|
pmPlugins: () => [{
|
|
21
26
|
name: 'annotation',
|
|
22
27
|
plugin: ({
|
|
@@ -64,28 +69,34 @@ const annotationPlugin = annotationProviders => {
|
|
|
64
69
|
if (!annotationProviders) {
|
|
65
70
|
return null;
|
|
66
71
|
}
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
render: ({
|
|
73
|
-
inlineCommentState
|
|
74
|
-
}) => {
|
|
75
|
-
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
"data-editor-popup": "true"
|
|
80
|
-
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
81
|
-
providers: annotationProviders,
|
|
82
|
-
editorView: editorView,
|
|
83
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
72
|
+
return /*#__PURE__*/React.createElement(AnnotationContentComponent, {
|
|
73
|
+
api: api,
|
|
74
|
+
editorView: editorView,
|
|
75
|
+
annotationProviders: annotationProviders,
|
|
76
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
86
77
|
});
|
|
87
78
|
}
|
|
88
79
|
};
|
|
89
80
|
};
|
|
81
|
+
function AnnotationContentComponent({
|
|
82
|
+
api,
|
|
83
|
+
editorView,
|
|
84
|
+
annotationProviders,
|
|
85
|
+
dispatchAnalyticsEvent
|
|
86
|
+
}) {
|
|
87
|
+
const {
|
|
88
|
+
annotationState: inlineCommentState
|
|
89
|
+
} = useSharedPluginState(api, ['annotation']);
|
|
90
|
+
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
"data-editor-popup": "true"
|
|
95
|
+
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
96
|
+
providers: annotationProviders,
|
|
97
|
+
editorView: editorView,
|
|
98
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
90
101
|
export default annotationPlugin;
|
|
91
102
|
export { AnnotationUpdateEmitter };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import
|
|
3
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
export class AnnotationNodeView extends ReactNodeView {
|
|
5
5
|
createDomRef() {
|
|
6
6
|
return document.createElement('span');
|
|
@@ -10,7 +10,6 @@ import contextIdentifierPlugin from './pm-plugins/context-identifier';
|
|
|
10
10
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
11
11
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
12
12
|
import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
|
|
13
|
-
import { plugin as reactNodeView } from './pm-plugins/react-nodeview';
|
|
14
13
|
import scrollGutter from './pm-plugins/scroll-gutter';
|
|
15
14
|
import { keymap } from '../../utils/keymap';
|
|
16
15
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
@@ -50,9 +49,6 @@ const basePlugin = (options, api) => {
|
|
|
50
49
|
}, {
|
|
51
50
|
name: 'newlinePreserveMarksPlugin',
|
|
52
51
|
plugin: newlinePreserveMarksPlugin
|
|
53
|
-
}, {
|
|
54
|
-
name: 'reactNodeView',
|
|
55
|
-
plugin: () => reactNodeView
|
|
56
52
|
}, {
|
|
57
53
|
name: 'frozenEditor',
|
|
58
54
|
plugin: ({
|
|
@@ -18,10 +18,7 @@ const captionPlugin = (_, api) => {
|
|
|
18
18
|
providerFactory,
|
|
19
19
|
eventDispatcher,
|
|
20
20
|
dispatch
|
|
21
|
-
}) =>
|
|
22
|
-
var _api$dependencies$ana;
|
|
23
|
-
return createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
|
|
24
|
-
}
|
|
21
|
+
}) => createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api)
|
|
25
22
|
}, {
|
|
26
23
|
name: 'captionKeymap',
|
|
27
24
|
plugin: captionKeymap
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { SelectionBasedNodeView } from '
|
|
4
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
5
5
|
export class CaptionNodeView extends SelectionBasedNodeView {
|
|
6
6
|
constructor(...args) {
|
|
7
7
|
super(...args);
|
|
@@ -39,7 +39,7 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
39
39
|
return selectedStateChange;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
export default function captionNodeView(portalProviderAPI, eventDispatcher) {
|
|
42
|
+
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
43
43
|
return (node, view, getPos) => {
|
|
44
44
|
const hasIntlContext = true;
|
|
45
45
|
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
@@ -11,7 +11,9 @@ const fireAnalytics = (tr, action, analyticsApi) => {
|
|
|
11
11
|
actionSubjectId: ACTION_SUBJECT_ID.CAPTION
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
|
-
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
14
|
+
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) => {
|
|
15
|
+
var _pluginInjectionApi$d;
|
|
16
|
+
const analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
|
|
15
17
|
return new SafePlugin({
|
|
16
18
|
appendTransaction(transactions, oldState, newState) {
|
|
17
19
|
// only run for transactions that change selection
|
|
@@ -41,7 +43,7 @@ export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
|
41
43
|
key: pluginKey,
|
|
42
44
|
props: {
|
|
43
45
|
nodeViews: {
|
|
44
|
-
caption: captionNodeView(portalProviderAPI, eventDispatcher)
|
|
46
|
+
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
});
|
|
@@ -7,7 +7,7 @@ import rafSchedule from 'raf-schd';
|
|
|
7
7
|
import { Card } from './genericCard';
|
|
8
8
|
import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import
|
|
10
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
11
11
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
12
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
13
13
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
@@ -327,7 +327,7 @@ _defineProperty(EmbedCardComponent, "contextTypes", {
|
|
|
327
327
|
contextAdapter: PropTypes.object
|
|
328
328
|
});
|
|
329
329
|
const WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
|
|
330
|
-
export class EmbedCard extends
|
|
330
|
+
export class EmbedCard extends ReactNodeView {
|
|
331
331
|
viewShouldUpdate(nextNode) {
|
|
332
332
|
if (this.node.attrs !== nextNode.attrs) {
|
|
333
333
|
return true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import Extension from '../ui/Extension';
|
|
4
4
|
import ExtensionNodeWrapper from '../ui/Extension/ExtensionNodeWrapper';
|
|
5
5
|
// getInlineNodeViewProducer is a new api to use instead of ReactNodeView
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { confluenceJiraIssue } from '@atlaskit/adf-schema';
|
|
4
|
-
import
|
|
4
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import ReactJIRAIssueNode from './nodeviews/jira-issue';
|
|
6
6
|
export const pluginKey = new PluginKey('jiraIssuePlugin');
|
|
7
7
|
const createPlugin = ({
|
|
@@ -85,10 +85,10 @@ const mediaPlugin = (options = {}, api) => {
|
|
|
85
85
|
return createPlugin(schema, {
|
|
86
86
|
providerFactory,
|
|
87
87
|
nodeViews: {
|
|
88
|
-
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
88
|
+
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
89
89
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options, api),
|
|
90
90
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
91
|
-
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory)
|
|
91
|
+
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
92
92
|
},
|
|
93
93
|
errorReporter,
|
|
94
94
|
uploadErrorHandler: options && options.uploadErrorHandler,
|
|
@@ -3,17 +3,15 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
|
3
3
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
4
4
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import ReactNodeView from '
|
|
7
|
-
import { stateKey as reactNodeViewStateKey } from '../../../plugins/base/pm-plugins/react-nodeview';
|
|
8
|
-
import WithPluginState from '../../../ui/WithPluginState';
|
|
6
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
9
7
|
import { setNodeSelection } from '../../../utils';
|
|
10
8
|
import { isNodeSelectedOrInRange, SelectedState } from '../../../utils/nodes';
|
|
11
|
-
import { pluginKey as editorDisabledPluginKey } from '../../editor-disabled';
|
|
12
9
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
13
10
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
14
11
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
15
12
|
import { injectIntl } from 'react-intl-next';
|
|
16
13
|
import { messages } from './messages';
|
|
14
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
17
15
|
const isMediaGroupSelectedFromProps = props => {
|
|
18
16
|
return isNodeSelectedOrInRange(props.anchorPos, props.headPos, props.getPos(), props.node.nodeSize);
|
|
19
17
|
};
|
|
@@ -202,11 +200,23 @@ class MediaGroup extends React.Component {
|
|
|
202
200
|
_defineProperty(MediaGroup, "displayName", 'MediaGroup');
|
|
203
201
|
const IntlMediaGroup = injectIntl(MediaGroup);
|
|
204
202
|
export default IntlMediaGroup;
|
|
203
|
+
function MediaGroupNodeViewInternal({
|
|
204
|
+
renderFn,
|
|
205
|
+
pluginInjectionApi
|
|
206
|
+
}) {
|
|
207
|
+
const {
|
|
208
|
+
editorDisabledState: editorDisabledPlugin
|
|
209
|
+
} = useSharedPluginState(pluginInjectionApi, ['editorDisabled']);
|
|
210
|
+
return renderFn({
|
|
211
|
+
editorDisabledPlugin
|
|
212
|
+
});
|
|
213
|
+
}
|
|
205
214
|
class MediaGroupNodeView extends ReactNodeView {
|
|
206
215
|
render(props, forwardRef) {
|
|
207
216
|
const {
|
|
208
217
|
providerFactory,
|
|
209
|
-
mediaOptions
|
|
218
|
+
mediaOptions,
|
|
219
|
+
pluginInjectionApi
|
|
210
220
|
} = props;
|
|
211
221
|
const getPos = this.getPos;
|
|
212
222
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
@@ -237,22 +247,19 @@ class MediaGroupNodeView extends ReactNodeView {
|
|
|
237
247
|
mediaOptions: mediaOptions
|
|
238
248
|
});
|
|
239
249
|
};
|
|
240
|
-
return /*#__PURE__*/React.createElement(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
reactNodeViewState: reactNodeViewStateKey,
|
|
244
|
-
editorDisabledPlugin: editorDisabledPluginKey
|
|
245
|
-
},
|
|
246
|
-
render: renderFn
|
|
250
|
+
return /*#__PURE__*/React.createElement(MediaGroupNodeViewInternal, {
|
|
251
|
+
renderFn: renderFn,
|
|
252
|
+
pluginInjectionApi: pluginInjectionApi
|
|
247
253
|
});
|
|
248
254
|
}
|
|
249
255
|
});
|
|
250
256
|
}
|
|
251
257
|
}
|
|
252
|
-
export const ReactMediaGroupNode = (portalProviderAPI, eventDispatcher, providerFactory, mediaOptions = {}) => (node, view, getPos) => {
|
|
258
|
+
export const ReactMediaGroupNode = (portalProviderAPI, eventDispatcher, providerFactory, mediaOptions = {}, pluginInjectionApi) => (node, view, getPos) => {
|
|
253
259
|
const hasIntlContext = true;
|
|
254
260
|
return new MediaGroupNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
255
261
|
providerFactory,
|
|
256
|
-
mediaOptions
|
|
262
|
+
mediaOptions,
|
|
263
|
+
pluginInjectionApi
|
|
257
264
|
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
258
265
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { SelectionBasedNodeView } from '
|
|
2
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
3
3
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
4
4
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -175,7 +175,7 @@ export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent) => (node, view, getPos) => {
|
|
178
|
+
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) => (node, view, getPos) => {
|
|
179
179
|
return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
180
180
|
providerFactory,
|
|
181
181
|
dispatchAnalyticsEvent
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
5
4
|
import React from 'react';
|
|
6
|
-
import { SelectionBasedNodeView } from '
|
|
5
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
7
6
|
import MediaNode from './media';
|
|
8
7
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
9
8
|
import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
|
|
@@ -19,9 +18,13 @@ const MediaNodeWithProviders = ({
|
|
|
19
18
|
width: widthState
|
|
20
19
|
});
|
|
21
20
|
};
|
|
21
|
+
function isMediaDecorationSpec(decoration) {
|
|
22
|
+
return decoration.spec.type !== undefined && decoration.spec.selected !== undefined;
|
|
23
|
+
}
|
|
22
24
|
class MediaNodeView extends SelectionBasedNodeView {
|
|
23
25
|
constructor(...args) {
|
|
24
26
|
super(...args);
|
|
27
|
+
_defineProperty(this, "isSelected", false);
|
|
25
28
|
_defineProperty(this, "renderMediaNodeWithState", (mediaProvider, contextIdentifierProvider) => {
|
|
26
29
|
return ({
|
|
27
30
|
width: editorWidth
|
|
@@ -30,10 +33,6 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
30
33
|
const {
|
|
31
34
|
mediaOptions
|
|
32
35
|
} = this.reactComponentProps;
|
|
33
|
-
const {
|
|
34
|
-
selection
|
|
35
|
-
} = this.view.state;
|
|
36
|
-
const isSelected = () => this.isNodeInsideSelection(selection.from, selection.to) || selection instanceof NodeSelection && selection.from === getPos();
|
|
37
36
|
const attrs = this.getAttrs();
|
|
38
37
|
const url = attrs.type === 'external' ? attrs.url : '';
|
|
39
38
|
let {
|
|
@@ -65,7 +64,7 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
65
64
|
view: this.view,
|
|
66
65
|
node: this.node,
|
|
67
66
|
getPos: getPos,
|
|
68
|
-
selected:
|
|
67
|
+
selected: this.nodeInsideSelection(),
|
|
69
68
|
originalDimensions: originalDimensions,
|
|
70
69
|
maxDimensions: maxDimensions,
|
|
71
70
|
url: url,
|
|
@@ -97,11 +96,16 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
97
96
|
}
|
|
98
97
|
return domRef;
|
|
99
98
|
}
|
|
100
|
-
viewShouldUpdate(nextNode) {
|
|
99
|
+
viewShouldUpdate(nextNode, decorations) {
|
|
100
|
+
const hasMediaNodeSelectedDecoration = decorations.some(decoration => isMediaDecorationSpec(decoration) && decoration.spec.type === 'media' && decoration.spec.selected);
|
|
101
|
+
if (this.isSelected !== hasMediaNodeSelectedDecoration) {
|
|
102
|
+
this.isSelected = hasMediaNodeSelectedDecoration;
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
101
105
|
if (this.node.attrs !== nextNode.attrs) {
|
|
102
106
|
return true;
|
|
103
107
|
}
|
|
104
|
-
return super.viewShouldUpdate(nextNode);
|
|
108
|
+
return super.viewShouldUpdate(nextNode, decorations);
|
|
105
109
|
}
|
|
106
110
|
stopEvent(event) {
|
|
107
111
|
// Don't trap right click events on media node
|
|
@@ -18,7 +18,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
|
|
|
18
18
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
19
19
|
import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
|
|
20
20
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
21
|
-
import ReactNodeView from '
|
|
21
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
22
22
|
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
23
23
|
import { NodeSelection } from 'prosemirror-state';
|
|
24
24
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|