@atlaskit/editor-plugin-placeholder 6.6.6 → 6.6.7

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
+ ## 6.6.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`356fd6e2db655`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/356fd6e2db655) -
8
+ [ux] [EDITOR-2469] fixed placeholder getting hidden when user tabs
9
+ - Updated dependencies
10
+
3
11
  ## 6.6.6
4
12
 
5
13
  ### Patch Changes
@@ -282,23 +282,52 @@ function createPlaceHolderStateFrom(_ref5) {
282
282
  from = _editorState$selectio.from,
283
283
  to = _editorState$selectio.to,
284
284
  $to = _editorState$selectio.$to;
285
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !(0, _utils.isEmptyDocument)(editorState.doc) && from === to && (0, _utils.isEmptyParagraph)($to.parent) && (0, _utils.hasDocAsParent)($to)) {
286
- return showOnEmptyParagraph ? setPlaceHolderState({
287
- placeholderText: defaultPlaceholderText,
288
- pos: to,
289
- placeholderPrompts: placeholderPrompts,
290
- typedAndDeleted: typedAndDeleted,
291
- userHadTyped: userHadTyped,
292
- canShowOnEmptyParagraph: true,
293
- showOnEmptyParagraph: true
294
- }) : emptyPlaceholder({
295
- placeholderText: defaultPlaceholderText,
296
- placeholderPrompts: placeholderPrompts,
297
- userHadTyped: userHadTyped,
298
- canShowOnEmptyParagraph: true,
299
- showOnEmptyParagraph: false,
300
- pos: to
301
- });
285
+ var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !(0, _utils.isEmptyDocument)(editorState.doc) && from === to && (0, _utils.isEmptyParagraph)($to.parent) && (0, _utils.hasDocAsParent)($to);
286
+ if (isOnEmptyParagraphInNonEmptyDoc) {
287
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers')) {
288
+ // If placeholder was already shown, keep it visible even without focus
289
+ // This prevents the placeholder from disappearing when switching browser tabs
290
+ if (showOnEmptyParagraph) {
291
+ return setPlaceHolderState({
292
+ placeholderText: defaultPlaceholderText,
293
+ pos: to,
294
+ placeholderPrompts: placeholderPrompts,
295
+ typedAndDeleted: typedAndDeleted,
296
+ userHadTyped: userHadTyped,
297
+ canShowOnEmptyParagraph: true,
298
+ showOnEmptyParagraph: true
299
+ });
300
+ }
301
+ // Focus is required to start the timeout for showing placeholder
302
+ if (isEditorFocused) {
303
+ return emptyPlaceholder({
304
+ placeholderText: defaultPlaceholderText,
305
+ placeholderPrompts: placeholderPrompts,
306
+ userHadTyped: userHadTyped,
307
+ canShowOnEmptyParagraph: true,
308
+ showOnEmptyParagraph: false,
309
+ pos: to
310
+ });
311
+ }
312
+ } else if (isEditorFocused) {
313
+ // Original behavior: focus is required for both showing and keeping placeholder visible
314
+ return showOnEmptyParagraph ? setPlaceHolderState({
315
+ placeholderText: defaultPlaceholderText,
316
+ pos: to,
317
+ placeholderPrompts: placeholderPrompts,
318
+ typedAndDeleted: typedAndDeleted,
319
+ userHadTyped: userHadTyped,
320
+ canShowOnEmptyParagraph: true,
321
+ showOnEmptyParagraph: true
322
+ }) : emptyPlaceholder({
323
+ placeholderText: defaultPlaceholderText,
324
+ placeholderPrompts: placeholderPrompts,
325
+ userHadTyped: userHadTyped,
326
+ canShowOnEmptyParagraph: true,
327
+ showOnEmptyParagraph: false,
328
+ pos: to
329
+ });
330
+ }
302
331
  }
303
332
  }
