@atlaskit/editor-plugin-placeholder 2.0.6 → 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,23 @@
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
+
11
+ ## 2.0.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [#127914](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127914)
16
+ [`1240912e13dd0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1240912e13dd0) -
17
+ [ux] ED-27097 Update empty line placeholder to only show when editor is focussed (not in live
18
+ view)
19
+ - Updated dependencies
20
+
3
21
  ## 2.0.6
4
22
 
5
23
  ### Patch Changes
@@ -74,8 +74,8 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
74
74
  if (defaultPlaceholderText && (0, _utils.isEmptyDocument)(editorState.doc)) {
75
75
  return setPlaceHolderState(defaultPlaceholderText);
76
76
  }
77
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
78
- var _parentNode$firstChil;
77
+ if (isEditorFocused && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
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
  }
@@ -63,8 +63,8 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
63
63
  if (defaultPlaceholderText && isEmptyDocument(editorState.doc)) {
64
64
  return setPlaceHolderState(defaultPlaceholderText);
65
65
  }
66
- if (editorExperiment('platform_editor_controls', 'variant1')) {
67
- var _parentNode$firstChil;
66
+ if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
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
  }
@@ -66,8 +66,8 @@ function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpe
66
66
  if (defaultPlaceholderText && isEmptyDocument(editorState.doc)) {
67
67
  return setPlaceHolderState(defaultPlaceholderText);
68
68
  }
69
- if (editorExperiment('platform_editor_controls', 'variant1')) {
70
- var _parentNode$firstChil;
69
+ if (isEditorFocused && editorExperiment('platform_editor_controls', 'variant1')) {
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.6",
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,12 +31,12 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^102.8.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",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/tmp-editor-statsig": "^4.0.0",
39
+ "@atlaskit/tmp-editor-statsig": "^4.1.0",
40
40
  "@babel/runtime": "^7.0.0"
41
41
  },
42
42
  "peerDependencies": {