@atlaskit/editor-plugin-mentions 2.15.2 → 2.15.3

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 2.15.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#116070](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116070)
8
+ [`85b41fded4577`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/85b41fded4577) -
9
+ ED-26308: implements fallback dom for mention plugin
10
+
3
11
  ## 2.15.2
4
12
 
5
13
  ### Patch Changes
@@ -12,7 +12,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _uuid = _interopRequireDefault(require("uuid"));
15
- var _adfSchema = require("@atlaskit/adf-schema");
16
15
  var _analytics = require("@atlaskit/editor-common/analytics");
17
16
  var _messages = require("@atlaskit/editor-common/messages");
18
17
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
@@ -20,6 +19,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
20
19
  var _resource = require("@atlaskit/mention/resource");
21
20
  var _types = require("@atlaskit/mention/types");
22
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
+ var _mentionNodeSpec = require("./nodeviews/mentionNodeSpec");
23
23
  var _key = require("./pm-plugins/key");
24
24
  var _main = require("./pm-plugins/main");
25
25
  var _SecondaryToolbarComponent = require("./ui/SecondaryToolbarComponent");
@@ -108,7 +108,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
108
108
  nodes: function nodes() {
109
109
  return [{
110
110
  name: 'mention',
111
- node: _adfSchema.mention
111
+ node: (0, _mentionNodeSpec.mentionNodeSpec)()
112
112
  }];
113
113
  },
114
114
  pmPlugins: function pmPlugins() {
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.mentionNodeSpec = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _adfSchema = require("@atlaskit/adf-schema");
10
+ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _colors = require("@atlaskit/theme/colors");
13
+ 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; }
14
+ 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; }
15
+ var isSSR = Boolean(process.env.REACT_SSR);
16
+
17
+ /**
18
+ * Wrapper for ADF mention node spec to augment toDOM implementation
19
+ * with fallback UI for lazy node view rendering / window virtualization
20
+ * @nodeSpecException:toDOM patch
21
+ * @returns
22
+ */
23
+ var mentionNodeSpec = exports.mentionNodeSpec = function mentionNodeSpec() {
24
+ if (isSSR || !(0, _platformFeatureFlags.fg)('platform_editor_lego__inline_node_virtualization')) {
25
+ return _adfSchema.mention;
26
+ }
27
+ return _objectSpread(_objectSpread({}, _adfSchema.mention), {}, {
28
+ toDOM: function toDOM(node) {
29
+ // packages/elements/mention/src/components/Mention/index.tsx
30
+ var mentionAttrs = {
31
+ 'aria-busy': 'true',
32
+ contenteditable: 'false',
33
+ 'data-access-level': '',
34
+ 'data-mention-id': node.attrs.id,
35
+ 'data-prosemirror-content-type': 'node',
36
+ 'data-prosemirror-node-inline': 'true',
37
+ 'data-prosemirror-node-name': 'mention',
38
+ style: (0, _lazyNodeView.convertToInlineCss)({
39
+ display: 'inline',
40
+ border: "1px solid transparent",
41
+ background: "var(--ds-background-neutral, ".concat(_colors.N30A, ")"),
42
+ color: "var(--ds-text-subtle, #44546F)",
43
+ borderRadius: '20px',
44
+ cursor: 'pointer',
45
+ padding: '0 0.3em 2px 0.23em',
46
+ wordBreak: 'break-word'
47
+ })
48
+ };
49
+ return ['span', mentionAttrs, node.attrs.text];
50
+ }
51
+ });
52
+ };
@@ -24,7 +24,7 @@ var ACTIONS = exports.ACTIONS = {
24
24
  SET_PROVIDER: 'SET_PROVIDER'
25
25
  };