304
333
  if (isEditorFocused && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
@@ -109,23 +109,52 @@ function createPlaceHolderStateFrom(_ref3) {
109
109
  from = _editorState$selectio.from,
110
110
  to = _editorState$selectio.to,
111
111
  $to = _editorState$selectio.$to;
112
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !(0, _utils.isEmptyDocument)(editorState.doc) && from === to && (0, _utils.isEmptyParagraph)($to.parent) && (0, _utils.hasDocAsParent)($to)) {
113
- return showOnEmptyParagraph ? setPlaceHolderState({
114
- placeholderText: defaultPlaceholderText,
115
- pos: to,
116
- placeholderPrompts: placeholderPrompts,
117
- typedAndDeleted: typedAndDeleted,
118
- userHadTyped: userHadTyped,
119
- canShowOnEmptyParagraph: true,
120
- showOnEmptyParagraph: true
121
- }) : emptyPlaceholder({
122
- placeholderText: defaultPlaceholderText,
123
- placeholderPrompts: placeholderPrompts,
124
- userHadTyped: userHadTyped,
125
- canShowOnEmptyParagraph: true,
126
- showOnEmptyParagraph: false,
127
- pos: to
128
- });
112
+ var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !(0, _utils.isEmptyDocument)(editorState.doc) && from === to && (0, _utils.isEmptyParagraph)($to.parent) && (0, _utils.hasDocAsParent)($to);
113
+ 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({
142
+ placeholderText: defaultPlaceholderText,
143
+ pos: to,
144
+ placeholderPrompts: placeholderPrompts,
145
+ typedAndDeleted: typedAndDeleted,
146
+ userHadTyped: userHadTyped,
147
+ canShowOnEmptyParagraph: true,
148
+ showOnEmptyParagraph: true
149
+ }) : emptyPlaceholder({
150
+ placeholderText: defaultPlaceholderText,
151
+ placeholderPrompts: placeholderPrompts,
152
+ userHadTyped: userHadTyped,
153
+ canShowOnEmptyParagraph: true,
154
+ showOnEmptyParagraph: false,
155
+ pos: to
156
+ });
157
+ }
129
158
  }
130
159
  }
131
160
  if (isEditorFocused && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
@@ -263,23 +263,52 @@ function createPlaceHolderStateFrom({
263
263
  to,
264
264
  $to
265
265
  } = editorState.selection;
266
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to)) {
267
- return showOnEmptyParagraph ? setPlaceHolderState({
268
- placeholderText: defaultPlaceholderText,
269
- pos: to,
270
- placeholderPrompts,
271
- typedAndDeleted,
272
- userHadTyped,
273
- canShowOnEmptyParagraph: true,
274
- showOnEmptyParagraph: true
275
- }) : emptyPlaceholder({
276
- placeholderText: defaultPlaceholderText,
277
- placeholderPrompts,
278
- userHadTyped,
279
- canShowOnEmptyParagraph: true,
280
- showOnEmptyParagraph: false,
281
- pos: to
282
- });
266
+ const isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
267
+ if (isOnEmptyParagraphInNonEmptyDoc) {
268
+ if (fg('platform_editor_ai_aifc_patch_ga_blockers')) {
269
+ // If placeholder was already shown, keep it visible even without focus
270
+ // This prevents the placeholder from disappearing when switching browser tabs
271
+ if (showOnEmptyParagraph) {
272
+ return setPlaceHolderState({
273
+ placeholderText: defaultPlaceholderText,
274
+ pos: to,
275
+ placeholderPrompts,
276
+ typedAndDeleted,
277
+ userHadTyped,
278
+ canShowOnEmptyParagraph: true,
279
+ showOnEmptyParagraph: true
280
+ });
281
+ }
282
+ // Focus is required to start the timeout for showing placeholder
283
+ if (isEditorFocused) {
284
+ return emptyPlaceholder({
285
+ placeholderText: defaultPlaceholderText,
286
+ placeholderPrompts,
287
+ userHadTyped,
288
+ canShowOnEmptyParagraph: true,
289
+ showOnEmptyParagraph: false,
290
+ pos: to
291
+ });
292
+ }
293
+ } else if (isEditorFocused) {
294
+ // Original behavior: focus is required for both showing and keeping placeholder visible
295
+ return showOnEmptyParagraph ? setPlaceHolderState({
296
+ placeholderText: defaultPlaceholderText,
297
+ pos: to,
298
+ placeholderPrompts,
299
+ typedAndDeleted,
300
+ userHadTyped,
301
+ canShowOnEmptyParagraph: true,
302
+ showOnEmptyParagraph: true
303
+ }) : emptyPlaceholder({
304
+ placeholderText: defaultPlaceholderText,
305
+ placeholderPrompts,
306
+ userHadTyped,
307
+ canShowOnEmptyParagraph: true,
308
+ showOnEmptyParagraph: false,
309
+ pos: to
310
+ });
311
+ }
283
312
  }
284
313
  }
