@atlaskit/editor-plugin-caption 10.1.0 → 10.1.1
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 +8 -0
- package/dist/cjs/captionPlugin.js +3 -2
- package/dist/cjs/nodeviews/index.js +22 -8
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/es2019/captionPlugin.js +3 -2
- package/dist/es2019/nodeviews/index.js +23 -8
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/esm/captionPlugin.js +3 -2
- package/dist/esm/nodeviews/index.js +23 -8
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/types/nodeviews/index.d.ts +5 -2
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/index.d.ts +5 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-caption
|
|
2
2
|
|
|
3
|
+
## 10.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ed7459903c172`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed7459903c172) -
|
|
8
|
+
Updated media to display correctly when ssr streaming is used.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 10.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -25,8 +25,9 @@ var captionPlugin = function captionPlugin(_ref) {
|
|
|
25
25
|
var portalProviderAPI = _ref2.portalProviderAPI,
|
|
26
26
|
providerFactory = _ref2.providerFactory,
|
|
27
27
|
eventDispatcher = _ref2.eventDispatcher,
|
|
28
|
-
dispatch = _ref2.dispatch
|
|
29
|
-
|
|
28
|
+
dispatch = _ref2.dispatch,
|
|
29
|
+
getIntl = _ref2.getIntl;
|
|
30
|
+
return (0, _main.default)(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl());
|
|
30
31
|
}
|
|
31
32
|
}, {
|
|
32
33
|
name: 'captionKeymap',
|
|
@@ -13,17 +13,23 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
17
|
+
var _browserApis = require("@atlaskit/browser-apis");
|
|
18
|
+
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
19
|
+
var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
|
|
16
20
|
var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-node-view");
|
|
17
21
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
22
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
19
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
25
|
var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
21
|
-
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi) {
|
|
26
|
+
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi, intl) {
|
|
22
27
|
var _this;
|
|
23
28
|
(0, _classCallCheck2.default)(this, CaptionNodeView);
|
|
24
29
|
_this = _callSuper(this, CaptionNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate]);
|
|
25
30
|
(0, _defineProperty2.default)(_this, "selected", _this.insideSelection());
|
|
26
31
|
_this.pluginInjectionApi = pluginInjectionApi;
|
|
32
|
+
_this.intl = intl;
|
|
27
33
|
_this.handleEditorDisabledChanged();
|
|
28
34
|
return _this;
|
|
29
35
|
}
|
|
@@ -31,15 +37,16 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
|
|
|
31
37
|
return (0, _createClass2.default)(CaptionNodeView, [{
|
|
32
38
|
key: "createDomRef",
|
|
33
39
|
value: function createDomRef() {
|
|
34
|
-
var
|
|
40
|
+
var _getDocument;
|
|
41
|
+
var domRef = ((_getDocument = (0, _browserApis.getDocument)()) !== null && _getDocument !== void 0 ? _getDocument : document).createElement('figcaption');
|
|
35
42
|
domRef.setAttribute('data-caption', 'true');
|
|
36
43
|
return domRef;
|
|
37
44
|
}
|
|
38
45
|
}, {
|
|
39
46
|
key: "getContentDOM",
|
|
40
47
|
value: function getContentDOM() {
|
|
41
|
-
var _this$pluginInjection;
|
|
42
|
-
var dom = document.createElement('div');
|
|
48
|
+
var _getDocument2, _this$pluginInjection;
|
|
49
|
+
var dom = ((_getDocument2 = (0, _browserApis.getDocument)()) !== null && _getDocument2 !== void 0 ? _getDocument2 : document).createElement('div');
|
|
43
50
|
// setting a className prevents PM/Chrome mutation observer from
|
|
44
51
|
// incorrectly deleting nodes
|
|
45
52
|
dom.className = 'caption-wrapper';
|
|
@@ -75,12 +82,18 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
|
|
|
75
82
|
}, {
|
|
76
83
|
key: "render",
|
|
77
84
|
value: function render(_props, forwardRef) {
|
|
78
|
-
|
|
85
|
+
var children = /*#__PURE__*/_react.default.createElement(_ui.Caption, {
|
|
79
86
|
selected: this.insideSelection(),
|
|
80
87
|
hasContent: this.node.content.childCount > 0
|
|
81
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNodeView.NodeViewContentHole, {
|
|
82
89
|
ref: forwardRef
|
|
83
90
|
}));
|
|
91
|
+
if (!this.intl || !(0, _coreUtils.isSSR)() || !(0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
92
|
+
return children;
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.RawIntlProvider, {
|
|
95
|
+
value: this.intl
|
|
96
|
+
}, children);
|
|
84
97
|
}
|
|
85
98
|
}, {
|
|
86
99
|
key: "viewShouldUpdate",
|
|
@@ -103,8 +116,9 @@ var CaptionNodeView = exports.CaptionNodeView = /*#__PURE__*/function (_Selectio
|
|
|
103
116
|
}
|
|
104
117
|
}]);
|
|
105
118
|
}(_selectionBasedNodeView.SelectionBasedNodeView);
|
|
106
|
-
|
|
119
|
+
/** Creates a caption node view for use with ProseMirror. */
|
|
120
|
+
function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl) {
|
|
107
121
|
return function (node, view, getPos) {
|
|
108
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi).init();
|
|
122
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi, intl).init();
|
|
109
123
|
};
|
|
110
124
|
}
|
|
@@ -18,7 +18,7 @@ var fireAnalytics = function fireAnalytics(tr, action, analyticsApi) {
|
|
|
18
18
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.CAPTION
|
|
19
19
|
})(tr);
|
|
20
20
|
};
|
|
21
|
-
var _default = exports.default = function _default(portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) {
|
|
21
|
+
var _default = exports.default = function _default(portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi, intl) {
|
|
22
22
|
var _pluginInjectionApi$a;
|
|
23
23
|
var analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
24
24
|
return new _safePlugin.SafePlugin({
|
|
@@ -50,7 +50,7 @@ var _default = exports.default = function _default(portalProviderAPI, eventDispa
|
|
|
50
50
|
key: _pluginKey.pluginKey,
|
|
51
51
|
props: {
|
|
52
52
|
nodeViews: {
|
|
53
|
-
caption: (0, _nodeviews.default)(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
53
|
+
caption: (0, _nodeviews.default)(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl)
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
});
|
|
@@ -19,8 +19,9 @@ const captionPlugin = ({
|
|
|
19
19
|
portalProviderAPI,
|
|
20
20
|
providerFactory,
|
|
21
21
|
eventDispatcher,
|
|
22
|
-
dispatch
|
|
23
|
-
|
|
22
|
+
dispatch,
|
|
23
|
+
getIntl
|
|
24
|
+
}) => createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl())
|
|
24
25
|
}, {
|
|
25
26
|
name: 'captionKeymap',
|
|
26
27
|
plugin: captionKeymap
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { RawIntlProvider } from 'react-intl';
|
|
4
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
5
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
6
|
+
import { NodeViewContentHole } from '@atlaskit/editor-common/react-node-view';
|
|
3
7
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
4
8
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
10
|
export class CaptionNodeView extends SelectionBasedNodeView {
|
|
6
|
-
constructor(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi) {
|
|
11
|
+
constructor(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi, intl) {
|
|
7
12
|
super(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate);
|
|
8
13
|
_defineProperty(this, "selected", this.insideSelection());
|
|
9
14
|
this.pluginInjectionApi = pluginInjectionApi;
|
|
15
|
+
this.intl = intl;
|
|
10
16
|
this.handleEditorDisabledChanged();
|
|
11
17
|
}
|
|
12
18
|
createDomRef() {
|
|
13
|
-
|
|
19
|
+
var _getDocument;
|
|
20
|
+
const domRef = ((_getDocument = getDocument()) !== null && _getDocument !== void 0 ? _getDocument : document).createElement('figcaption');
|
|
14
21
|
domRef.setAttribute('data-caption', 'true');
|
|
15
22
|
return domRef;
|
|
16
23
|
}
|
|
17
24
|
getContentDOM() {
|
|
18
|
-
var _this$pluginInjection, _this$pluginInjection2, _this$pluginInjection3;
|
|
19
|
-
const dom = document.createElement('div');
|
|
25
|
+
var _getDocument2, _this$pluginInjection, _this$pluginInjection2, _this$pluginInjection3;
|
|
26
|
+
const dom = ((_getDocument2 = getDocument()) !== null && _getDocument2 !== void 0 ? _getDocument2 : document).createElement('div');
|
|
20
27
|
// setting a className prevents PM/Chrome mutation observer from
|
|
21
28
|
// incorrectly deleting nodes
|
|
22
29
|
dom.className = 'caption-wrapper';
|
|
@@ -45,12 +52,18 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
render(_props, forwardRef) {
|
|
48
|
-
|
|
55
|
+
const children = /*#__PURE__*/React.createElement(Caption, {
|
|
49
56
|
selected: this.insideSelection(),
|
|
50
57
|
hasContent: this.node.content.childCount > 0
|
|
51
|
-
}, /*#__PURE__*/React.createElement(
|
|
58
|
+
}, /*#__PURE__*/React.createElement(NodeViewContentHole, {
|
|
52
59
|
ref: forwardRef
|
|
53
60
|
}));
|
|
61
|
+
if (!this.intl || !isSSR() || !expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
62
|
+
return children;
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
65
|
+
value: this.intl
|
|
66
|
+
}, children);
|
|
54
67
|
}
|
|
55
68
|
viewShouldUpdate(nextNode) {
|
|
56
69
|
if (this.node.childCount !== nextNode.childCount) {
|
|
@@ -68,8 +81,10 @@ export class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
68
81
|
this.cleanupEditorDisabledListener = undefined;
|
|
69
82
|
}
|
|
70
83
|
}
|
|
71
|
-
|
|
84
|
+
|
|
85
|
+
/** Creates a caption node view for use with ProseMirror. */
|
|
86
|
+
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl) {
|
|
72
87
|
return (node, view, getPos) => {
|
|
73
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi).init();
|
|
88
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi, intl).init();
|
|
74
89
|
};
|
|
75
90
|
}
|
|
@@ -11,7 +11,7 @@ const fireAnalytics = (tr, action, analyticsApi) => {
|
|
|
11
11
|
actionSubjectId: ACTION_SUBJECT_ID.CAPTION
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
|
-
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) => {
|
|
14
|
+
export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi, intl) => {
|
|
15
15
|
var _pluginInjectionApi$a;
|
|
16
16
|
const analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
17
17
|
return new SafePlugin({
|
|
@@ -43,7 +43,7 @@ export default ((portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
|
43
43
|
key: pluginKey,
|
|
44
44
|
props: {
|
|
45
45
|
nodeViews: {
|
|
46
|
-
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
46
|
+
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -18,8 +18,9 @@ var captionPlugin = function captionPlugin(_ref) {
|
|
|
18
18
|
var portalProviderAPI = _ref2.portalProviderAPI,
|
|
19
19
|
providerFactory = _ref2.providerFactory,
|
|
20
20
|
eventDispatcher = _ref2.eventDispatcher,
|
|
21
|
-
dispatch = _ref2.dispatch
|
|
22
|
-
|
|
21
|
+
dispatch = _ref2.dispatch,
|
|
22
|
+
getIntl = _ref2.getIntl;
|
|
23
|
+
return createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl());
|
|
23
24
|
}
|
|
24
25
|
}, {
|
|
25
26
|
name: 'captionKeymap',
|
|
@@ -7,15 +7,21 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
7
7
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { RawIntlProvider } from 'react-intl';
|
|
11
|
+
import { getDocument } from '@atlaskit/browser-apis';
|
|
12
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
13
|
+
import { NodeViewContentHole } from '@atlaskit/editor-common/react-node-view';
|
|
10
14
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
11
15
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
17
|
export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
13
|
-
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi) {
|
|
18
|
+
function CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate, pluginInjectionApi, intl) {
|
|
14
19
|
var _this;
|
|
15
20
|
_classCallCheck(this, CaptionNodeView);
|
|
16
21
|
_this = _callSuper(this, CaptionNodeView, [node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, viewShouldUpdate]);
|
|
17
22
|
_defineProperty(_this, "selected", _this.insideSelection());
|
|
18
23
|
_this.pluginInjectionApi = pluginInjectionApi;
|
|
24
|
+
_this.intl = intl;
|
|
19
25
|
_this.handleEditorDisabledChanged();
|
|
20
26
|
return _this;
|
|
21
27
|
}
|
|
@@ -23,15 +29,16 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
23
29
|
return _createClass(CaptionNodeView, [{
|
|
24
30
|
key: "createDomRef",
|
|
25
31
|
value: function createDomRef() {
|
|
26
|
-
var
|
|
32
|
+
var _getDocument;
|
|
33
|
+
var domRef = ((_getDocument = getDocument()) !== null && _getDocument !== void 0 ? _getDocument : document).createElement('figcaption');
|
|
27
34
|
domRef.setAttribute('data-caption', 'true');
|
|
28
35
|
return domRef;
|
|
29
36
|
}
|
|
30
37
|
}, {
|
|
31
38
|
key: "getContentDOM",
|
|
32
39
|
value: function getContentDOM() {
|
|
33
|
-
var _this$pluginInjection;
|
|
34
|
-
var dom = document.createElement('div');
|
|
40
|
+
var _getDocument2, _this$pluginInjection;
|
|
41
|
+
var dom = ((_getDocument2 = getDocument()) !== null && _getDocument2 !== void 0 ? _getDocument2 : document).createElement('div');
|
|
35
42
|
// setting a className prevents PM/Chrome mutation observer from
|
|
36
43
|
// incorrectly deleting nodes
|
|
37
44
|
dom.className = 'caption-wrapper';
|
|
@@ -67,12 +74,18 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
67
74
|
}, {
|
|
68
75
|
key: "render",
|
|
69
76
|
value: function render(_props, forwardRef) {
|
|
70
|
-
|
|
77
|
+
var children = /*#__PURE__*/React.createElement(Caption, {
|
|
71
78
|
selected: this.insideSelection(),
|
|
72
79
|
hasContent: this.node.content.childCount > 0
|
|
73
|
-
}, /*#__PURE__*/React.createElement(
|
|
80
|
+
}, /*#__PURE__*/React.createElement(NodeViewContentHole, {
|
|
74
81
|
ref: forwardRef
|
|
75
82
|
}));
|
|
83
|
+
if (!this.intl || !isSSR() || !expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
84
|
+
return children;
|
|
85
|
+
}
|
|
86
|
+
return /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
87
|
+
value: this.intl
|
|
88
|
+
}, children);
|
|
76
89
|
}
|
|
77
90
|
}, {
|
|
78
91
|
key: "viewShouldUpdate",
|
|
@@ -95,8 +108,10 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
95
108
|
}
|
|
96
109
|
}]);
|
|
97
110
|
}(SelectionBasedNodeView);
|
|
98
|
-
|
|
111
|
+
|
|
112
|
+
/** Creates a caption node view for use with ProseMirror. */
|
|
113
|
+
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl) {
|
|
99
114
|
return function (node, view, getPos) {
|
|
100
|
-
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi).init();
|
|
115
|
+
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, pluginInjectionApi, intl).init();
|
|
101
116
|
};
|
|
102
117
|
}
|
|
@@ -11,7 +11,7 @@ var fireAnalytics = function fireAnalytics(tr, action, analyticsApi) {
|
|
|
11
11
|
actionSubjectId: ACTION_SUBJECT_ID.CAPTION
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
|
-
export default (function (portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) {
|
|
14
|
+
export default (function (portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi, intl) {
|
|
15
15
|
var _pluginInjectionApi$a;
|
|
16
16
|
var analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
17
17
|
return new SafePlugin({
|
|
@@ -43,7 +43,7 @@ export default (function (portalProviderAPI, eventDispatcher, providerFactory, d
|
|
|
43
43
|
key: pluginKey,
|
|
44
44
|
props: {
|
|
45
45
|
nodeViews: {
|
|
46
|
-
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
46
|
+
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi, intl)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type IntlShape } from 'react-intl';
|
|
2
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
5
|
import type { ForwardRef, ReactComponentProps, shouldUpdate } from '@atlaskit/editor-common/react-node-view';
|
|
@@ -11,7 +12,8 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
11
12
|
private selected;
|
|
12
13
|
private cleanupEditorDisabledListener?;
|
|
13
14
|
pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>;
|
|
14
|
-
|
|
15
|
+
private intl?;
|
|
16
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: ReactComponentProps, reactComponent?: React.ComponentType<React.PropsWithChildren<unknown>>, viewShouldUpdate?: shouldUpdate, pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>, intl?: IntlShape);
|
|
15
17
|
createDomRef(): HTMLElement;
|
|
16
18
|
getContentDOM(): {
|
|
17
19
|
dom: HTMLDivElement;
|
|
@@ -25,4 +27,5 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
25
27
|
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
26
28
|
destroy(): void;
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
/** Creates a caption node view for use with ProseMirror. */
|
|
31
|
+
export default function captionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined, intl?: IntlShape): (node: PMNode, view: EditorView, getPos: getPosHandler) => CaptionNodeView;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
1
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
4
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
6
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { CaptionPlugin } from '../captionPluginType';
|
|
7
|
-
declare const _default: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, dispatch: Dispatch, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined) => SafePlugin;
|
|
8
|
+
declare const _default: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, dispatch: Dispatch, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined, intl?: IntlShape) => SafePlugin;
|
|
8
9
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type IntlShape } from 'react-intl';
|
|
2
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
5
|
import type { ForwardRef, ReactComponentProps, shouldUpdate } from '@atlaskit/editor-common/react-node-view';
|
|
@@ -11,7 +12,8 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
11
12
|
private selected;
|
|
12
13
|
private cleanupEditorDisabledListener?;
|
|
13
14
|
pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>;
|
|
14
|
-
|
|
15
|
+
private intl?;
|
|
16
|
+
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: ReactComponentProps, reactComponent?: React.ComponentType<React.PropsWithChildren<unknown>>, viewShouldUpdate?: shouldUpdate, pluginInjectionApi?: ExtractInjectionAPI<CaptionPlugin>, intl?: IntlShape);
|
|
15
17
|
createDomRef(): HTMLElement;
|
|
16
18
|
getContentDOM(): {
|
|
17
19
|
dom: HTMLDivElement;
|
|
@@ -25,4 +27,5 @@ export declare class CaptionNodeView extends SelectionBasedNodeView {
|
|
|
25
27
|
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
26
28
|
destroy(): void;
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
/** Creates a caption node view for use with ProseMirror. */
|
|
31
|
+
export default function captionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined, intl?: IntlShape): (node: PMNode, view: EditorView, getPos: getPosHandler) => CaptionNodeView;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl';
|
|
1
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
4
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
6
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { CaptionPlugin } from '../captionPluginType';
|
|
7
|
-
declare const _default: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, dispatch: Dispatch, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined) => SafePlugin;
|
|
8
|
+
declare const _default: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, dispatch: Dispatch, pluginInjectionApi: ExtractInjectionAPI<CaptionPlugin> | undefined, intl?: IntlShape) => SafePlugin;
|
|
8
9
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-caption",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "Caption plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,17 @@
|
|
|
28
28
|
"atlaskit:src": "src/index.ts",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^52.11.0",
|
|
31
|
-
"@atlaskit/
|
|
31
|
+
"@atlaskit/browser-apis": "^0.0.1",
|
|
32
|
+
"@atlaskit/editor-plugin-analytics": "^10.1.0",
|
|
32
33
|
"@atlaskit/editor-plugin-editor-disabled": "^10.1.0",
|
|
33
34
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^81.0.0",
|
|
34
36
|
"@babel/runtime": "^7.0.0"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
|
-
"@atlaskit/editor-common": "^114.
|
|
38
|
-
"react": "^18.2.0"
|
|
39
|
+
"@atlaskit/editor-common": "^114.33.0",
|
|
40
|
+
"react": "^18.2.0",
|
|
41
|
+
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
39
42
|
},
|
|
40
43
|
"techstack": {
|
|
41
44
|
"@atlassian/frontend": {
|