@atlaskit/editor-core 187.11.0 → 187.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/cjs/editor-next/editor-internal.js +0 -2
- package/dist/cjs/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/cjs/editor-next/index.js +0 -2
- package/dist/cjs/editor.js +6 -2
- package/dist/cjs/plugins/text-formatting/index.js +8 -14
- package/dist/cjs/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +3 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/es2019/editor-next/editor-internal.js +0 -2
- package/dist/es2019/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/es2019/editor-next/index.js +0 -2
- package/dist/es2019/editor.js +5 -0
- package/dist/es2019/plugins/text-formatting/index.js +115 -119
- package/dist/es2019/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -4
- package/dist/esm/editor-next/editor-internal.js +0 -2
- package/dist/esm/editor-next/hooks/useProviderFactory.js +2 -2
- package/dist/esm/editor-next/index.js +0 -2
- package/dist/esm/editor.js +6 -2
- package/dist/esm/plugins/text-formatting/index.js +9 -15
- package/dist/esm/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js} +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types/editor-next/hooks/useProviderFactory.d.ts +4 -4
- package/dist/types/editor.d.ts +1 -0
- package/dist/types/labs/next/presets/default.d.ts +28 -56
- package/dist/types/labs/next/presets/useUniversalPreset.d.ts +2 -2
- package/dist/types/plugins/text-formatting/actions.d.ts +11 -9
- package/dist/types/plugins/text-formatting/index.d.ts +8 -15
- package/dist/types/types/editor-props.d.ts +10 -10
- package/dist/types/utils/editorDeprecationWarnings.d.ts +2 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types-ts4.5/editor-next/hooks/useProviderFactory.d.ts +4 -4
- package/dist/types-ts4.5/editor.d.ts +1 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -56
- package/dist/types-ts4.5/labs/next/presets/useUniversalPreset.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +11 -9
- package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +8 -15
- package/dist/types-ts4.5/types/editor-props.d.ts +10 -10
- package/dist/types-ts4.5/utils/editorDeprecationWarnings.d.ts +2 -0
- package/package.json +2 -2
- package/report.api.md +25 -38
- package/tmp/api-report-tmp.d.ts +25 -36
- package/dist/types/editor-next/utils/deprecationWarnings.d.ts +0 -2
- package/dist/types-ts4.5/editor-next/utils/deprecationWarnings.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`94eaf42403b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/94eaf42403b) - ED-16575 - clean up EditorNext Props
|
|
8
|
+
- [`c2279d7aeb1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2279d7aeb1) - [ED-19205] Update text formatting plugin API to abstract away the analytics implementation
|
|
9
|
+
|
|
3
10
|
## 187.11.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -158,9 +158,6 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleAnalyticsEvent", function (payload) {
|
|
161
|
-
if (!_this.props.allowAnalyticsGASV3) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
161
|
(0, _analytics.fireAnalyticsEvent)(_this.props.createAnalyticsEvent)(payload);
|
|
165
162
|
});
|
|
166
163
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorPlugins", []);
|
|
@@ -507,7 +504,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
507
504
|
}
|
|
508
505
|
});
|
|
509
506
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dispatchAnalyticsEvent", function (payload) {
|
|
510
|
-
if (_this.
|
|
507
|
+
if (_this.eventDispatcher) {
|
|
511
508
|
var dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
512
509
|
dispatch(_utils.analyticsEventKey, {
|
|
513
510
|
payload: payload
|
|
@@ -99,7 +99,6 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
99
99
|
providerFactory: providerFactory,
|
|
100
100
|
onEditorCreated: onEditorCreated,
|
|
101
101
|
onEditorDestroyed: onEditorDestroyed,
|
|
102
|
-
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
103
102
|
disabled: props.disabled,
|
|
104
103
|
preset: preset,
|
|
105
104
|
render: function render(_ref2) {
|
|
@@ -133,7 +132,6 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
133
132
|
primaryToolbarComponents: config.primaryToolbarComponents,
|
|
134
133
|
primaryToolbarIconBefore: props.primaryToolbarIconBefore,
|
|
135
134
|
secondaryToolbarComponents: config.secondaryToolbarComponents,
|
|
136
|
-
insertMenuItems: props.insertMenuItems,
|
|
137
135
|
customContentComponents: props.contentComponents,
|
|
138
136
|
customPrimaryToolbarComponents: props.primaryToolbarComponents,
|
|
139
137
|
customSecondaryToolbarComponents: props.secondaryToolbarComponents,
|
|
@@ -37,8 +37,6 @@ function useProviderFactory(props, editorActions, createAnalyticsEvent) {
|
|
|
37
37
|
var extensionProviders = props.extensionProviders,
|
|
38
38
|
quickInsert = props.quickInsert,
|
|
39
39
|
linking = props.linking,
|
|
40
|
-
smartLinks = props.smartLinks,
|
|
41
|
-
UNSAFE_cards = props.UNSAFE_cards,
|
|
42
40
|
autoformattingProvider = props.autoformattingProvider,
|
|
43
41
|
media = props.media,
|
|
44
42
|
emojiProvider = props.emojiProvider,
|
|
@@ -52,6 +50,8 @@ function useProviderFactory(props, editorActions, createAnalyticsEvent) {
|
|
|
52
50
|
collabEdit = props.collabEdit,
|
|
53
51
|
collabEditProvider = props.collabEditProvider,
|
|
54
52
|
presenceProvider = props.presenceProvider;
|
|
53
|
+
var UNSAFE_cards = props.UNSAFE_cards;
|
|
54
|
+
var smartLinks = props.smartLinks;
|
|
55
55
|
var providerFactory = (0, _react.useRef)(new _providerFactory.ProviderFactory());
|
|
56
56
|
var _useState = (0, _react.useState)(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)),
|
|
57
57
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -23,7 +23,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
23
23
|
var _EditorContext = require("../ui/EditorContext");
|
|
24
24
|
var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
|
|
25
25
|
var _editorInternal = _interopRequireDefault(require("./editor-internal"));
|
|
26
|
-
var _deprecationWarnings = _interopRequireDefault(require("./utils/deprecationWarnings"));
|
|
27
26
|
var _sendDurationAnalytics = _interopRequireDefault(require("./utils/sendDurationAnalytics"));
|
|
28
27
|
var _trackEditorActions = _interopRequireDefault(require("./utils/trackEditorActions"));
|
|
29
28
|
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; }
|
|
@@ -46,7 +45,6 @@ function Editor(passedProps) {
|
|
|
46
45
|
return (0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)(data);
|
|
47
46
|
};
|
|
48
47
|
(0, _hooks.useConstructor)(function () {
|
|
49
|
-
(0, _deprecationWarnings.default)(props);
|
|
50
48
|
(0, _trackEditorActions.default)(editorActions.current, props.performanceTracking, function (value) {
|
|
51
49
|
return handleAnalyticsEvent(value);
|
|
52
50
|
});
|
package/dist/cjs/editor.js
CHANGED
|
@@ -14,6 +14,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
+
var _editorDeprecationWarnings = _interopRequireDefault(require("./utils/editorDeprecationWarnings"));
|
|
17
18
|
var _editorNext = _interopRequireDefault(require("./editor-next"));
|
|
18
19
|
var _useUniversalPreset = _interopRequireDefault(require("./labs/next/presets/useUniversalPreset"));
|
|
19
20
|
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); }; }
|
|
@@ -30,9 +31,12 @@ var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
|
30
31
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
31
32
|
(0, _inherits2.default)(Editor, _React$Component);
|
|
32
33
|
var _super = _createSuper(Editor);
|
|
33
|
-
function Editor() {
|
|
34
|
+
function Editor(props) {
|
|
35
|
+
var _this;
|
|
34
36
|
(0, _classCallCheck2.default)(this, Editor);
|
|
35
|
-
|
|
37
|
+
_this = _super.call(this, props);
|
|
38
|
+
(0, _editorDeprecationWarnings.default)(props);
|
|
39
|
+
return _this;
|
|
36
40
|
}
|
|
37
41
|
(0, _createClass2.default)(Editor, [{
|
|
38
42
|
key: "render",
|
|
@@ -18,6 +18,7 @@ var _smartInputRule = _interopRequireDefault(require("./pm-plugins/smart-input-r
|
|
|
18
18
|
var _Toolbar = _interopRequireDefault(require("./ui/Toolbar"));
|
|
19
19
|
var _actions = require("./actions");
|
|
20
20
|
var textFormatting = function textFormatting() {
|
|
21
|
+
var _api$dependencies$ana7, _api$dependencies$ana8, _api$dependencies$ana9, _api$dependencies$ana10, _api$dependencies$ana11, _api$dependencies$ana12, _api$dependencies$ana13;
|
|
21
22
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
23
|
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
23
24
|
return {
|
|
@@ -121,20 +122,13 @@ var textFormatting = function textFormatting() {
|
|
|
121
122
|
});
|
|
122
123
|
},
|
|
123
124
|
actions: {
|
|
124
|
-
toggleSuperscript: _actions.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
toggleCodeWithAnalytics: _actions.toggleCodeWithAnalytics,
|
|
132
|
-
toggleUnderline: _actions.toggleUnderline,
|
|
133
|
-
toggleUnderlineWithAnalytics: _actions.toggleUnderlineWithAnalytics,
|
|
134
|
-
toggleEm: _actions.toggleEm,
|
|
135
|
-
toggleEmWithAnalytics: _actions.toggleEmWithAnalytics,
|
|
136
|
-
toggleStrong: _actions.toggleStrong,
|
|
137
|
-
toggleStrongWithAnalytics: _actions.toggleStrongWithAnalytics
|
|
125
|
+
toggleSuperscript: (0, _actions.toggleSuperscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions),
|
|
126
|
+
toggleSubscript: (0, _actions.toggleSubscriptWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions),
|
|
127
|
+
toggleStrike: (0, _actions.toggleStrikeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions),
|
|
128
|
+
toggleCode: (0, _actions.toggleCodeWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions),
|
|
129
|
+
toggleUnderline: (0, _actions.toggleUnderlineWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana11 = api.dependencies.analytics) === null || _api$dependencies$ana11 === void 0 ? void 0 : _api$dependencies$ana11.actions),
|
|
130
|
+
toggleEm: (0, _actions.toggleEmWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana12 = api.dependencies.analytics) === null || _api$dependencies$ana12 === void 0 ? void 0 : _api$dependencies$ana12.actions),
|
|
131
|
+
toggleStrong: (0, _actions.toggleStrongWithAnalytics)(api === null || api === void 0 ? void 0 : (_api$dependencies$ana13 = api.dependencies.analytics) === null || _api$dependencies$ana13 === void 0 ? void 0 : _api$dependencies$ana13.actions)
|
|
138
132
|
}
|
|
139
133
|
};
|
|
140
134
|
};
|
package/dist/cjs/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js}
RENAMED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
var _versionWrapper = require("
|
|
8
|
-
function
|
|
6
|
+
exports.default = editorDeprecationWarnings;
|
|
7
|
+
var _versionWrapper = require("../version-wrapper");
|
|
8
|
+
function editorDeprecationWarnings(props) {
|
|
9
9
|
if (process.env.NODE_ENV === 'production') {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -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 = "187.
|
|
9
|
+
var version = "187.12.0";
|
|
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
|
@@ -156,9 +156,6 @@ export class ReactEditorView extends React.Component {
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
_defineProperty(this, "handleAnalyticsEvent", payload => {
|
|
159
|
-
if (!this.props.allowAnalyticsGASV3) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
159
|
fireAnalyticsEvent(this.props.createAnalyticsEvent)(payload);
|
|
163
160
|
});
|
|
164
161
|
_defineProperty(this, "editorPlugins", []);
|
|
@@ -505,7 +502,7 @@ export class ReactEditorView extends React.Component {
|
|
|
505
502
|
}
|
|
506
503
|
});
|
|
507
504
|
_defineProperty(this, "dispatchAnalyticsEvent", payload => {
|
|
508
|
-
if (this.
|
|
505
|
+
if (this.eventDispatcher) {
|
|
509
506
|
const dispatch = createDispatch(this.eventDispatcher);
|
|
510
507
|
dispatch(analyticsEventKey, {
|
|
511
508
|
payload
|
|
@@ -93,7 +93,6 @@ export function EditorInternalWithoutHooks({
|
|
|
93
93
|
providerFactory: providerFactory,
|
|
94
94
|
onEditorCreated: onEditorCreated,
|
|
95
95
|
onEditorDestroyed: onEditorDestroyed,
|
|
96
|
-
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
97
96
|
disabled: props.disabled,
|
|
98
97
|
preset: preset,
|
|
99
98
|
render: ({
|
|
@@ -128,7 +127,6 @@ export function EditorInternalWithoutHooks({
|
|
|
128
127
|
primaryToolbarComponents: config.primaryToolbarComponents,
|
|
129
128
|
primaryToolbarIconBefore: props.primaryToolbarIconBefore,
|
|
130
129
|
secondaryToolbarComponents: config.secondaryToolbarComponents,
|
|
131
|
-
insertMenuItems: props.insertMenuItems,
|
|
132
130
|
customContentComponents: props.contentComponents,
|
|
133
131
|
customPrimaryToolbarComponents: props.primaryToolbarComponents,
|
|
134
132
|
customSecondaryToolbarComponents: props.secondaryToolbarComponents,
|
|
@@ -28,8 +28,6 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
28
28
|
extensionProviders,
|
|
29
29
|
quickInsert,
|
|
30
30
|
linking,
|
|
31
|
-
smartLinks,
|
|
32
|
-
UNSAFE_cards,
|
|
33
31
|
autoformattingProvider,
|
|
34
32
|
media,
|
|
35
33
|
emojiProvider,
|
|
@@ -44,6 +42,8 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
44
42
|
collabEditProvider,
|
|
45
43
|
presenceProvider
|
|
46
44
|
} = props;
|
|
45
|
+
const UNSAFE_cards = props.UNSAFE_cards;
|
|
46
|
+
const smartLinks = props.smartLinks;
|
|
47
47
|
const providerFactory = useRef(new ProviderFactory());
|
|
48
48
|
const [providerState, setProviderState] = useState(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent));
|
|
49
49
|
const prevProps = usePreviousState({
|
|
@@ -15,7 +15,6 @@ import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
|
15
15
|
import { useEditorContext } from '../ui/EditorContext';
|
|
16
16
|
import measurements from '../utils/performance/measure-enum';
|
|
17
17
|
import EditorInternal from './editor-internal';
|
|
18
|
-
import deprecationWarnings from './utils/deprecationWarnings';
|
|
19
18
|
import sendDurationAnalytics from './utils/sendDurationAnalytics';
|
|
20
19
|
import trackEditorActions from './utils/trackEditorActions';
|
|
21
20
|
export function Editor(passedProps) {
|
|
@@ -38,7 +37,6 @@ export function Editor(passedProps) {
|
|
|
38
37
|
const experienceStore = useRef();
|
|
39
38
|
const handleAnalyticsEvent = data => fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
40
39
|
useConstructor(() => {
|
|
41
|
-
deprecationWarnings(props);
|
|
42
40
|
trackEditorActions(editorActions.current, props.performanceTracking, value => handleAnalyticsEvent(value));
|
|
43
41
|
});
|
|
44
42
|
const getExperienceStore = () => experienceStore.current;
|
package/dist/es2019/editor.js
CHANGED
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
|
+
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
|
|
6
7
|
import EditorNext from './editor-next';
|
|
7
8
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
8
9
|
const EditorNextWrapper = ({
|
|
@@ -16,6 +17,10 @@ const EditorNextWrapper = ({
|
|
|
16
17
|
}, props));
|
|
17
18
|
};
|
|
18
19
|
export default class Editor extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
editorDeprecationWarnings(props);
|
|
23
|
+
}
|
|
19
24
|
render() {
|
|
20
25
|
return jsx(EditorNextWrapper, {
|
|
21
26
|
props: this.props
|
|
@@ -9,123 +9,119 @@ import textFormattingInputRulePlugin from './pm-plugins/input-rule';
|
|
|
9
9
|
import keymapPlugin from './pm-plugins/keymap';
|
|
10
10
|
import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
|
|
11
11
|
import Toolbar from './ui/Toolbar';
|
|
12
|
-
import {
|
|
13
|
-
const textFormatting = (options = {}, api) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
toggleStrong,
|
|
128
|
-
toggleStrongWithAnalytics
|
|
129
|
-
}
|
|
130
|
-
});
|
|
12
|
+
import { toggleSuperscriptWithAnalytics, toggleSubscriptWithAnalytics, toggleStrikeWithAnalytics, toggleCodeWithAnalytics, toggleUnderlineWithAnalytics, toggleEmWithAnalytics, toggleStrongWithAnalytics } from './actions';
|
|
13
|
+
const textFormatting = (options = {}, api) => {
|
|
14
|
+
var _api$dependencies$ana7, _api$dependencies$ana8, _api$dependencies$ana9, _api$dependencies$ana10, _api$dependencies$ana11, _api$dependencies$ana12, _api$dependencies$ana13;
|
|
15
|
+
return {
|
|
16
|
+
name: 'textFormatting',
|
|
17
|
+
marks() {
|
|
18
|
+
return [{
|
|
19
|
+
name: 'em',
|
|
20
|
+
mark: em
|
|
21
|
+
}, {
|
|
22
|
+
name: 'strong',
|
|
23
|
+
mark: strong
|
|
24
|
+
}, {
|
|
25
|
+
name: 'strike',
|
|
26
|
+
mark: strike
|
|
27
|
+
}].concat(options.disableCode ? [] : {
|
|
28
|
+
name: 'code',
|
|
29
|
+
mark: code
|
|
30
|
+
}).concat(options.disableSuperscriptAndSubscript ? [] : {
|
|
31
|
+
name: 'subsup',
|
|
32
|
+
mark: subsup
|
|
33
|
+
}).concat(options.disableUnderline ? [] : {
|
|
34
|
+
name: 'underline',
|
|
35
|
+
mark: underline
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
pmPlugins() {
|
|
39
|
+
return [{
|
|
40
|
+
name: 'textFormatting',
|
|
41
|
+
plugin: ({
|
|
42
|
+
dispatch
|
|
43
|
+
}) => {
|
|
44
|
+
var _api$dependencies$ana;
|
|
45
|
+
return textFormattingPlugin(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);
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
name: 'textFormattingCursor',
|
|
49
|
+
plugin: () => textFormattingCursorPlugin
|
|
50
|
+
}, {
|
|
51
|
+
name: 'textFormattingInputRule',
|
|
52
|
+
// Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
|
|
53
|
+
plugin: ({
|
|
54
|
+
schema,
|
|
55
|
+
featureFlags
|
|
56
|
+
}) => {
|
|
57
|
+
var _api$dependencies$ana2;
|
|
58
|
+
return textFormattingInputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
name: 'textFormattingSmartRule',
|
|
62
|
+
plugin: () => {
|
|
63
|
+
var _api$dependencies$ana3;
|
|
64
|
+
return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions) : undefined;
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
name: 'textFormattingClear',
|
|
68
|
+
plugin: ({
|
|
69
|
+
dispatch
|
|
70
|
+
}) => clearFormattingPlugin(dispatch)
|
|
71
|
+
}, {
|
|
72
|
+
name: 'textFormattingClearKeymap',
|
|
73
|
+
plugin: () => {
|
|
74
|
+
var _api$dependencies$ana4;
|
|
75
|
+
return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
name: 'textFormattingKeymap',
|
|
79
|
+
plugin: ({
|
|
80
|
+
schema
|
|
81
|
+
}) => {
|
|
82
|
+
var _api$dependencies$ana5;
|
|
83
|
+
return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
|
|
84
|
+
}
|
|
85
|
+
}];
|
|
86
|
+
},
|
|
87
|
+
primaryToolbarComponent({
|
|
88
|
+
editorView,
|
|
89
|
+
popupsMountPoint,
|
|
90
|
+
popupsScrollableElement,
|
|
91
|
+
isToolbarReducedSpacing,
|
|
92
|
+
toolbarSize,
|
|
93
|
+
disabled
|
|
94
|
+
}) {
|
|
95
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
96
|
+
plugins: {
|
|
97
|
+
textFormattingState: textFormattingPluginKey,
|
|
98
|
+
clearFormattingPluginState: clearFormattingPluginKey
|
|
99
|
+
},
|
|
100
|
+
render: () => {
|
|
101
|
+
var _api$dependencies$ana6;
|
|
102
|
+
return /*#__PURE__*/React.createElement(Toolbar, {
|
|
103
|
+
editorState: editorView.state,
|
|
104
|
+
popupsMountPoint: popupsMountPoint,
|
|
105
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
106
|
+
toolbarSize: toolbarSize,
|
|
107
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
108
|
+
editorView: editorView,
|
|
109
|
+
isToolbarDisabled: disabled,
|
|
110
|
+
shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
|
|
111
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
actions: {
|
|
117
|
+
toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions),
|
|
118
|
+
toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions),
|
|
119
|
+
toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions),
|
|
120
|
+
toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions),
|
|
121
|
+
toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana11 = api.dependencies.analytics) === null || _api$dependencies$ana11 === void 0 ? void 0 : _api$dependencies$ana11.actions),
|
|
122
|
+
toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana12 = api.dependencies.analytics) === null || _api$dependencies$ana12 === void 0 ? void 0 : _api$dependencies$ana12.actions),
|
|
123
|
+
toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana13 = api.dependencies.analytics) === null || _api$dependencies$ana13 === void 0 ? void 0 : _api$dependencies$ana13.actions)
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
131
127
|
export default textFormatting;
|
package/dist/es2019/{editor-next/utils/deprecationWarnings.js → utils/editorDeprecationWarnings.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { nextMajorVersion } from '
|
|
2
|
-
export default function
|
|
1
|
+
import { nextMajorVersion } from '../version-wrapper';
|
|
2
|
+
export default function editorDeprecationWarnings(props) {
|
|
3
3
|
if (process.env.NODE_ENV === 'production') {
|
|
4
4
|
return;
|
|
5
5
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -151,9 +151,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
_defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (payload) {
|
|
154
|
-
if (!_this.props.allowAnalyticsGASV3) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
154
|
fireAnalyticsEvent(_this.props.createAnalyticsEvent)(payload);
|
|
158
155
|
});
|
|
159
156
|
_defineProperty(_assertThisInitialized(_this), "editorPlugins", []);
|
|
@@ -500,7 +497,7 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
500
497
|
}
|
|
501
498
|
});
|
|
502
499
|
_defineProperty(_assertThisInitialized(_this), "dispatchAnalyticsEvent", function (payload) {
|
|
503
|
-
if (_this.
|
|
500
|
+
if (_this.eventDispatcher) {
|
|
504
501
|
var dispatch = createDispatch(_this.eventDispatcher);
|
|
505
502
|
dispatch(analyticsEventKey, {
|
|
506
503
|
payload: payload
|
|
@@ -92,7 +92,6 @@ export function EditorInternalWithoutHooks(_ref) {
|
|
|
92
92
|
providerFactory: providerFactory,
|
|
93
93
|
onEditorCreated: onEditorCreated,
|
|
94
94
|
onEditorDestroyed: onEditorDestroyed,
|
|
95
|
-
allowAnalyticsGASV3: props.allowAnalyticsGASV3,
|
|
96
95
|
disabled: props.disabled,
|
|
97
96
|
preset: preset,
|
|
98
97
|
render: function render(_ref2) {
|
|
@@ -126,7 +125,6 @@ export function EditorInternalWithoutHooks(_ref) {
|
|
|
126
125
|
primaryToolbarComponents: config.primaryToolbarComponents,
|
|
127
126
|
primaryToolbarIconBefore: props.primaryToolbarIconBefore,
|
|
128
127
|
secondaryToolbarComponents: config.secondaryToolbarComponents,
|
|
129
|
-
insertMenuItems: props.insertMenuItems,
|
|
130
128
|
customContentComponents: props.contentComponents,
|
|
131
129
|
customPrimaryToolbarComponents: props.primaryToolbarComponents,
|
|
132
130
|
customSecondaryToolbarComponents: props.secondaryToolbarComponents,
|
|
@@ -30,8 +30,6 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
30
30
|
var extensionProviders = props.extensionProviders,
|
|
31
31
|
quickInsert = props.quickInsert,
|
|
32
32
|
linking = props.linking,
|
|
33
|
-
smartLinks = props.smartLinks,
|
|
34
|
-
UNSAFE_cards = props.UNSAFE_cards,
|
|
35
33
|
autoformattingProvider = props.autoformattingProvider,
|
|
36
34
|
media = props.media,
|
|
37
35
|
emojiProvider = props.emojiProvider,
|
|
@@ -45,6 +43,8 @@ export default function useProviderFactory(props, editorActions, createAnalytics
|
|
|
45
43
|
collabEdit = props.collabEdit,
|
|
46
44
|
collabEditProvider = props.collabEditProvider,
|
|
47
45
|
presenceProvider = props.presenceProvider;
|
|
46
|
+
var UNSAFE_cards = props.UNSAFE_cards;
|
|
47
|
+
var smartLinks = props.smartLinks;
|
|
48
48
|
var providerFactory = useRef(new ProviderFactory());
|
|
49
49
|
var _useState = useState(createNewState(editorActions, quickInsert, extensionProviders, createAnalyticsEvent)),
|
|
50
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -18,7 +18,6 @@ import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
|
18
18
|
import { useEditorContext } from '../ui/EditorContext';
|
|
19
19
|
import measurements from '../utils/performance/measure-enum';
|
|
20
20
|
import EditorInternal from './editor-internal';
|
|
21
|
-
import deprecationWarnings from './utils/deprecationWarnings';
|
|
22
21
|
import sendDurationAnalytics from './utils/sendDurationAnalytics';
|
|
23
22
|
import trackEditorActions from './utils/trackEditorActions';
|
|
24
23
|
export function Editor(passedProps) {
|
|
@@ -39,7 +38,6 @@ export function Editor(passedProps) {
|
|
|
39
38
|
return fireAnalyticsEvent(createAnalyticsEvent)(data);
|
|
40
39
|
};
|
|
41
40
|
useConstructor(function () {
|
|
42
|
-
deprecationWarnings(props);
|
|
43
41
|
trackEditorActions(editorActions.current, props.performanceTracking, function (value) {
|
|
44
42
|
return handleAnalyticsEvent(value);
|
|
45
43
|
});
|
package/dist/esm/editor.js
CHANGED
|
@@ -10,6 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
/** @jsx jsx */
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
|
+
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
|
|
13
14
|
import EditorNext from './editor-next';
|
|
14
15
|
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
15
16
|
var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
@@ -24,9 +25,12 @@ var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
|
24
25
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
25
26
|
_inherits(Editor, _React$Component);
|
|
26
27
|
var _super = _createSuper(Editor);
|
|
27
|
-
function Editor() {
|
|
28
|
+
function Editor(props) {
|
|
29
|
+
var _this;
|
|
28
30
|
_classCallCheck(this, Editor);
|
|
29
|
-
|
|
31
|
+
_this = _super.call(this, props);
|
|
32
|
+
editorDeprecationWarnings(props);
|
|
33
|
+
return _this;
|
|
30
34
|
}
|
|
31
35
|
_createClass(Editor, [{
|
|
32
36
|
key: "render",
|