@atlaskit/editor-common 74.45.5 → 74.46.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 +6 -0
- package/dist/cjs/keymaps/index.js +4 -4
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/{plugin-commands.js → editor-commands.js} +4 -4
- package/dist/cjs/preset/index.js +3 -3
- package/dist/cjs/preset/plugin-injection-api.js +8 -8
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/keymaps/index.js +3 -3
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/{plugin-commands.js → editor-commands.js} +3 -3
- package/dist/es2019/preset/index.js +1 -1
- package/dist/es2019/preset/plugin-injection-api.js +4 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/keymaps/index.js +3 -3
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/{plugin-commands.js → editor-commands.js} +3 -3
- package/dist/esm/preset/index.js +1 -1
- package/dist/esm/preset/plugin-injection-api.js +8 -8
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/keymaps/index.d.ts +2 -2
- package/dist/types/mark/commands.d.ts +2 -2
- package/dist/{types-ts4.5/preset/plugin-commands.d.ts → types/preset/editor-commands.d.ts} +4 -4
- package/dist/types/preset/index.d.ts +1 -1
- package/dist/types/preset/plugin-injection-api.d.ts +2 -2
- package/dist/types/types/editor-command.d.ts +5 -0
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/types/next-editor-plugin.d.ts +17 -6
- package/dist/types-ts4.5/keymaps/index.d.ts +2 -2
- package/dist/types-ts4.5/mark/commands.d.ts +2 -2
- package/dist/{types/preset/plugin-commands.d.ts → types-ts4.5/preset/editor-commands.d.ts} +4 -4
- package/dist/types-ts4.5/preset/index.d.ts +1 -1
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +2 -2
- package/dist/types-ts4.5/types/editor-command.d.ts +5 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -2
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +17 -6
- package/package.json +1 -1
- package/dist/types/types/plugin-command.d.ts +0 -7
- package/dist/types-ts4.5/types/plugin-command.d.ts +0 -7
- /package/dist/cjs/types/{plugin-command.js → editor-command.js} +0 -0
- /package/dist/es2019/types/{plugin-command.js → editor-command.js} +0 -0
- /package/dist/esm/types/{plugin-command.js → editor-command.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.46.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`24fc3925d73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24fc3925d73) - Add a new hook called `usePreset` accesed via `@atlaskit/editor-core/use-preset`. This hook can be used to safely access state and commands from outside the editor using `EditorContext`.
|
|
8
|
+
|
|
3
9
|
## 74.45.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -80,7 +80,7 @@ Object.defineProperty(exports, "UP", {
|
|
|
80
80
|
});
|
|
81
81
|
exports.backspace = exports.altPaste = exports.alignLeft = exports.addRowBefore = exports.addRowAfter = exports.addLink = exports.addInlineComment = exports.addColumnBefore = exports.addColumnAfter = exports.addAltText = void 0;
|
|
82
82
|
exports.bindKeymapWithCommand = bindKeymapWithCommand;
|
|
83
|
-
exports.
|
|
83
|
+
exports.bindKeymapWithEditorCommand = bindKeymapWithEditorCommand;
|
|
84
84
|
exports.find = exports.escape = exports.enter = exports.deleteKey = exports.cut = exports.ctrlBackSpace = exports.copy = exports.clearFormatting = void 0;
|
|
85
85
|
exports.findKeyMapForBrowser = findKeyMapForBrowser;
|
|
86
86
|
exports.findKeymapByDescription = findKeymapByDescription;
|
|
@@ -105,7 +105,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
105
105
|
var _react = _interopRequireWildcard(require("react"));
|
|
106
106
|
var _react2 = require("@emotion/react");
|
|
107
107
|
var _colors = require("@atlaskit/theme/colors");
|
|
108
|
-
var
|
|
108
|
+
var _editorCommands = require("../preset/editor-commands");
|
|
109
109
|
var _utils = require("../utils");
|
|
110
110
|
var _consts = require("./consts");
|
|
111
111
|
var _keymap = require("./keymap");
|
|
@@ -363,8 +363,8 @@ function bindKeymapWithCommand(shortcut, cmd, keymap) {
|
|
|
363
363
|
var oldCmd = keymap[shortcut];
|
|
364
364
|
keymap[shortcut] = oldCmd ? combineWithOldCommand(cmd, oldCmd) : cmd;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
bindKeymapWithCommand(shortcut, (0,
|
|
366
|
+
function bindKeymapWithEditorCommand(shortcut, cmd, keymap) {
|
|
367
|
+
bindKeymapWithCommand(shortcut, (0, _editorCommands.editorCommandToPMCommand)(cmd), keymap);
|
|
368
368
|
}
|
|
369
369
|
function findKeyMapForBrowser(keyMap) {
|
|
370
370
|
if (keyMap) {
|
|
@@ -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.46.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
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.editorCommandToPMCommand = editorCommandToPMCommand;
|
|
7
7
|
/**
|
|
8
|
-
* Convert a
|
|
9
|
-
* The preferred approach to dispatching a `
|
|
8
|
+
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
9
|
+
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
10
10
|
* `executeCommand` 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.
|
|
@@ -14,7 +14,7 @@ exports.pluginCommandToPMCommand = pluginCommandToPMCommand;
|
|
|
14
14
|
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
15
15
|
* @returns Command
|
|
16
16
|
*/
|
|
17
|
-
function
|
|
17
|
+
function editorCommandToPMCommand(command) {
|
|
18
18
|
return function (_ref, dispatch) {
|
|
19
19
|
var tr = _ref.tr;
|
|
20
20
|
var newTr = command === null || command === void 0 ? void 0 : command({
|
package/dist/cjs/preset/index.js
CHANGED
|
@@ -15,12 +15,12 @@ Object.defineProperty(exports, "EditorPresetBuilder", {
|
|
|
15
15
|
return _builder.EditorPresetBuilder;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "editorCommandToPMCommand", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _editorCommands.editorCommandToPMCommand;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
var _builder = require("./builder");
|
|
25
25
|
var _pluginInjectionApi = require("./plugin-injection-api");
|
|
26
|
-
var
|
|
26
|
+
var _editorCommands = require("./editor-commands");
|
|
@@ -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 _editorCommands = require("./editor-commands");
|
|
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; }
|
|
@@ -125,11 +125,11 @@ var ActionsAPI = /*#__PURE__*/function () {
|
|
|
125
125
|
}]);
|
|
126
126
|
return ActionsAPI;
|
|
127
127
|
}();
|
|
128
|
-
var
|
|
129
|
-
function
|
|
130
|
-
(0, _classCallCheck2.default)(this,
|
|
128
|
+
var EditorCommandsAPI = /*#__PURE__*/function () {
|
|
129
|
+
function EditorCommandsAPI() {
|
|
130
|
+
(0, _classCallCheck2.default)(this, EditorCommandsAPI);
|
|
131
131
|
}
|
|
132
|
-
(0, _createClass2.default)(
|
|
132
|
+
(0, _createClass2.default)(EditorCommandsAPI, [{
|
|
133
133
|
key: "createAPI",
|
|
134
134
|
value: function createAPI(plugin) {
|
|
135
135
|
if (!plugin || !hasCommands(plugin)) {
|
|
@@ -143,7 +143,7 @@ var PluginCommandsAPI = /*#__PURE__*/function () {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
}]);
|
|
146
|
-
return
|
|
146
|
+
return EditorCommandsAPI;
|
|
147
147
|
}();
|
|
148
148
|
var SharedStateAPI = /*#__PURE__*/function () {
|
|
149
149
|
function SharedStateAPI(_ref4) {
|
|
@@ -271,7 +271,7 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
271
271
|
});
|
|
272
272
|
this.plugins = new Map();
|
|
273
273
|
this.actionsAPI = new ActionsAPI();
|
|
274
|
-
this.commandsAPI = new
|
|
274
|
+
this.commandsAPI = new EditorCommandsAPI();
|
|
275
275
|
this.getEditorView = getEditorView;
|
|
276
276
|
}
|
|
277
277
|
(0, _createClass2.default)(EditorPluginInjectionAPI, [{
|
|
@@ -321,7 +321,7 @@ var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
321
321
|
}
|
|
322
322
|
var state = editorView.state,
|
|
323
323
|
dispatch = editorView.dispatch;
|
|
324
|
-
return (0,
|
|
324
|
+
return (0, _editorCommands.editorCommandToPMCommand)(command)(state, dispatch);
|
|
325
325
|
}
|
|
326
326
|
}]);
|
|
327
327
|
return EditorPluginInjectionAPI;
|
|
@@ -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.46.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N400 } from '@atlaskit/theme/colors';
|
|
5
|
-
import {
|
|
5
|
+
import { editorCommandToPMCommand } from '../preset/editor-commands';
|
|
6
6
|
import { browser } from '../utils';
|
|
7
7
|
export const addAltText = makeKeyMapWithCommon('Add Alt Text', 'Mod-Alt-y');
|
|
8
8
|
export const navToEditorToolbar = makeKeyMapWithCommon('Navigate to editor toolbar', 'Alt-F9');
|
|
@@ -196,8 +196,8 @@ export function bindKeymapWithCommand(shortcut, cmd, keymap) {
|
|
|
196
196
|
const oldCmd = keymap[shortcut];
|
|
197
197
|
keymap[shortcut] = oldCmd ? combineWithOldCommand(cmd, oldCmd) : cmd;
|
|
198
198
|
}
|
|
199
|
-
export function
|
|
200
|
-
bindKeymapWithCommand(shortcut,
|
|
199
|
+
export function bindKeymapWithEditorCommand(shortcut, cmd, keymap) {
|
|
200
|
+
bindKeymapWithCommand(shortcut, editorCommandToPMCommand(cmd), keymap);
|
|
201
201
|
}
|
|
202
202
|
export function findKeyMapForBrowser(keyMap) {
|
|
203
203
|
if (keyMap) {
|
|
@@ -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.46.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert a
|
|
3
|
-
* The preferred approach to dispatching a `
|
|
2
|
+
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
3
|
+
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
4
4
|
* `executeCommand` 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.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
9
9
|
* @returns Command
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function editorCommandToPMCommand(command) {
|
|
12
12
|
return ({
|
|
13
13
|
tr
|
|
14
14
|
}, dispatch) => {
|
|
@@ -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 { editorCommandToPMCommand } from './editor-commands';
|
|
5
5
|
function hasGetSharedState(plugin) {
|
|
6
6
|
return typeof plugin.getSharedState === 'function';
|
|
7
7
|
}
|
|
@@ -74,7 +74,7 @@ class ActionsAPI {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
class
|
|
77
|
+
class EditorCommandsAPI {
|
|
78
78
|
createAPI(plugin) {
|
|
79
79
|
if (!plugin || !hasCommands(plugin)) {
|
|
80
80
|
return {};
|
|
@@ -189,7 +189,7 @@ export class EditorPluginInjectionAPI {
|
|
|
189
189
|
});
|
|
190
190
|
this.plugins = new Map();
|
|
191
191
|
this.actionsAPI = new ActionsAPI();
|
|
192
|
-
this.commandsAPI = new
|
|
192
|
+
this.commandsAPI = new EditorCommandsAPI();
|
|
193
193
|
this.getEditorView = getEditorView;
|
|
194
194
|
}
|
|
195
195
|
api() {
|
|
@@ -239,6 +239,6 @@ export class EditorPluginInjectionAPI {
|
|
|
239
239
|
state,
|
|
240
240
|
dispatch
|
|
241
241
|
} = editorView;
|
|
242
|
-
return
|
|
242
|
+
return editorCommandToPMCommand(command)(state, dispatch);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
@@ -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.46.0";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,7 +5,7 @@ var _templateObject;
|
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { N400 } from '@atlaskit/theme/colors';
|
|
8
|
-
import {
|
|
8
|
+
import { editorCommandToPMCommand } from '../preset/editor-commands';
|
|
9
9
|
import { browser } from '../utils';
|
|
10
10
|
export var addAltText = makeKeyMapWithCommon('Add Alt Text', 'Mod-Alt-y');
|
|
11
11
|
export var navToEditorToolbar = makeKeyMapWithCommon('Navigate to editor toolbar', 'Alt-F9');
|
|
@@ -192,8 +192,8 @@ export function bindKeymapWithCommand(shortcut, cmd, keymap) {
|
|
|
192
192
|
var oldCmd = keymap[shortcut];
|
|
193
193
|
keymap[shortcut] = oldCmd ? combineWithOldCommand(cmd, oldCmd) : cmd;
|
|
194
194
|
}
|
|
195
|
-
export function
|
|
196
|
-
bindKeymapWithCommand(shortcut,
|
|
195
|
+
export function bindKeymapWithEditorCommand(shortcut, cmd, keymap) {
|
|
196
|
+
bindKeymapWithCommand(shortcut, editorCommandToPMCommand(cmd), keymap);
|
|
197
197
|
}
|
|
198
198
|
export function findKeyMapForBrowser(keyMap) {
|
|
199
199
|
if (keyMap) {
|
|
@@ -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.46.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert a
|
|
3
|
-
* The preferred approach to dispatching a `
|
|
2
|
+
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
3
|
+
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
4
4
|
* `executeCommand` 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.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
9
9
|
* @returns Command
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function editorCommandToPMCommand(command) {
|
|
12
12
|
return function (_ref, dispatch) {
|
|
13
13
|
var tr = _ref.tr;
|
|
14
14
|
var newTr = command === null || command === void 0 ? void 0 : command({
|
package/dist/esm/preset/index.js
CHANGED
|
@@ -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 { editorCommandToPMCommand } from './editor-commands';
|
|
13
13
|
function hasGetSharedState(plugin) {
|
|
14
14
|
return typeof plugin.getSharedState === 'function';
|
|
15
15
|
}
|
|
@@ -117,11 +117,11 @@ var ActionsAPI = /*#__PURE__*/function () {
|
|
|
117
117
|
}]);
|
|
118
118
|
return ActionsAPI;
|
|
119
119
|
}();
|
|
120
|
-
var
|
|
121
|
-
function
|
|
122
|
-
_classCallCheck(this,
|
|
120
|
+
var EditorCommandsAPI = /*#__PURE__*/function () {
|
|
121
|
+
function EditorCommandsAPI() {
|
|
122
|
+
_classCallCheck(this, EditorCommandsAPI);
|
|
123
123
|
}
|
|
124
|
-
_createClass(
|
|
124
|
+
_createClass(EditorCommandsAPI, [{
|
|
125
125
|
key: "createAPI",
|
|
126
126
|
value: function createAPI(plugin) {
|
|
127
127
|
if (!plugin || !hasCommands(plugin)) {
|
|
@@ -135,7 +135,7 @@ var PluginCommandsAPI = /*#__PURE__*/function () {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}]);
|
|
138
|
-
return
|
|
138
|
+
return EditorCommandsAPI;
|
|
139
139
|
}();
|
|
140
140
|
export var SharedStateAPI = /*#__PURE__*/function () {
|
|
141
141
|
function SharedStateAPI(_ref4) {
|
|
@@ -262,7 +262,7 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
262
262
|
});
|
|
263
263
|
this.plugins = new Map();
|
|
264
264
|
this.actionsAPI = new ActionsAPI();
|
|
265
|
-
this.commandsAPI = new
|
|
265
|
+
this.commandsAPI = new EditorCommandsAPI();
|
|
266
266
|
this.getEditorView = getEditorView;
|
|
267
267
|
}
|
|
268
268
|
_createClass(EditorPluginInjectionAPI, [{
|
|
@@ -312,7 +312,7 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
312
312
|
}
|
|
313
313
|
var state = editorView.state,
|
|
314
314
|
dispatch = editorView.dispatch;
|
|
315
|
-
return
|
|
315
|
+
return editorCommandToPMCommand(command)(state, dispatch);
|
|
316
316
|
}
|
|
317
317
|
}]);
|
|
318
318
|
return EditorPluginInjectionAPI;
|
|
@@ -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.46.0";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
package/dist/esm/version.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import type { Command } from '../types/command';
|
|
5
|
-
import type {
|
|
5
|
+
import type { EditorCommand } from '../types/editor-command';
|
|
6
6
|
export declare const addAltText: Keymap;
|
|
7
7
|
export declare const navToEditorToolbar: Keymap;
|
|
8
8
|
export declare const navToFloatingToolbar: Keymap;
|
|
@@ -88,7 +88,7 @@ export interface Keymap {
|
|
|
88
88
|
export declare function bindKeymapWithCommand(shortcut: string, cmd: Command, keymap: {
|
|
89
89
|
[key: string]: Command;
|
|
90
90
|
}): void;
|
|
91
|
-
export declare function
|
|
91
|
+
export declare function bindKeymapWithEditorCommand(shortcut: string, cmd: EditorCommand, keymap: {
|
|
92
92
|
[key: string]: Command;
|
|
93
93
|
}): void;
|
|
94
94
|
export declare function findKeyMapForBrowser(keyMap: Keymap): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Mark, MarkType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EditorCommand } from '../types';
|
|
4
4
|
export declare function filterChildrenBetween(doc: PMNode, from: number, to: number, predicate: (node: PMNode, pos: number, parent: PMNode | null) => boolean | undefined): {
|
|
5
5
|
node: PMNode;
|
|
6
6
|
pos: number;
|
|
@@ -15,4 +15,4 @@ export declare const applyMarkOnRange: (from: number, to: number, removeMark: bo
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const toggleMark: (markType: MarkType, attrs?: {
|
|
17
17
|
[key: string]: any;
|
|
18
|
-
} | undefined) =>
|
|
18
|
+
} | undefined) => EditorCommand;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Command } from '../types/command';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EditorCommand } from '../types/editor-command';
|
|
3
3
|
/**
|
|
4
|
-
* Convert a
|
|
5
|
-
* The preferred approach to dispatching a `
|
|
4
|
+
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
5
|
+
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
6
6
|
* `executeCommand` 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.
|
|
@@ -10,4 +10,4 @@ import type { PluginCommand } from '../types/plugin-command';
|
|
|
10
10
|
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
11
11
|
* @returns Command
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function editorCommandToPMCommand(command: EditorCommand | undefined): Command;
|
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
3
4
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
4
|
-
import type { PluginCommand } from '../types/plugin-command';
|
|
5
5
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
6
6
|
type SharedStateAPIProps = {
|
|
7
7
|
getEditorState: () => EditorState | undefined;
|
|
@@ -43,7 +43,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
43
43
|
constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
|
|
44
44
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
45
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
|
-
executeCommand: (command:
|
|
46
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
47
47
|
};
|
|
48
48
|
private executeCommand;
|
|
49
49
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
@@ -28,8 +28,8 @@ export type { EditorReactContext } from './editor-react-context';
|
|
|
28
28
|
export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin-factory';
|
|
29
29
|
export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
|
|
30
30
|
export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
|
|
31
|
-
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, ExtractPluginActions, PluginInjectionAPIWithDependency, PluginInjectionAPIWithDependencies, } from './next-editor-plugin';
|
|
32
|
-
export type {
|
|
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 { EditorCommand, EditorCommandWithMetadata, } from './editor-command';
|
|
33
33
|
export type IconProps = {
|
|
34
34
|
label?: string;
|
|
35
35
|
};
|
|
@@ -5,8 +5,8 @@
|
|
|
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 { EditorCommand, EditorCommandWithMetadata } from './editor-command';
|
|
8
9
|
import type { EditorPlugin } from './editor-plugin';
|
|
9
|
-
import type { PluginCommand, PluginCommandWithMetadata } from './plugin-command';
|
|
10
10
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
11
11
|
type PickSharedStatePropertyName<Metadata extends NextEditorPluginMetadata> = IsAny<Metadata> extends true ? never : ExtractSharedStateFromMetadata<Metadata> extends never ? never : 'getSharedState';
|
|
12
12
|
type WithSharedState<Metadata extends NextEditorPluginMetadata> = {
|
|
@@ -25,13 +25,13 @@ export type DefaultEditorPlugin<Name extends string, Metadata extends NextEditor
|
|
|
25
25
|
};
|
|
26
26
|
type MaybeAction = ((...agrs: any) => any) | ((...agrs: any) => void);
|
|
27
27
|
type NextEditorPluginActions = Record<string, MaybeAction>;
|
|
28
|
-
type
|
|
28
|
+
type NextEditorEditorCommands = Record<string, EditorCommandWithMetadata | EditorCommand>;
|
|
29
29
|
export interface NextEditorPluginMetadata {
|
|
30
30
|
readonly sharedState?: any;
|
|
31
31
|
readonly pluginConfiguration?: any;
|
|
32
32
|
readonly dependencies?: DependencyPlugin[];
|
|
33
33
|
readonly actions?: NextEditorPluginActions;
|
|
34
|
-
readonly commands?:
|
|
34
|
+
readonly commands?: NextEditorEditorCommands;
|
|
35
35
|
}
|
|
36
36
|
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> = {
|
|
37
37
|
dependencies: CreatePluginDependenciesAPI<[
|
|
@@ -39,13 +39,13 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
|
|
|
39
39
|
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
40
|
]>;
|
|
41
41
|
/**
|
|
42
|
-
* Dispatches
|
|
42
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
45
45
|
* is successful or `null` if it shouldn't be dispatched.
|
|
46
46
|
* @returns (boolean) if the command was successful in dispatching
|
|
47
47
|
*/
|
|
48
|
-
executeCommand: (
|
|
48
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
49
49
|
};
|
|
50
50
|
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
51
51
|
dependencies: CreatePluginDependenciesAPI<[
|
|
@@ -117,4 +117,15 @@ type CheckTupleRequirements<Plugin, Config, ArrayType> = unknown extends Config
|
|
|
117
117
|
type CheckBasicPlugin<Plugin> = Plugin extends (args: any, api: any) => EditorPlugin ? CheckTupleRequirements<Plugin, ExtractPluginConfiguration<Plugin>, PluginAsArray<Plugin>> : never;
|
|
118
118
|
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
119
|
export type ExtractInjectionAPI<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? PluginInjectionAPI<Name, Metadata> : never;
|
|
120
|
+
export type PublicPluginAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
|
|
121
|
+
dependencies: CreatePluginDependenciesAPI<PluginList>;
|
|
122
|
+
/**
|
|
123
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
124
|
+
*
|
|
125
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
126
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
127
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
128
|
+
*/
|
|
129
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
130
|
+
};
|
|
120
131
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import type { Command } from '../types/command';
|
|
5
|
-
import type {
|
|
5
|
+
import type { EditorCommand } from '../types/editor-command';
|
|
6
6
|
export declare const addAltText: Keymap;
|
|
7
7
|
export declare const navToEditorToolbar: Keymap;
|
|
8
8
|
export declare const navToFloatingToolbar: Keymap;
|
|
@@ -88,7 +88,7 @@ export interface Keymap {
|
|
|
88
88
|
export declare function bindKeymapWithCommand(shortcut: string, cmd: Command, keymap: {
|
|
89
89
|
[key: string]: Command;
|
|
90
90
|
}): void;
|
|
91
|
-
export declare function
|
|
91
|
+
export declare function bindKeymapWithEditorCommand(shortcut: string, cmd: EditorCommand, keymap: {
|
|
92
92
|
[key: string]: Command;
|
|
93
93
|
}): void;
|
|
94
94
|
export declare function findKeyMapForBrowser(keyMap: Keymap): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Mark, MarkType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EditorCommand } from '../types';
|
|
4
4
|
export declare function filterChildrenBetween(doc: PMNode, from: number, to: number, predicate: (node: PMNode, pos: number, parent: PMNode | null) => boolean | undefined): {
|
|
5
5
|
node: PMNode;
|
|
6
6
|
pos: number;
|
|
@@ -15,4 +15,4 @@ export declare const applyMarkOnRange: (from: number, to: number, removeMark: bo
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const toggleMark: (markType: MarkType, attrs?: {
|
|
17
17
|
[key: string]: any;
|
|
18
|
-
} | undefined) =>
|
|
18
|
+
} | undefined) => EditorCommand;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Command } from '../types/command';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EditorCommand } from '../types/editor-command';
|
|
3
3
|
/**
|
|
4
|
-
* Convert a
|
|
5
|
-
* The preferred approach to dispatching a `
|
|
4
|
+
* Convert a EditorCommand to a standard Prosemirror Command.
|
|
5
|
+
* The preferred approach to dispatching a `EditorCommand` is via the
|
|
6
6
|
* `executeCommand` 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.
|
|
@@ -10,4 +10,4 @@ import type { PluginCommand } from '../types/plugin-command';
|
|
|
10
10
|
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
11
11
|
* @returns Command
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function editorCommandToPMCommand(command: EditorCommand | undefined): Command;
|
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
3
4
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
4
|
-
import type { PluginCommand } from '../types/plugin-command';
|
|
5
5
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
6
6
|
type SharedStateAPIProps = {
|
|
7
7
|
getEditorState: () => EditorState | undefined;
|
|
@@ -48,7 +48,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
48
48
|
] : [
|
|
49
49
|
]
|
|
50
50
|
]>;
|
|
51
|
-
executeCommand: (command:
|
|
51
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
52
52
|
};
|
|
53
53
|
private executeCommand;
|
|
54
54
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
@@ -28,8 +28,8 @@ export type { EditorReactContext } from './editor-react-context';
|
|
|
28
28
|
export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin-factory';
|
|
29
29
|
export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
|
|
30
30
|
export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
|
|
31
|
-
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, ExtractPluginActions, PluginInjectionAPIWithDependency, PluginInjectionAPIWithDependencies, } from './next-editor-plugin';
|
|
32
|
-
export type {
|
|
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 { EditorCommand, EditorCommandWithMetadata, } from './editor-command';
|
|
33
33
|
export type IconProps = {
|
|
34
34
|
label?: string;
|
|
35
35
|
};
|
|
@@ -5,8 +5,8 @@
|
|
|
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 { EditorCommand, EditorCommandWithMetadata } from './editor-command';
|
|
8
9
|
import type { EditorPlugin } from './editor-plugin';
|
|
9
|
-
import type { PluginCommand, PluginCommandWithMetadata } from './plugin-command';
|
|
10
10
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
11
11
|
type PickSharedStatePropertyName<Metadata extends NextEditorPluginMetadata> = IsAny<Metadata> extends true ? never : ExtractSharedStateFromMetadata<Metadata> extends never ? never : 'getSharedState';
|
|
12
12
|
type WithSharedState<Metadata extends NextEditorPluginMetadata> = {
|
|
@@ -25,13 +25,13 @@ export type DefaultEditorPlugin<Name extends string, Metadata extends NextEditor
|
|
|
25
25
|
};
|
|
26
26
|
type MaybeAction = ((...agrs: any) => any) | ((...agrs: any) => void);
|
|
27
27
|
type NextEditorPluginActions = Record<string, MaybeAction>;
|
|
28
|
-
type
|
|
28
|
+
type NextEditorEditorCommands = Record<string, EditorCommandWithMetadata | EditorCommand>;
|
|
29
29
|
export interface NextEditorPluginMetadata {
|
|
30
30
|
readonly sharedState?: any;
|
|
31
31
|
readonly pluginConfiguration?: any;
|
|
32
32
|
readonly dependencies?: DependencyPlugin[];
|
|
33
33
|
readonly actions?: NextEditorPluginActions;
|
|
34
|
-
readonly commands?:
|
|
34
|
+
readonly commands?: NextEditorEditorCommands;
|
|
35
35
|
}
|
|
36
36
|
export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> = {
|
|
37
37
|
dependencies: CreatePluginDependenciesAPI<[
|
|
@@ -39,13 +39,13 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
|
|
|
39
39
|
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
40
|
]>;
|
|
41
41
|
/**
|
|
42
|
-
* Dispatches
|
|
42
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
45
45
|
* is successful or `null` if it shouldn't be dispatched.
|
|
46
46
|
* @returns (boolean) if the command was successful in dispatching
|
|
47
47
|
*/
|
|
48
|
-
executeCommand: (
|
|
48
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
49
49
|
};
|
|
50
50
|
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
51
51
|
dependencies: CreatePluginDependenciesAPI<[
|
|
@@ -135,4 +135,15 @@ export type ExtractPluginNameFromAllBuilderPlugins<Plugin extends AllEditorPrese
|
|
|
135
135
|
...any
|
|
136
136
|
] ? MaybePlugin extends NextEditorPlugin<any, any> ? ExtractPluginName<MaybePlugin> : never : never : Plugin extends NextEditorPlugin<any, any> ? ExtractPluginName<Plugin> : never;
|
|
137
137
|
export type ExtractInjectionAPI<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? PluginInjectionAPI<Name, Metadata> : never;
|
|
138
|
+
export type PublicPluginAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
|
|
139
|
+
dependencies: CreatePluginDependenciesAPI<PluginList>;
|
|
140
|
+
/**
|
|
141
|
+
* Dispatches an EditorCommand to ProseMirror
|
|
142
|
+
*
|
|
143
|
+
* @param command A function (EditorCommand | undefined) that takes an object containing a `Transaction` and returns a `Transaction` if it
|
|
144
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
145
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
146
|
+
*/
|
|
147
|
+
executeCommand: (command: EditorCommand | undefined) => boolean;
|
|
148
|
+
};
|
|
138
149
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
type PluginCommandProps = {
|
|
3
|
-
tr: Transaction;
|
|
4
|
-
};
|
|
5
|
-
export type PluginCommand = (props: PluginCommandProps) => Transaction | null;
|
|
6
|
-
export type PluginCommandWithMetadata = (args: any) => PluginCommand;
|
|
7
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
type PluginCommandProps = {
|
|
3
|
-
tr: Transaction;
|
|
4
|
-
};
|
|
5
|
-
export type PluginCommand = (props: PluginCommandProps) => Transaction | null;
|
|
6
|
-
export type PluginCommandWithMetadata = (args: any) => PluginCommand;
|
|
7
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|