285
314
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
@@ -98,23 +98,52 @@ export function createPlaceHolderStateFrom({
98
98
  to,
99
99
  $to
100
100
  } = editorState.selection;
101
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to)) {
102
- return showOnEmptyParagraph ? setPlaceHolderState({
103
- placeholderText: defaultPlaceholderText,
104
- pos: to,
105
- placeholderPrompts,
106
- typedAndDeleted,
107
- userHadTyped,
108
- canShowOnEmptyParagraph: true,
109
- showOnEmptyParagraph: true
110
- }) : emptyPlaceholder({
111
- placeholderText: defaultPlaceholderText,
112
- placeholderPrompts,
113
- userHadTyped,
114
- canShowOnEmptyParagraph: true,
115
- showOnEmptyParagraph: false,
116
- pos: to
117
- });
101
+ const isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
102
+ 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({
131
+ placeholderText: defaultPlaceholderText,
132
+ pos: to,
133
+ placeholderPrompts,
134
+ typedAndDeleted,
135
+ userHadTyped,
136
+ canShowOnEmptyParagraph: true,
137
+ showOnEmptyParagraph: true
138
+ }) : emptyPlaceholder({
139
+ placeholderText: defaultPlaceholderText,
140
+ placeholderPrompts,
141
+ userHadTyped,
142
+ canShowOnEmptyParagraph: true,
143
+ showOnEmptyParagraph: false,
144
+ pos: to
145
+ });
146
+ }
118
147
  }
119
148
  }
120
149
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
@@ -272,23 +272,52 @@ function createPlaceHolderStateFrom(_ref5) {
272
272
  from = _editorState$selectio.from,
273
273
  to = _editorState$selectio.to,
274
274
  $to = _editorState$selectio.$to;
275
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to)) {
276
- return showOnEmptyParagraph ? setPlaceHolderState({
277
- placeholderText: defaultPlaceholderText,
278
- pos: to,
279
- placeholderPrompts: placeholderPrompts,
280
- typedAndDeleted: typedAndDeleted,
281
- userHadTyped: userHadTyped,
282
- canShowOnEmptyParagraph: true,
283
- showOnEmptyParagraph: true
284
- }) : emptyPlaceholder({
285
- placeholderText: defaultPlaceholderText,
286
- placeholderPrompts: placeholderPrompts,
287
- userHadTyped: userHadTyped,
288
- canShowOnEmptyParagraph: true,
289
- showOnEmptyParagraph: false,
290
- pos: to
291
- });
275
+ var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
276
+ if (isOnEmptyParagraphInNonEmptyDoc) {
277
+ if (fg('platform_editor_ai_aifc_patch_ga_blockers')) {
278
+ // If placeholder was already shown, keep it visible even without focus
279
+ // This prevents the placeholder from disappearing when switching browser tabs
280
+ if (showOnEmptyParagraph) {
281
+ return setPlaceHolderState({
282
+ placeholderText: defaultPlaceholderText,
283
+ pos: to,
284
+ placeholderPrompts: placeholderPrompts,
285
+ typedAndDeleted: typedAndDeleted,
286
+ userHadTyped: userHadTyped,
287
+ canShowOnEmptyParagraph: true,
288
+ showOnEmptyParagraph: true
289
+ });
290
+ }
291
+ // Focus is required to start the timeout for showing placeholder
292
+ if (isEditorFocused) {
293
+ return emptyPlaceholder({
294
+ placeholderText: defaultPlaceholderText,
295
+ placeholderPrompts: placeholderPrompts,
296
+ userHadTyped: userHadTyped,
297
+ canShowOnEmptyParagraph: true,
298
+ showOnEmptyParagraph: false,
299
+ pos: to
300
+ });
301
+ }
302
+ } else if (isEditorFocused) {
303
+ // Original behavior: focus is required for both showing and keeping placeholder visible
304
+ return showOnEmptyParagraph ? setPlaceHolderState({
305
+ placeholderText: defaultPlaceholderText,
306
+ pos: to,
307
+ placeholderPrompts: placeholderPrompts,
308
+ typedAndDeleted: typedAndDeleted,
309
+ userHadTyped: userHadTyped,
310
+ canShowOnEmptyParagraph: true,
311
+ showOnEmptyParagraph: true
312
+ }) : emptyPlaceholder({
313
+ placeholderText: defaultPlaceholderText,
314
+ placeholderPrompts: placeholderPrompts,
315
+ userHadTyped: userHadTyped,
316
+ canShowOnEmptyParagraph: true,
317
+ showOnEmptyParagraph: false,
318
+ pos: to
319
+ });
320
+ }
292
321
  }
293
322
  }
