@atlaskit/editor-common 74.47.1 → 74.49.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 +21 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/core-plugin.js +25 -0
- package/dist/cjs/preset/editor-commands.js +1 -1
- package/dist/cjs/preset/plugin-injection-api.js +12 -15
- package/dist/cjs/resizer/Resizer.js +3 -2
- package/dist/cjs/styles/shared/resizer.js +2 -1
- package/dist/cjs/types/editor-public-api.js +5 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/core-plugin.js +21 -0
- package/dist/es2019/preset/editor-commands.js +1 -1
- package/dist/es2019/preset/plugin-injection-api.js +13 -15
- package/dist/es2019/resizer/Resizer.js +2 -1
- package/dist/es2019/styles/shared/resizer.js +10 -0
- package/dist/es2019/types/editor-public-api.js +1 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/core-plugin.js +18 -0
- package/dist/esm/preset/editor-commands.js +1 -1
- package/dist/esm/preset/plugin-injection-api.js +12 -15
- package/dist/esm/resizer/Resizer.js +3 -2
- package/dist/esm/styles/shared/resizer.js +2 -1
- package/dist/esm/types/editor-public-api.js +1 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/hooks/useSharedPluginState.d.ts +2 -2
- package/dist/types/preset/core-plugin.d.ts +18 -0
- package/dist/types/preset/editor-commands.d.ts +1 -1
- package/dist/types/preset/plugin-injection-api.d.ts +17 -5
- package/dist/types/resizer/Resizer.d.ts +2 -1
- package/dist/types/resizer/types.d.ts +1 -0
- package/dist/types/types/editor-public-api.d.ts +3 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/next-editor-plugin.d.ts +14 -31
- package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +2 -2
- package/dist/types-ts4.5/preset/core-plugin.d.ts +18 -0
- package/dist/types-ts4.5/preset/editor-commands.d.ts +1 -1
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +18 -5
- package/dist/types-ts4.5/resizer/Resizer.d.ts +2 -1
- package/dist/types-ts4.5/resizer/types.d.ts +1 -0
- package/dist/types-ts4.5/types/editor-public-api.d.ts +4 -0
- package/dist/types-ts4.5/types/index.d.ts +1 -0
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +19 -31
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.49.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`9ebabeaa630`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9ebabeaa630) - added ExtractPublicEditorAPI type helper
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`fd6bb9c9184`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd6bb9c9184) - Delete version.json
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 74.48.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`30d49e87f62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30d49e87f62) - Added danger apperance to ReszierNext component and toggled it when the delete icon in the table floating toolbar is rolled over
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`967f4819f58`](https://bitbucket.org/atlassian/atlassian-frontend/commits/967f4819f58) - Introduce core plugin that is always injected into the pluginInjectionApi. This has a new action `execute` that replaces the existing `executeCommand` that was called from the `pluginInjectionApi`.
|
|
23
|
+
|
|
3
24
|
## 74.47.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
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; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "74.
|
|
19
|
+
var packageVersion = "74.49.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.corePlugin = void 0;
|
|
7
|
+
var _editorCommands = require("./editor-commands");
|
|
8
|
+
var corePlugin = function corePlugin(_ref) {
|
|
9
|
+
var getEditorView = _ref.getEditorView;
|
|
10
|
+
return {
|
|
11
|
+
name: 'core',
|
|
12
|
+
actions: {
|
|
13
|
+
execute: function execute(command) {
|
|
14
|
+
var editorView = getEditorView();
|
|
15
|
+
if (!editorView || !command) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var state = editorView.state,
|
|
19
|
+
dispatch = editorView.dispatch;
|
|
20
|
+
return (0, _editorCommands.editorCommandToPMCommand)(command)(state, dispatch);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.corePlugin = corePlugin;
|
|
@@ -7,7 +7,7 @@ exports.editorCommandToPMCommand = editorCommandToPMCommand;
|
|
|
7
7
|
/**
|
|
8
8
|
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
9
9
|
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
10
|
-
* `
|
|
10
|
+
* `dependencies.core.actions.execute` on `pluginInjectionAPI`. In some cases
|
|
11
11
|
* the type may require a Command until we refactor this out and this
|
|
12
12
|
* function is suitable for those cases.
|
|
13
13
|
*
|
|
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
14
14
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
15
15
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
16
|
-
var
|
|
16
|
+
var _corePlugin = require("./core-plugin");
|
|
17
17
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
18
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -260,6 +260,12 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
260
260
|
_this2.addPlugin(plugin);
|
|
261
261
|
});
|
|
262
262
|
(0, _defineProperty2.default)(this, "addPlugin", function (plugin) {
|
|
263
|
+
// Plugins other than `core` are checked by the preset itself
|
|
264
|
+
// For some reason in some tests we have duplicates that are missed.
|
|
265
|
+
// To follow-up in ED-19611
|
|
266
|
+
if (plugin.name === 'core' && _this2.plugins.has(plugin.name)) {
|
|
267
|
+
throw new Error("Plugin ".concat(plugin.name, " has already been initialised in the Editor API! \n There cannot be duplicate plugins or you will have unexpected behaviour"));
|
|
268
|
+
}
|
|
263
269
|
_this2.plugins.set(plugin.name, plugin);
|
|
264
270
|
});
|
|
265
271
|
(0, _defineProperty2.default)(this, "getPluginByName", function (pluginName) {
|
|
@@ -272,7 +278,10 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
272
278
|
this.plugins = new Map();
|
|
273
279
|
this.actionsAPI = new ActionsAPI();
|
|
274
280
|
this.commandsAPI = new EditorCommandsAPI();
|
|
275
|
-
|
|
281
|
+
// Special core plugin that is always added
|
|
282
|
+
this.addPlugin((0, _corePlugin.corePlugin)({
|
|
283
|
+
getEditorView: getEditorView
|
|
284
|
+
}));
|
|
276
285
|
}
|
|
277
286
|
(0, _createClass2.default)(EditorPluginInjectionAPI, [{
|
|
278
287
|
key: "api",
|
|
@@ -308,21 +317,9 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
308
317
|
}
|
|
309
318
|
});
|
|
310
319
|
return {
|
|
311
|
-
dependencies: dependencies
|
|
312
|
-
executeCommand: this.executeCommand.bind(this)
|
|
320
|
+
dependencies: dependencies
|
|
313
321
|
};
|
|
314
322
|
}
|
|
315
|
-
}, {
|
|
316
|
-
key: "executeCommand",
|
|
317
|
-
value: function executeCommand(command) {
|
|
318
|
-
var editorView = this.getEditorView();
|
|
319
|
-
if (!editorView || !command) {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
var state = editorView.state,
|
|
323
|
-
dispatch = editorView.dispatch;
|
|
324
|
-
return (0, _editorCommands.editorCommandToPMCommand)(command)(state, dispatch);
|
|
325
|
-
}
|
|
326
323
|
}]);
|
|
327
324
|
return EditorPluginInjectionAPI;
|
|
328
325
|
}();
|
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _reResizable = require("re-resizable");
|
|
16
16
|
var _resizer = require("../styles/shared/resizer");
|
|
17
|
-
var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "handlePositioning", "handleStyles", "resizeRatio", "innerPadding", "snap", "snapGap", "handleMarginTop", "isHandleVisible"];
|
|
17
|
+
var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "innerPadding", "snap", "snapGap", "handleMarginTop", "isHandleVisible"];
|
|
18
18
|
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); }
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
@@ -39,6 +39,7 @@ function ResizerNext(props) {
|
|
|
39
39
|
handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen,
|
|
40
40
|
_props$handlePosition = props.handlePositioning,
|
|
41
41
|
handlePositioning = _props$handlePosition === void 0 ? 'overlap' : _props$handlePosition,
|
|
42
|
+
appearance = props.appearance,
|
|
42
43
|
handleStyles = props.handleStyles,
|
|
43
44
|
_props$resizeRatio = props.resizeRatio,
|
|
44
45
|
resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio,
|
|
@@ -108,7 +109,7 @@ function ResizerNext(props) {
|
|
|
108
109
|
var resizerClassName = (0, _classnames3.default)(className, _resizer.resizerItemClassName, {
|
|
109
110
|
'is-resizing': isResizing,
|
|
110
111
|
'display-handle': isHandleVisible
|
|
111
|
-
});
|
|
112
|
+
}, appearance);
|
|
112
113
|
|
|
113
114
|
// snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
|
|
114
115
|
var snapGapActual = (0, _react.useMemo)(function () {
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.resizerStyles = exports.resizerItemClassName = exports.resizerHandleZIndex = exports.resizerHandleStickyClassName = exports.resizerHandleSmallClassName = exports.resizerHandleShadowClassName = exports.resizerHandleRightClassName = exports.resizerHandleMediumClassName = exports.resizerHandleLeftClassName = exports.resizerHandleLargeClassName = exports.resizerHandleClassName = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
12
|
var _templateObject;
|
|
12
13
|
/*
|
|
@@ -41,5 +42,5 @@ var resizerHandleClassName = {
|
|
|
41
42
|
large: resizerHandleLargeClassName
|
|
42
43
|
};
|
|
43
44
|
exports.resizerHandleClassName = resizerHandleClassName;
|
|
44
|
-
var resizerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", ", .", " {\n display: flex;\n visibility: hidden;\n flex-direction: column;\n justify-content: center;\n width: 7px;\n transition: visibility 0.2s;\n }\n\n .", " {\n align-items: flex-end;\n }\n\n .", " {\n align-items: flex-start;\n }\n\n .", "::after,\n .", "::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n transition: background-color 0.2s;\n\n border-radius: 6px;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", ",\n .", ".display-handle\n .", ",\n .", ".display-handle\n .", " {\n visibility: visible;\n }\n\n .", ":hover\n .", "::after,\n .", ":hover\n .", "::after,\n .", ".display-handle\n .", "::after,\n .", ".display-handle\n .", "::after {\n background: ", ";\n }\n\n .", "\n .", "::after,\n .", "\n .", "::after,\n .", "\n .", ":hover::after,\n .", "\n .", ":hover::after,\n .", ".is-resizing\n .", "::after,\n .", ".is-resizing\n .", "::after {\n background: ", ";\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 64px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 43px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 96px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n position: sticky;\n top: 10px;\n bottom: 10px;\n }\n\n .", " {\n visibility: hidden;\n position: absolute;\n width: 7px;\n border-radius: 4px;\n opacity: 0;\n transition: background-color 0.2s, visibility 0.2s;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", " {\n visibility: visible;\n background-color: ", ";\n opacity: 0.5;\n }\n"])), resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border, ".concat(_colors.N60, ")"), akEditorSelectedNodeClassName, resizerHandleRightClassName, akEditorSelectedNodeClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border-focused, ".concat(_colors.B200, ")"), resizerHandleRightClassName, resizerHandleClassName.medium, resizerHandleLeftClassName, resizerHandleClassName.medium, resizerHandleRightClassName, resizerHandleClassName.small, resizerHandleLeftClassName, resizerHandleClassName.small, resizerHandleRightClassName, resizerHandleClassName.large, resizerHandleLeftClassName, resizerHandleClassName.large, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleLeftClassName, resizerHandleStickyClassName, resizerHandleShadowClassName, resizerHandleRightClassName, resizerHandleShadowClassName, resizerHandleLeftClassName, resizerHandleShadowClassName, "var(--ds-background-selected, ".concat(_colors.B50, ")"));
|
|
45
|
+
var resizerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", ", .", " {\n display: flex;\n visibility: hidden;\n flex-direction: column;\n justify-content: center;\n width: 7px;\n transition: visibility 0.2s;\n }\n\n .", " {\n align-items: flex-end;\n }\n\n .", " {\n align-items: flex-start;\n }\n\n .", "::after,\n .", "::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n transition: background-color 0.2s;\n\n border-radius: 6px;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", ",\n .", ".display-handle\n .", ",\n .", ".display-handle\n .", " {\n visibility: visible;\n }\n\n .", ":hover\n .", "::after,\n .", ":hover\n .", "::after,\n .", ".display-handle\n .", "::after,\n .", ".display-handle\n .", "::after {\n background: ", ";\n }\n\n .", ".danger {\n &\n .", "::after,\n .", "::after {\n transition: none;\n background: ", ";\n }\n }\n\n .", "\n .", "::after,\n .", "\n .", "::after,\n .", "\n .", ":hover::after,\n .", "\n .", ":hover::after,\n .", ".is-resizing\n .", "::after,\n .", ".is-resizing\n .", "::after {\n background: ", ";\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 64px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 43px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 96px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n position: sticky;\n top: 10px;\n bottom: 10px;\n }\n\n .", " {\n visibility: hidden;\n position: absolute;\n width: 7px;\n border-radius: 4px;\n opacity: 0;\n transition: background-color 0.2s, visibility 0.2s;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", " {\n visibility: visible;\n background-color: ", ";\n opacity: 0.5;\n }\n"])), resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border, ".concat(_colors.N60, ")"), resizerItemClassName, resizerHandleRightClassName, resizerHandleLeftClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, resizerHandleRightClassName, akEditorSelectedNodeClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border-focused, ".concat(_colors.B200, ")"), resizerHandleRightClassName, resizerHandleClassName.medium, resizerHandleLeftClassName, resizerHandleClassName.medium, resizerHandleRightClassName, resizerHandleClassName.small, resizerHandleLeftClassName, resizerHandleClassName.small, resizerHandleRightClassName, resizerHandleClassName.large, resizerHandleLeftClassName, resizerHandleClassName.large, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleLeftClassName, resizerHandleStickyClassName, resizerHandleShadowClassName, resizerHandleRightClassName, resizerHandleShadowClassName, resizerHandleLeftClassName, resizerHandleShadowClassName, "var(--ds-background-selected, ".concat(_colors.B50, ")"));
|
|
45
46
|
exports.resizerStyles = resizerStyles;
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
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); }; }
|
|
25
25
|
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; } } /** @jsx jsx */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "74.
|
|
27
|
+
var packageVersion = "74.49.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "74.
|
|
3
|
+
const packageVersion = "74.49.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { editorCommandToPMCommand } from './editor-commands';
|
|
2
|
+
export const corePlugin = ({
|
|
3
|
+
getEditorView
|
|
4
|
+
}) => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'core',
|
|
7
|
+
actions: {
|
|
8
|
+
execute: command => {
|
|
9
|
+
const editorView = getEditorView();
|
|
10
|
+
if (!editorView || !command) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
state,
|
|
15
|
+
dispatch
|
|
16
|
+
} = editorView;
|
|
17
|
+
return editorCommandToPMCommand(command)(state, dispatch);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
3
3
|
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
4
|
-
* `
|
|
4
|
+
* `dependencies.core.actions.execute` on `pluginInjectionAPI`. In some cases
|
|
5
5
|
* the type may require a Command until we refactor this out and this
|
|
6
6
|
* function is suitable for those cases.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import throttle from 'lodash/throttle';
|
|
4
|
-
import {
|
|
4
|
+
import { corePlugin } from './core-plugin';
|
|
5
5
|
function hasGetSharedState(plugin) {
|
|
6
6
|
return typeof plugin.getSharedState === 'function';
|
|
7
7
|
}
|
|
@@ -178,6 +178,13 @@ export class EditorPluginInjectionAPI {
|
|
|
178
178
|
this.addPlugin(plugin);
|
|
179
179
|
});
|
|
180
180
|
_defineProperty(this, "addPlugin", plugin => {
|
|
181
|
+
// Plugins other than `core` are checked by the preset itself
|
|
182
|
+
// For some reason in some tests we have duplicates that are missed.
|
|
183
|
+
// To follow-up in ED-19611
|
|
184
|
+
if (plugin.name === 'core' && this.plugins.has(plugin.name)) {
|
|
185
|
+
throw new Error(`Plugin ${plugin.name} has already been initialised in the Editor API!
|
|
186
|
+
There cannot be duplicate plugins or you will have unexpected behaviour`);
|
|
187
|
+
}
|
|
181
188
|
this.plugins.set(plugin.name, plugin);
|
|
182
189
|
});
|
|
183
190
|
_defineProperty(this, "getPluginByName", pluginName => {
|
|
@@ -190,7 +197,10 @@ export class EditorPluginInjectionAPI {
|
|
|
190
197
|
this.plugins = new Map();
|
|
191
198
|
this.actionsAPI = new ActionsAPI();
|
|
192
199
|
this.commandsAPI = new EditorCommandsAPI();
|
|
193
|
-
|
|
200
|
+
// Special core plugin that is always added
|
|
201
|
+
this.addPlugin(corePlugin({
|
|
202
|
+
getEditorView
|
|
203
|
+
}));
|
|
194
204
|
}
|
|
195
205
|
api() {
|
|
196
206
|
const {
|
|
@@ -226,19 +236,7 @@ export class EditorPluginInjectionAPI {
|
|
|
226
236
|
}
|
|
227
237
|
});
|
|
228
238
|
return {
|
|
229
|
-
dependencies
|
|
230
|
-
executeCommand: this.executeCommand.bind(this)
|
|
239
|
+
dependencies
|
|
231
240
|
};
|
|
232
241
|
}
|
|
233
|
-
executeCommand(command) {
|
|
234
|
-
const editorView = this.getEditorView();
|
|
235
|
-
if (!editorView || !command) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
const {
|
|
239
|
-
state,
|
|
240
|
-
dispatch
|
|
241
|
-
} = editorView;
|
|
242
|
-
return editorCommandToPMCommand(command)(state, dispatch);
|
|
243
|
-
}
|
|
244
242
|
}
|
|
@@ -17,6 +17,7 @@ export default function ResizerNext(props) {
|
|
|
17
17
|
handleHeightSize = 'medium',
|
|
18
18
|
handleAlignmentMethod = 'center',
|
|
19
19
|
handlePositioning = 'overlap',
|
|
20
|
+
appearance,
|
|
20
21
|
handleStyles,
|
|
21
22
|
resizeRatio = 1,
|
|
22
23
|
innerPadding,
|
|
@@ -97,7 +98,7 @@ export default function ResizerNext(props) {
|
|
|
97
98
|
const resizerClassName = classnames(className, resizerItemClassName, {
|
|
98
99
|
'is-resizing': isResizing,
|
|
99
100
|
'display-handle': isHandleVisible
|
|
100
|
-
});
|
|
101
|
+
}, appearance);
|
|
101
102
|
|
|
102
103
|
// snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
|
|
103
104
|
const snapGapActual = useMemo(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
+
import { akEditorDeleteBorder } from '@atlaskit/editor-shared-styles';
|
|
2
3
|
import { B200, B50, N60 } from '@atlaskit/theme/colors';
|
|
3
4
|
/*
|
|
4
5
|
Styles in this file are based on
|
|
@@ -73,6 +74,15 @@ export const resizerStyles = css`
|
|
|
73
74
|
background: ${`var(--ds-border, ${N60})`};
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
.${resizerItemClassName}.danger {
|
|
78
|
+
&
|
|
79
|
+
.${resizerHandleRightClassName}::after,
|
|
80
|
+
.${resizerHandleLeftClassName}::after {
|
|
81
|
+
transition: none;
|
|
82
|
+
background: ${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
.${akEditorSelectedNodeClassName}
|
|
77
87
|
.${resizerHandleRightClassName}::after,
|
|
78
88
|
.${akEditorSelectedNodeClassName}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
9
9
|
import Layer from '../Layer';
|
|
10
10
|
const packageName = "@atlaskit/editor-common";
|
|
11
|
-
const packageVersion = "74.
|
|
11
|
+
const packageVersion = "74.49.0";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.49.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { editorCommandToPMCommand } from './editor-commands';
|
|
2
|
+
export var corePlugin = function corePlugin(_ref) {
|
|
3
|
+
var getEditorView = _ref.getEditorView;
|
|
4
|
+
return {
|
|
5
|
+
name: 'core',
|
|
6
|
+
actions: {
|
|
7
|
+
execute: function execute(command) {
|
|
8
|
+
var editorView = getEditorView();
|
|
9
|
+
if (!editorView || !command) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
var state = editorView.state,
|
|
13
|
+
dispatch = editorView.dispatch;
|
|
14
|
+
return editorCommandToPMCommand(command)(state, dispatch);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
3
3
|
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
4
|
-
* `
|
|
4
|
+
* `dependencies.core.actions.execute` on `pluginInjectionAPI`. In some cases
|
|
5
5
|
* the type may require a Command until we refactor this out and this
|
|
6
6
|
* function is suitable for those cases.
|
|
7
7
|
*
|
|
@@ -9,7 +9,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
10
|
import isEqual from 'lodash/isEqual';
|
|
11
11
|
import throttle from 'lodash/throttle';
|
|
12
|
-
import {
|
|
12
|
+
import { corePlugin } from './core-plugin';
|
|
13
13
|
function hasGetSharedState(plugin) {
|
|
14
14
|
return typeof plugin.getSharedState === 'function';
|
|
15
15
|
}
|
|
@@ -251,6 +251,12 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
251
251
|
_this2.addPlugin(plugin);
|
|
252
252
|
});
|
|
253
253
|
_defineProperty(this, "addPlugin", function (plugin) {
|
|
254
|
+
// Plugins other than `core` are checked by the preset itself
|
|
255
|
+
// For some reason in some tests we have duplicates that are missed.
|
|
256
|
+
// To follow-up in ED-19611
|
|
257
|
+
if (plugin.name === 'core' && _this2.plugins.has(plugin.name)) {
|
|
258
|
+
throw new Error("Plugin ".concat(plugin.name, " has already been initialised in the Editor API! \n There cannot be duplicate plugins or you will have unexpected behaviour"));
|
|
259
|
+
}
|
|
254
260
|
_this2.plugins.set(plugin.name, plugin);
|
|
255
261
|
});
|
|
256
262
|
_defineProperty(this, "getPluginByName", function (pluginName) {
|
|
@@ -263,7 +269,10 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
263
269
|
this.plugins = new Map();
|
|
264
270
|
this.actionsAPI = new ActionsAPI();
|
|
265
271
|
this.commandsAPI = new EditorCommandsAPI();
|
|
266
|
-
|
|
272
|
+
// Special core plugin that is always added
|
|
273
|
+
this.addPlugin(corePlugin({
|
|
274
|
+
getEditorView: getEditorView
|
|
275
|
+
}));
|
|
267
276
|
}
|
|
268
277
|
_createClass(EditorPluginInjectionAPI, [{
|
|
269
278
|
key: "api",
|
|
@@ -299,21 +308,9 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
299
308
|
}
|
|
300
309
|
});
|
|
301
310
|
return {
|
|
302
|
-
dependencies: dependencies
|
|
303
|
-
executeCommand: this.executeCommand.bind(this)
|
|
311
|
+
dependencies: dependencies
|
|
304
312
|
};
|
|
305
313
|
}
|
|
306
|
-
}, {
|
|
307
|
-
key: "executeCommand",
|
|
308
|
-
value: function executeCommand(command) {
|
|
309
|
-
var editorView = this.getEditorView();
|
|
310
|
-
if (!editorView || !command) {
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
var state = editorView.state,
|
|
314
|
-
dispatch = editorView.dispatch;
|
|
315
|
-
return editorCommandToPMCommand(command)(state, dispatch);
|
|
316
|
-
}
|
|
317
314
|
}]);
|
|
318
315
|
return EditorPluginInjectionAPI;
|
|
319
316
|
}();
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
-
var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "handlePositioning", "handleStyles", "resizeRatio", "innerPadding", "snap", "snapGap", "handleMarginTop", "isHandleVisible"];
|
|
5
|
+
var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "handlePositioning", "appearance", "handleStyles", "resizeRatio", "innerPadding", "snap", "snapGap", "handleMarginTop", "isHandleVisible"];
|
|
6
6
|
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; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
import React, { useMemo, useRef, useState } from 'react';
|
|
@@ -29,6 +29,7 @@ export default function ResizerNext(props) {
|
|
|
29
29
|
handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen,
|
|
30
30
|
_props$handlePosition = props.handlePositioning,
|
|
31
31
|
handlePositioning = _props$handlePosition === void 0 ? 'overlap' : _props$handlePosition,
|
|
32
|
+
appearance = props.appearance,
|
|
32
33
|
handleStyles = props.handleStyles,
|
|
33
34
|
_props$resizeRatio = props.resizeRatio,
|
|
34
35
|
resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio,
|
|
@@ -98,7 +99,7 @@ export default function ResizerNext(props) {
|
|
|
98
99
|
var resizerClassName = classnames(className, resizerItemClassName, {
|
|
99
100
|
'is-resizing': isResizing,
|
|
100
101
|
'display-handle': isHandleVisible
|
|
101
|
-
});
|
|
102
|
+
}, appearance);
|
|
102
103
|
|
|
103
104
|
// snapGap is usually a constant, if snap.x?.length is 0 and snapGap has a value resizer cannot be resized
|
|
104
105
|
var snapGapActual = useMemo(function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
+
import { akEditorDeleteBorder } from '@atlaskit/editor-shared-styles';
|
|
4
5
|
import { B200, B50, N60 } from '@atlaskit/theme/colors';
|
|
5
6
|
/*
|
|
6
7
|
Styles in this file are based on
|
|
@@ -24,4 +25,4 @@ export var resizerHandleClassName = {
|
|
|
24
25
|
medium: resizerHandleMediumClassName,
|
|
25
26
|
large: resizerHandleLargeClassName
|
|
26
27
|
};
|
|
27
|
-
export var resizerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", ", .", " {\n display: flex;\n visibility: hidden;\n flex-direction: column;\n justify-content: center;\n width: 7px;\n transition: visibility 0.2s;\n }\n\n .", " {\n align-items: flex-end;\n }\n\n .", " {\n align-items: flex-start;\n }\n\n .", "::after,\n .", "::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n transition: background-color 0.2s;\n\n border-radius: 6px;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", ",\n .", ".display-handle\n .", ",\n .", ".display-handle\n .", " {\n visibility: visible;\n }\n\n .", ":hover\n .", "::after,\n .", ":hover\n .", "::after,\n .", ".display-handle\n .", "::after,\n .", ".display-handle\n .", "::after {\n background: ", ";\n }\n\n .", "\n .", "::after,\n .", "\n .", "::after,\n .", "\n .", ":hover::after,\n .", "\n .", ":hover::after,\n .", ".is-resizing\n .", "::after,\n .", ".is-resizing\n .", "::after {\n background: ", ";\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 64px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 43px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 96px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n position: sticky;\n top: 10px;\n bottom: 10px;\n }\n\n .", " {\n visibility: hidden;\n position: absolute;\n width: 7px;\n border-radius: 4px;\n opacity: 0;\n transition: background-color 0.2s, visibility 0.2s;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", " {\n visibility: visible;\n background-color: ", ";\n opacity: 0.5;\n }\n"])), resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border, ".concat(N60, ")"), akEditorSelectedNodeClassName, resizerHandleRightClassName, akEditorSelectedNodeClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border-focused, ".concat(B200, ")"), resizerHandleRightClassName, resizerHandleClassName.medium, resizerHandleLeftClassName, resizerHandleClassName.medium, resizerHandleRightClassName, resizerHandleClassName.small, resizerHandleLeftClassName, resizerHandleClassName.small, resizerHandleRightClassName, resizerHandleClassName.large, resizerHandleLeftClassName, resizerHandleClassName.large, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleLeftClassName, resizerHandleStickyClassName, resizerHandleShadowClassName, resizerHandleRightClassName, resizerHandleShadowClassName, resizerHandleLeftClassName, resizerHandleShadowClassName, "var(--ds-background-selected, ".concat(B50, ")"));
|
|
28
|
+
export var resizerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", ", .", " {\n display: flex;\n visibility: hidden;\n flex-direction: column;\n justify-content: center;\n width: 7px;\n transition: visibility 0.2s;\n }\n\n .", " {\n align-items: flex-end;\n }\n\n .", " {\n align-items: flex-start;\n }\n\n .", "::after,\n .", "::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n transition: background-color 0.2s;\n\n border-radius: 6px;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", ",\n .", ".display-handle\n .", ",\n .", ".display-handle\n .", " {\n visibility: visible;\n }\n\n .", ":hover\n .", "::after,\n .", ":hover\n .", "::after,\n .", ".display-handle\n .", "::after,\n .", ".display-handle\n .", "::after {\n background: ", ";\n }\n\n .", ".danger {\n &\n .", "::after,\n .", "::after {\n transition: none;\n background: ", ";\n }\n }\n\n .", "\n .", "::after,\n .", "\n .", "::after,\n .", "\n .", ":hover::after,\n .", "\n .", ":hover::after,\n .", ".is-resizing\n .", "::after,\n .", ".is-resizing\n .", "::after {\n background: ", ";\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 64px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 43px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n height: 96px;\n }\n\n .", ".", "::after,\n .", ".", "::after {\n position: sticky;\n top: 10px;\n bottom: 10px;\n }\n\n .", " {\n visibility: hidden;\n position: absolute;\n width: 7px;\n border-radius: 4px;\n opacity: 0;\n transition: background-color 0.2s, visibility 0.2s;\n }\n\n .", ":hover\n .", ",\n .", ":hover\n .", " {\n visibility: visible;\n background-color: ", ";\n opacity: 0.5;\n }\n"])), resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerHandleRightClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border, ".concat(N60, ")"), resizerItemClassName, resizerHandleRightClassName, resizerHandleLeftClassName, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, resizerHandleRightClassName, akEditorSelectedNodeClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, resizerItemClassName, resizerHandleRightClassName, resizerItemClassName, resizerHandleLeftClassName, "var(--ds-border-focused, ".concat(B200, ")"), resizerHandleRightClassName, resizerHandleClassName.medium, resizerHandleLeftClassName, resizerHandleClassName.medium, resizerHandleRightClassName, resizerHandleClassName.small, resizerHandleLeftClassName, resizerHandleClassName.small, resizerHandleRightClassName, resizerHandleClassName.large, resizerHandleLeftClassName, resizerHandleClassName.large, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleLeftClassName, resizerHandleStickyClassName, resizerHandleShadowClassName, resizerHandleRightClassName, resizerHandleShadowClassName, resizerHandleLeftClassName, resizerHandleShadowClassName, "var(--ds-background-selected, ".concat(B50, ")"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
18
18
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
19
19
|
import Layer from '../Layer';
|
|
20
20
|
var packageName = "@atlaskit/editor-common";
|
|
21
|
-
var packageVersion = "74.
|
|
21
|
+
var packageVersion = "74.49.0";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies } from '../types/next-editor-plugin';
|
|
1
|
+
import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies, PublicPluginAPI } from '../types/next-editor-plugin';
|
|
2
2
|
type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPIWithDependencies<any> | undefined, PluginList extends string[]> = Readonly<{
|
|
3
3
|
[K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPIWithDependencies<any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
|
|
4
4
|
}>;
|
|
@@ -35,5 +35,5 @@ type ExtractPluginNames<API extends PluginInjectionAPIWithDependencies<any>> = A
|
|
|
35
35
|
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
36
36
|
* the values are the shared state exposed by that plugin.
|
|
37
37
|
*/
|
|
38
|
-
export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<
|
|
38
|
+
export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<PublicPluginAPI<Plugins>>[]>(injectionApi: PublicPluginAPI<Plugins> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
|
|
39
39
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { EditorCommand, NextEditorPlugin } from '../types';
|
|
3
|
+
export type CorePlugin = NextEditorPlugin<'core', {
|
|
4
|
+
pluginConfiguration: {
|
|
5
|
+
getEditorView: () => EditorView | undefined;
|
|
6
|
+
};
|
|
7
|
+
actions: {
|
|
8
|
+
/**
|
|
9
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
10
|
+
*
|
|
11
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
12
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
13
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
14
|
+
*/
|
|
15
|
+
execute: (command: EditorCommand | undefined) => boolean;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export declare const corePlugin: CorePlugin;
|
|
@@ -3,7 +3,7 @@ import type { EditorCommand } from '../types/editor-command';
|
|
|
3
3
|
/**
|
|
4
4
|
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
5
5
|
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
6
|
-
* `
|
|
6
|
+
* `dependencies.core.actions.execute` on `pluginInjectionAPI`. In some cases
|
|
7
7
|
* the type may require a Command until we refactor this out and this
|
|
8
8
|
* function is suitable for those cases.
|
|
9
9
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { EditorCommand } from '../types/editor-command';
|
|
4
3
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
5
4
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
6
5
|
type SharedStateAPIProps = {
|
|
@@ -39,13 +38,26 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
39
38
|
private actionsAPI;
|
|
40
39
|
private commandsAPI;
|
|
41
40
|
private plugins;
|
|
42
|
-
private getEditorView;
|
|
43
41
|
constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
|
|
44
42
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
45
|
-
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []
|
|
46
|
-
|
|
43
|
+
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : [], (config: {
|
|
44
|
+
getEditorView: () => EditorView | undefined;
|
|
45
|
+
}, api?: PluginInjectionAPI<"core", {
|
|
46
|
+
pluginConfiguration: {
|
|
47
|
+
getEditorView: () => EditorView | undefined;
|
|
48
|
+
};
|
|
49
|
+
actions: {
|
|
50
|
+
execute: (command: import("../types").EditorCommand | undefined) => boolean;
|
|
51
|
+
};
|
|
52
|
+
}> | undefined) => DefaultEditorPlugin<"core", {
|
|
53
|
+
pluginConfiguration: {
|
|
54
|
+
getEditorView: () => EditorView | undefined;
|
|
55
|
+
};
|
|
56
|
+
actions: {
|
|
57
|
+
execute: (command: import("../types").EditorCommand | undefined) => boolean;
|
|
58
|
+
};
|
|
59
|
+
}>]>;
|
|
47
60
|
};
|
|
48
|
-
private executeCommand;
|
|
49
61
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
50
62
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
51
63
|
private addPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { HandleComponent } from 're-resizable';
|
|
4
|
-
import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
|
|
4
|
+
import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, ResizerAppearance, Snap } from './types';
|
|
5
5
|
export type ResizerProps = {
|
|
6
6
|
enable: EnabledHandles;
|
|
7
7
|
width: number;
|
|
@@ -24,5 +24,6 @@ export type ResizerProps = {
|
|
|
24
24
|
handleAlignmentMethod?: HandleAlignmentMethod;
|
|
25
25
|
resizeRatio?: number;
|
|
26
26
|
isHandleVisible?: boolean;
|
|
27
|
+
appearance?: ResizerAppearance;
|
|
27
28
|
};
|
|
28
29
|
export default function ResizerNext(props: PropsWithChildren<ResizerProps>): JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EditorPresetBuilder } from '../preset/builder';
|
|
2
|
+
import type { ExtractNextEditorPlugins, PublicPluginAPI } from './next-editor-plugin';
|
|
3
|
+
export type ExtractPublicEditorAPI<T extends EditorPresetBuilder<any, any>> = T extends EditorPresetBuilder<any, infer Plugins> ? PublicPluginAPI<ExtractNextEditorPlugins<Plugins>> : PublicPluginAPI<[]>;
|
|
@@ -29,6 +29,7 @@ export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin
|
|
|
29
29
|
export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
|
|
30
30
|
export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
|
|
31
31
|
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, ExtractPluginActions, PluginInjectionAPIWithDependency, PluginInjectionAPIWithDependencies, PublicPluginAPI, } from './next-editor-plugin';
|
|
32
|
+
export type { ExtractPublicEditorAPI } from './editor-public-api';
|
|
32
33
|
export type { EditorCommand, EditorCommandWithMetadata, } from './editor-command';
|
|
33
34
|
export type IconProps = {
|
|
34
35
|
label?: string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
|
|
6
6
|
*/
|
|
7
7
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { CorePlugin } from '../preset/core-plugin';
|
|
8
9
|
import type { EditorCommand, EditorCommandWithMetadata } from './editor-command';
|
|
9
10
|
import type { EditorPlugin } from './editor-plugin';
|
|
10
11
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
@@ -33,28 +34,12 @@ export interface NextEditorPluginMetadata {
|
|
|
33
34
|
readonly actions?: NextEditorPluginActions;
|
|
34
35
|
readonly commands?: NextEditorEditorCommands;
|
|
35
36
|
}
|
|
36
|
-
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* Dispatches an EditorCommand to ProseMirror
|
|
43
|
-
*
|
|
44
|
-
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
45
|
-
* is successful or `null` if it shouldn't be dispatched.
|
|
46
|
-
* @returns (boolean) if the command was successful in dispatching
|
|
47
|
-
*/
|
|
48
|
-
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
49
|
-
};
|
|
50
|
-
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
51
|
-
dependencies: CreatePluginDependenciesAPI<[
|
|
52
|
-
NextEditorPlugin<Name, Metadata>
|
|
53
|
-
]>;
|
|
54
|
-
} : never;
|
|
55
|
-
export type PluginInjectionAPIWithDependencies<Plugins> = Plugins extends NextEditorPlugin<infer Name, infer Metadata>[] ? {
|
|
56
|
-
dependencies: CreatePluginDependenciesAPI<Plugins>;
|
|
57
|
-
} : never;
|
|
37
|
+
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> = PublicPluginAPI<[
|
|
38
|
+
NextEditorPlugin<Name, Metadata>,
|
|
39
|
+
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
|
+
]>;
|
|
41
|
+
export type PluginInjectionAPIWithDependency<Plugin extends NextEditorPlugin<any, any>> = PublicPluginAPI<[Plugin]>;
|
|
42
|
+
export type PluginInjectionAPIWithDependencies<Plugins extends NextEditorPlugin<any, any>[]> = PublicPluginAPI<Plugins>;
|
|
58
43
|
type NextEditorPluginFunctionDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration> = (config: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
59
44
|
type NextEditorPluginFunctionOptionalConfigDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration = undefined> = (config?: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
60
45
|
type OptionalPrivateProperty = {
|
|
@@ -118,14 +103,12 @@ type CheckBasicPlugin<Plugin> = Plugin extends (args: any, api: any) => EditorPl
|
|
|
118
103
|
export type ExtractPluginNameFromAllBuilderPlugins<Plugin extends AllEditorPresetPluginTypes> = Plugin extends Array<any> ? Plugin extends [infer MaybePlugin, ...any] ? MaybePlugin extends NextEditorPlugin<any, any> ? ExtractPluginName<MaybePlugin> : never : never : Plugin extends NextEditorPlugin<any, any> ? ExtractPluginName<Plugin> : never;
|
|
119
104
|
export type ExtractInjectionAPI<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? PluginInjectionAPI<Name, Metadata> : never;
|
|
120
105
|
export type PublicPluginAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
|
|
121
|
-
dependencies: CreatePluginDependenciesAPI<PluginList>;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*/
|
|
129
|
-
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
106
|
+
dependencies: CreatePluginDependenciesAPI<[...PluginList, CorePlugin]>;
|
|
107
|
+
};
|
|
108
|
+
export type ExtractNextEditorPlugins<Plugins extends AllEditorPresetPluginTypes[]> = {
|
|
109
|
+
[PluginNumber in keyof Plugins]: Plugins[PluginNumber] extends NextEditorPlugin<infer Name, infer Metadata> ? NextEditorPlugin<Name, Metadata> : Plugins[PluginNumber] extends [
|
|
110
|
+
NextEditorPlugin<infer Name, infer Metadata>,
|
|
111
|
+
any
|
|
112
|
+
] ? NextEditorPlugin<Name, Metadata> : never;
|
|
130
113
|
};
|
|
131
114
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies } from '../types/next-editor-plugin';
|
|
1
|
+
import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies, PublicPluginAPI } from '../types/next-editor-plugin';
|
|
2
2
|
type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPIWithDependencies<any> | undefined, PluginList extends string[]> = Readonly<{
|
|
3
3
|
[K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPIWithDependencies<any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
|
|
4
4
|
}>;
|
|
@@ -35,5 +35,5 @@ type ExtractPluginNames<API extends PluginInjectionAPIWithDependencies<any>> = A
|
|
|
35
35
|
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
36
36
|
* the values are the shared state exposed by that plugin.
|
|
37
37
|
*/
|
|
38
|
-
export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<
|
|
38
|
+
export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<PublicPluginAPI<Plugins>>[]>(injectionApi: PublicPluginAPI<Plugins> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
|
|
39
39
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { EditorCommand, NextEditorPlugin } from '../types';
|
|
3
|
+
export type CorePlugin = NextEditorPlugin<'core', {
|
|
4
|
+
pluginConfiguration: {
|
|
5
|
+
getEditorView: () => EditorView | undefined;
|
|
6
|
+
};
|
|
7
|
+
actions: {
|
|
8
|
+
/**
|
|
9
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
10
|
+
*
|
|
11
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
12
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
13
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
14
|
+
*/
|
|
15
|
+
execute: (command: EditorCommand | undefined) => boolean;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export declare const corePlugin: CorePlugin;
|
|
@@ -3,7 +3,7 @@ import type { EditorCommand } from '../types/editor-command';
|
|
|
3
3
|
/**
|
|
4
4
|
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
5
5
|
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
6
|
-
* `
|
|
6
|
+
* `dependencies.core.actions.execute` on `pluginInjectionAPI`. In some cases
|
|
7
7
|
* the type may require a Command until we refactor this out and this
|
|
8
8
|
* function is suitable for those cases.
|
|
9
9
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { EditorCommand } from '../types/editor-command';
|
|
4
3
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
5
4
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
6
5
|
type SharedStateAPIProps = {
|
|
@@ -39,18 +38,32 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
39
38
|
private actionsAPI;
|
|
40
39
|
private commandsAPI;
|
|
41
40
|
private plugins;
|
|
42
|
-
private getEditorView;
|
|
43
41
|
constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
|
|
44
42
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
45
43
|
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[
|
|
46
44
|
NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
|
|
47
45
|
..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [
|
|
48
46
|
] : [
|
|
49
|
-
]
|
|
47
|
+
],
|
|
48
|
+
(config: {
|
|
49
|
+
getEditorView: () => EditorView | undefined;
|
|
50
|
+
}, api?: PluginInjectionAPI<"core", {
|
|
51
|
+
pluginConfiguration: {
|
|
52
|
+
getEditorView: () => EditorView | undefined;
|
|
53
|
+
};
|
|
54
|
+
actions: {
|
|
55
|
+
execute: (command: import("../types").EditorCommand | undefined) => boolean;
|
|
56
|
+
};
|
|
57
|
+
}> | undefined) => DefaultEditorPlugin<"core", {
|
|
58
|
+
pluginConfiguration: {
|
|
59
|
+
getEditorView: () => EditorView | undefined;
|
|
60
|
+
};
|
|
61
|
+
actions: {
|
|
62
|
+
execute: (command: import("../types").EditorCommand | undefined) => boolean;
|
|
63
|
+
};
|
|
64
|
+
}>
|
|
50
65
|
]>;
|
|
51
|
-
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
52
66
|
};
|
|
53
|
-
private executeCommand;
|
|
54
67
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
55
68
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
56
69
|
private addPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { HandleComponent } from 're-resizable';
|
|
4
|
-
import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
|
|
4
|
+
import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, ResizerAppearance, Snap } from './types';
|
|
5
5
|
export type ResizerProps = {
|
|
6
6
|
enable: EnabledHandles;
|
|
7
7
|
width: number;
|
|
@@ -24,5 +24,6 @@ export type ResizerProps = {
|
|
|
24
24
|
handleAlignmentMethod?: HandleAlignmentMethod;
|
|
25
25
|
resizeRatio?: number;
|
|
26
26
|
isHandleVisible?: boolean;
|
|
27
|
+
appearance?: ResizerAppearance;
|
|
27
28
|
};
|
|
28
29
|
export default function ResizerNext(props: PropsWithChildren<ResizerProps>): JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorPresetBuilder } from '../preset/builder';
|
|
2
|
+
import type { ExtractNextEditorPlugins, PublicPluginAPI } from './next-editor-plugin';
|
|
3
|
+
export type ExtractPublicEditorAPI<T extends EditorPresetBuilder<any, any>> = T extends EditorPresetBuilder<any, infer Plugins> ? PublicPluginAPI<ExtractNextEditorPlugins<Plugins>> : PublicPluginAPI<[
|
|
4
|
+
]>;
|
|
@@ -29,6 +29,7 @@ export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin
|
|
|
29
29
|
export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
|
|
30
30
|
export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
|
|
31
31
|
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, ExtractPluginActions, PluginInjectionAPIWithDependency, PluginInjectionAPIWithDependencies, PublicPluginAPI, } from './next-editor-plugin';
|
|
32
|
+
export type { ExtractPublicEditorAPI } from './editor-public-api';
|
|
32
33
|
export type { EditorCommand, EditorCommandWithMetadata, } from './editor-command';
|
|
33
34
|
export type IconProps = {
|
|
34
35
|
label?: string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
|
|
6
6
|
*/
|
|
7
7
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import type { CorePlugin } from '../preset/core-plugin';
|
|
8
9
|
import type { EditorCommand, EditorCommandWithMetadata } from './editor-command';
|
|
9
10
|
import type { EditorPlugin } from './editor-plugin';
|
|
10
11
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
@@ -33,28 +34,14 @@ export interface NextEditorPluginMetadata {
|
|
|
33
34
|
readonly actions?: NextEditorPluginActions;
|
|
34
35
|
readonly commands?: NextEditorEditorCommands;
|
|
35
36
|
}
|
|
36
|
-
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
45
|
-
* is successful or `null` if it shouldn't be dispatched.
|
|
46
|
-
* @returns (boolean) if the command was successful in dispatching
|
|
47
|
-
*/
|
|
48
|
-
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
49
|
-
};
|
|
50
|
-
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
51
|
-
dependencies: CreatePluginDependenciesAPI<[
|
|
52
|
-
NextEditorPlugin<Name, Metadata>
|
|
53
|
-
]>;
|
|
54
|
-
} : never;
|
|
55
|
-
export type PluginInjectionAPIWithDependencies<Plugins> = Plugins extends NextEditorPlugin<infer Name, infer Metadata>[] ? {
|
|
56
|
-
dependencies: CreatePluginDependenciesAPI<Plugins>;
|
|
57
|
-
} : never;
|
|
37
|
+
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> = PublicPluginAPI<[
|
|
38
|
+
NextEditorPlugin<Name, Metadata>,
|
|
39
|
+
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
|
+
]>;
|
|
41
|
+
export type PluginInjectionAPIWithDependency<Plugin extends NextEditorPlugin<any, any>> = PublicPluginAPI<[
|
|
42
|
+
Plugin
|
|
43
|
+
]>;
|
|
44
|
+
export type PluginInjectionAPIWithDependencies<Plugins extends NextEditorPlugin<any, any>[]> = PublicPluginAPI<Plugins>;
|
|
58
45
|
type NextEditorPluginFunctionDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration> = (config: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
59
46
|
type NextEditorPluginFunctionOptionalConfigDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration = undefined> = (config?: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
60
47
|
type OptionalPrivateProperty = {
|
|
@@ -136,14 +123,15 @@ export type ExtractPluginNameFromAllBuilderPlugins<Plugin extends AllEditorPrese
|
|
|
136
123
|
] ? MaybePlugin extends NextEditorPlugin<any, any> ? ExtractPluginName<MaybePlugin> : never : never : Plugin extends NextEditorPlugin<any, any> ? ExtractPluginName<Plugin> : never;
|
|
137
124
|
export type ExtractInjectionAPI<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? PluginInjectionAPI<Name, Metadata> : never;
|
|
138
125
|
export type PublicPluginAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
|
|
139
|
-
dependencies: CreatePluginDependenciesAPI<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
126
|
+
dependencies: CreatePluginDependenciesAPI<[
|
|
127
|
+
...PluginList,
|
|
128
|
+
CorePlugin
|
|
129
|
+
]>;
|
|
130
|
+
};
|
|
131
|
+
export type ExtractNextEditorPlugins<Plugins extends AllEditorPresetPluginTypes[]> = {
|
|
132
|
+
[PluginNumber in keyof Plugins]: Plugins[PluginNumber] extends NextEditorPlugin<infer Name, infer Metadata> ? NextEditorPlugin<Name, Metadata> : Plugins[PluginNumber] extends [
|
|
133
|
+
NextEditorPlugin<infer Name, infer Metadata>,
|
|
134
|
+
any
|
|
135
|
+
] ? NextEditorPlugin<Name, Metadata> : never;
|
|
148
136
|
};
|
|
149
137
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "74.
|
|
3
|
+
"version": "74.49.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@atlaskit/spinner": "^15.5.0",
|
|
113
113
|
"@atlaskit/task-decision": "^17.7.0",
|
|
114
114
|
"@atlaskit/theme": "^12.5.0",
|
|
115
|
-
"@atlaskit/tokens": "^1.
|
|
115
|
+
"@atlaskit/tokens": "^1.15.0",
|
|
116
116
|
"@atlaskit/tooltip": "^17.8.0",
|
|
117
117
|
"@atlaskit/ufo": "^0.2.0",
|
|
118
118
|
"@atlaskit/width-detector": "^4.1.0",
|