26
26
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
27
- var PACKAGE_VERSION = "2.15.2";
27
+ var PACKAGE_VERSION = "2.15.3";
28
28
  var setProvider = function setProvider(provider) {
29
29
  return function (state, dispatch) {
30
30
  if (dispatch) {
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import uuid from 'uuid';
4
- import { mention } from '@atlaskit/adf-schema';
5
4
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
5
  import { toolbarInsertBlockMessages as messages, mentionMessages } from '@atlaskit/editor-common/messages';
7
6
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
@@ -9,6 +8,7 @@ import { IconMention } from '@atlaskit/editor-common/quick-insert';
9
8
  import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
10
9
  import { MentionNameStatus, isPromise } from '@atlaskit/mention/types';
11
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
12
12
  import { mentionPluginKey } from './pm-plugins/key';
13
13
  import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
14
14
  import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
@@ -104,7 +104,7 @@ const mentionsPlugin = ({
104
104
  nodes() {
105
105
  return [{
106
106
  name: 'mention',
107
- node: mention
107
+ node: mentionNodeSpec()
108
108
  }];
109
109
  },
110
110
  pmPlugins() {
@@ -0,0 +1,43 @@
1
+ import { mention } from '@atlaskit/adf-schema';
2
+ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { N30A } from '@atlaskit/theme/colors';
5
+ const isSSR = Boolean(process.env.REACT_SSR);
6
+
7
+ /**
8
+ * Wrapper for ADF mention node spec to augment toDOM implementation
9
+ * with fallback UI for lazy node view rendering / window virtualization
10
+ * @nodeSpecException:toDOM patch
11
+ * @returns
12
+ */
13
+ export const mentionNodeSpec = () => {
14
+ if (isSSR || !fg('platform_editor_lego__inline_node_virtualization')) {
15
+ return mention;
16
+ }
17
+ return {
18
+ ...mention,
19
+ toDOM: node => {
20
+ // packages/elements/mention/src/components/Mention/index.tsx
21
+ const mentionAttrs = {
22
+ 'aria-busy': 'true',
23
+ contenteditable: 'false',
24
+ 'data-access-level': '',
25
+ 'data-mention-id': node.attrs.id,
26
+ 'data-prosemirror-content-type': 'node',
27
+ 'data-prosemirror-node-inline': 'true',
28
+ 'data-prosemirror-node-name': 'mention',
29
+ style: convertToInlineCss({
30
+ display: 'inline',
31
+ border: `1px solid transparent`,
32
+ background: `var(--ds-background-neutral, ${N30A})`,
33
+ color: "var(--ds-text-subtle, #44546F)",
34
+ borderRadius: '20px',
35
+ cursor: 'pointer',
36
+ padding: '0 0.3em 2px 0.23em',
37
+ wordBreak: 'break-word'
38
+ })
39
+ };
40
+ return ['span', mentionAttrs, node.attrs.text];
41
+ }
42
+ };
43
+ };
@@ -13,7 +13,7 @@ export const ACTIONS = {
13
13
  SET_PROVIDER: 'SET_PROVIDER'
14
14
  };
15
15
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
16
- const PACKAGE_VERSION = "2.15.2";
16
+ const PACKAGE_VERSION = "2.15.3";
17
17
  const setProvider = provider => (state, dispatch) => {
18
18
  if (dispatch) {
19
19
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -6,7 +6,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import React, { useEffect, useMemo } from 'react';
7
7
  import { useIntl } from 'react-intl-next';
8
8
  import uuid from 'uuid';
9
- import { mention } from '@atlaskit/adf-schema';
10
9
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
10
  import { toolbarInsertBlockMessages as messages, mentionMessages } from '@atlaskit/editor-common/messages';
12
11
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
@@ -14,6 +13,7 @@ import { IconMention } from '@atlaskit/editor-common/quick-insert';
14
13
  import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
15
14
  import { MentionNameStatus, isPromise } from '@atlaskit/mention/types';
16
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
+ import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
17
17
  import { mentionPluginKey } from './pm-plugins/key';
18
18
  import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
19
19
  import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
@@ -98,7 +98,7 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
98
98
  nodes: function nodes() {
99
99
  return [{
100
100
  name: 'mention',
101
- node: mention
101
+ node: mentionNodeSpec()
102
102
  }];
103
103
  },
104
104
  pmPlugins: function pmPlugins() {
@@ -0,0 +1,45 @@
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 { mention } from '@atlaskit/adf-schema';
5
+ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { N30A } from '@atlaskit/theme/colors';
8
+ var isSSR = Boolean(process.env.REACT_SSR);
9
+
10
+ /**
11
+ * Wrapper for ADF mention node spec to augment toDOM implementation
12
+ * with fallback UI for lazy node view rendering / window virtualization
13
+ * @nodeSpecException:toDOM patch
14
+ * @returns
15
+ */
16
+ export var mentionNodeSpec = function mentionNodeSpec() {
17
+ if (isSSR || !fg('platform_editor_lego__inline_node_virtualization')) {
18
+ return mention;
19
+ }
20
+ return _objectSpread(_objectSpread({}, mention), {}, {
21
+ toDOM: function toDOM(node) {
22
+ // packages/elements/mention/src/components/Mention/index.tsx
23
+ var mentionAttrs = {
24
+ 'aria-busy': 'true',
25
+ contenteditable: 'false',
26
+ 'data-access-level': '',
27
+ 'data-mention-id': node.attrs.id,
28
+ 'data-prosemirror-content-type': 'node',
29
+ 'data-prosemirror-node-inline': 'true',
30
+ 'data-prosemirror-node-name': 'mention',
31
+ style: convertToInlineCss({
32
+ display: 'inline',
33
+ border: "1px solid transparent",
34
+ background: "var(--ds-background-neutral, ".concat(N30A, ")"),
35
+ color: "var(--ds-text-subtle, #44546F)",
36
+ borderRadius: '20px',
37
+ cursor: 'pointer',
38
+ padding: '0 0.3em 2px 0.23em',
39
+ wordBreak: 'break-word'
40
+ })
41
+ };
42
+ return ['span', mentionAttrs, node.attrs.text];
43
+ }
44
+ });
45
+ };
@@ -16,7 +16,7 @@ export var ACTIONS = {
16
16
  SET_PROVIDER: 'SET_PROVIDER'
17
17
  };
18
18
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
19
- var PACKAGE_VERSION = "2.15.2";
19
+ var PACKAGE_VERSION = "2.15.3";
20
20
  var setProvider = function setProvider(provider) {
21
21
  return function (state, dispatch) {
22
22
  if (dispatch) {
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wrapper for ADF mention node spec to augment toDOM implementation
3
+ * with fallback UI for lazy node view rendering / window virtualization
4
+ * @nodeSpecException:toDOM patch
5
+ * @returns
6
+ */
7
+ export declare const mentionNodeSpec: () => import("prosemirror-model").NodeSpec;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wrapper for ADF mention node spec to augment toDOM implementation
3
+ * with fallback UI for lazy node view rendering / window virtualization
4
+ * @nodeSpecException:toDOM patch
5
+ * @returns
6
+ */
7
+ export declare const mentionNodeSpec: () => import("prosemirror-model").NodeSpec;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "2.15.2",
3
+ "version": "2.15.3",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,13 +32,13 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.2.1",
35
- "@atlaskit/editor-common": "^99.17.0",
35
+ "@atlaskit/editor-common": "^99.18.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.12.0",
37
37
  "@atlaskit/editor-plugin-base": "^2.2.0",
38
38
  "@atlaskit/editor-plugin-context-identifier": "^1.4.0",
39
39
  "@atlaskit/editor-plugin-type-ahead": "^1.13.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/icon": "^23.9.0",
41
+ "@atlaskit/icon": "^23.10.0",
42
42
  "@atlaskit/mention": "^23.11.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/theme": "^16.0.0",
@@ -113,6 +113,9 @@
113
113
  },
114
114
  "platform_editor_offline_editing_ga": {
115
115
  "type": "boolean"
116
+ },
117
+ "platform_editor_lego__inline_node_virtualization": {
118
+ "type": "boolean"
116
119
  }
117
120
  }
118
121
  }