@atlaskit/editor-core 192.6.0 → 193.0.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 +16 -0
- package/dist/cjs/create-editor/create-plugins-list.js +0 -1
- package/dist/cjs/preset-universal.js +8 -1
- package/dist/cjs/presets/default.js +1 -2
- package/dist/cjs/presets/universal.js +1 -1
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +5 -3
- package/dist/cjs/ui/Addon/ClickAreaInline/index.js +4 -3
- package/dist/cjs/ui/Appearance/Comment/Comment.js +207 -10
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +0 -1
- package/dist/es2019/preset-universal.js +2 -1
- package/dist/es2019/presets/default.js +1 -2
- package/dist/es2019/presets/universal.js +1 -1
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +4 -4
- package/dist/es2019/ui/Addon/ClickAreaInline/index.js +3 -3
- package/dist/es2019/ui/Appearance/Comment/Comment.js +201 -58
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +0 -1
- package/dist/esm/preset-universal.js +2 -1
- package/dist/esm/presets/default.js +1 -2
- package/dist/esm/presets/universal.js +1 -1
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +4 -3
- package/dist/esm/ui/Addon/ClickAreaInline/index.js +3 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +208 -9
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-preset.d.ts +110 -74
- package/dist/types/preset-universal.d.ts +1 -0
- package/dist/types/presets/default.d.ts +52 -156
- package/dist/types/presets/universal.d.ts +110 -74
- package/dist/types/presets/useUniversalPreset.d.ts +110 -74
- package/dist/types-ts4.5/create-editor/create-preset.d.ts +130 -85
- package/dist/types-ts4.5/preset-universal.d.ts +1 -0
- package/dist/types-ts4.5/presets/default.d.ts +54 -180
- package/dist/types-ts4.5/presets/universal.d.ts +130 -85
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +130 -85
- package/docs/4-annotations.tsx +1 -1
- package/package.json +25 -9
- package/docs/editor-use-only.tsx +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 193.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#78867](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78867) [`283c8a390db7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/283c8a390db7) - Move annotation plugin from default preset to universal preset
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#75947](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75947) [`43549c3789b1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/43549c3789b1) - Migrate @atlaskit/editor-core to use declarative entry points
|
|
12
|
+
|
|
13
|
+
## 192.7.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#77607](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77607) [`78ab76808037`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/78ab76808037) - Fixed bug where save button state was not updated correctly for when media upload is in progress or finish uploading
|
|
18
|
+
|
|
3
19
|
## 192.6.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -77,7 +77,6 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
|
77
77
|
textFormatting: _objectSpread(_objectSpread({}, props.textFormatting || {}), {}, {
|
|
78
78
|
responsiveToolbarMenu: ((_props$textFormatting = props.textFormatting) === null || _props$textFormatting === void 0 ? void 0 : _props$textFormatting.responsiveToolbarMenu) != null ? props.textFormatting.responsiveToolbarMenu : props.allowUndoRedoButtons
|
|
79
79
|
}),
|
|
80
|
-
annotationProviders: props.annotationProviders,
|
|
81
80
|
submitEditor: props.onSave,
|
|
82
81
|
quickInsert: {
|
|
83
82
|
enableElementBrowser: props.elementBrowser && props.elementBrowser.showModal,
|
|
@@ -4,10 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "createUniversalPreset", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _universal.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
Object.defineProperty(exports, "useUniversalPreset", {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
get: function get() {
|
|
10
16
|
return _useUniversalPreset.default;
|
|
11
17
|
}
|
|
12
18
|
});
|
|
13
|
-
var _useUniversalPreset = _interopRequireDefault(require("./presets/useUniversalPreset"));
|
|
19
|
+
var _useUniversalPreset = _interopRequireDefault(require("./presets/useUniversalPreset"));
|
|
20
|
+
var _universal = _interopRequireDefault(require("./presets/universal"));
|
|
@@ -9,7 +9,6 @@ exports.useDefaultPreset = useDefaultPreset;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-plugins/analytics");
|
|
12
|
-
var _annotation = require("@atlaskit/editor-plugins/annotation");
|
|
13
12
|
var _base = require("@atlaskit/editor-plugins/base");
|
|
14
13
|
var _betterTypeHistory = require("@atlaskit/editor-plugins/better-type-history");
|
|
15
14
|
var _blockType = require("@atlaskit/editor-plugins/block-type");
|
|
@@ -56,7 +55,7 @@ function createDefaultPreset(options) {
|
|
|
56
55
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
57
56
|
}]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead || {
|
|
58
57
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
59
|
-
}]).maybeAdd(_history.historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([_blockType.blockTypePlugin, options.blockType]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).maybeAdd([
|
|
58
|
+
}]).maybeAdd(_history.historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(_undoRedo.undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([_blockType.blockTypePlugin, options.blockType]).add(_clearMarksOnEmptyDoc.clearMarksOnEmptyDocPlugin).maybeAdd([_selectionToolbar.selectionToolbarPlugin, {
|
|
60
59
|
preferenceToolbarAboveSelection: false
|
|
61
60
|
}], function () {
|
|
62
61
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.enable-selection-toolbar_ucdwd')) {
|
|
@@ -104,7 +104,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
104
104
|
__livePage: props.__livePage
|
|
105
105
|
}], Boolean(props.allowExpand)).maybeAdd(_guideline.guidelinePlugin, Boolean(!isMobile && !isComment && !isChromeless && (props.media || props.allowTables))).maybeAdd([_grid.gridPlugin, {
|
|
106
106
|
shouldCalcBreakoutGridLines: isFullPage
|
|
107
|
-
}], Boolean(props.media)).maybeAdd([_media.mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, {
|
|
107
|
+
}], Boolean(props.media)).maybeAdd([_annotation.annotationPlugin, props.annotationProviders], Boolean(props.annotationProviders)).maybeAdd([_media.mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, {
|
|
108
108
|
allowLazyLoading: !isMobile,
|
|
109
109
|
allowBreakoutSnapPoints: isFullPage,
|
|
110
110
|
allowAdvancedToolBarOptions: typeof ((_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.allowAdvancedToolBarOptions) !== 'undefined' ? (_props$media2 = props.media) === null || _props$media2 === void 0 ? void 0 : _props$media2.allowAdvancedToolBarOptions : isFullPage || isComment,
|
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ClickAreaBlock = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _react2 = require("@emotion/react");
|
|
11
10
|
var _clickAreaHelper = require("../click-area-helper");
|
|
12
|
-
var _templateObject;
|
|
13
11
|
/** @jsx jsx */
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
var clickWrapper = (0, _react2.css)({
|
|
14
|
+
flexGrow: 1,
|
|
15
|
+
height: '100%'
|
|
16
|
+
});
|
|
15
17
|
var ClickAreaBlock = exports.ClickAreaBlock = function ClickAreaBlock(_ref) {
|
|
16
18
|
var editorView = _ref.editorView,
|
|
17
19
|
editorDisabled = _ref.editorDisabled,
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ClickAreaInline = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _react2 = require("@emotion/react");
|
|
11
10
|
var _commands = require("@atlaskit/editor-common/commands");
|
|
12
|
-
var _templateObject;
|
|
13
11
|
/** @jsx jsx */
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
var clickArea = (0, _react2.css)({
|
|
14
|
+
flexGrow: 1
|
|
15
|
+
});
|
|
15
16
|
var ClickAreaInline = exports.ClickAreaInline = function ClickAreaInline(_ref) {
|
|
16
17
|
var editorView = _ref.editorView,
|
|
17
18
|
children = _ref.children;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.CommentEditorWithIntl = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -13,7 +14,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
19
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -37,17 +37,49 @@ var _PluginSlot = _interopRequireDefault(require("../../PluginSlot"));
|
|
|
37
37
|
var _Toolbar = _interopRequireDefault(require("../../Toolbar"));
|
|
38
38
|
var _WithFlash = _interopRequireDefault(require("../../WithFlash"));
|
|
39
39
|
var _Toolbar2 = require("./Toolbar");
|
|
40
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
41
|
-
/** @jsx jsx */
|
|
42
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
44
42
|
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); }; }
|
|
45
|
-
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; } }
|
|
43
|
+
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; } } /* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */ /** @jsx jsx */
|
|
46
44
|
var CommentEditorMargin = 14;
|
|
47
|
-
var commentEditorStyle = (0, _react2.css)(
|
|
48
|
-
|
|
45
|
+
var commentEditorStyle = (0, _react2.css)({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
'.less-margin .ProseMirror': {
|
|
49
|
+
margin: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-100, 8px)", " ", "var(--ds-space-100, 8px)")
|
|
50
|
+
},
|
|
51
|
+
minWidth: '272px',
|
|
52
|
+
height: 'auto',
|
|
53
|
+
backgroundColor: "var(--ds-background-input, white)",
|
|
54
|
+
border: "1px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
55
|
+
boxSizing: 'border-box',
|
|
56
|
+
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
57
|
+
maxWidth: 'inherit',
|
|
58
|
+
wordWrap: 'break-word'
|
|
59
|
+
});
|
|
60
|
+
var ContentArea = (0, _ContentStyles.createEditorContentStyle)((0, _react2.css)({
|
|
61
|
+
flexGrow: 1,
|
|
62
|
+
overflowX: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table-sticky-scrollbar') ? 'clip' : 'hidden',
|
|
63
|
+
lineHeight: '24px',
|
|
64
|
+
'.ProseMirror': {
|
|
65
|
+
margin: "var(--ds-space-150, 12px)"
|
|
66
|
+
},
|
|
67
|
+
'.gridParent': {
|
|
68
|
+
marginLeft: "".concat(CommentEditorMargin - _styles.GRID_GUTTER, "px"),
|
|
69
|
+
marginRight: "".concat(CommentEditorMargin - _styles.GRID_GUTTER, "px"),
|
|
70
|
+
width: "calc(100% + ".concat(CommentEditorMargin - _styles.GRID_GUTTER, "px)")
|
|
71
|
+
},
|
|
72
|
+
padding: "var(--ds-space-250, 20px)"
|
|
73
|
+
}, _commonStyles.tableCommentEditorStyles));
|
|
49
74
|
ContentArea.displayName = 'ContentArea';
|
|
50
|
-
var secondaryToolbarStyle = (0, _react2.css)(
|
|
75
|
+
var secondaryToolbarStyle = (0, _react2.css)({
|
|
76
|
+
boxSizing: 'border-box',
|
|
77
|
+
justifyContent: 'flex-end',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-025, 2px)")
|
|
81
|
+
});
|
|
82
|
+
var appearance = 'comment';
|
|
51
83
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
52
84
|
(0, _inherits2.default)(Editor, _React$Component);
|
|
53
85
|
var _super = _createSuper(Editor);
|
|
@@ -114,7 +146,9 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
114
146
|
return (0, _react2.jsx)(_WithFlash.default, {
|
|
115
147
|
animate: maxContentSizeReached
|
|
116
148
|
}, (0, _react2.jsx)("div", {
|
|
117
|
-
css: [commentEditorStyle, (0, _react2.css)(
|
|
149
|
+
css: [commentEditorStyle, (0, _react2.css)({
|
|
150
|
+
minHeight: "".concat(minHeight, "px")
|
|
151
|
+
})],
|
|
118
152
|
className: "akEditor",
|
|
119
153
|
ref: _this.wrapperElementRef
|
|
120
154
|
}, (0, _react2.jsx)(_Toolbar2.MainToolbar, {
|
|
@@ -153,7 +187,9 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
153
187
|
ref: function ref(_ref3) {
|
|
154
188
|
return _this.containerElement = _ref3;
|
|
155
189
|
},
|
|
156
|
-
css: maxHeight ? (0, _react2.css)(
|
|
190
|
+
css: maxHeight ? (0, _react2.css)({
|
|
191
|
+
maxHeight: "".concat(maxHeight, "px")
|
|
192
|
+
}) : null,
|
|
157
193
|
className: (0, _classnames.default)('ak-editor-content-area', {
|
|
158
194
|
'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
|
|
159
195
|
}),
|
|
@@ -219,4 +255,165 @@ function RenderWithPluginState(_ref4) {
|
|
|
219
255
|
mediaState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined
|
|
220
256
|
}));
|
|
221
257
|
}
|
|
222
|
-
var
|
|
258
|
+
var EditorNext = function EditorNext(props) {
|
|
259
|
+
var api = (0, _context.usePresetContext)();
|
|
260
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['media', 'maxContentSize']),
|
|
261
|
+
mediaState = _useSharedPluginState2.mediaState,
|
|
262
|
+
maxContentSizeState = _useSharedPluginState2.maxContentSizeState;
|
|
263
|
+
var editorDOMElement = props.editorDOMElement,
|
|
264
|
+
editorView = props.editorView,
|
|
265
|
+
editorActions = props.editorActions,
|
|
266
|
+
eventDispatcher = props.eventDispatcher,
|
|
267
|
+
providerFactory = props.providerFactory,
|
|
268
|
+
contentComponents = props.contentComponents,
|
|
269
|
+
customContentComponents = props.customContentComponents,
|
|
270
|
+
customPrimaryToolbarComponents = props.customPrimaryToolbarComponents,
|
|
271
|
+
primaryToolbarComponents = props.primaryToolbarComponents,
|
|
272
|
+
customSecondaryToolbarComponents = props.customSecondaryToolbarComponents,
|
|
273
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
274
|
+
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
275
|
+
popupsScrollableElement = props.popupsScrollableElement,
|
|
276
|
+
maxHeight = props.maxHeight,
|
|
277
|
+
_props$minHeight = props.minHeight,
|
|
278
|
+
minHeight = _props$minHeight === void 0 ? 150 : _props$minHeight,
|
|
279
|
+
onSave = props.onSave,
|
|
280
|
+
onCancel = props.onCancel,
|
|
281
|
+
disabled = props.disabled,
|
|
282
|
+
dispatchAnalyticsEvent = props.dispatchAnalyticsEvent,
|
|
283
|
+
intl = props.intl,
|
|
284
|
+
useStickyToolbar = props.useStickyToolbar,
|
|
285
|
+
pluginHooks = props.pluginHooks,
|
|
286
|
+
featureFlags = props.featureFlags,
|
|
287
|
+
innerRef = props.innerRef;
|
|
288
|
+
var maxContentSizeReached = Boolean(maxContentSizeState === null || maxContentSizeState === void 0 ? void 0 : maxContentSizeState.maxContentSizeReached);
|
|
289
|
+
var showSecondaryToolbar = !!onSave || !!onCancel || !!customSecondaryToolbarComponents;
|
|
290
|
+
var containerElement = null;
|
|
291
|
+
|
|
292
|
+
// Wrapper container for toolbar and content area
|
|
293
|
+
var wrapperElementRef = (0, _react.useMemo)(function () {
|
|
294
|
+
return innerRef || /*#__PURE__*/_react.default.createRef();
|
|
295
|
+
}, [innerRef]);
|
|
296
|
+
var _useState = (0, _react.useState)(disabled),
|
|
297
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
298
|
+
saveButtonDisabled = _useState2[0],
|
|
299
|
+
setSaveButtonDisabled = _useState2[1];
|
|
300
|
+
(0, _react.useEffect)(function () {
|
|
301
|
+
if (mediaState) {
|
|
302
|
+
mediaState.subscribeToUploadInProgressState(setSaveButtonDisabled);
|
|
303
|
+
}
|
|
304
|
+
return function () {
|
|
305
|
+
return mediaState === null || mediaState === void 0 ? void 0 : mediaState.unsubscribeFromUploadInProgressState(setSaveButtonDisabled);
|
|
306
|
+
};
|
|
307
|
+
}, [mediaState]);
|
|
308
|
+
var handleSave = (0, _react.useCallback)(function () {
|
|
309
|
+
if (editorView && onSave) {
|
|
310
|
+
onSave(editorView);
|
|
311
|
+
}
|
|
312
|
+
}, [editorView, onSave]);
|
|
313
|
+
var handleCancel = (0, _react.useCallback)(function () {
|
|
314
|
+
if (editorView && onCancel) {
|
|
315
|
+
onCancel(editorView);
|
|
316
|
+
}
|
|
317
|
+
}, [editorView, onCancel]);
|
|
318
|
+
var isShortcutToFocusToolbar = (0, _react.useCallback)(function (event) {
|
|
319
|
+
//Alt + F9 to reach first element in this main toolbar
|
|
320
|
+
return event.altKey && (event.key === 'F9' || event.keyCode === 120);
|
|
321
|
+
}, []);
|
|
322
|
+
var isTwoLineToolbarEnabled = !!customPrimaryToolbarComponents && !!(featureFlags !== null && featureFlags !== void 0 && featureFlags.twoLineEditorToolbar);
|
|
323
|
+
var handleEscape = (0, _react.useCallback)(function (event) {
|
|
324
|
+
if (!(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
|
|
325
|
+
editorView === null || editorView === void 0 || editorView.focus();
|
|
326
|
+
}
|
|
327
|
+
event.preventDefault();
|
|
328
|
+
event.stopPropagation();
|
|
329
|
+
}, [editorView]);
|
|
330
|
+
return (0, _react2.jsx)(_WithFlash.default, {
|
|
331
|
+
animate: maxContentSizeReached
|
|
332
|
+
}, (0, _react2.jsx)("div", {
|
|
333
|
+
css: [commentEditorStyle, (0, _react2.css)({
|
|
334
|
+
minHeight: "".concat(minHeight, "px")
|
|
335
|
+
})],
|
|
336
|
+
className: "akEditor",
|
|
337
|
+
ref: wrapperElementRef
|
|
338
|
+
}, (0, _react2.jsx)(_Toolbar2.MainToolbar, {
|
|
339
|
+
useStickyToolbar: useStickyToolbar,
|
|
340
|
+
twoLineEditorToolbar: isTwoLineToolbarEnabled
|
|
341
|
+
}, (0, _react2.jsx)(_uiMenu.ToolbarArrowKeyNavigationProvider, {
|
|
342
|
+
editorView: editorView,
|
|
343
|
+
childComponentSelector: "[data-testid='ak-editor-main-toolbar']",
|
|
344
|
+
isShortcutToFocusToolbar: isShortcutToFocusToolbar,
|
|
345
|
+
handleEscape: handleEscape,
|
|
346
|
+
editorAppearance: appearance,
|
|
347
|
+
useStickyToolbar: useStickyToolbar,
|
|
348
|
+
intl: intl
|
|
349
|
+
}, (0, _react2.jsx)(_Toolbar.default, {
|
|
350
|
+
editorView: editorView,
|
|
351
|
+
editorActions: editorActions,
|
|
352
|
+
eventDispatcher: eventDispatcher,
|
|
353
|
+
providerFactory: providerFactory,
|
|
354
|
+
appearance: appearance,
|
|
355
|
+
items: primaryToolbarComponents,
|
|
356
|
+
popupsMountPoint: popupsMountPoint,
|
|
357
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
358
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
359
|
+
disabled: !!disabled,
|
|
360
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
361
|
+
containerElement: containerElement,
|
|
362
|
+
twoLineEditorToolbar: isTwoLineToolbarEnabled
|
|
363
|
+
}), (0, _react2.jsx)("div", {
|
|
364
|
+
css: (0, _Toolbar2.mainToolbarCustomComponentsSlotStyle)(isTwoLineToolbarEnabled)
|
|
365
|
+
}, customPrimaryToolbarComponents))), (0, _react2.jsx)(_Addon.ClickAreaBlock, {
|
|
366
|
+
editorView: editorView,
|
|
367
|
+
editorDisabled: disabled
|
|
368
|
+
}, (0, _react2.jsx)(_ui.WidthConsumer, null, function (_ref5) {
|
|
369
|
+
var width = _ref5.width;
|
|
370
|
+
return (0, _react2.jsx)(ContentArea, {
|
|
371
|
+
ref: function ref(_ref6) {
|
|
372
|
+
return containerElement = _ref6;
|
|
373
|
+
},
|
|
374
|
+
css: maxHeight ? (0, _react2.css)({
|
|
375
|
+
maxHeight: "".concat(maxHeight, "px")
|
|
376
|
+
}) : null,
|
|
377
|
+
className: (0, _classnames.default)('ak-editor-content-area', {
|
|
378
|
+
'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
|
|
379
|
+
}),
|
|
380
|
+
featureFlags: featureFlags
|
|
381
|
+
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, (0, _react2.jsx)(_PluginSlot.default, {
|
|
382
|
+
editorView: editorView,
|
|
383
|
+
editorActions: editorActions,
|
|
384
|
+
eventDispatcher: eventDispatcher,
|
|
385
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
386
|
+
providerFactory: providerFactory,
|
|
387
|
+
appearance: appearance,
|
|
388
|
+
items: contentComponents,
|
|
389
|
+
popupsMountPoint: popupsMountPoint,
|
|
390
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
391
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
392
|
+
containerElement: containerElement,
|
|
393
|
+
disabled: !!disabled,
|
|
394
|
+
wrapperElement: wrapperElementRef.current,
|
|
395
|
+
pluginHooks: pluginHooks
|
|
396
|
+
}), editorDOMElement, customContentComponents && 'after' in customContentComponents ? customContentComponents.after : null);
|
|
397
|
+
}))), showSecondaryToolbar && (0, _react2.jsx)("div", {
|
|
398
|
+
css: secondaryToolbarStyle,
|
|
399
|
+
"data-testid": "ak-editor-secondary-toolbar"
|
|
400
|
+
}, (0, _react2.jsx)(_buttonGroup.default, null, !!onSave && (0, _react2.jsx)(_customThemeButton.default, {
|
|
401
|
+
appearance: "primary",
|
|
402
|
+
onClick: handleSave,
|
|
403
|
+
testId: "comment-save-button",
|
|
404
|
+
isDisabled: disabled || saveButtonDisabled
|
|
405
|
+
}, intl.formatMessage(_messages.default.saveButton)), !!onCancel && (0, _react2.jsx)(_customThemeButton.default, {
|
|
406
|
+
appearance: "subtle",
|
|
407
|
+
onClick: handleCancel,
|
|
408
|
+
isDisabled: disabled
|
|
409
|
+
}, intl.formatMessage(_messages.default.cancelButton))), (0, _react2.jsx)("span", {
|
|
410
|
+
style: {
|
|
411
|
+
flexGrow: 1
|
|
412
|
+
}
|
|
413
|
+
}), customSecondaryToolbarComponents));
|
|
414
|
+
};
|
|
415
|
+
EditorNext.displayName = 'CommentEditorAppearance';
|
|
416
|
+
var CommentEditorNextWithIntl = (0, _reactIntlNext.injectIntl)(EditorNext);
|
|
417
|
+
var CommentEditorOldWithIntl = (0, _reactIntlNext.injectIntl)(Editor);
|
|
418
|
+
var ExportComp = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.alluploadsfinished-dispatch-update_ivtow') ? CommentEditorNextWithIntl : CommentEditorOldWithIntl;
|
|
419
|
+
var CommentEditorWithIntl = exports.CommentEditorWithIntl = ExportComp;
|
|
@@ -65,7 +65,6 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
|
|
|
65
65
|
...(props.textFormatting || {}),
|
|
66
66
|
responsiveToolbarMenu: ((_props$textFormatting = props.textFormatting) === null || _props$textFormatting === void 0 ? void 0 : _props$textFormatting.responsiveToolbarMenu) != null ? props.textFormatting.responsiveToolbarMenu : props.allowUndoRedoButtons
|
|
67
67
|
},
|
|
68
|
-
annotationProviders: props.annotationProviders,
|
|
69
68
|
submitEditor: props.onSave,
|
|
70
69
|
quickInsert: {
|
|
71
70
|
enableElementBrowser: props.elementBrowser && props.elementBrowser.showModal,
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as useUniversalPreset } from './presets/useUniversalPreset';
|
|
1
|
+
export { default as useUniversalPreset } from './presets/useUniversalPreset';
|
|
2
|
+
export { default as createUniversalPreset } from './presets/universal';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
4
4
|
import { analyticsPlugin } from '@atlaskit/editor-plugins/analytics';
|
|
5
|
-
import { annotationPlugin } from '@atlaskit/editor-plugins/annotation';
|
|
6
5
|
import { basePlugin } from '@atlaskit/editor-plugins/base';
|
|
7
6
|
import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugins/better-type-history';
|
|
8
7
|
import { blockTypePlugin } from '@atlaskit/editor-plugins/block-type';
|
|
@@ -48,7 +47,7 @@ export function createDefaultPreset(options) {
|
|
|
48
47
|
contextIdentifierProvider: options.contextIdentifierProvider
|
|
49
48
|
}]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead || {
|
|
50
49
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
51
|
-
}]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([
|
|
50
|
+
}]).maybeAdd(historyPlugin, Boolean(isMobile || options.allowUndoRedoButtons)).maybeAdd(undoRedoPlugin, Boolean((_options$featureFlags = (_options$featureFlags2 = options.featureFlags) === null || _options$featureFlags2 === void 0 ? void 0 : _options$featureFlags2.undoRedoButtons) !== null && _options$featureFlags !== void 0 ? _options$featureFlags : options.allowUndoRedoButtons)).add([blockTypePlugin, options.blockType]).add(clearMarksOnEmptyDocPlugin).maybeAdd([selectionToolbarPlugin, {
|
|
52
51
|
preferenceToolbarAboveSelection: false
|
|
53
52
|
}], () => {
|
|
54
53
|
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
|
|
@@ -92,7 +92,7 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
92
92
|
__livePage: props.__livePage
|
|
93
93
|
}], Boolean(props.allowExpand)).maybeAdd(guidelinePlugin, Boolean(!isMobile && !isComment && !isChromeless && (props.media || props.allowTables))).maybeAdd([gridPlugin, {
|
|
94
94
|
shouldCalcBreakoutGridLines: isFullPage
|
|
95
|
-
}], Boolean(props.media)).maybeAdd([mediaPlugin, {
|
|
95
|
+
}], Boolean(props.media)).maybeAdd([annotationPlugin, props.annotationProviders], Boolean(props.annotationProviders)).maybeAdd([mediaPlugin, {
|
|
96
96
|
...props.media,
|
|
97
97
|
allowLazyLoading: !isMobile,
|
|
98
98
|
allowBreakoutSnapPoints: isFullPage,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { clickAreaClickHandler } from '../click-area-helper';
|
|
5
|
-
const clickWrapper = css
|
|
6
|
-
|
|
7
|
-
height: 100
|
|
8
|
-
|
|
5
|
+
const clickWrapper = css({
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
height: '100%'
|
|
8
|
+
});
|
|
9
9
|
export const ClickAreaBlock = ({
|
|
10
10
|
editorView,
|
|
11
11
|
editorDisabled,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { createParagraphAtEnd } from '@atlaskit/editor-common/commands';
|
|
5
|
-
const clickArea = css
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const clickArea = css({
|
|
6
|
+
flexGrow: 1
|
|
7
|
+
});
|
|
8
8
|
export const ClickAreaInline = ({
|
|
9
9
|
editorView,
|
|
10
10
|
children
|