294
323
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
@@ -98,23 +98,52 @@ export function createPlaceHolderStateFrom(_ref3) {
98
98
  from = _editorState$selectio.from,
99
99
  to = _editorState$selectio.to,
100
100
  $to = _editorState$selectio.$to;
101
- if ((defaultPlaceholderText || placeholderADF) && withEmptyParagraph && isEditorFocused && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to)) {
102
- return showOnEmptyParagraph ? setPlaceHolderState({
103
- placeholderText: defaultPlaceholderText,
104
- pos: to,
105
- placeholderPrompts: placeholderPrompts,
106
- typedAndDeleted: typedAndDeleted,
107
- userHadTyped: userHadTyped,
108
- canShowOnEmptyParagraph: true,
109
- showOnEmptyParagraph: true
110
- }) : emptyPlaceholder({
111
- placeholderText: defaultPlaceholderText,
112
- placeholderPrompts: placeholderPrompts,
113
- userHadTyped: userHadTyped,
114
- canShowOnEmptyParagraph: true,
115
- showOnEmptyParagraph: false,
116
- pos: to
117
- });
101
+ var isOnEmptyParagraphInNonEmptyDoc = (defaultPlaceholderText || placeholderADF) && withEmptyParagraph && !isInitial && !isEmptyDocument(editorState.doc) && from === to && isEmptyParagraph($to.parent) && hasDocAsParent($to);
102
+ 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({
131
+ placeholderText: defaultPlaceholderText,
132
+ pos: to,
133
+ placeholderPrompts: placeholderPrompts,
134
+ typedAndDeleted: typedAndDeleted,
135
+ userHadTyped: userHadTyped,
136
+ canShowOnEmptyParagraph: true,
137
+ showOnEmptyParagraph: true
138
+ }) : emptyPlaceholder({
139
+ placeholderText: defaultPlaceholderText,
140
+ placeholderPrompts: placeholderPrompts,
141
+ userHadTyped: userHadTyped,
142
+ canShowOnEmptyParagraph: true,
143
+ showOnEmptyParagraph: false,
144
+ pos: to
145
+ });
146
+ }
118
147
  }
119
148
  }
120
149
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-placeholder",
3
- "version": "6.6.6",
3
+ "version": "6.6.7",
4
4
  "description": "Placeholder plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/editor-plugin-type-ahead": "^6.6.0",
35
35
  "@atlaskit/editor-prosemirror": "^7.2.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
- "@atlaskit/tmp-editor-statsig": "^16.2.0",
37
+ "@atlaskit/tmp-editor-statsig": "^16.3.0",
38
38
  "@atlaskit/tokens": "^9.0.0",
39
39
  "@babel/runtime": "^7.0.0"
40
40
  },