@atlaskit/editor-common 74.9.0 → 74.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +3 -1
- package/dist/cjs/selection-based-node-view/SelectionBasedNodeView.js +5 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-menu/DropdownMenu/index.js +4 -0
- package/dist/cjs/utils/editor-core-utils.js +3 -0
- package/dist/cjs/utils/nodes.js +3 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +3 -1
- package/dist/es2019/selection-based-node-view/SelectionBasedNodeView.js +5 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-menu/DropdownMenu/index.js +4 -0
- package/dist/es2019/utils/editor-core-utils.js +3 -0
- package/dist/es2019/utils/nodes.js +3 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +3 -1
- package/dist/esm/selection-based-node-view/SelectionBasedNodeView.js +5 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-menu/DropdownMenu/index.js +4 -0
- package/dist/esm/utils/editor-core-utils.js +3 -0
- package/dist/esm/utils/nodes.js +3 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/react-node-view/getInlineNodeViewProducer.d.ts +4 -9
- package/dist/types/react-node-view/types.d.ts +1 -1
- package/dist/types/types/editor-plugin.d.ts +1 -1
- package/dist/types/utils/editor-core-utils.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +1 -1
- package/dist/types-ts4.5/react-node-view/getInlineNodeViewProducer.d.ts +4 -9
- package/dist/types-ts4.5/react-node-view/types.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-plugin.d.ts +1 -1
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`87070f514cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87070f514cd) - [ux] ED-18024 Adds an enter keydown handler on the main toolbar droplist (BlockInsertMenuLegacy) to prevent the editor capturing the keypress when the keyboard is used to insert nodes.
|
|
8
|
+
|
|
9
|
+
## 74.9.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`18344c31ea3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18344c31ea3) - [ED-13910] Fix EditorView getPos type
|
|
14
|
+
|
|
3
15
|
## 74.9.0
|
|
4
16
|
|
|
5
17
|
### Minor 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.9.
|
|
19
|
+
var packageVersion = "74.9.2";
|
|
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
|
|
@@ -178,7 +178,9 @@ function getPortalChildren(_ref2) {
|
|
|
178
178
|
}, (0, _react2.jsx)("span", {
|
|
179
179
|
className: "".concat(inlineNodeViewClassname, "AddZeroWidthSpace")
|
|
180
180
|
}), _utils.ZERO_WIDTH_SPACE), (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
181
|
-
view: nodeViewParams.view
|
|
181
|
+
view: nodeViewParams.view
|
|
182
|
+
// TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
|
|
183
|
+
,
|
|
182
184
|
getPos: nodeViewParams.getPos,
|
|
183
185
|
node: currentNode
|
|
184
186
|
}, extraComponentProps)), (0, _react2.jsx)("span", {
|
|
@@ -95,8 +95,11 @@ var SelectionBasedNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
95
95
|
if (typeof this.getPos === 'boolean') {
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
var pos = this.getPos();
|
|
99
|
+
if (typeof pos === 'number') {
|
|
100
|
+
this.pos = pos;
|
|
101
|
+
this.posEnd = pos + this.node.nodeSize;
|
|
102
|
+
}
|
|
100
103
|
}
|
|
101
104
|
}, {
|
|
102
105
|
key: "getPositionsWithDefault",
|
|
@@ -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.9.
|
|
27
|
+
var packageVersion = "74.9.2";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -179,6 +179,10 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
179
179
|
isTriggerNotTabbable: true,
|
|
180
180
|
handleClickOutside: this.handleClose,
|
|
181
181
|
handleEscapeKeydown: this.handleCloseAndFocus,
|
|
182
|
+
handleEnterKeydown: function handleEnterKeydown(e) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
},
|
|
182
186
|
targetRef: this.state.target
|
|
183
187
|
}, (0, _react2.jsx)("div", {
|
|
184
188
|
style: {
|
|
@@ -91,6 +91,9 @@ function nonNullable(value) {
|
|
|
91
91
|
|
|
92
92
|
// checks if the given position is within the ProseMirror document
|
|
93
93
|
var isValidPosition = function isValidPosition(pos, state) {
|
|
94
|
+
if (typeof pos !== 'number') {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
94
97
|
if (pos >= 0 && pos <= state.doc.resolve(0).end()) {
|
|
95
98
|
return true;
|
|
96
99
|
}
|
package/dist/cjs/utils/nodes.js
CHANGED
|
@@ -79,6 +79,9 @@ var SelectedState = /*#__PURE__*/function (SelectedState) {
|
|
|
79
79
|
*/
|
|
80
80
|
exports.SelectedState = SelectedState;
|
|
81
81
|
var isNodeSelectedOrInRange = function isNodeSelectedOrInRange(anchorPosition, headPosition, nodePosition, nodeSize) {
|
|
82
|
+
if (typeof nodePosition !== 'number') {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
82
85
|
var rangeStart = Math.min(anchorPosition, headPosition);
|
|
83
86
|
var rangeEnd = Math.max(anchorPosition, headPosition);
|
|
84
87
|
var nodeStart = nodePosition;
|
package/dist/cjs/version.json
CHANGED
|
@@ -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.9.
|
|
3
|
+
const packageVersion = "74.9.2";
|
|
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
|
|
@@ -171,7 +171,9 @@ function getPortalChildren({
|
|
|
171
171
|
}, jsx("span", {
|
|
172
172
|
className: `${inlineNodeViewClassname}AddZeroWidthSpace`
|
|
173
173
|
}), ZERO_WIDTH_SPACE), jsx(Component, _extends({
|
|
174
|
-
view: nodeViewParams.view
|
|
174
|
+
view: nodeViewParams.view
|
|
175
|
+
// TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
|
|
176
|
+
,
|
|
175
177
|
getPos: nodeViewParams.getPos,
|
|
176
178
|
node: currentNode
|
|
177
179
|
}, extraComponentProps)), jsx("span", {
|
|
@@ -80,8 +80,11 @@ export class SelectionBasedNodeView extends ReactNodeView {
|
|
|
80
80
|
if (typeof this.getPos === 'boolean') {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const pos = this.getPos();
|
|
84
|
+
if (typeof pos === 'number') {
|
|
85
|
+
this.pos = pos;
|
|
86
|
+
this.posEnd = pos + this.node.nodeSize;
|
|
87
|
+
}
|
|
85
88
|
}
|
|
86
89
|
getPositionsWithDefault(pos, posEnd) {
|
|
87
90
|
return {
|
|
@@ -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.9.
|
|
11
|
+
const packageVersion = "74.9.2";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
|
@@ -187,6 +187,10 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
187
187
|
isTriggerNotTabbable: true,
|
|
188
188
|
handleClickOutside: this.handleClose,
|
|
189
189
|
handleEscapeKeydown: this.handleCloseAndFocus,
|
|
190
|
+
handleEnterKeydown: e => {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
},
|
|
190
194
|
targetRef: this.state.target
|
|
191
195
|
}, jsx("div", {
|
|
192
196
|
style: {
|
|
@@ -75,6 +75,9 @@ export function nonNullable(value) {
|
|
|
75
75
|
|
|
76
76
|
// checks if the given position is within the ProseMirror document
|
|
77
77
|
export const isValidPosition = (pos, state) => {
|
|
78
|
+
if (typeof pos !== 'number') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
78
81
|
if (pos >= 0 && pos <= state.doc.resolve(0).end()) {
|
|
79
82
|
return true;
|
|
80
83
|
}
|
|
@@ -53,6 +53,9 @@ export let SelectedState = /*#__PURE__*/function (SelectedState) {
|
|
|
53
53
|
* is fully selected by a range or if the "inside" of the node has been selected or clicked.
|
|
54
54
|
*/
|
|
55
55
|
export const isNodeSelectedOrInRange = (anchorPosition, headPosition, nodePosition, nodeSize) => {
|
|
56
|
+
if (typeof nodePosition !== 'number') {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
56
59
|
const rangeStart = Math.min(anchorPosition, headPosition);
|
|
57
60
|
const rangeEnd = Math.max(anchorPosition, headPosition);
|
|
58
61
|
const nodeStart = nodePosition;
|
package/dist/es2019/version.json
CHANGED
|
@@ -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.
|
|
9
|
+
var packageVersion = "74.9.2";
|
|
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
|
|
@@ -168,7 +168,9 @@ function getPortalChildren(_ref2) {
|
|
|
168
168
|
}, jsx("span", {
|
|
169
169
|
className: "".concat(inlineNodeViewClassname, "AddZeroWidthSpace")
|
|
170
170
|
}), ZERO_WIDTH_SPACE), jsx(Component, _extends({
|
|
171
|
-
view: nodeViewParams.view
|
|
171
|
+
view: nodeViewParams.view
|
|
172
|
+
// TODO: ED-13910 - Remove the boolean to fix the prosemirror view type
|
|
173
|
+
,
|
|
172
174
|
getPos: nodeViewParams.getPos,
|
|
173
175
|
node: currentNode
|
|
174
176
|
}, extraComponentProps)), jsx("span", {
|
|
@@ -89,8 +89,11 @@ export var SelectionBasedNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
89
89
|
if (typeof this.getPos === 'boolean') {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
var pos = this.getPos();
|
|
93
|
+
if (typeof pos === 'number') {
|
|
94
|
+
this.pos = pos;
|
|
95
|
+
this.posEnd = pos + this.node.nodeSize;
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
}, {
|
|
96
99
|
key: "getPositionsWithDefault",
|
|
@@ -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.9.
|
|
21
|
+
var packageVersion = "74.9.2";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -169,6 +169,10 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
169
169
|
isTriggerNotTabbable: true,
|
|
170
170
|
handleClickOutside: this.handleClose,
|
|
171
171
|
handleEscapeKeydown: this.handleCloseAndFocus,
|
|
172
|
+
handleEnterKeydown: function handleEnterKeydown(e) {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
e.stopPropagation();
|
|
175
|
+
},
|
|
172
176
|
targetRef: this.state.target
|
|
173
177
|
}, jsx("div", {
|
|
174
178
|
style: {
|
|
@@ -73,6 +73,9 @@ export function nonNullable(value) {
|
|
|
73
73
|
|
|
74
74
|
// checks if the given position is within the ProseMirror document
|
|
75
75
|
export var isValidPosition = function isValidPosition(pos, state) {
|
|
76
|
+
if (typeof pos !== 'number') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
76
79
|
if (pos >= 0 && pos <= state.doc.resolve(0).end()) {
|
|
77
80
|
return true;
|
|
78
81
|
}
|
package/dist/esm/utils/nodes.js
CHANGED
|
@@ -66,6 +66,9 @@ export var SelectedState = /*#__PURE__*/function (SelectedState) {
|
|
|
66
66
|
* is fully selected by a range or if the "inside" of the node has been selected or clicked.
|
|
67
67
|
*/
|
|
68
68
|
export var isNodeSelectedOrInRange = function isNodeSelectedOrInRange(anchorPosition, headPosition, nodePosition, nodeSize) {
|
|
69
|
+
if (typeof nodePosition !== 'number') {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
69
72
|
var rangeStart = Math.min(anchorPosition, headPosition);
|
|
70
73
|
var rangeEnd = Math.max(anchorPosition, headPosition);
|
|
71
74
|
var nodeStart = nodePosition;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import {
|
|
4
|
+
import { Decoration, EditorView, NodeView } from 'prosemirror-view';
|
|
5
5
|
import type { PMPluginFactoryParams } from '../types';
|
|
6
6
|
export type InlineNodeViewComponentProps = {
|
|
7
7
|
view: EditorView;
|
|
8
|
-
getPos:
|
|
8
|
+
getPos: () => GetPosReturn;
|
|
9
9
|
node: PMNode;
|
|
10
10
|
};
|
|
11
11
|
type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<InlineNodeViewComponentProps & ExtraComponentProps>;
|
|
12
12
|
export declare const inlineNodeViewClassname = "inlineNodeView";
|
|
13
|
-
type NodeViewProducer =
|
|
14
|
-
type
|
|
15
|
-
node: Parameters<NodeViewProducer>[0];
|
|
16
|
-
view: Parameters<NodeViewProducer>[1];
|
|
17
|
-
getPos: Parameters<NodeViewProducer>[2];
|
|
18
|
-
decorations: Parameters<NodeViewProducer>[3];
|
|
19
|
-
};
|
|
13
|
+
type NodeViewProducer = (node: PMNode, view: EditorView, getPos: (() => GetPosReturn) | boolean, decorations: Decoration[]) => NodeView;
|
|
14
|
+
type GetPosReturn = number | undefined;
|
|
20
15
|
export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, }: {
|
|
21
16
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
22
17
|
Component: InlineNodeViewComponent<ExtraComponentProps>;
|
|
@@ -4,7 +4,7 @@ export interface ReactNodeProps {
|
|
|
4
4
|
}
|
|
5
5
|
export type ProsemirrorGetPosHandler = () => number;
|
|
6
6
|
export type getPosHandler = getPosHandlerNode | boolean;
|
|
7
|
-
export type getPosHandlerNode = () => number;
|
|
7
|
+
export type getPosHandlerNode = () => number | undefined;
|
|
8
8
|
export type ReactComponentProps = {
|
|
9
9
|
[key: string]: unknown;
|
|
10
10
|
};
|
|
@@ -88,5 +88,5 @@ export interface EditorPlugin {
|
|
|
88
88
|
onEditorViewStateUpdated?: (props: EditorViewStateUpdatedCallbackProps) => void;
|
|
89
89
|
}
|
|
90
90
|
export type getPosHandler = getPosHandlerNode | boolean;
|
|
91
|
-
export type getPosHandlerNode = () => number;
|
|
91
|
+
export type getPosHandlerNode = () => number | undefined;
|
|
92
92
|
export {};
|
|
@@ -25,5 +25,5 @@ export declare const isLastItemMediaGroup: (node: Node) => boolean;
|
|
|
25
25
|
export declare const setNodeSelection: (view: EditorView, pos: number) => void;
|
|
26
26
|
export declare function setTextSelection(view: EditorView, anchor: number, head?: number): void;
|
|
27
27
|
export declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
28
|
-
export declare const isValidPosition: (pos: number, state: EditorState) => boolean;
|
|
28
|
+
export declare const isValidPosition: (pos: number | undefined, state: EditorState) => boolean;
|
|
29
29
|
export declare const isInLayoutColumn: (state: EditorState) => boolean;
|
|
@@ -25,7 +25,7 @@ export declare enum SelectedState {
|
|
|
25
25
|
* If the node is selected then an enum is returned that describes weather the node
|
|
26
26
|
* is fully selected by a range or if the "inside" of the node has been selected or clicked.
|
|
27
27
|
*/
|
|
28
|
-
export declare const isNodeSelectedOrInRange: (anchorPosition: number, headPosition: number, nodePosition: number, nodeSize: number) => SelectedState | null;
|
|
28
|
+
export declare const isNodeSelectedOrInRange: (anchorPosition: number, headPosition: number, nodePosition: number | undefined, nodeSize: number) => SelectedState | null;
|
|
29
29
|
/**
|
|
30
30
|
* Checks if a particular node fragment is supported in the parent
|
|
31
31
|
* @param state EditorState
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import {
|
|
4
|
+
import { Decoration, EditorView, NodeView } from 'prosemirror-view';
|
|
5
5
|
import type { PMPluginFactoryParams } from '../types';
|
|
6
6
|
export type InlineNodeViewComponentProps = {
|
|
7
7
|
view: EditorView;
|
|
8
|
-
getPos:
|
|
8
|
+
getPos: () => GetPosReturn;
|
|
9
9
|
node: PMNode;
|
|
10
10
|
};
|
|
11
11
|
type InlineNodeViewComponent<ExtraComponentProps> = React.ComponentType<InlineNodeViewComponentProps & ExtraComponentProps>;
|
|
12
12
|
export declare const inlineNodeViewClassname = "inlineNodeView";
|
|
13
|
-
type NodeViewProducer =
|
|
14
|
-
type
|
|
15
|
-
node: Parameters<NodeViewProducer>[0];
|
|
16
|
-
view: Parameters<NodeViewProducer>[1];
|
|
17
|
-
getPos: Parameters<NodeViewProducer>[2];
|
|
18
|
-
decorations: Parameters<NodeViewProducer>[3];
|
|
19
|
-
};
|
|
13
|
+
type NodeViewProducer = (node: PMNode, view: EditorView, getPos: (() => GetPosReturn) | boolean, decorations: Decoration[]) => NodeView;
|
|
14
|
+
type GetPosReturn = number | undefined;
|
|
20
15
|
export declare function getInlineNodeViewProducer<ExtraComponentProps>({ pmPluginFactoryParams, Component, extraComponentProps, }: {
|
|
21
16
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
22
17
|
Component: InlineNodeViewComponent<ExtraComponentProps>;
|
|
@@ -4,7 +4,7 @@ export interface ReactNodeProps {
|
|
|
4
4
|
}
|
|
5
5
|
export type ProsemirrorGetPosHandler = () => number;
|
|
6
6
|
export type getPosHandler = getPosHandlerNode | boolean;
|
|
7
|
-
export type getPosHandlerNode = () => number;
|
|
7
|
+
export type getPosHandlerNode = () => number | undefined;
|
|
8
8
|
export type ReactComponentProps = {
|
|
9
9
|
[key: string]: unknown;
|
|
10
10
|
};
|
|
@@ -88,5 +88,5 @@ export interface EditorPlugin {
|
|
|
88
88
|
onEditorViewStateUpdated?: (props: EditorViewStateUpdatedCallbackProps) => void;
|
|
89
89
|
}
|
|
90
90
|
export type getPosHandler = getPosHandlerNode | boolean;
|
|
91
|
-
export type getPosHandlerNode = () => number;
|
|
91
|
+
export type getPosHandlerNode = () => number | undefined;
|
|
92
92
|
export {};
|
|
@@ -25,5 +25,5 @@ export declare const isLastItemMediaGroup: (node: Node) => boolean;
|
|
|
25
25
|
export declare const setNodeSelection: (view: EditorView, pos: number) => void;
|
|
26
26
|
export declare function setTextSelection(view: EditorView, anchor: number, head?: number): void;
|
|
27
27
|
export declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
28
|
-
export declare const isValidPosition: (pos: number, state: EditorState) => boolean;
|
|
28
|
+
export declare const isValidPosition: (pos: number | undefined, state: EditorState) => boolean;
|
|
29
29
|
export declare const isInLayoutColumn: (state: EditorState) => boolean;
|
|
@@ -25,7 +25,7 @@ export declare enum SelectedState {
|
|
|
25
25
|
* If the node is selected then an enum is returned that describes weather the node
|
|
26
26
|
* is fully selected by a range or if the "inside" of the node has been selected or clicked.
|
|
27
27
|
*/
|
|
28
|
-
export declare const isNodeSelectedOrInRange: (anchorPosition: number, headPosition: number, nodePosition: number, nodeSize: number) => SelectedState | null;
|
|
28
|
+
export declare const isNodeSelectedOrInRange: (anchorPosition: number, headPosition: number, nodePosition: number | undefined, nodeSize: number) => SelectedState | null;
|
|
29
29
|
/**
|
|
30
30
|
* Checks if a particular node fragment is supported in the parent
|
|
31
31
|
* @param state EditorState
|
package/package.json
CHANGED