@atlaskit/editor-common 93.1.4 → 93.1.5
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 +8 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/prosemirror-dom-metadata/index.js +48 -0
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +0 -5
- package/dist/cjs/react-node-view/index.js +0 -7
- package/dist/cjs/safe-plugin/index.js +35 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/prosemirror-dom-metadata/index.js +41 -0
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +0 -5
- package/dist/es2019/react-node-view/index.js +0 -7
- package/dist/es2019/safe-plugin/index.js +31 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/prosemirror-dom-metadata/index.js +41 -0
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +0 -5
- package/dist/esm/react-node-view/index.js +0 -7
- package/dist/esm/safe-plugin/index.js +34 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/element-browser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +3 -1
- package/dist/types/prosemirror-dom-metadata/index.d.ts +18 -0
- package/dist/types/safe-plugin/index.d.ts +17 -0
- package/dist/types/ui-menu/ColorPickerButton/index.d.ts +1 -1
- package/dist/types-ts4.5/element-browser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types-ts4.5/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +3 -1
- package/dist/types-ts4.5/prosemirror-dom-metadata/index.d.ts +18 -0
- package/dist/types-ts4.5/safe-plugin/index.d.ts +17 -0
- package/dist/types-ts4.5/ui-menu/ColorPickerButton/index.d.ts +1 -1
- package/package.json +4 -3
- package/prosemirror-dom-metadata/package.json +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 93.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#150189](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150189)
|
|
8
|
+
[`7537d7c549a7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7537d7c549a7b) -
|
|
9
|
+
[No Issue] Improve prosemirror data attributes for nodes/marks toDOM and NodeViews
|
|
10
|
+
|
|
3
11
|
## 93.1.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "93.1.
|
|
20
|
+
var packageVersion = "93.1.5";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createProseMirrorMetadata = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
var isPMNode = function isPMNode(nodeOrMark) {
|
|
13
|
+
return nodeOrMark instanceof _model.Node || Array.isArray(nodeOrMark.marks);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
18
|
+
*
|
|
19
|
+
* Creates a set of generic metadata attributes for a ProseMirror node or mark.
|
|
20
|
+
* These attributes are used to annotate the DOM representation with information
|
|
21
|
+
* about the node or mark type.
|
|
22
|
+
*
|
|
23
|
+
* @param {PMNode | PMMark} nodeOrMark - The ProseMirror node or mark to create metadata for.
|
|
24
|
+
* @returns {Record<string, string>} An object containing metadata attributes.
|
|
25
|
+
* - `data-prosemirror-content-type`: Specifies if the content is a node or mark.
|
|
26
|
+
* - `data-prosemirror-node-name` (if applicable): The name of the node.
|
|
27
|
+
* - `data-prosemirror-node-block` (if applicable): Indicates if the node is a block.
|
|
28
|
+
* - `data-prosemirror-node-inline` (if applicable): Indicates if the node is inline.
|
|
29
|
+
* - `data-prosemirror-mark-name` (if applicable): The name of the mark.
|
|
30
|
+
*/
|
|
31
|
+
var createProseMirrorMetadata = exports.createProseMirrorMetadata = function createProseMirrorMetadata(nodeOrMark) {
|
|
32
|
+
var name = nodeOrMark.type.name;
|
|
33
|
+
var isNode = isPMNode(nodeOrMark);
|
|
34
|
+
var commonAttributes = {
|
|
35
|
+
'data-prosemirror-content-type': isNode ? 'node' : 'mark'
|
|
36
|
+
};
|
|
37
|
+
if (!isNode) {
|
|
38
|
+
return _objectSpread(_objectSpread({}, commonAttributes), {}, (0, _defineProperty2.default)({}, 'data-prosemirror-mark-name', name));
|
|
39
|
+
}
|
|
40
|
+
commonAttributes['data-prosemirror-node-name'] = name;
|
|
41
|
+
if (nodeOrMark.type.isBlock) {
|
|
42
|
+
commonAttributes['data-prosemirror-node-block'] = 'true';
|
|
43
|
+
}
|
|
44
|
+
if (nodeOrMark.type.isInline) {
|
|
45
|
+
commonAttributes['data-prosemirror-node-inline'] = 'true';
|
|
46
|
+
}
|
|
47
|
+
return commonAttributes;
|
|
48
|
+
};
|
|
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _analytics = require("../analytics");
|
|
15
14
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
16
15
|
var _utils = require("../utils");
|
|
@@ -47,10 +46,6 @@ function createNodeView(_ref) {
|
|
|
47
46
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
48
47
|
// difference between them and it kills the nodeView
|
|
49
48
|
domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
|
|
50
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
|
|
51
|
-
domRef.dataset.prosemirrorNodeName = nodeViewParams.node.type.name;
|
|
52
|
-
domRef.dataset.prosemirrorNodeInline = 'true';
|
|
53
|
-
}
|
|
54
49
|
|
|
55
50
|
// This util is shared for tracking rendering, and the ErrorBoundary that
|
|
56
51
|
// is setup to wrap the Component when rendering
|
|
@@ -22,7 +22,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
22
22
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
24
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
25
|
var _analytics = require("../analytics");
|
|
27
26
|
var _eventDispatcher = require("../event-dispatcher");
|
|
28
27
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
@@ -89,12 +88,6 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
89
88
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
90
89
|
// difference between them and it kills the nodeView
|
|
91
90
|
this.domRef.classList.add("".concat(this.node.type.name, "View-content-wrap"));
|
|
92
|
-
if (this.domRef && (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
|
|
93
|
-
this.domRef.dataset.prosemirrorNodeName = this.node.type.name;
|
|
94
|
-
if (this.node.type.isBlock) {
|
|
95
|
-
this.domRef.dataset.prosemirrorNodeBlock = 'true';
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
91
|
var _getPerformanceOption = (0, _utils.getPerformanceOptions)(this.view),
|
|
99
92
|
samplingRate = _getPerformanceOption.samplingRate,
|
|
100
93
|
slowThreshold = _getPerformanceOption.slowThreshold,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.SafePlugin = void 0;
|
|
7
|
+
exports.attachGenericProseMirrorMetadata = exports.SafePlugin = void 0;
|
|
8
8
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -12,9 +12,35 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
14
|
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _prosemirrorDomMetadata = require("../prosemirror-dom-metadata");
|
|
16
19
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
17
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
/**
|
|
22
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
23
|
+
*
|
|
24
|
+
* Attaches generic ProseMirror metadata attributes to a given DOM element based on the properties of a ProseMirror node.
|
|
25
|
+
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} params - The parameters for the function.
|
|
29
|
+
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
30
|
+
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
31
|
+
*/
|
|
32
|
+
var attachGenericProseMirrorMetadata = exports.attachGenericProseMirrorMetadata = function attachGenericProseMirrorMetadata(_ref) {
|
|
33
|
+
var nodeOrMark = _ref.nodeOrMark,
|
|
34
|
+
dom = _ref.dom;
|
|
35
|
+
var metadata = (0, _prosemirrorDomMetadata.createProseMirrorMetadata)(nodeOrMark);
|
|
36
|
+
Object.entries(metadata).forEach(function (_ref2) {
|
|
37
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
38
|
+
name = _ref3[0],
|
|
39
|
+
value = _ref3[1];
|
|
40
|
+
dom.setAttribute(name, value);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
18
44
|
// Wraper to avoid any exception during the get pos operation
|
|
19
45
|
// See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
|
|
20
46
|
// And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
|
|
@@ -42,7 +68,14 @@ var wrapGetPosExceptions = function wrapGetPosExceptions(spec) {
|
|
|
42
68
|
return;
|
|
43
69
|
// eslint-disable-next-line no-extra-bind
|
|
44
70
|
}.bind(thisArg);
|
|
45
|
-
|
|
71
|
+
var result = Reflect.apply(target, thisArg, [node, view, safeGetPos].concat((0, _toConsumableArray2.default)(more)));
|
|
72
|
+
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement && (0, _platformFeatureFlags.fg)('platform_editor_breakout_use_css')) {
|
|
73
|
+
attachGenericProseMirrorMetadata({
|
|
74
|
+
nodeOrMark: node,
|
|
75
|
+
dom: result.dom
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
46
79
|
}
|
|
47
80
|
});
|
|
48
81
|
return safeNodeView;
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "93.1.
|
|
27
|
+
var packageVersion = "93.1.5";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "93.1.
|
|
4
|
+
const packageVersion = "93.1.5";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
const isPMNode = nodeOrMark => {
|
|
3
|
+
return nodeOrMark instanceof PMNode || Array.isArray(nodeOrMark.marks);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
8
|
+
*
|
|
9
|
+
* Creates a set of generic metadata attributes for a ProseMirror node or mark.
|
|
10
|
+
* These attributes are used to annotate the DOM representation with information
|
|
11
|
+
* about the node or mark type.
|
|
12
|
+
*
|
|
13
|
+
* @param {PMNode | PMMark} nodeOrMark - The ProseMirror node or mark to create metadata for.
|
|
14
|
+
* @returns {Record<string, string>} An object containing metadata attributes.
|
|
15
|
+
* - `data-prosemirror-content-type`: Specifies if the content is a node or mark.
|
|
16
|
+
* - `data-prosemirror-node-name` (if applicable): The name of the node.
|
|
17
|
+
* - `data-prosemirror-node-block` (if applicable): Indicates if the node is a block.
|
|
18
|
+
* - `data-prosemirror-node-inline` (if applicable): Indicates if the node is inline.
|
|
19
|
+
* - `data-prosemirror-mark-name` (if applicable): The name of the mark.
|
|
20
|
+
*/
|
|
21
|
+
export const createProseMirrorMetadata = nodeOrMark => {
|
|
22
|
+
const name = nodeOrMark.type.name;
|
|
23
|
+
const isNode = isPMNode(nodeOrMark);
|
|
24
|
+
const commonAttributes = {
|
|
25
|
+
'data-prosemirror-content-type': isNode ? 'node' : 'mark'
|
|
26
|
+
};
|
|
27
|
+
if (!isNode) {
|
|
28
|
+
return {
|
|
29
|
+
...commonAttributes,
|
|
30
|
+
['data-prosemirror-mark-name']: name
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
commonAttributes['data-prosemirror-node-name'] = name;
|
|
34
|
+
if (nodeOrMark.type.isBlock) {
|
|
35
|
+
commonAttributes['data-prosemirror-node-block'] = 'true';
|
|
36
|
+
}
|
|
37
|
+
if (nodeOrMark.type.isInline) {
|
|
38
|
+
commonAttributes['data-prosemirror-node-inline'] = 'true';
|
|
39
|
+
}
|
|
40
|
+
return commonAttributes;
|
|
41
|
+
};
|
|
@@ -7,7 +7,6 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
12
11
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
13
12
|
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
@@ -40,10 +39,6 @@ function createNodeView({
|
|
|
40
39
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
41
40
|
// difference between them and it kills the nodeView
|
|
42
41
|
domRef.classList.add(`${nodeViewParams.node.type.name}View-content-wrap`, `${inlineNodeViewClassname}`);
|
|
43
|
-
if (fg('platform_editor_breakout_use_css')) {
|
|
44
|
-
domRef.dataset.prosemirrorNodeName = nodeViewParams.node.type.name;
|
|
45
|
-
domRef.dataset.prosemirrorNodeInline = 'true';
|
|
46
|
-
}
|
|
47
42
|
|
|
48
43
|
// This util is shared for tracking rendering, and the ErrorBoundary that
|
|
49
44
|
// is setup to wrap the Component when rendering
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
6
5
|
import { createDispatch } from '../event-dispatcher';
|
|
7
6
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
@@ -62,12 +61,6 @@ export default class ReactNodeView {
|
|
|
62
61
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
63
62
|
// difference between them and it kills the nodeView
|
|
64
63
|
this.domRef.classList.add(`${this.node.type.name}View-content-wrap`);
|
|
65
|
-
if (this.domRef && fg('platform_editor_breakout_use_css')) {
|
|
66
|
-
this.domRef.dataset.prosemirrorNodeName = this.node.type.name;
|
|
67
|
-
if (this.node.type.isBlock) {
|
|
68
|
-
this.domRef.dataset.prosemirrorNodeBlock = 'true';
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
64
|
const {
|
|
72
65
|
samplingRate,
|
|
73
66
|
slowThreshold,
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
|
|
4
|
+
/**
|
|
5
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
6
|
+
*
|
|
7
|
+
* Attaches generic ProseMirror metadata attributes to a given DOM element based on the properties of a ProseMirror node.
|
|
8
|
+
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} params - The parameters for the function.
|
|
12
|
+
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
13
|
+
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
14
|
+
*/
|
|
15
|
+
export const attachGenericProseMirrorMetadata = ({
|
|
16
|
+
nodeOrMark,
|
|
17
|
+
dom
|
|
18
|
+
}) => {
|
|
19
|
+
const metadata = createProseMirrorMetadata(nodeOrMark);
|
|
20
|
+
Object.entries(metadata).forEach(([name, value]) => {
|
|
21
|
+
dom.setAttribute(name, value);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
2
25
|
// Wraper to avoid any exception during the get pos operation
|
|
3
26
|
// See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
|
|
4
27
|
// And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
|
|
@@ -22,7 +45,14 @@ const wrapGetPosExceptions = spec => {
|
|
|
22
45
|
return;
|
|
23
46
|
// eslint-disable-next-line no-extra-bind
|
|
24
47
|
}).bind(thisArg);
|
|
25
|
-
|
|
48
|
+
const result = Reflect.apply(target, thisArg, [node, view, safeGetPos, ...more]);
|
|
49
|
+
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement && fg('platform_editor_breakout_use_css')) {
|
|
50
|
+
attachGenericProseMirrorMetadata({
|
|
51
|
+
nodeOrMark: node,
|
|
52
|
+
dom: result.dom
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
26
56
|
}
|
|
27
57
|
});
|
|
28
58
|
return safeNodeView;
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "93.1.
|
|
16
|
+
const packageVersion = "93.1.5";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "93.1.
|
|
10
|
+
var packageVersion = "93.1.5";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
var isPMNode = function isPMNode(nodeOrMark) {
|
|
6
|
+
return nodeOrMark instanceof PMNode || Array.isArray(nodeOrMark.marks);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
11
|
+
*
|
|
12
|
+
* Creates a set of generic metadata attributes for a ProseMirror node or mark.
|
|
13
|
+
* These attributes are used to annotate the DOM representation with information
|
|
14
|
+
* about the node or mark type.
|
|
15
|
+
*
|
|
16
|
+
* @param {PMNode | PMMark} nodeOrMark - The ProseMirror node or mark to create metadata for.
|
|
17
|
+
* @returns {Record<string, string>} An object containing metadata attributes.
|
|
18
|
+
* - `data-prosemirror-content-type`: Specifies if the content is a node or mark.
|
|
19
|
+
* - `data-prosemirror-node-name` (if applicable): The name of the node.
|
|
20
|
+
* - `data-prosemirror-node-block` (if applicable): Indicates if the node is a block.
|
|
21
|
+
* - `data-prosemirror-node-inline` (if applicable): Indicates if the node is inline.
|
|
22
|
+
* - `data-prosemirror-mark-name` (if applicable): The name of the mark.
|
|
23
|
+
*/
|
|
24
|
+
export var createProseMirrorMetadata = function createProseMirrorMetadata(nodeOrMark) {
|
|
25
|
+
var name = nodeOrMark.type.name;
|
|
26
|
+
var isNode = isPMNode(nodeOrMark);
|
|
27
|
+
var commonAttributes = {
|
|
28
|
+
'data-prosemirror-content-type': isNode ? 'node' : 'mark'
|
|
29
|
+
};
|
|
30
|
+
if (!isNode) {
|
|
31
|
+
return _objectSpread(_objectSpread({}, commonAttributes), {}, _defineProperty({}, 'data-prosemirror-mark-name', name));
|
|
32
|
+
}
|
|
33
|
+
commonAttributes['data-prosemirror-node-name'] = name;
|
|
34
|
+
if (nodeOrMark.type.isBlock) {
|
|
35
|
+
commonAttributes['data-prosemirror-node-block'] = 'true';
|
|
36
|
+
}
|
|
37
|
+
if (nodeOrMark.type.isInline) {
|
|
38
|
+
commonAttributes['data-prosemirror-node-inline'] = 'true';
|
|
39
|
+
}
|
|
40
|
+
return commonAttributes;
|
|
41
|
+
};
|
|
@@ -10,7 +10,6 @@ import React from 'react';
|
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
12
|
import { jsx } from '@emotion/react';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
15
14
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
16
15
|
import { analyticsEventKey, browser, getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
@@ -42,10 +41,6 @@ function createNodeView(_ref) {
|
|
|
42
41
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
43
42
|
// difference between them and it kills the nodeView
|
|
44
43
|
domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
|
|
45
|
-
if (fg('platform_editor_breakout_use_css')) {
|
|
46
|
-
domRef.dataset.prosemirrorNodeName = nodeViewParams.node.type.name;
|
|
47
|
-
domRef.dataset.prosemirrorNodeInline = 'true';
|
|
48
|
-
}
|
|
49
44
|
|
|
50
45
|
// This util is shared for tracking rendering, and the ErrorBoundary that
|
|
51
46
|
// is setup to wrap the Component when rendering
|
|
@@ -3,7 +3,6 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
8
7
|
import { createDispatch } from '../event-dispatcher';
|
|
9
8
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
@@ -70,12 +69,6 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
70
69
|
// nodeView if DOM structure has nested plain "div"s, it doesn't see the
|
|
71
70
|
// difference between them and it kills the nodeView
|
|
72
71
|
this.domRef.classList.add("".concat(this.node.type.name, "View-content-wrap"));
|
|
73
|
-
if (this.domRef && fg('platform_editor_breakout_use_css')) {
|
|
74
|
-
this.domRef.dataset.prosemirrorNodeName = this.node.type.name;
|
|
75
|
-
if (this.node.type.isBlock) {
|
|
76
|
-
this.domRef.dataset.prosemirrorNodeBlock = 'true';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
72
|
var _getPerformanceOption = getPerformanceOptions(this.view),
|
|
80
73
|
samplingRate = _getPerformanceOption.samplingRate,
|
|
81
74
|
slowThreshold = _getPerformanceOption.slowThreshold,
|
|
@@ -5,9 +5,35 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
7
7
|
import _toArray from "@babel/runtime/helpers/toArray";
|
|
8
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
8
9
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
9
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
11
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { createProseMirrorMetadata } from '../prosemirror-dom-metadata';
|
|
14
|
+
/**
|
|
15
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
16
|
+
*
|
|
17
|
+
* Attaches generic ProseMirror metadata attributes to a given DOM element based on the properties of a ProseMirror node.
|
|
18
|
+
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} params - The parameters for the function.
|
|
22
|
+
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
23
|
+
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
24
|
+
*/
|
|
25
|
+
export var attachGenericProseMirrorMetadata = function attachGenericProseMirrorMetadata(_ref) {
|
|
26
|
+
var nodeOrMark = _ref.nodeOrMark,
|
|
27
|
+
dom = _ref.dom;
|
|
28
|
+
var metadata = createProseMirrorMetadata(nodeOrMark);
|
|
29
|
+
Object.entries(metadata).forEach(function (_ref2) {
|
|
30
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
31
|
+
name = _ref3[0],
|
|
32
|
+
value = _ref3[1];
|
|
33
|
+
dom.setAttribute(name, value);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
11
37
|
// Wraper to avoid any exception during the get pos operation
|
|
12
38
|
// See this https://hello.atlassian.net/wiki/spaces/EDITOR/pages/2849713193/ED-19672+Extensions+Regression
|
|
13
39
|
// And this https://discuss.prosemirror.net/t/possible-bug-on-viewdesc-posbeforechild/5783
|
|
@@ -35,7 +61,14 @@ var wrapGetPosExceptions = function wrapGetPosExceptions(spec) {
|
|
|
35
61
|
return;
|
|
36
62
|
// eslint-disable-next-line no-extra-bind
|
|
37
63
|
}.bind(thisArg);
|
|
38
|
-
|
|
64
|
+
var result = Reflect.apply(target, thisArg, [node, view, safeGetPos].concat(_toConsumableArray(more)));
|
|
65
|
+
if ((result === null || result === void 0 ? void 0 : result.dom) instanceof HTMLElement && fg('platform_editor_breakout_use_css')) {
|
|
66
|
+
attachGenericProseMirrorMetadata({
|
|
67
|
+
nodeOrMark: node,
|
|
68
|
+
dom: result.dom
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
39
72
|
}
|
|
40
73
|
});
|
|
41
74
|
return safeNodeView;
|
|
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
21
21
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "93.1.
|
|
24
|
+
var packageVersion = "93.1.5";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -36,5 +36,5 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
|
|
|
36
36
|
searchTerm?: string | undefined;
|
|
37
37
|
emptyStateHandler?: EmptyStateHandler | undefined;
|
|
38
38
|
viewMoreItem?: QuickInsertItem | undefined;
|
|
39
|
-
}
|
|
39
|
+
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "mode" | "analyticsContext" | "categories" | "onSelectCategory" | "selectedCategory" | "items" | "emptyStateHandler" | "searchTerm" | "onInsertItem" | "onSearch" | "onSelectItem" | "viewMoreItem" | "showCategories" | "showSearch"> & React.RefAttributes<any>>>;
|
|
40
40
|
export default MemoizedElementBrowser;
|
|
@@ -116,5 +116,7 @@ export declare class HyperlinkLinkAddToolbar extends PureComponent<Props, State>
|
|
|
116
116
|
export declare const HyperlinkLinkAddToolbarWithIntl: React.FC<import("react-intl-next").WithIntlProps<HyperlinkLinkAddToolbarProps>> & {
|
|
117
117
|
WrappedComponent: React.ComponentType<HyperlinkLinkAddToolbarProps>;
|
|
118
118
|
};
|
|
119
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<
|
|
119
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Omit<HyperlinkLinkAddToolbarProps, "intl"> & {
|
|
120
|
+
forwardedRef?: React.Ref<any> | undefined;
|
|
121
|
+
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
120
122
|
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
/**
|
|
4
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
5
|
+
*
|
|
6
|
+
* Creates a set of generic metadata attributes for a ProseMirror node or mark.
|
|
7
|
+
* These attributes are used to annotate the DOM representation with information
|
|
8
|
+
* about the node or mark type.
|
|
9
|
+
*
|
|
10
|
+
* @param {PMNode | PMMark} nodeOrMark - The ProseMirror node or mark to create metadata for.
|
|
11
|
+
* @returns {Record<string, string>} An object containing metadata attributes.
|
|
12
|
+
* - `data-prosemirror-content-type`: Specifies if the content is a node or mark.
|
|
13
|
+
* - `data-prosemirror-node-name` (if applicable): The name of the node.
|
|
14
|
+
* - `data-prosemirror-node-block` (if applicable): Indicates if the node is a block.
|
|
15
|
+
* - `data-prosemirror-node-inline` (if applicable): Indicates if the node is inline.
|
|
16
|
+
* - `data-prosemirror-mark-name` (if applicable): The name of the mark.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createProseMirrorMetadata: (nodeOrMark: PMNode | PMMark) => Record<string, string>;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import type { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
3
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
2
4
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
/**
|
|
6
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
7
|
+
*
|
|
8
|
+
* Attaches generic ProseMirror metadata attributes to a given DOM element based on the properties of a ProseMirror node.
|
|
9
|
+
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} params - The parameters for the function.
|
|
13
|
+
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
14
|
+
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
15
|
+
*/
|
|
16
|
+
export declare const attachGenericProseMirrorMetadata: ({ nodeOrMark, dom, }: {
|
|
17
|
+
nodeOrMark: PMNode | PMMark;
|
|
18
|
+
dom: HTMLElement;
|
|
19
|
+
}) => void;
|
|
3
20
|
export declare class SafePlugin<T = any> extends Plugin<T> {
|
|
4
21
|
_isATypeSafePlugin: never;
|
|
5
22
|
constructor(spec: SafePluginSpec<T>);
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
7
7
|
import type { PaletteColor, PaletteTooltipMessages } from '../../ui-color';
|
|
8
8
|
import type { Position as PopupPosition } from '../../ui/Popup/utils';
|
|
9
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
10
10
|
currentColor?: string | undefined;
|
|
11
11
|
title?: string | undefined;
|
|
12
12
|
isAriaExpanded?: boolean | undefined;
|
|
@@ -36,5 +36,5 @@ declare const MemoizedElementBrowser: React.MemoExoticComponent<React.ForwardRef
|
|
|
36
36
|
searchTerm?: string | undefined;
|
|
37
37
|
emptyStateHandler?: EmptyStateHandler | undefined;
|
|
38
38
|
viewMoreItem?: QuickInsertItem | undefined;
|
|
39
|
-
}
|
|
39
|
+
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "mode" | "analyticsContext" | "categories" | "onSelectCategory" | "selectedCategory" | "items" | "emptyStateHandler" | "searchTerm" | "onInsertItem" | "onSearch" | "onSelectItem" | "viewMoreItem" | "showCategories" | "showSearch"> & React.RefAttributes<any>>>;
|
|
40
40
|
export default MemoizedElementBrowser;
|
|
@@ -116,5 +116,7 @@ export declare class HyperlinkLinkAddToolbar extends PureComponent<Props, State>
|
|
|
116
116
|
export declare const HyperlinkLinkAddToolbarWithIntl: React.FC<import("react-intl-next").WithIntlProps<HyperlinkLinkAddToolbarProps>> & {
|
|
117
117
|
WrappedComponent: React.ComponentType<HyperlinkLinkAddToolbarProps>;
|
|
118
118
|
};
|
|
119
|
-
declare const _default: React.ForwardRefExoticComponent<Omit<
|
|
119
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Omit<HyperlinkLinkAddToolbarProps, "intl"> & {
|
|
120
|
+
forwardedRef?: React.Ref<any> | undefined;
|
|
121
|
+
}, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
120
122
|
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
/**
|
|
4
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
5
|
+
*
|
|
6
|
+
* Creates a set of generic metadata attributes for a ProseMirror node or mark.
|
|
7
|
+
* These attributes are used to annotate the DOM representation with information
|
|
8
|
+
* about the node or mark type.
|
|
9
|
+
*
|
|
10
|
+
* @param {PMNode | PMMark} nodeOrMark - The ProseMirror node or mark to create metadata for.
|
|
11
|
+
* @returns {Record<string, string>} An object containing metadata attributes.
|
|
12
|
+
* - `data-prosemirror-content-type`: Specifies if the content is a node or mark.
|
|
13
|
+
* - `data-prosemirror-node-name` (if applicable): The name of the node.
|
|
14
|
+
* - `data-prosemirror-node-block` (if applicable): Indicates if the node is a block.
|
|
15
|
+
* - `data-prosemirror-node-inline` (if applicable): Indicates if the node is inline.
|
|
16
|
+
* - `data-prosemirror-mark-name` (if applicable): The name of the mark.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createProseMirrorMetadata: (nodeOrMark: PMNode | PMMark) => Record<string, string>;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import type { Mark as PMMark } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
1
3
|
import { Plugin } from '@atlaskit/editor-prosemirror/state';
|
|
2
4
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
/**
|
|
6
|
+
* 🧱 Internal Helper Function: Editor FE Platform
|
|
7
|
+
*
|
|
8
|
+
* Attaches generic ProseMirror metadata attributes to a given DOM element based on the properties of a ProseMirror node.
|
|
9
|
+
* This function is useful for annotating DOM elements with metadata that describes the type and characteristics of the ProseMirror node.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} params - The parameters for the function.
|
|
13
|
+
* @param {PMNode} params.node - The ProseMirror node from which to derive metadata.
|
|
14
|
+
* @param {HTMLElement} params.dom - The DOM element to which the metadata attributes will be attached.
|
|
15
|
+
*/
|
|
16
|
+
export declare const attachGenericProseMirrorMetadata: ({ nodeOrMark, dom, }: {
|
|
17
|
+
nodeOrMark: PMNode | PMMark;
|
|
18
|
+
dom: HTMLElement;
|
|
19
|
+
}) => void;
|
|
3
20
|
export declare class SafePlugin<T = any> extends Plugin<T> {
|
|
4
21
|
_isATypeSafePlugin: never;
|
|
5
22
|
constructor(spec: SafePluginSpec<T>);
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
7
7
|
import type { PaletteColor, PaletteTooltipMessages } from '../../ui-color';
|
|
8
8
|
import type { Position as PopupPosition } from '../../ui/Popup/utils';
|
|
9
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Omit<{
|
|
10
10
|
currentColor?: string | undefined;
|
|
11
11
|
title?: string | undefined;
|
|
12
12
|
isAriaExpanded?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "93.1.
|
|
3
|
+
"version": "93.1.5",
|
|
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/"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"runReact18": true
|
|
29
29
|
},
|
|
30
30
|
"af:exports": {
|
|
31
|
+
"./prosemirror-dom-metadata": "./src/prosemirror-dom-metadata/index.ts",
|
|
31
32
|
"./whitespace": "./src/whitespace/index.ts",
|
|
32
33
|
"./event-dispatcher": "./src/event-dispatcher/index.ts",
|
|
33
34
|
"./extensions": "./src/extensions.ts",
|
|
@@ -127,7 +128,7 @@
|
|
|
127
128
|
"@atlaskit/emoji": "^67.8.0",
|
|
128
129
|
"@atlaskit/icon": "^22.22.0",
|
|
129
130
|
"@atlaskit/icon-object": "^6.5.0",
|
|
130
|
-
"@atlaskit/link-datasource": "^3.
|
|
131
|
+
"@atlaskit/link-datasource": "^3.5.0",
|
|
131
132
|
"@atlaskit/link-picker": "^1.47.0",
|
|
132
133
|
"@atlaskit/media-card": "^78.5.0",
|
|
133
134
|
"@atlaskit/media-client": "^28.0.0",
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
"@atlaskit/primitives": "^12.2.0",
|
|
144
145
|
"@atlaskit/profilecard": "^20.4.0",
|
|
145
146
|
"@atlaskit/section-message": "^6.6.0",
|
|
146
|
-
"@atlaskit/smart-card": "^29.
|
|
147
|
+
"@atlaskit/smart-card": "^29.1.0",
|
|
147
148
|
"@atlaskit/smart-user-picker": "^6.10.0",
|
|
148
149
|
"@atlaskit/spinner": "^16.3.0",
|
|
149
150
|
"@atlaskit/task-decision": "^17.11.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/prosemirror-dom-metadata",
|
|
3
|
+
"main": "../dist/cjs/prosemirror-dom-metadata/index.js",
|
|
4
|
+
"module": "../dist/esm/prosemirror-dom-metadata/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/prosemirror-dom-metadata/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/prosemirror-dom-metadata/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/prosemirror-dom-metadata/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|