@atlaskit/editor-core 184.0.4 → 185.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
- package/dist/cjs/editor-next/index.js +41 -34
- package/dist/cjs/editor.js +30 -269
- package/dist/cjs/i18n/en_ZZ.js +32 -6
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/plugins/base/index.js +0 -12
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/cjs/plugins/card/toolbar.js +11 -9
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
- package/dist/cjs/plugins/code-block/index.js +7 -5
- package/dist/cjs/plugins/code-block/toolbar.js +5 -5
- package/dist/cjs/plugins/copy-button/commands.js +2 -3
- package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
- package/dist/cjs/plugins/expand/index.js +1 -1
- package/dist/cjs/plugins/expand/toolbar.js +40 -39
- package/dist/cjs/plugins/extension/index.js +1 -1
- package/dist/cjs/plugins/extension/toolbar.js +5 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/cjs/plugins/layout/index.js +8 -4
- package/dist/cjs/plugins/layout/toolbar.js +5 -6
- package/dist/cjs/plugins/media/toolbar/index.js +31 -24
- package/dist/cjs/plugins/panel/index.js +2 -1
- package/dist/cjs/plugins/panel/toolbar.js +7 -7
- package/dist/cjs/plugins/placeholder-text/index.js +7 -5
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
- package/dist/es2019/editor-next/index.js +39 -30
- package/dist/es2019/editor.js +29 -232
- package/dist/es2019/i18n/en_ZZ.js +32 -6
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/plugins/base/index.js +0 -7
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +8 -6
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/es2019/plugins/code-block/index.js +7 -5
- package/dist/es2019/plugins/code-block/toolbar.js +5 -6
- package/dist/es2019/plugins/copy-button/commands.js +2 -3
- package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/expand/toolbar.js +5 -6
- package/dist/es2019/plugins/extension/index.js +1 -1
- package/dist/es2019/plugins/extension/toolbar.js +5 -6
- package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/layout/toolbar.js +5 -6
- package/dist/es2019/plugins/media/toolbar/index.js +35 -24
- package/dist/es2019/plugins/panel/index.js +2 -2
- package/dist/es2019/plugins/panel/toolbar.js +7 -8
- package/dist/es2019/plugins/placeholder-text/index.js +7 -5
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
- package/dist/esm/editor-next/index.js +42 -33
- package/dist/esm/editor.js +29 -270
- package/dist/esm/i18n/en_ZZ.js +32 -6
- package/dist/esm/index.js +1 -2
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/plugins/base/index.js +0 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +7 -6
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/esm/plugins/code-block/index.js +7 -5
- package/dist/esm/plugins/code-block/toolbar.js +5 -5
- package/dist/esm/plugins/copy-button/commands.js +2 -3
- package/dist/esm/plugins/copy-button/toolbar.js +7 -8
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/expand/toolbar.js +40 -39
- package/dist/esm/plugins/extension/index.js +1 -1
- package/dist/esm/plugins/extension/toolbar.js +5 -5
- package/dist/esm/plugins/floating-toolbar/index.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/esm/plugins/layout/index.js +8 -4
- package/dist/esm/plugins/layout/toolbar.js +5 -6
- package/dist/esm/plugins/media/toolbar/index.js +31 -24
- package/dist/esm/plugins/panel/index.js +2 -1
- package/dist/esm/plugins/panel/toolbar.js +7 -7
- package/dist/esm/plugins/placeholder-text/index.js +7 -5
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/esm/ui/CollapsedEditor/index.js +1 -2
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/editor-next/index.d.ts +0 -6
- package/dist/types/editor.d.ts +1 -137
- package/dist/types/i18n/en_ZZ.d.ts +28 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
- package/dist/types/labs/next/presets/default.d.ts +212 -0
- package/dist/types/labs/next/presets/mobile.d.ts +106 -0
- package/dist/types/plugins/base/index.d.ts +0 -4
- package/dist/types/plugins/card/index.d.ts +2 -2
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -2
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types/plugins/card/ui/types.d.ts +1 -1
- package/dist/types/plugins/code-block/index.d.ts +7 -1
- package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types/plugins/expand/index.d.ts +2 -1
- package/dist/types/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +7 -2
- package/dist/types/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types/plugins/layout/index.d.ts +7 -1
- package/dist/types/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +2 -0
- package/dist/types/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
- package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
- package/dist/types-ts4.5/editor.d.ts +1 -137
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
- package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
- package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
- package/package.json +15 -10
- package/report.api.md +5 -93
- package/dist/cjs/editor-next/editor-migration-component.js +0 -54
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
- package/dist/es2019/editor-next/editor-migration-component.js +0 -30
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
- package/dist/esm/editor-next/editor-migration-component.js +0 -47
- package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
- package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
- package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
package/dist/esm/editor.js
CHANGED
|
@@ -5,271 +5,51 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
8
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
11
|
/** @jsx jsx */
|
|
11
12
|
import { jsx } from '@emotion/react';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
13
|
import React from 'react';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { name, version } from './version-wrapper';
|
|
14
|
+
import { defaultProps } from './editor-next/utils/editorPropTypes';
|
|
15
|
+
import EditorNext from './editor-next';
|
|
16
|
+
import useUniversalPreset from './labs/next/presets/useUniversalPreset';
|
|
18
17
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
18
|
+
import { name, version } from './version-wrapper';
|
|
19
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
19
20
|
import uuid from 'uuid/v4';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import prepareExtensionProvider from './utils/prepare-extension-provider';
|
|
30
|
-
import handleProviders from './editor-next/utils/handleProviders';
|
|
31
|
-
import getProvidersFromEditorProps from './editor-next/utils/getProvidersFromEditorProps';
|
|
32
|
-
import { startMeasure, clearMeasure, stopMeasure, measureTTI } from '@atlaskit/editor-common/utils';
|
|
33
|
-
import measurements from './utils/performance/measure-enum';
|
|
34
|
-
import editorMeasureTTICallback from './editor-next/utils/editorMeasureTTICallback';
|
|
35
|
-
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
36
|
-
import sendDurationAnalytics from './editor-next/utils/sendDurationAnalytics';
|
|
37
|
-
import { createPreset } from './create-editor/create-plugins-list';
|
|
38
|
-
import { shouldRecreatePreset } from './create-editor/preset-utils';
|
|
21
|
+
var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
22
|
+
var props = _ref.props;
|
|
23
|
+
var preset = useUniversalPreset({
|
|
24
|
+
props: props
|
|
25
|
+
});
|
|
26
|
+
return jsx(EditorNext, _extends({
|
|
27
|
+
preset: preset
|
|
28
|
+
}, props));
|
|
29
|
+
};
|
|
39
30
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
40
31
|
_inherits(Editor, _React$Component);
|
|
41
32
|
var _super = _createSuper(Editor);
|
|
42
|
-
function Editor(
|
|
43
|
-
var _props$performanceTra, _props$performanceTra2, _props$featureFlags;
|
|
33
|
+
function Editor() {
|
|
44
34
|
var _this;
|
|
45
35
|
_classCallCheck(this, Editor);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* @private
|
|
49
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
50
|
-
* Please reach out to the Editor team if you were previously using this
|
|
51
|
-
* and need to find a workaround.
|
|
52
|
-
*/
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "prepareExtensionProvider", prepareExtensionProvider(function () {
|
|
54
|
-
return _this.editorActions;
|
|
55
|
-
}));
|
|
56
|
-
/**
|
|
57
|
-
* @private
|
|
58
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
59
|
-
* Please reach out to the Editor team if you were previously using this
|
|
60
|
-
* and need to find a workaround.
|
|
61
|
-
*/
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "prepareQuickInsertProvider", function (extensionProvider, quickInsert) {
|
|
63
|
-
return prepareQuickInsertProvider(_this.editorActions, extensionProvider, quickInsert, _this.createAnalyticsEvent);
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* @private
|
|
67
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
68
|
-
* Please reach out to the Editor team if you were previously using this
|
|
69
|
-
* and need to find a workaround.
|
|
70
|
-
*/
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "handleSave", function (view) {
|
|
72
|
-
var _this$props$onSave, _this$props;
|
|
73
|
-
return (_this$props$onSave = (_this$props = _this.props).onSave) === null || _this$props$onSave === void 0 ? void 0 : _this$props$onSave.call(_this$props, view);
|
|
74
|
-
});
|
|
75
|
-
/**
|
|
76
|
-
* @private
|
|
77
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
78
|
-
* Please reach out to the Editor team if you were previously using this
|
|
79
|
-
* and need to find a workaround.
|
|
80
|
-
*/
|
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (data) {
|
|
82
|
-
return fireAnalyticsEvent(_this.createAnalyticsEvent)(data);
|
|
83
|
-
});
|
|
84
|
-
_defineProperty(_assertThisInitialized(_this), "getFeatureFlags", function () {
|
|
85
|
-
return createFeatureFlagsFromProps(_this.props);
|
|
86
|
-
});
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "getExperienceStore", function () {
|
|
88
|
-
return _this.experienceStore;
|
|
89
|
-
});
|
|
90
|
-
_this.providerFactory = new ProviderFactory();
|
|
91
|
-
deprecationWarnings(props);
|
|
92
|
-
_this.editorActions = (context || {}).editorActions || new EditorActions();
|
|
93
|
-
_this.editorSessionId = uuid();
|
|
94
|
-
_this.startTime = performance.now();
|
|
95
|
-
_this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
|
|
96
|
-
_this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
|
|
97
|
-
_this.getExperienceStore = _this.getExperienceStore.bind(_assertThisInitialized(_this));
|
|
98
|
-
_this.trackEditorActions(_this.editorActions, props);
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Consider any changes here to corresponding file for `EditorNext` in
|
|
102
|
-
* `useEditorConstructor` (editor-next/hooks/useEditorMeasuresConstructor.ts)
|
|
103
|
-
*/
|
|
104
|
-
startMeasure(measurements.EDITOR_MOUNTED);
|
|
105
|
-
if ((_props$performanceTra = props.performanceTracking) !== null && _props$performanceTra !== void 0 && (_props$performanceTra2 = _props$performanceTra.ttiTracking) !== null && _props$performanceTra2 !== void 0 && _props$performanceTra2.enabled || (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
|
|
106
|
-
var _props$performanceTra3, _props$performanceTra4, _props$performanceTra5, _props$performanceTra6;
|
|
107
|
-
measureTTI(function (tti, ttiFromInvocation, canceled) {
|
|
108
|
-
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, _this.props.performanceTracking, _this.props.featureFlags, _this.createAnalyticsEvent, _this.experienceStore);
|
|
109
|
-
}, (_props$performanceTra3 = props.performanceTracking) === null || _props$performanceTra3 === void 0 ? void 0 : (_props$performanceTra4 = _props$performanceTra3.ttiTracking) === null || _props$performanceTra4 === void 0 ? void 0 : _props$performanceTra4.ttiIdleThreshold, (_props$performanceTra5 = props.performanceTracking) === null || _props$performanceTra5 === void 0 ? void 0 : (_props$performanceTra6 = _props$performanceTra5.ttiTracking) === null || _props$performanceTra6 === void 0 ? void 0 : _props$performanceTra6.ttiCancelTimeout);
|
|
36
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
|
+
args[_key] = arguments[_key];
|
|
110
38
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* Consider any changes here to corresponding file for `EditorNext` in
|
|
114
|
-
* `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
|
|
115
|
-
*/
|
|
116
|
-
var _extensionProvider = _this.prepareExtensionProvider(props.extensionProviders);
|
|
117
|
-
var quickInsertProvider = _this.prepareQuickInsertProvider(_extensionProvider, props.quickInsert);
|
|
118
|
-
var preset = createPreset(props, undefined, _this.createAnalyticsEvent);
|
|
119
|
-
_this.state = {
|
|
120
|
-
extensionProvider: _extensionProvider,
|
|
121
|
-
quickInsertProvider: quickInsertProvider,
|
|
122
|
-
preset: preset
|
|
123
|
-
};
|
|
39
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "editorSessionId", uuid());
|
|
124
41
|
return _this;
|
|
125
42
|
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Consider any changes here to corresponding file for `EditorNext` in
|
|
129
|
-
* `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
|
|
130
|
-
* `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
|
|
131
|
-
*/
|
|
132
43
|
_createClass(Editor, [{
|
|
133
|
-
key: "componentDidMount",
|
|
134
|
-
value: function componentDidMount() {
|
|
135
|
-
stopMeasure(measurements.EDITOR_MOUNTED, sendDurationAnalytics(ACTION.EDITOR_MOUNTED, this.props, this.getExperienceStore, this.createAnalyticsEvent));
|
|
136
|
-
handleProviders(this.providerFactory, getProvidersFromEditorProps(this.props), this.state.extensionProvider, this.state.quickInsertProvider);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Consider any changes here to corresponding file for `EditorNext` in
|
|
141
|
-
* `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
|
|
142
|
-
*/
|
|
143
|
-
}, {
|
|
144
|
-
key: "componentDidUpdate",
|
|
145
|
-
value: function componentDidUpdate(prevProps) {
|
|
146
|
-
var _this2 = this;
|
|
147
|
-
var needsANewPreset = shouldRecreatePreset(prevProps, this.props);
|
|
148
|
-
var preset = needsANewPreset ? createPreset(this.props, prevProps, this.createAnalyticsEvent) : this.state.preset;
|
|
149
|
-
var _this$props2 = this.props,
|
|
150
|
-
extensionProviders = _this$props2.extensionProviders,
|
|
151
|
-
quickInsert = _this$props2.quickInsert;
|
|
152
|
-
if (extensionProviders && extensionProviders !== prevProps.extensionProviders ||
|
|
153
|
-
// Though this will introduce some performance regression related to quick insert
|
|
154
|
-
// loading but we can remove it soon when Forge will move to new API.
|
|
155
|
-
// quickInsert={Promise.resolve(consumerQuickInsert)} is one of the main reason behind this performance issue.
|
|
156
|
-
quickInsert && quickInsert !== prevProps.quickInsert) {
|
|
157
|
-
var extensionProvider = this.prepareExtensionProvider(extensionProviders);
|
|
158
|
-
var quickInsertProvider = this.prepareQuickInsertProvider(extensionProvider, quickInsert);
|
|
159
|
-
this.setState({
|
|
160
|
-
extensionProvider: extensionProvider,
|
|
161
|
-
quickInsertProvider: quickInsertProvider,
|
|
162
|
-
preset: preset
|
|
163
|
-
}, function () {
|
|
164
|
-
return handleProviders(_this2.providerFactory, getProvidersFromEditorProps(_this2.props), _this2.state.extensionProvider, _this2.state.quickInsertProvider);
|
|
165
|
-
});
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (needsANewPreset) {
|
|
169
|
-
this.setState({
|
|
170
|
-
preset: preset
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
handleProviders(this.providerFactory, getProvidersFromEditorProps(this.props), this.state.extensionProvider, this.state.quickInsertProvider);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Consider any changes here to corresponding file for `EditorNext` in
|
|
179
|
-
* `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
|
|
180
|
-
* `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
|
|
181
|
-
*/
|
|
182
|
-
}, {
|
|
183
|
-
key: "componentWillUnmount",
|
|
184
|
-
value: function componentWillUnmount() {
|
|
185
|
-
var _this$props3, _this$props3$performa, _this$props3$performa2, _this$props$featureFl;
|
|
186
|
-
this.unregisterEditorFromActions();
|
|
187
|
-
this.providerFactory.destroy();
|
|
188
|
-
clearMeasure(measurements.EDITOR_MOUNTED);
|
|
189
|
-
((_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$performa = _this$props3.performanceTracking) === null || _this$props3$performa === void 0 ? void 0 : (_this$props3$performa2 = _this$props3$performa.onEditorReadyCallbackTracking) === null || _this$props3$performa2 === void 0 ? void 0 : _this$props3$performa2.enabled) && clearMeasure(measurements.ON_EDITOR_READY_CALLBACK);
|
|
190
|
-
if ((_this$props$featureFl = this.props.featureFlags) !== null && _this$props$featureFl !== void 0 && _this$props$featureFl.ufo) {
|
|
191
|
-
var _this$experienceStore;
|
|
192
|
-
(_this$experienceStore = this.experienceStore) === null || _this$experienceStore === void 0 ? void 0 : _this$experienceStore.abortAll({
|
|
193
|
-
reason: 'editor component unmounted'
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* @private
|
|
200
|
-
* @deprecated - Do not override this at all, this is an anti-pattern.
|
|
201
|
-
* Please reach out to the Editor team if you were previously using this
|
|
202
|
-
* and need to find a workaround.
|
|
203
|
-
*/
|
|
204
|
-
}, {
|
|
205
|
-
key: "trackEditorActions",
|
|
206
|
-
value: function trackEditorActions(editorActions, props) {
|
|
207
|
-
var _this3 = this;
|
|
208
|
-
return _trackEditorActions(editorActions, props.performanceTracking, function (value) {
|
|
209
|
-
return _this3.handleAnalyticsEvent(value);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}, {
|
|
213
|
-
key: "onEditorCreated",
|
|
214
|
-
value:
|
|
215
|
-
/**
|
|
216
|
-
* @private
|
|
217
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
218
|
-
* Please reach out to the Editor team if you were previously using this
|
|
219
|
-
* and need to find a workaround.
|
|
220
|
-
*/
|
|
221
|
-
function onEditorCreated(instance) {
|
|
222
|
-
var _this4 = this;
|
|
223
|
-
_onEditorCreated(instance, this.props, function (experienceStore) {
|
|
224
|
-
return _this4.experienceStore = experienceStore;
|
|
225
|
-
}, this.getExperienceStore, function () {
|
|
226
|
-
return _this4.createAnalyticsEvent;
|
|
227
|
-
}, this.editorActions, this.startTime, function (view, dispatcher, transformerForActions) {
|
|
228
|
-
return _this4.registerEditorForActions(view, dispatcher, transformerForActions);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* @private
|
|
234
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
235
|
-
* Please reach out to the Editor team if you were previously using this
|
|
236
|
-
* and need to find a workaround.
|
|
237
|
-
*/
|
|
238
|
-
}, {
|
|
239
|
-
key: "onEditorDestroyed",
|
|
240
|
-
value: function onEditorDestroyed(_instance) {
|
|
241
|
-
var _this$props$onDestroy, _this$props4;
|
|
242
|
-
this.unregisterEditorFromActions();
|
|
243
|
-
(_this$props$onDestroy = (_this$props4 = this.props).onDestroy) === null || _this$props$onDestroy === void 0 ? void 0 : _this$props$onDestroy.call(_this$props4);
|
|
244
|
-
}
|
|
245
|
-
}, {
|
|
246
|
-
key: "registerEditorForActions",
|
|
247
|
-
value:
|
|
248
|
-
/**
|
|
249
|
-
* @private
|
|
250
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
251
|
-
* Please reach out to the Editor team if you were previously using this
|
|
252
|
-
* and need to find a workaround.
|
|
253
|
-
*/
|
|
254
|
-
function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
|
|
255
|
-
this.editorActions._privateRegisterEditor(editorView, eventDispatcher, contentTransformer, this.getFeatureFlags);
|
|
256
|
-
}
|
|
257
|
-
}, {
|
|
258
|
-
key: "unregisterEditorFromActions",
|
|
259
|
-
value:
|
|
260
|
-
/**
|
|
261
|
-
* @private
|
|
262
|
-
* @deprecated - Do not override this at all, this is an antipattern.
|
|
263
|
-
* Please reach out to the Editor team if you were previously using this
|
|
264
|
-
* and need to find a workaround.
|
|
265
|
-
*/
|
|
266
|
-
function unregisterEditorFromActions() {
|
|
267
|
-
this.editorActions._privateUnregisterEditor();
|
|
268
|
-
}
|
|
269
|
-
}, {
|
|
270
44
|
key: "render",
|
|
271
45
|
value: function render() {
|
|
272
|
-
|
|
46
|
+
// TODO: https://product-fabric.atlassian.net/browse/ED-16979
|
|
47
|
+
// Move `FabricEditorAnalyticsContext` back into `EditorNext`
|
|
48
|
+
// This was moved out here to workaround the issue that the analytics
|
|
49
|
+
// context does not wrap the Preset (and therefore does not pass this context
|
|
50
|
+
// information to analytics calls within plugins). After this cleanup task ^ we will
|
|
51
|
+
// not have to generate the `createAnalyticsEvent` outside the Preset
|
|
52
|
+
// and we can move this back into `EditorNext`.
|
|
273
53
|
return jsx(FabricEditorAnalyticsContext, {
|
|
274
54
|
data: {
|
|
275
55
|
packageName: name,
|
|
@@ -278,33 +58,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
278
58
|
appearance: getAnalyticsAppearance(this.props.appearance),
|
|
279
59
|
editorSessionId: this.editorSessionId
|
|
280
60
|
}
|
|
281
|
-
}, jsx(
|
|
282
|
-
|
|
283
|
-
return (_this5.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
|
|
284
|
-
props: _this5.props,
|
|
285
|
-
handleAnalyticsEvent: _this5.handleAnalyticsEvent,
|
|
286
|
-
createAnalyticsEvent: _this5.createAnalyticsEvent,
|
|
287
|
-
preset: _this5.state.preset,
|
|
288
|
-
handleSave: _this5.handleSave,
|
|
289
|
-
editorActions: _this5.editorActions,
|
|
290
|
-
providerFactory: _this5.providerFactory,
|
|
291
|
-
onEditorCreated: _this5.onEditorCreated,
|
|
292
|
-
onEditorDestroyed: _this5.onEditorDestroyed
|
|
293
|
-
});
|
|
294
|
-
}
|
|
61
|
+
}, jsx(EditorNextWrapper, {
|
|
62
|
+
props: this.props
|
|
295
63
|
}));
|
|
296
64
|
}
|
|
297
65
|
}]);
|
|
298
66
|
return Editor;
|
|
299
67
|
}(React.Component);
|
|
300
|
-
/**
|
|
301
|
-
* WARNING: Code should be shared between Editor + EditorNext
|
|
302
|
-
* If you are making changes that affect both, consider making them
|
|
303
|
-
* in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
|
|
304
|
-
*/
|
|
305
68
|
_defineProperty(Editor, "defaultProps", defaultProps);
|
|
306
|
-
_defineProperty(Editor, "contextTypes", {
|
|
307
|
-
editorActions: PropTypes.object
|
|
308
|
-
});
|
|
309
|
-
_defineProperty(Editor, "propTypes", propTypes('minHeight only supports editor appearance chromeless and comment for Editor'));
|
|
310
69
|
export { Editor as default };
|
package/dist/esm/i18n/en_ZZ.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
//
|
|
9
9
|
export default {
|
|
10
10
|
'fabric.editor.addAltText': 'Alt text',
|
|
11
|
+
'fabric.editor.addImageBorder': 'Add border',
|
|
11
12
|
'fabric.editor.alignCenter': 'Align Center',
|
|
12
13
|
'fabric.editor.alignLeft': 'Align left',
|
|
13
14
|
'fabric.editor.alignRight': 'Align Right',
|
|
14
15
|
'fabric.editor.alignment': 'Text alignment',
|
|
15
16
|
'fabric.editor.altText': 'Alt text',
|
|
16
17
|
'fabric.editor.alttext.validation': 'Please remove any special characters in alt text.',
|
|
17
|
-
'fabric.editor.annotate': 'Annotate',
|
|
18
18
|
'fabric.editor.annotationToolbar': 'Annotation toolbar',
|
|
19
19
|
'fabric.editor.backLink': 'Go back',
|
|
20
20
|
'fabric.editor.blockCardUnavailable': 'The inline link is inside {node} and cannot have its view changed',
|
|
@@ -62,6 +62,7 @@ export default {
|
|
|
62
62
|
'fabric.editor.customPanel.description': 'Add a note with an emoji and colored background',
|
|
63
63
|
'fabric.editor.decisionPlaceholder': 'Add a decision…',
|
|
64
64
|
'fabric.editor.defaultAltText': 'List item',
|
|
65
|
+
'fabric.editor.description': 'Description',
|
|
65
66
|
'fabric.editor.displayBlock': 'Display card',
|
|
66
67
|
'fabric.editor.displayEmbed': 'Display embed',
|
|
67
68
|
'fabric.editor.displayInline': 'Display inline',
|
|
@@ -77,6 +78,7 @@ export default {
|
|
|
77
78
|
'fabric.editor.editStatusColor': 'Edit Status Color',
|
|
78
79
|
'fabric.editor.editStatusText': 'Edit Status',
|
|
79
80
|
'fabric.editor.editableContentLabel': 'Editable content',
|
|
81
|
+
'fabric.editor.editorAssistiveLabel': 'Main content area, start typing to enter text.',
|
|
80
82
|
'fabric.editor.editorHelp': 'Editor help',
|
|
81
83
|
'fabric.editor.editors': 'Editors',
|
|
82
84
|
'fabric.editor.elementBrowser.help': 'Help',
|
|
@@ -101,14 +103,18 @@ export default {
|
|
|
101
103
|
'fabric.editor.error': 'Error',
|
|
102
104
|
'fabric.editor.errorPanel': 'Error panel',
|
|
103
105
|
'fabric.editor.errorPanel.description': 'Call out errors in a colored panel',
|
|
104
|
-
'fabric.editor.extension.confirmDeleteLinkedModalMessage': '
|
|
105
|
-
'fabric.editor.extension.confirmDeleteLinkedModalOKButton': '
|
|
106
|
+
'fabric.editor.extension.confirmDeleteLinkedModalMessage': 'Deleting {nodeName} will break anything connected to it.',
|
|
107
|
+
'fabric.editor.extension.confirmDeleteLinkedModalOKButton': 'Delete',
|
|
108
|
+
'fabric.editor.extension.deleteElementTitle': 'Delete element',
|
|
109
|
+
'fabric.editor.extension.sourceNoTitledName': 'this element',
|
|
106
110
|
'fabric.editor.extensions.config-panel.save-indicator': 'All changes are always autosaved',
|
|
107
111
|
'fabric.editor.find': 'Find',
|
|
108
112
|
'fabric.editor.findNext': 'Find next',
|
|
109
113
|
'fabric.editor.findPrevious': 'Find previous',
|
|
110
114
|
'fabric.editor.findReplaceToolbarButton': 'Find and replace',
|
|
111
115
|
'fabric.editor.floatingToolbar.confirmModalCancel': 'Cancel',
|
|
116
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': 'Also delete connected elements',
|
|
117
|
+
'fabric.editor.floatingToolbar.confirmModalConnectedUnit': '{amount, plural, =0 {{name}} one {{name} (+1 connected element)} other {{name} (+{amount,number} connected elements)}}',
|
|
112
118
|
'fabric.editor.floatingToolbar.confirmModalHeading': 'Are you sure?',
|
|
113
119
|
'fabric.editor.floatingToolbar.confirmModalOK': 'OK',
|
|
114
120
|
'fabric.editor.floatingToolbar.floatingToolbarAnnouncer': 'Floating toolbar controls have been opened',
|
|
@@ -139,6 +145,12 @@ export default {
|
|
|
139
145
|
'fabric.editor.hyperlink.searchLinkAriaDescription': 'Suggestions will appear below as you type into the field',
|
|
140
146
|
'fabric.editor.hyperlink.searchLinkResults': '{count, plural, =0 {no results found} one {{count,number} result found} other {{count,number} results found}}',
|
|
141
147
|
'fabric.editor.hyperlinkToolbarPlaceholder': 'Paste or search for link',
|
|
148
|
+
'fabric.editor.imageBorderBold': 'Bold',
|
|
149
|
+
'fabric.editor.imageBorderColor': 'Color',
|
|
150
|
+
'fabric.editor.imageBorderMedium': 'Medium',
|
|
151
|
+
'fabric.editor.imageBorderOptions': 'Border options',
|
|
152
|
+
'fabric.editor.imageBorderSize': 'Size',
|
|
153
|
+
'fabric.editor.imageBorderSubtle': 'Subtle',
|
|
142
154
|
'fabric.editor.improvement': 'Improvement',
|
|
143
155
|
'fabric.editor.indent': 'Indent',
|
|
144
156
|
'fabric.editor.info': 'Info',
|
|
@@ -160,9 +172,12 @@ export default {
|
|
|
160
172
|
'fabric.editor.matchCase': 'Match case',
|
|
161
173
|
'fabric.editor.mediaAddLink': 'Add link',
|
|
162
174
|
'fabric.editor.mediaGroupDeleteLabel': 'delete',
|
|
175
|
+
'fabric.editor.mentionNode.label': 'Tagged user',
|
|
163
176
|
'fabric.editor.mentionsAddLabel': 'add-icon',
|
|
164
177
|
'fabric.editor.mentionsIconLabel': 'Mention',
|
|
165
178
|
'fabric.editor.moreFormatting': 'More formatting',
|
|
179
|
+
'fabric.editor.navigate.toolbar.editor': 'Navigate to editor toolbar',
|
|
180
|
+
'fabric.editor.navigate.toolbar.floating': 'Navigate to floating toolbar',
|
|
166
181
|
'fabric.editor.noResultsFound': 'No results',
|
|
167
182
|
'fabric.editor.noSearchResults': 'No search results',
|
|
168
183
|
'fabric.editor.normal': 'Normal text',
|
|
@@ -183,6 +198,7 @@ export default {
|
|
|
183
198
|
'fabric.editor.placeholderTextPlaceholder': 'Add placeholder text',
|
|
184
199
|
'fabric.editor.quickInsert': 'Quick insert',
|
|
185
200
|
'fabric.editor.redo': 'Redo',
|
|
201
|
+
'fabric.editor.removeImageBorder': 'Remove border',
|
|
186
202
|
'fabric.editor.replace': 'Replace',
|
|
187
203
|
'fabric.editor.replaceAll': 'Replace all',
|
|
188
204
|
'fabric.editor.replaceWith': 'Replace with',
|
|
@@ -191,6 +207,7 @@ export default {
|
|
|
191
207
|
'fabric.editor.searchResults': '{itemsLength, plural, one {{itemsLength,number} search result available} other {{itemsLength,number} search results available}}',
|
|
192
208
|
'fabric.editor.selectLanguage': 'Select language',
|
|
193
209
|
'fabric.editor.settingsLinks': 'Go to Link Preferences',
|
|
210
|
+
'fabric.editor.shortcut': 'Text shortcut',
|
|
194
211
|
'fabric.editor.single': 'Single column',
|
|
195
212
|
'fabric.editor.statusPlaceholder': 'Set a status',
|
|
196
213
|
'fabric.editor.story': 'Story',
|
|
@@ -212,9 +229,17 @@ export default {
|
|
|
212
229
|
'fabric.editor.threeColumns': 'Three columns',
|
|
213
230
|
'fabric.editor.threeColumnsWithSidebars': 'Three columns with sidebars',
|
|
214
231
|
'fabric.editor.toolbarLabel': 'Editor toolbar',
|
|
215
|
-
'fabric.editor.toolbarMediaTitle': '
|
|
232
|
+
'fabric.editor.toolbarMediaTitle': 'Add image, video, or file',
|
|
216
233
|
'fabric.editor.twoColumns': 'Two columns',
|
|
217
|
-
'fabric.editor.
|
|
234
|
+
'fabric.editor.typeAhead.popupLabel': 'Typeahead results',
|
|
235
|
+
'fabric.editor.typeAhead.quickInsertInputLabel': 'Begin typing to search or filter shortcut options',
|
|
236
|
+
'fabric.editor.typeAhead.quickInsertPopupLabel': 'Shortcuts for inserts and formatting',
|
|
237
|
+
'fabric.editor.typeahead.emojiInputLabel': 'Begin typing to search or filter emoji options',
|
|
238
|
+
'fabric.editor.typeahead.emojiListItemLabel': 'Emoji {name} Text Shortcut {shortcut}',
|
|
239
|
+
'fabric.editor.typeahead.emojiPopupLabel': 'Emoji shortcuts',
|
|
240
|
+
'fabric.editor.typeahead.mentionInputLabel': 'Begin typing to search for users to tag',
|
|
241
|
+
'fabric.editor.typeahead.mentionPopupLabel': 'Users you can tag',
|
|
242
|
+
'fabric.editor.typeahead.metionListItemLabel': 'User {name} @{shortName}',
|
|
218
243
|
'fabric.editor.unableToOpenLink': 'Unable to open this link',
|
|
219
244
|
'fabric.editor.underline': 'Underline',
|
|
220
245
|
'fabric.editor.undo': 'Undo',
|
|
@@ -228,5 +253,6 @@ export default {
|
|
|
228
253
|
'fabric.editor.warningPanel': 'Warning panel',
|
|
229
254
|
'fabric.editor.warningPanel.description': 'Add a note of caution in a colored panel',
|
|
230
255
|
'fabric.editor.wrapLeft': 'Wrap left',
|
|
231
|
-
'fabric.editor.wrapRight': 'Wrap right'
|
|
256
|
+
'fabric.editor.wrapRight': 'Wrap right',
|
|
257
|
+
'fabric.emoji.label': 'Emoji'
|
|
232
258
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -61,5 +61,4 @@ export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ui/Co
|
|
|
61
61
|
export { DEFAULT_BORDER_COLOR } from './ui/ColorPalette/Palettes/common';
|
|
62
62
|
export { default as messages, statusMessages, dateMessages } from './messages';
|
|
63
63
|
export { createTypeAheadTools } from './plugins/type-ahead/api';
|
|
64
|
-
export { createQuickInsertTools } from './plugins/quick-insert/api';
|
|
65
|
-
export { default as EditorMigrationComponent } from './editor-next/editor-migration-component';
|
|
64
|
+
export { createQuickInsertTools } from './plugins/quick-insert/api';
|
|
@@ -23,6 +23,7 @@ import quickInsertPlugin from '../../../plugins/quick-insert';
|
|
|
23
23
|
import selectionPlugin from '../../../plugins/selection';
|
|
24
24
|
import codeBlockPlugin from '../../../plugins/code-block';
|
|
25
25
|
import undoRedoPlugin from '../../../plugins/undo-redo';
|
|
26
|
+
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
26
27
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
27
28
|
// #endregion
|
|
28
29
|
|
|
@@ -51,7 +52,7 @@ export function createDefaultPreset(options) {
|
|
|
51
52
|
}]);
|
|
52
53
|
}
|
|
53
54
|
return builder;
|
|
54
|
-
}).add([pastePlugin, options.paste]).add(clipboardPlugin).add([basePlugin, options.base]).maybeAdd(undoRedoPlugin, function (p, builder) {
|
|
55
|
+
}).add([pastePlugin, options.paste]).add(clipboardPlugin).add([basePlugin, options.base]).add(decorationsPlugin).maybeAdd(undoRedoPlugin, function (p, builder) {
|
|
55
56
|
var _options$featureFlags;
|
|
56
57
|
// The undo redo plugin needs to be add before the blockTypePlugin
|
|
57
58
|
if ((_options$featureFlags = options.featureFlags) !== null && _options$featureFlags !== void 0 && _options$featureFlags.undoRedoButtons) {
|
|
@@ -14,7 +14,6 @@ import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
|
14
14
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
15
15
|
import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
|
|
16
16
|
import { plugin as reactNodeView } from './pm-plugins/react-nodeview';
|
|
17
|
-
import decorationPlugin, { hoverDecoration } from './pm-plugins/decoration';
|
|
18
17
|
import scrollGutter from './pm-plugins/scroll-gutter';
|
|
19
18
|
import { keymap } from '../../utils/keymap';
|
|
20
19
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
@@ -70,11 +69,6 @@ var basePlugin = function basePlugin(options, api) {
|
|
|
70
69
|
var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
71
70
|
return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
|
|
72
71
|
}
|
|
73
|
-
}, {
|
|
74
|
-
name: 'decorationPlugin',
|
|
75
|
-
plugin: function plugin() {
|
|
76
|
-
return decorationPlugin();
|
|
77
|
-
}
|
|
78
72
|
}, {
|
|
79
73
|
name: 'history',
|
|
80
74
|
plugin: function plugin() {
|
|
@@ -150,9 +144,6 @@ var basePlugin = function basePlugin(options, api) {
|
|
|
150
144
|
name: 'text',
|
|
151
145
|
node: text
|
|
152
146
|
}];
|
|
153
|
-
},
|
|
154
|
-
actions: {
|
|
155
|
-
hoverDecoration: hoverDecoration
|
|
156
147
|
}
|
|
157
148
|
};
|
|
158
149
|
};
|
|
@@ -61,6 +61,12 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
61
61
|
contentEditable: true
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "onError", function (_ref) {
|
|
65
|
+
var err = _ref.err;
|
|
66
|
+
if (err) {
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
64
70
|
return _this;
|
|
65
71
|
}
|
|
66
72
|
_createClass(BlockCardComponent, [{
|
|
@@ -89,6 +95,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
95
|
appearance: "block",
|
|
90
96
|
onClick: this.onClick,
|
|
91
97
|
onResolve: this.onResolve,
|
|
98
|
+
onError: this.onError,
|
|
92
99
|
showActions: platform === 'web',
|
|
93
100
|
platform: platform,
|
|
94
101
|
showServerActions: showServerActions
|
|
@@ -233,6 +233,12 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
233
233
|
});
|
|
234
234
|
_this.saveOriginalDimensionsAttributes(height, undefined);
|
|
235
235
|
});
|
|
236
|
+
_defineProperty(_assertThisInitialized(_this), "onError", function (_ref2) {
|
|
237
|
+
var err = _ref2.err;
|
|
238
|
+
if (err) {
|
|
239
|
+
throw err;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
236
242
|
return _this;
|
|
237
243
|
}
|
|
238
244
|
_createClass(EmbedCardComponent, [{
|
|
@@ -287,6 +293,7 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
287
293
|
appearance: "embed",
|
|
288
294
|
onClick: this.onClick,
|
|
289
295
|
onResolve: this.onResolve,
|
|
296
|
+
onError: this.onError,
|
|
290
297
|
showActions: platform === 'web',
|
|
291
298
|
isFrameVisible: true,
|
|
292
299
|
inheritDimensions: true,
|
|
@@ -46,7 +46,11 @@ export var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
46
46
|
})();
|
|
47
47
|
});
|
|
48
48
|
_defineProperty(_assertThisInitialized(_this), "onError", function (data) {
|
|
49
|
-
var url = data.url
|
|
49
|
+
var url = data.url,
|
|
50
|
+
err = data.err;
|
|
51
|
+
if (err) {
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
50
54
|
_this.onResolve({
|
|
51
55
|
url: url
|
|
52
56
|
});
|
|
@@ -6,8 +6,7 @@ import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
|
6
6
|
import { closeHistory } from 'prosemirror-history';
|
|
7
7
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
8
8
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { SMART_LINK_TYPE } from '../../../plugins/analytics/types/node-events';
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics';
|
|
11
10
|
import { nodesBetweenChanged, processRawValue } from '../../../utils';
|
|
12
11
|
import { unlinkPayload } from '../../../utils/linking-utils';
|
|
13
12
|
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
@@ -9,8 +9,8 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
9
9
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
10
10
|
import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
11
11
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
12
|
-
import { linkToolbarMessages
|
|
13
|
-
import commonMessages from '
|
|
12
|
+
import { linkToolbarMessages } from '../../messages';
|
|
13
|
+
import commonMessages, { linkMessages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { changeSelectedCardToText } from './pm-plugins/doc';
|
|
15
15
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
16
16
|
import { pluginKey } from './pm-plugins/main';
|
|
@@ -163,7 +163,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
|
163
163
|
};
|
|
164
164
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
165
165
|
return function (node) {
|
|
166
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
166
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
|
|
167
167
|
var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
|
|
168
168
|
url = _titleUrlPairFromNode2.url;
|
|
169
169
|
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.analytics) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
@@ -181,7 +181,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
181
181
|
}
|
|
182
182
|
var pluginState = pluginKey.getState(state);
|
|
183
183
|
var currentAppearance = appearanceForNodeType(node.type);
|
|
184
|
-
var
|
|
184
|
+
var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
185
|
+
hoverDecoration = _ref2.hoverDecoration;
|
|
185
186
|
|
|
186
187
|
/* mobile builds toolbar natively using toolbarItems */
|
|
187
188
|
if (pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -238,8 +239,8 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
238
239
|
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
239
240
|
}]);
|
|
240
241
|
if (currentAppearance === 'embed') {
|
|
241
|
-
var _pluginInjectionApi$
|
|
242
|
-
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
242
|
+
var _pluginInjectionApi$d6;
|
|
243
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, cardOptions);
|
|
243
244
|
if (alignmentOptions.length) {
|
|
244
245
|
alignmentOptions.push({
|
|
245
246
|
type: 'separator'
|