@atlaskit/editor-plugin-placeholder 2.0.7 → 2.0.8

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
+ ## 2.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#129904](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/129904)
8
+ [`7a5c1784af47f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7a5c1784af47f) -
9
+ [ux] ED-27141 Adding a check so that only empty paragraphs will show empty node placeholder
10
+
3
11
  ## 2.0.7
4
12
 
5
13
  ### Patch Changes
@@ -75,7 +75,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
75
75
  return setPlaceHolderState(defaultPlaceholderText);
76
76
  }
77
77
  if (isEditorFocused && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
78
- var _parentNode$firstChil;
78
+ var _parentNode$firstChil, _parentNode$firstChil2;
79
79
  var _editorState$selectio = editorState.selection,
80
80
  $from = _editorState$selectio.$from,
81
81
  $to = _editorState$selectio.$to;
@@ -90,7 +90,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
90
90
  return setPlaceHolderState(emptyLinePlaceholder, $from.pos);
91
91
  }
92
92
  }
93
- var isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0;
93
+ var isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0 && ((_parentNode$firstChil2 = parentNode.firstChild) === null || _parentNode$firstChil2 === void 0 ? void 0 : _parentNode$firstChil2.type.name) === 'paragraph';
94
94
  if (nodeTypesWithShortPlaceholderText.includes(parentType) && isEmptyNode) {
95
95
  return setPlaceHolderState(SHORT_NODE_PLACEHOLDER_TEXT, $from.pos);
96
96
  }
@@ -64,7 +64,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
64
64
  return setPlaceHolderState(defaultPlaceholderText);
65
65
  }
66
66
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
67
- var _parentNode$firstChil;
67
+ var _parentNode$firstChil, _parentNode$firstChil2;
68
68
  const {
69
69
  $from,
70
70
  $to
@@ -80,7 +80,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
80
80
  return setPlaceHolderState(emptyLinePlaceholder, $from.pos);
81
81
  }
82
82
  }
83
- const isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0;
83
+ const isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0 && ((_parentNode$firstChil2 = parentNode.firstChild) === null || _parentNode$firstChil2 === void 0 ? void 0 : _parentNode$firstChil2.type.name) === 'paragraph';
84
84
  if (nodeTypesWithShortPlaceholderText.includes(parentType) && isEmptyNode) {
85
85
  return setPlaceHolderState(SHORT_NODE_PLACEHOLDER_TEXT, $from.pos);
86
86
  }
@@ -67,7 +67,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
67
67
  return setPlaceHolderState(defaultPlaceholderText);
68
68
  }
69
69
  if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
70
- var _parentNode$firstChil;
70
+ var _parentNode$firstChil, _parentNode$firstChil2;
71
71
  var _editorState$selectio = editorState.selection,
72
72
  $from = _editorState$selectio.$from,
73
73
  $to = _editorState$selectio.$to;
@@ -82,7 +82,7 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
82
82
  return setPlaceHolderState(emptyLinePlaceholder, $from.pos);
83
83
  }
84
84
  }
85
- var isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0;
85
+ var isEmptyNode = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.childCount) === 1 && ((_parentNode$firstChil = parentNode.firstChild) === null || _parentNode$firstChil === void 0 ? void 0 : _parentNode$firstChil.content.size) === 0 && ((_parentNode$firstChil2 = parentNode.firstChild) === null || _parentNode$firstChil2 === void 0 ? void 0 : _parentNode$firstChil2.type.name) === 'paragraph';
86
86
  if (nodeTypesWithShortPlaceholderText.includes(parentType) && isEmptyNode) {
87
87
  return setPlaceHolderState(SHORT_NODE_PLACEHOLDER_TEXT, $from.pos);
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-placeholder",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Placeholder plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^102.10.0",
34
+ "@atlaskit/editor-common": "^102.12.0",
35
35
  "@atlaskit/editor-plugin-composition": "^1.3.0",
36
36
  "@atlaskit/editor-plugin-focus": "^1.5.0",
37
37
  "@atlaskit/editor-plugin-type-ahead": "^2.1.0",