@atlaskit/editor-plugin-selection-marker 2.1.1 → 2.1.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 2.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#137989](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137989)
8
+ [`8a449b2a3d26a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8a449b2a3d26a) -
9
+ Fix hiding selection on advanced code blocks in safari.
10
+
3
11
  ## 2.1.1
4
12
 
5
13
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.GlobalStylesWrapper = void 0;
7
7
  var _react = require("@emotion/react");
8
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
8
9
  /**
9
10
  * @jsxRuntime classic
10
11
  * @jsx jsx
@@ -20,14 +21,35 @@ var _react = require("@emotion/react");
20
21
  * selection highlight will not show on those.
21
22
  * - We do not apply this reset when the editor is disabled
22
23
  */
23
- var globalStyles = (0, _react.css)({
24
+ var oldGlobalStyles = (0, _react.css)({
24
25
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
25
26
  '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input)': {
26
27
  background: 'unset'
27
28
  }
28
29
  });
30
+
31
+ /**
32
+ * Unset the selection background color as we are using our own
33
+ * Otherwise we might have a mix of grey + our selection marker depending on the state.
34
+ *
35
+ * Edge cases:
36
+ * - We do not apply this reset to input fields or code blocks (ie. expand case) because otherwise
37
+ * selection highlight will not show on those.
38
+ * - We do not apply this reset when the editor is disabled
39
+ */
40
+ var globalStyles = (0, _react.css)({
41
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
42
+ '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input, .cm-editor)': {
43
+ background: 'unset'
44
+ }
45
+ });
29
46
  var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
47
+ if ((0, _experiments.editorExperiment)('platform_editor_advanced_code_blocks', true)) {
48
+ return (0, _react.jsx)(_react.Global, {
49
+ styles: globalStyles
50
+ });
51
+ }
30
52
  return (0, _react.jsx)(_react.Global, {
31
- styles: globalStyles
53
+ styles: oldGlobalStyles
32
54
  });
33
55
  };
@@ -4,6 +4,7 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, Global, jsx } from '@emotion/react';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
 
8
9
  /**
9
10
  * Unset the selection background color as we are using our own
@@ -14,14 +15,35 @@ import { css, Global, jsx } from '@emotion/react';
14
15
  * selection highlight will not show on those.
15
16
  * - We do not apply this reset when the editor is disabled
16
17
  */
17
- const globalStyles = css({
18
+ const oldGlobalStyles = css({
18
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
19
20
  '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input)': {
20
21
  background: 'unset'
21
22
  }
22
23
  });
24
+
25
+ /**
26
+ * Unset the selection background color as we are using our own
27
+ * Otherwise we might have a mix of grey + our selection marker depending on the state.
28
+ *
29
+ * Edge cases:
30
+ * - We do not apply this reset to input fields or code blocks (ie. expand case) because otherwise
31
+ * selection highlight will not show on those.
32
+ * - We do not apply this reset when the editor is disabled
33
+ */
34
+ const globalStyles = css({
35
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
36
+ '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input, .cm-editor)': {
37
+ background: 'unset'
38
+ }
39
+ });
23
40
  export const GlobalStylesWrapper = () => {
41
+ if (editorExperiment('platform_editor_advanced_code_blocks', true)) {
42
+ return jsx(Global, {
43
+ styles: globalStyles
44
+ });
45
+ }
24
46
  return jsx(Global, {
25
- styles: globalStyles
47
+ styles: oldGlobalStyles
26
48
  });
27
49
  };
@@ -4,6 +4,7 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, Global, jsx } from '@emotion/react';
7
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
 
8
9
  /**
9
10
  * Unset the selection background color as we are using our own
@@ -14,14 +15,35 @@ import { css, Global, jsx } from '@emotion/react';
14
15
  * selection highlight will not show on those.
15
16
  * - We do not apply this reset when the editor is disabled
16
17
  */
17
- var globalStyles = css({
18
+ var oldGlobalStyles = css({
18
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
19
20
  '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input)': {
20
21
  background: 'unset'
21
22
  }
22
23
  });
24
+
25
+ /**
26
+ * Unset the selection background color as we are using our own
27
+ * Otherwise we might have a mix of grey + our selection marker depending on the state.
28
+ *
29
+ * Edge cases:
30
+ * - We do not apply this reset to input fields or code blocks (ie. expand case) because otherwise
31
+ * selection highlight will not show on those.
32
+ * - We do not apply this reset when the editor is disabled
33
+ */
34
+ var globalStyles = css({
35
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
36
+ '.ProseMirror:not(:focus):not([contenteditable="false"]) ::selection:not(input, .cm-editor)': {
37
+ background: 'unset'
38
+ }
39
+ });
23
40
  export var GlobalStylesWrapper = function GlobalStylesWrapper() {
41
+ if (editorExperiment('platform_editor_advanced_code_blocks', true)) {
42
+ return jsx(Global, {
43
+ styles: globalStyles
44
+ });
45
+ }
24
46
  return jsx(Global, {
25
- styles: globalStyles
47
+ styles: oldGlobalStyles
26
48
  });
27
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,6 +39,7 @@
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/primitives": "^14.3.0",
41
41
  "@atlaskit/theme": "^18.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^4.6.0",
42
43
  "@atlaskit/tokens": "^4.7.0",
43
44
  "@babel/runtime": "^7.0.0",
44
45
  "@emotion/react": "^11.7.1",