@atlaskit/editor-plugin-placeholder 7.4.3 → 7.4.4

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-placeholder
2
2
 
3
+ ## 7.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`db37927f35395`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/db37927f35395) -
8
+ Cleanup platform_editor_ai_aifc_patch_ga_blockers flag.
9
+ - Updated dependencies
10
+
3
11
  ## 7.4.3
4
12
 
5
13
  ### Patch Changes
@@ -20,7 +20,7 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
20
20
  var placeholderDecoration = document.createElement('span');
21
21
  var placeholderNodeWithText = placeholderDecoration;
22
22
  placeholderDecoration.setAttribute('data-testid', _constants.placeholderTestId);
23
- var shouldFadeIn = showOnEmptyParagraph && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers');
23
+ var shouldFadeIn = showOnEmptyParagraph;
24
24
  placeholderDecoration.className = shouldFadeIn ? 'placeholder-decoration placeholder-decoration-fade-in' : 'placeholder-decoration';
25
25
  placeholderDecoration.setAttribute('aria-hidden', 'true');
26
26
 
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = createPlugin;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
8
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
9
  var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
11
10
  var _placeholderPlugin = require("../placeholderPlugin");
@@ -58,7 +57,7 @@ function createPlugin(intl, defaultPlaceholderText, bracketPlaceholderText, empt
58
57
  userHadTyped = _calculateUserInterac.userHadTyped,
59
58
  typedAndDeleted = _calculateUserInterac.typedAndDeleted;
60
59
  var isPlaceholderHidden = (_placeholderState$isP = placeholderState === null || placeholderState === void 0 ? void 0 : placeholderState.isPlaceholderHidden) !== null && _placeholderState$isP !== void 0 ? _placeholderState$isP : false;
61
- var shouldUpdatePlaceholderHidden = (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined : (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined && withEmptyParagraph;
60
+ var shouldUpdatePlaceholderHidden = (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined;
62
61
  if (shouldUpdatePlaceholderHidden) {
63
62
  isPlaceholderHidden = meta.isPlaceholderHidden;
64
63
  }
@@ -13,7 +13,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
13
13
  var _messages = require("@atlaskit/editor-common/messages");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
17
  var _placeholderPlugin = require("../placeholderPlugin");
19
18
  var _adfBuilders = require("./adf-builders");
@@ -78,7 +77,7 @@ function createPlaceHolderStateFrom(_ref3) {
78
77
  isPlaceholderHidden = _ref3.isPlaceholderHidden,
79
78
  withEmptyParagraph = _ref3.withEmptyParagraph,
80
79
  showOnEmptyParagraph = _ref3.showOnEmptyParagraph;
81
- var shouldHidePlaceholder = (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? isPlaceholderHidden : isPlaceholderHidden && withEmptyParagraph;
80
+ var shouldHidePlaceholder = isPlaceholderHidden;
82
81
  if (shouldHidePlaceholder) {
83
82
  return _objectSpread(_objectSpread({}, emptyPlaceholder({
84
83
  placeholderText: defaultPlaceholderText,
@@ -111,34 +110,10 @@ function createPlaceHolderStateFrom(_ref3) {
111
110
  $to = _editorState$selectio.$to;
112
111
  var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !(0, _utils.isEmptyDocument)(editorState.doc) && from === to && (0, _utils.isEmptyParagraph)($to.parent) && (0, _utils.hasDocAsParent)($to);
113
112
  if (isOnEmptyParagraphInNonEmptyDoc) {
114
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers')) {
115
- // If placeholder was already shown, keep it visible even without focus
116
- // This prevents the placeholder from disappearing when switching browser tabs
117
- if (showOnEmptyParagraph) {
118
- return setPlaceHolderState({
119
- placeholderText: defaultPlaceholderText,
120
- pos: to,
121
- placeholderPrompts: placeholderPrompts,
122
- typedAndDeleted: typedAndDeleted,
123
- userHadTyped: userHadTyped,
124
- canShowOnEmptyParagraph: true,
125
- showOnEmptyParagraph: true
126
- });
127
- }
128
- // Focus is required to start the timeout for showing placeholder
129
- if (isEditorFocused) {
130
- return emptyPlaceholder({
131
- placeholderText: defaultPlaceholderText,
132
- placeholderPrompts: placeholderPrompts,
133
- userHadTyped: userHadTyped,
134
- canShowOnEmptyParagraph: true,
135
- showOnEmptyParagraph: false,
136
- pos: to
137
- });
138
- }
139
- } else if (isEditorFocused) {
140
- // Original behavior: focus is required for both showing and keeping placeholder visible
141
- return showOnEmptyParagraph ? setPlaceHolderState({
113
+ // If placeholder was already shown, keep it visible even without focus
114
+ // This prevents the placeholder from disappearing when switching browser tabs
115
+ if (showOnEmptyParagraph) {
116
+ return setPlaceHolderState({
142
117
  placeholderText: defaultPlaceholderText,
143
118
  pos: to,
144
119
  placeholderPrompts: placeholderPrompts,
@@ -146,7 +121,11 @@ function createPlaceHolderStateFrom(_ref3) {
146
121
  userHadTyped: userHadTyped,
147
122
  canShowOnEmptyParagraph: true,
148
123
  showOnEmptyParagraph: true
149
- }) : emptyPlaceholder({
124
+ });
125
+ }
126
+ // Focus is required to start the timeout for showing placeholder
127
+ if (isEditorFocused) {
128
+ return emptyPlaceholder({
150
129
  placeholderText: defaultPlaceholderText,
151
130
  placeholderPrompts: placeholderPrompts,
152
131
  userHadTyped: userHadTyped,
@@ -10,7 +10,7 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
10
10
  const placeholderDecoration = document.createElement('span');
11
11
  let placeholderNodeWithText = placeholderDecoration;
12
12
  placeholderDecoration.setAttribute('data-testid', placeholderTestId);
13
- const shouldFadeIn = showOnEmptyParagraph && fg('platform_editor_ai_aifc_patch_ga_blockers');
13
+ const shouldFadeIn = showOnEmptyParagraph;
14
14
  placeholderDecoration.className = shouldFadeIn ? 'placeholder-decoration placeholder-decoration-fade-in' : 'placeholder-decoration';
15
15
  placeholderDecoration.setAttribute('aria-hidden', 'true');
16
16
 
@@ -1,8 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
5
- import { pluginKey, EMPTY_PARAGRAPH_TIMEOUT_DELAY } from '../placeholderPlugin';
4
+ import { EMPTY_PARAGRAPH_TIMEOUT_DELAY, pluginKey } from '../placeholderPlugin';
6
5
  import { TYPEWRITER_TYPED_AND_DELETED_DELAY } from './constants';
7
6
  import { createPlaceholderDecoration } from './decorations';
8
7
  import { calculateUserInteractionState, createPlaceHolderStateFrom, getPlaceholderState } from './utils';
@@ -51,7 +50,7 @@ export default function createPlugin(intl, defaultPlaceholderText, bracketPlaceh
51
50
  newEditorState
52
51
  });
53
52
  let isPlaceholderHidden = (_placeholderState$isP = placeholderState === null || placeholderState === void 0 ? void 0 : placeholderState.isPlaceholderHidden) !== null && _placeholderState$isP !== void 0 ? _placeholderState$isP : false;
54
- const shouldUpdatePlaceholderHidden = fg('platform_editor_ai_aifc_patch_ga_blockers') ? (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined : (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined && withEmptyParagraph;
53
+ const shouldUpdatePlaceholderHidden = (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined;
55
54
  if (shouldUpdatePlaceholderHidden) {
56
55
  isPlaceholderHidden = meta.isPlaceholderHidden;
57
56
  }
@@ -1,7 +1,6 @@
1
1
  import { placeholderTextMessages as messages } from '@atlaskit/editor-common/messages';
2
2
  import { bracketTyped, hasDocAsParent, isEmptyDocument, isEmptyParagraph } from '@atlaskit/editor-common/utils';
3
3
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
5
  import { pluginKey } from '../placeholderPlugin';
7
6
  import { createLongEmptyNodePlaceholderADF, createShortEmptyNodePlaceholderADF } from './adf-builders';
@@ -65,7 +64,7 @@ export function createPlaceHolderStateFrom({
65
64
  withEmptyParagraph,
66
65
  showOnEmptyParagraph
67
66
  }) {
68
- const shouldHidePlaceholder = fg('platform_editor_ai_aifc_patch_ga_blockers') ? isPlaceholderHidden : isPlaceholderHidden && withEmptyParagraph;
67
+ const shouldHidePlaceholder = isPlaceholderHidden;
69
68
  if (shouldHidePlaceholder) {
70
69
  return {
71
70
  ...emptyPlaceholder({
@@ -100,34 +99,10 @@ export function createPlaceHolderStateFrom({
100
99
  } = editorState.selection;
101
100
  const isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
102
101
  if (isOnEmptyParagraphInNonEmptyDoc) {
103
- if (fg('platform_editor_ai_aifc_patch_ga_blockers')) {
104
- // If placeholder was already shown, keep it visible even without focus
105
- // This prevents the placeholder from disappearing when switching browser tabs
106
- if (showOnEmptyParagraph) {
107
- return setPlaceHolderState({
108
- placeholderText: defaultPlaceholderText,
109
- pos: to,
110
- placeholderPrompts,
111
- typedAndDeleted,
112
- userHadTyped,
113
- canShowOnEmptyParagraph: true,
114
- showOnEmptyParagraph: true
115
- });
116
- }
117
- // Focus is required to start the timeout for showing placeholder
118
- if (isEditorFocused) {
119
- return emptyPlaceholder({
120
- placeholderText: defaultPlaceholderText,
121
- placeholderPrompts,
122
- userHadTyped,
123
- canShowOnEmptyParagraph: true,
124
- showOnEmptyParagraph: false,
125
- pos: to
126
- });
127
- }
128
- } else if (isEditorFocused) {
129
- // Original behavior: focus is required for both showing and keeping placeholder visible
130
- return showOnEmptyParagraph ? setPlaceHolderState({
102
+ // If placeholder was already shown, keep it visible even without focus
103
+ // This prevents the placeholder from disappearing when switching browser tabs
104
+ if (showOnEmptyParagraph) {
105
+ return setPlaceHolderState({
131
106
  placeholderText: defaultPlaceholderText,
132
107
  pos: to,
133
108
  placeholderPrompts,
@@ -135,7 +110,11 @@ export function createPlaceHolderStateFrom({
135
110
  userHadTyped,
136
111
  canShowOnEmptyParagraph: true,
137
112
  showOnEmptyParagraph: true
138
- }) : emptyPlaceholder({
113
+ });
114
+ }
115
+ // Focus is required to start the timeout for showing placeholder
116
+ if (isEditorFocused) {
117
+ return emptyPlaceholder({
139
118
  placeholderText: defaultPlaceholderText,
140
119
  placeholderPrompts,
141
120
  userHadTyped,
@@ -14,7 +14,7 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
14
14
  var placeholderDecoration = document.createElement('span');
15
15
  var placeholderNodeWithText = placeholderDecoration;
16
16
  placeholderDecoration.setAttribute('data-testid', placeholderTestId);
17
- var shouldFadeIn = showOnEmptyParagraph && fg('platform_editor_ai_aifc_patch_ga_blockers');
17
+ var shouldFadeIn = showOnEmptyParagraph;
18
18
  placeholderDecoration.className = shouldFadeIn ? 'placeholder-decoration placeholder-decoration-fade-in' : 'placeholder-decoration';
19
19
  placeholderDecoration.setAttribute('aria-hidden', 'true');
20
20
 
@@ -1,8 +1,7 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
5
- import { pluginKey, EMPTY_PARAGRAPH_TIMEOUT_DELAY } from '../placeholderPlugin';
4
+ import { EMPTY_PARAGRAPH_TIMEOUT_DELAY, pluginKey } from '../placeholderPlugin';
6
5
  import { TYPEWRITER_TYPED_AND_DELETED_DELAY } from './constants';
7
6
  import { createPlaceholderDecoration } from './decorations';
8
7
  import { calculateUserInteractionState, createPlaceHolderStateFrom, getPlaceholderState } from './utils';
@@ -52,7 +51,7 @@ export default function createPlugin(intl, defaultPlaceholderText, bracketPlaceh
52
51
  userHadTyped = _calculateUserInterac.userHadTyped,
53
52
  typedAndDeleted = _calculateUserInterac.typedAndDeleted;
54
53
  var isPlaceholderHidden = (_placeholderState$isP = placeholderState === null || placeholderState === void 0 ? void 0 : placeholderState.isPlaceholderHidden) !== null && _placeholderState$isP !== void 0 ? _placeholderState$isP : false;
55
- var shouldUpdatePlaceholderHidden = fg('platform_editor_ai_aifc_patch_ga_blockers') ? (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined : (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined && withEmptyParagraph;
54
+ var shouldUpdatePlaceholderHidden = (meta === null || meta === void 0 ? void 0 : meta.isPlaceholderHidden) !== undefined;
56
55
  if (shouldUpdatePlaceholderHidden) {
57
56
  isPlaceholderHidden = meta.isPlaceholderHidden;
58
57
  }
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { placeholderTextMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { bracketTyped, hasDocAsParent, isEmptyDocument, isEmptyParagraph } from '@atlaskit/editor-common/utils';
6
6
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
8
  import { pluginKey } from '../placeholderPlugin';
10
9
  import { createLongEmptyNodePlaceholderADF, createShortEmptyNodePlaceholderADF } from './adf-builders';
@@ -67,7 +66,7 @@ export function createPlaceHolderStateFrom(_ref3) {
67
66
  isPlaceholderHidden = _ref3.isPlaceholderHidden,
68
67
  withEmptyParagraph = _ref3.withEmptyParagraph,
69
68
  showOnEmptyParagraph = _ref3.showOnEmptyParagraph;
70
- var shouldHidePlaceholder = fg('platform_editor_ai_aifc_patch_ga_blockers') ? isPlaceholderHidden : isPlaceholderHidden && withEmptyParagraph;
69
+ var shouldHidePlaceholder = isPlaceholderHidden;
71
70
  if (shouldHidePlaceholder) {
72
71
  return _objectSpread(_objectSpread({}, emptyPlaceholder({
73
72
  placeholderText: defaultPlaceholderText,
@@ -100,34 +99,10 @@ export function createPlaceHolderStateFrom(_ref3) {
100
99
  $to = _editorState$selectio.$to;
101
100
  var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
102
101
  if (isOnEmptyParagraphInNonEmptyDoc) {
103
- if (fg('platform_editor_ai_aifc_patch_ga_blockers')) {
104
- // If placeholder was already shown, keep it visible even without focus
105
- // This prevents the placeholder from disappearing when switching browser tabs
106
- if (showOnEmptyParagraph) {
107
- return setPlaceHolderState({
108
- placeholderText: defaultPlaceholderText,
109
- pos: to,
110
- placeholderPrompts: placeholderPrompts,
111
- typedAndDeleted: typedAndDeleted,
112
- userHadTyped: userHadTyped,
113
- canShowOnEmptyParagraph: true,
114
- showOnEmptyParagraph: true
115
- });
116
- }
117
- // Focus is required to start the timeout for showing placeholder
118
- if (isEditorFocused) {
119
- return emptyPlaceholder({
120
- placeholderText: defaultPlaceholderText,
121
- placeholderPrompts: placeholderPrompts,
122
- userHadTyped: userHadTyped,
123
- canShowOnEmptyParagraph: true,
124
- showOnEmptyParagraph: false,
125
- pos: to
126
- });
127
- }
128
- } else if (isEditorFocused) {
129
- // Original behavior: focus is required for both showing and keeping placeholder visible
130
- return showOnEmptyParagraph ? setPlaceHolderState({
102
+ // If placeholder was already shown, keep it visible even without focus
103
+ // This prevents the placeholder from disappearing when switching browser tabs
104
+ if (showOnEmptyParagraph) {
105
+ return setPlaceHolderState({
131
106
  placeholderText: defaultPlaceholderText,
132
107
  pos: to,
133
108
  placeholderPrompts: placeholderPrompts,
@@ -135,7 +110,11 @@ export function createPlaceHolderStateFrom(_ref3) {
135
110
  userHadTyped: userHadTyped,
136
111
  canShowOnEmptyParagraph: true,
137
112
  showOnEmptyParagraph: true
138
- }) : emptyPlaceholder({
113
+ });
114
+ }
115
+ // Focus is required to start the timeout for showing placeholder
116
+ if (isEditorFocused) {
117
+ return emptyPlaceholder({
139
118
  placeholderText: defaultPlaceholderText,
140
119
  placeholderPrompts: placeholderPrompts,
141
120
  userHadTyped: userHadTyped,
@@ -1,6 +1,6 @@
1
1
  import type { DocNode } from '@atlaskit/adf-schema';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { PlaceHolderState, CreatePlaceholderStateProps, UserInteractionState } from './types';
3
+ import type { CreatePlaceholderStateProps, PlaceHolderState, UserInteractionState } from './types';
4
4
  export declare function getPlaceholderState(editorState: EditorState): PlaceHolderState;
5
5
  export declare function setPlaceHolderState({ placeholderText, pos, placeholderPrompts, typedAndDeleted, userHadTyped, canShowOnEmptyParagraph, showOnEmptyParagraph, contextPlaceholderADF, }: {
6
6
  canShowOnEmptyParagraph?: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { DocNode } from '@atlaskit/adf-schema';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { PlaceHolderState, CreatePlaceholderStateProps, UserInteractionState } from './types';
3
+ import type { CreatePlaceholderStateProps, PlaceHolderState, UserInteractionState } from './types';
4
4
  export declare function getPlaceholderState(editorState: EditorState): PlaceHolderState;
5
5
  export declare function setPlaceHolderState({ placeholderText, pos, placeholderPrompts, typedAndDeleted, userHadTyped, canShowOnEmptyParagraph, showOnEmptyParagraph, contextPlaceholderADF, }: {
6
6
  canShowOnEmptyParagraph?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-placeholder",
3
- "version": "7.4.3",
3
+ "version": "7.4.4",
4
4
  "description": "Placeholder plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,12 +37,12 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/primitives": "^18.0.0",
39
39
  "@atlaskit/spinner": "^19.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^35.5.0",
40
+ "@atlaskit/tmp-editor-statsig": "^35.6.0",
41
41
  "@atlaskit/tokens": "^11.1.0",
42
42
  "@babel/runtime": "^7.0.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@atlaskit/editor-common": "^111.32.0",
45
+ "@atlaskit/editor-common": "^111.33.0",
46
46
  "react": "^18.2.0",
47
47
  "react-dom": "^18.2.0",
48
48
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -51,9 +51,6 @@
51
51
  "@testing-library/react": "^16.3.0"
52
52
  },
53
53
  "platform-feature-flags": {
54
- "platform_editor_ai_aifc_patch_ga_blockers": {
55
- "type": "boolean"
56
- },
57
54
  "platform_editor_ai_aifc_adf_placeholder": {
58
55
  "type": "boolean"
59
56
  }