@atlaskit/editor-plugin-placeholder-text 2.2.2 → 2.3.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,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-placeholder-text
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#150855](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150855)
|
|
14
|
+
[`06f114eb0c6a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/06f114eb0c6a3) -
|
|
15
|
+
Used plugin selector conditionally behind feature flag
|
|
16
|
+
|
|
3
17
|
## 2.2.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
15
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
18
|
var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
|
|
@@ -133,13 +134,25 @@ function createPlugin(dispatch, options, api) {
|
|
|
133
134
|
}
|
|
134
135
|
});
|
|
135
136
|
}
|
|
137
|
+
var useSharedPlaceholderTextState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
138
|
+
var showInsertPanelAt = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'placeholderText.showInsertPanelAt');
|
|
139
|
+
return {
|
|
140
|
+
showInsertPanelAt: showInsertPanelAt
|
|
141
|
+
};
|
|
142
|
+
}, function (api) {
|
|
143
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['placeholderText']),
|
|
144
|
+
placeholderTextState = _useSharedPluginState.placeholderTextState;
|
|
145
|
+
return {
|
|
146
|
+
showInsertPanelAt: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.showInsertPanelAt
|
|
147
|
+
};
|
|
148
|
+
});
|
|
136
149
|
function ContentComponent(_ref) {
|
|
137
150
|
var editorView = _ref.editorView,
|
|
138
151
|
dependencyApi = _ref.dependencyApi,
|
|
139
152
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
140
153
|
popupsBoundariesElement = _ref.popupsBoundariesElement;
|
|
141
|
-
var
|
|
142
|
-
|
|
154
|
+
var _useSharedPlaceholder = useSharedPlaceholderTextState(dependencyApi),
|
|
155
|
+
showInsertPanelAt = _useSharedPlaceholder.showInsertPanelAt;
|
|
143
156
|
var insertPlaceholderText = function insertPlaceholderText(value) {
|
|
144
157
|
return (0, _actions.insertPlaceholderTextAtSelection)(value)(editorView.state, editorView.dispatch);
|
|
145
158
|
};
|
|
@@ -155,7 +168,7 @@ function ContentComponent(_ref) {
|
|
|
155
168
|
var setFocusInEditor = function setFocusInEditor() {
|
|
156
169
|
return editorView.focus();
|
|
157
170
|
};
|
|
158
|
-
if (
|
|
171
|
+
if (showInsertPanelAt) {
|
|
159
172
|
return /*#__PURE__*/_react.default.createElement(_PlaceholderFloatingToolbar.default
|
|
160
173
|
// Ignored via go/ees005
|
|
161
174
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -166,7 +179,7 @@ function ContentComponent(_ref) {
|
|
|
166
179
|
getFixedCoordinatesFromPos: getFixedCoordinatesFromPos,
|
|
167
180
|
getNodeFromPos: getNodeFromPos,
|
|
168
181
|
hidePlaceholderFloatingToolbar: hidePlaceholderToolbar,
|
|
169
|
-
showInsertPanelAt:
|
|
182
|
+
showInsertPanelAt: showInsertPanelAt,
|
|
170
183
|
insertPlaceholder: insertPlaceholderText,
|
|
171
184
|
setFocusInEditor: setFocusInEditor
|
|
172
185
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { placeholder } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { isNodeEmpty } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import TextIcon from '@atlaskit/icon/core/text';
|
|
@@ -126,6 +127,19 @@ export function createPlugin(dispatch, options, api) {
|
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
129
|
}
|
|
130
|
+
const useSharedPlaceholderTextState = sharedPluginStateHookMigratorFactory(api => {
|
|
131
|
+
const showInsertPanelAt = useSharedPluginStateSelector(api, 'placeholderText.showInsertPanelAt');
|
|
132
|
+
return {
|
|
133
|
+
showInsertPanelAt
|
|
134
|
+
};
|
|
135
|
+
}, api => {
|
|
136
|
+
const {
|
|
137
|
+
placeholderTextState
|
|
138
|
+
} = useSharedPluginState(api, ['placeholderText']);
|
|
139
|
+
return {
|
|
140
|
+
showInsertPanelAt: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.showInsertPanelAt
|
|
141
|
+
};
|
|
142
|
+
});
|
|
129
143
|
function ContentComponent({
|
|
130
144
|
editorView,
|
|
131
145
|
dependencyApi,
|
|
@@ -133,14 +147,14 @@ function ContentComponent({
|
|
|
133
147
|
popupsBoundariesElement
|
|
134
148
|
}) {
|
|
135
149
|
const {
|
|
136
|
-
|
|
137
|
-
} =
|
|
150
|
+
showInsertPanelAt
|
|
151
|
+
} = useSharedPlaceholderTextState(dependencyApi);
|
|
138
152
|
const insertPlaceholderText = value => insertPlaceholderTextAtSelection(value)(editorView.state, editorView.dispatch);
|
|
139
153
|
const hidePlaceholderToolbar = () => hidePlaceholderFloatingToolbar(editorView.state, editorView.dispatch);
|
|
140
154
|
const getNodeFromPos = pos => editorView.domAtPos(pos).node;
|
|
141
155
|
const getFixedCoordinatesFromPos = pos => editorView.coordsAtPos(pos);
|
|
142
156
|
const setFocusInEditor = () => editorView.focus();
|
|
143
|
-
if (
|
|
157
|
+
if (showInsertPanelAt) {
|
|
144
158
|
return /*#__PURE__*/React.createElement(PlaceholderFloatingToolbar
|
|
145
159
|
// Ignored via go/ees005
|
|
146
160
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -151,7 +165,7 @@ function ContentComponent({
|
|
|
151
165
|
getFixedCoordinatesFromPos: getFixedCoordinatesFromPos,
|
|
152
166
|
getNodeFromPos: getNodeFromPos,
|
|
153
167
|
hidePlaceholderFloatingToolbar: hidePlaceholderToolbar,
|
|
154
|
-
showInsertPanelAt:
|
|
168
|
+
showInsertPanelAt: showInsertPanelAt,
|
|
155
169
|
insertPlaceholder: insertPlaceholderText,
|
|
156
170
|
setFocusInEditor: setFocusInEditor
|
|
157
171
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { placeholder } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { isNodeEmpty } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import TextIcon from '@atlaskit/icon/core/text';
|
|
@@ -125,13 +126,25 @@ export function createPlugin(dispatch, options, api) {
|
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
}
|
|
129
|
+
var useSharedPlaceholderTextState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
130
|
+
var showInsertPanelAt = useSharedPluginStateSelector(api, 'placeholderText.showInsertPanelAt');
|
|
131
|
+
return {
|
|
132
|
+
showInsertPanelAt: showInsertPanelAt
|
|
133
|
+
};
|
|
134
|
+
}, function (api) {
|
|
135
|
+
var _useSharedPluginState = useSharedPluginState(api, ['placeholderText']),
|
|
136
|
+
placeholderTextState = _useSharedPluginState.placeholderTextState;
|
|
137
|
+
return {
|
|
138
|
+
showInsertPanelAt: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.showInsertPanelAt
|
|
139
|
+
};
|
|
140
|
+
});
|
|
128
141
|
function ContentComponent(_ref) {
|
|
129
142
|
var editorView = _ref.editorView,
|
|
130
143
|
dependencyApi = _ref.dependencyApi,
|
|
131
144
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
132
145
|
popupsBoundariesElement = _ref.popupsBoundariesElement;
|
|
133
|
-
var
|
|
134
|
-
|
|
146
|
+
var _useSharedPlaceholder = useSharedPlaceholderTextState(dependencyApi),
|
|
147
|
+
showInsertPanelAt = _useSharedPlaceholder.showInsertPanelAt;
|
|
135
148
|
var insertPlaceholderText = function insertPlaceholderText(value) {
|
|
136
149
|
return insertPlaceholderTextAtSelection(value)(editorView.state, editorView.dispatch);
|
|
137
150
|
};
|
|
@@ -147,7 +160,7 @@ function ContentComponent(_ref) {
|
|
|
147
160
|
var setFocusInEditor = function setFocusInEditor() {
|
|
148
161
|
return editorView.focus();
|
|
149
162
|
};
|
|
150
|
-
if (
|
|
163
|
+
if (showInsertPanelAt) {
|
|
151
164
|
return /*#__PURE__*/React.createElement(PlaceholderFloatingToolbar
|
|
152
165
|
// Ignored via go/ees005
|
|
153
166
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -158,7 +171,7 @@ function ContentComponent(_ref) {
|
|
|
158
171
|
getFixedCoordinatesFromPos: getFixedCoordinatesFromPos,
|
|
159
172
|
getNodeFromPos: getNodeFromPos,
|
|
160
173
|
hidePlaceholderFloatingToolbar: hidePlaceholderToolbar,
|
|
161
|
-
showInsertPanelAt:
|
|
174
|
+
showInsertPanelAt: showInsertPanelAt,
|
|
162
175
|
insertPlaceholder: insertPlaceholderText,
|
|
163
176
|
setFocusInEditor: setFocusInEditor
|
|
164
177
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-placeholder-text",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "placeholder text plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
32
|
-
"@atlaskit/editor-common": "^
|
|
32
|
+
"@atlaskit/editor-common": "^105.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
34
34
|
"@atlaskit/editor-plugin-type-ahead": "^2.6.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "7.0.0",
|