@atlaskit/editor-plugin-selection-marker 1.0.0 → 1.0.1

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 +1,7 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
+
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#81026](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81026) [`9f75ed822487`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f75ed822487) - [ux] Fix selection marker background with input fields (ie. expands).
@@ -9,8 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _hooks = require("@atlaskit/editor-common/hooks");
10
10
  var _main = require("./pm-plugins/main");
11
11
  var _globalStyles = require("./ui/global-styles");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- 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; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ 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 && Object.prototype.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; }
14
14
  var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
15
15
  var api = _ref.api;
16
16
  return {
@@ -9,9 +9,11 @@ var _react = require("@emotion/react");
9
9
 
10
10
  // Unset the selection background color as we are using our own
11
11
  // Otherwise we might have a mix of grey + our selection marker depending on the state.
12
+ // We do not apply this reset to input fields (ie. expand case) because otherwise
13
+ // selection highlight will not show on those.
12
14
  var globalStyles = (0, _react.css)({
13
15
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
14
- '.ProseMirror:not(:focus) ::selection': {
16
+ '.ProseMirror:not(:focus) ::selection:not(input)': {
15
17
  background: 'unset'
16
18
  }
17
19
  });
@@ -49,7 +49,7 @@ var toDOM = function toDOM(type) {
49
49
  var containsText = function containsText(resolvedPos) {
50
50
  var nodeBefore = resolvedPos.nodeBefore,
51
51
  nodeAfter = resolvedPos.nodeAfter;
52
- return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
52
+ return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isInline) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isInline);
53
53
  };
54
54
  var createWidgetDecoration = exports.createWidgetDecoration = function createWidgetDecoration(resolvedPos, type, selection) {
55
55
  // We don't want the cursor to show if it's not text selection
@@ -3,9 +3,11 @@ import { css, Global, jsx } from '@emotion/react';
3
3
 
4
4
  // Unset the selection background color as we are using our own
5
5
  // Otherwise we might have a mix of grey + our selection marker depending on the state.
6
+ // We do not apply this reset to input fields (ie. expand case) because otherwise
7
+ // selection highlight will not show on those.
6
8
  const globalStyles = css({
7
9
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
8
- '.ProseMirror:not(:focus) ::selection': {
10
+ '.ProseMirror:not(:focus) ::selection:not(input)': {
9
11
  background: 'unset'
10
12
  }
11
13
  });
@@ -45,7 +45,7 @@ const containsText = resolvedPos => {
45
45
  nodeBefore,
46
46
  nodeAfter
47
47
  } = resolvedPos;
48
- return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
48
+ return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isInline) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isInline);
49
49
  };
50
50
  export const createWidgetDecoration = (resolvedPos, type, selection) => {
51
51
  // We don't want the cursor to show if it's not text selection
@@ -3,9 +3,11 @@ import { css, Global, jsx } from '@emotion/react';
3
3
 
4
4
  // Unset the selection background color as we are using our own
5
5
  // Otherwise we might have a mix of grey + our selection marker depending on the state.
6
+ // We do not apply this reset to input fields (ie. expand case) because otherwise
7
+ // selection highlight will not show on those.
6
8
  var globalStyles = css({
7
9
  // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
8
- '.ProseMirror:not(:focus) ::selection': {
10
+ '.ProseMirror:not(:focus) ::selection:not(input)': {
9
11
  background: 'unset'
10
12
  }
11
13
  });
@@ -42,7 +42,7 @@ var toDOM = function toDOM(type) {
42
42
  var containsText = function containsText(resolvedPos) {
43
43
  var nodeBefore = resolvedPos.nodeBefore,
44
44
  nodeAfter = resolvedPos.nodeAfter;
45
- return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
45
+ return (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isInline) || (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isInline);
46
46
  };
47
47
  export var createWidgetDecoration = function createWidgetDecoration(resolvedPos, type, selection) {
48
48
  // We don't want the cursor to show if it's not text selection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,12 +31,12 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^78.10.0",
34
+ "@atlaskit/editor-common": "^78.12.0",
35
35
  "@atlaskit/editor-plugin-focus": "^1.1.0",
36
36
  "@atlaskit/editor-plugin-type-ahead": "^1.0.2",
37
37
  "@atlaskit/editor-prosemirror": "3.0.0",
38
- "@atlaskit/primitives": "^4.0.0",
39
- "@atlaskit/tokens": "^1.38.0",
38
+ "@atlaskit/primitives": "^4.1.0",
39
+ "@atlaskit/tokens": "^1.41.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "@emotion/react": "^11.7.1"
42
42
  },