@atlaskit/editor-plugin-placeholder 7.2.0 → 7.2.1
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,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-placeholder
|
|
2
2
|
|
|
3
|
+
## 7.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5c6dee8d82e9e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c6dee8d82e9e) -
|
|
8
|
+
Updated adf placeholder to inject zero-width-space character at the start of the placeholder
|
|
9
|
+
decoration. This is needed to stop the browser caret from getting confused when its placed between
|
|
10
|
+
and editable and non-editable element
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 7.2.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -92,6 +92,18 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
|
|
|
92
92
|
if (isTargetNested && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
93
93
|
placeholderDecoration.classList.add('placeholder-decoration-hide-overflow');
|
|
94
94
|
}
|
|
95
|
+
if (placeholderADF && _utils.browser.chrome && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_adf_placeholder')) {
|
|
96
|
+
var fragment = document.createDocumentFragment();
|
|
97
|
+
// An issue occurs with the caret where it gets bigger when it's next to a non-editable element like a decoration.
|
|
98
|
+
// See: https://discuss.prosemirror.net/t/chrome-caret-cursor-larger-than-the-text-with-inlined-items/5946/2
|
|
99
|
+
// Adding a zero-width space seems to fix this issue.
|
|
100
|
+
fragment.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
|
|
101
|
+
fragment.appendChild(placeholderDecoration);
|
|
102
|
+
return _view.DecorationSet.create(editorState.doc, [_view.Decoration.widget(pos, fragment, {
|
|
103
|
+
side: 0,
|
|
104
|
+
key: "placeholder ".concat(placeholderText)
|
|
105
|
+
})]);
|
|
106
|
+
}
|
|
95
107
|
return _view.DecorationSet.create(editorState.doc, [_view.Decoration.widget(pos, placeholderDecoration, {
|
|
96
108
|
side: 0,
|
|
97
109
|
key: "placeholder ".concat(placeholderText)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -82,6 +82,18 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
82
82
|
if (isTargetNested && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
83
83
|
placeholderDecoration.classList.add('placeholder-decoration-hide-overflow');
|
|
84
84
|
}
|
|
85
|
+
if (placeholderADF && browser.chrome && fg('platform_editor_ai_aifc_adf_placeholder')) {
|
|
86
|
+
const fragment = document.createDocumentFragment();
|
|
87
|
+
// An issue occurs with the caret where it gets bigger when it's next to a non-editable element like a decoration.
|
|
88
|
+
// See: https://discuss.prosemirror.net/t/chrome-caret-cursor-larger-than-the-text-with-inlined-items/5946/2
|
|
89
|
+
// Adding a zero-width space seems to fix this issue.
|
|
90
|
+
fragment.appendChild(document.createTextNode(ZERO_WIDTH_SPACE));
|
|
91
|
+
fragment.appendChild(placeholderDecoration);
|
|
92
|
+
return DecorationSet.create(editorState.doc, [Decoration.widget(pos, fragment, {
|
|
93
|
+
side: 0,
|
|
94
|
+
key: `placeholder ${placeholderText}`
|
|
95
|
+
})]);
|
|
96
|
+
}
|
|
85
97
|
return DecorationSet.create(editorState.doc, [Decoration.widget(pos, placeholderDecoration, {
|
|
86
98
|
side: 0,
|
|
87
99
|
key: `placeholder ${placeholderText}`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -86,6 +86,18 @@ export function createPlaceholderDecoration(editorState, placeholderText, placeh
|
|
|
86
86
|
if (isTargetNested && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
87
87
|
placeholderDecoration.classList.add('placeholder-decoration-hide-overflow');
|
|
88
88
|
}
|
|
89
|
+
if (placeholderADF && browser.chrome && fg('platform_editor_ai_aifc_adf_placeholder')) {
|
|
90
|
+
var fragment = document.createDocumentFragment();
|
|
91
|
+
// An issue occurs with the caret where it gets bigger when it's next to a non-editable element like a decoration.
|
|
92
|
+
// See: https://discuss.prosemirror.net/t/chrome-caret-cursor-larger-than-the-text-with-inlined-items/5946/2
|
|
93
|
+
// Adding a zero-width space seems to fix this issue.
|
|
94
|
+
fragment.appendChild(document.createTextNode(ZERO_WIDTH_SPACE));
|
|
95
|
+
fragment.appendChild(placeholderDecoration);
|
|
96
|
+
return DecorationSet.create(editorState.doc, [Decoration.widget(pos, fragment, {
|
|
97
|
+
side: 0,
|
|
98
|
+
key: "placeholder ".concat(placeholderText)
|
|
99
|
+
})]);
|
|
100
|
+
}
|
|
89
101
|
return DecorationSet.create(editorState.doc, [Decoration.widget(pos, placeholderDecoration, {
|
|
90
102
|
side: 0,
|
|
91
103
|
key: "placeholder ".concat(placeholderText)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-placeholder",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Placeholder plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"@atlaskit/editor-plugin-type-ahead": "^7.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
37
37
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
38
|
-
"@atlaskit/primitives": "^17.
|
|
38
|
+
"@atlaskit/primitives": "^17.1.0",
|
|
39
39
|
"@atlaskit/spinner": "^19.0.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^16.23.0",
|
|
41
41
|
"@atlaskit/tokens": "^9.1.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/editor-common": "^111.
|
|
45
|
+
"@atlaskit/editor-common": "^111.8.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"
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"platform_editor_placeholder_plugin_tidying": {
|
|
61
61
|
"type": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"platform_editor_ai_aifc_adf_placeholder": {
|
|
64
|
+
"type": "boolean"
|
|
62
65
|
}
|
|
63
66
|
},
|
|
64
67
|
"techstack": {
|