@atlaskit/editor-plugin-tasks-and-decisions 2.8.0 → 2.9.0
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 +12 -0
- package/dist/cjs/commands.js +11 -1
- package/dist/cjs/nodeviews/taskItem.js +4 -2
- package/dist/cjs/plugin.js +70 -21
- package/dist/cjs/pm-plugins/actions.js +20 -0
- package/dist/cjs/pm-plugins/main.js +14 -4
- package/dist/cjs/pm-plugins/types.js +4 -2
- package/dist/cjs/ui/Task/index.js +26 -6
- package/dist/es2019/commands.js +8 -0
- package/dist/es2019/nodeviews/taskItem.js +4 -2
- package/dist/es2019/plugin.js +29 -4
- package/dist/es2019/pm-plugins/actions.js +12 -0
- package/dist/es2019/pm-plugins/main.js +15 -6
- package/dist/es2019/pm-plugins/types.js +7 -2
- package/dist/es2019/ui/Task/index.js +25 -4
- package/dist/esm/commands.js +10 -0
- package/dist/esm/nodeviews/taskItem.js +4 -2
- package/dist/esm/plugin.js +71 -22
- package/dist/esm/pm-plugins/actions.js +13 -0
- package/dist/esm/pm-plugins/main.js +14 -4
- package/dist/esm/pm-plugins/types.js +7 -2
- package/dist/esm/ui/Task/index.js +26 -6
- package/dist/types/commands.d.ts +2 -0
- package/dist/types/pm-plugins/actions.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/pm-plugins/types.d.ts +17 -1
- package/dist/types/types.d.ts +14 -4
- package/dist/types/ui/Task/index.d.ts +8 -2
- package/dist/types-ts4.5/commands.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/types.d.ts +17 -1
- package/dist/types-ts4.5/types.d.ts +14 -4
- package/dist/types-ts4.5/ui/Task/index.d.ts +8 -2
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#137506](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137506)
|
|
8
|
+
[`75c4ebf9d7515`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/75c4ebf9d7515) -
|
|
9
|
+
Pass TaskDecisionProvider via preset
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 2.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/commands.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.isSupportedSourceNode = exports.insertTaskDecisionWithAnalytics = exports.insertTaskDecisionCommand = exports.insertTaskDecisionAction = exports.getListTypes = exports.createListAtSelection = exports.changeInDepth = void 0;
|
|
7
|
+
exports.setProvider = exports.isSupportedSourceNode = exports.insertTaskDecisionWithAnalytics = exports.insertTaskDecisionCommand = exports.insertTaskDecisionAction = exports.getListTypes = exports.createListAtSelection = exports.changeInDepth = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -14,6 +14,8 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
|
+
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
18
|
+
var _types = require("./pm-plugins/types");
|
|
17
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
21
|
var getContextData = function getContextData() {
|
|
@@ -285,4 +287,12 @@ var createListAtSelection = exports.createListAtSelection = function createListA
|
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
return (0, _utils2.safeInsert)(emptyList)(tr);
|
|
290
|
+
};
|
|
291
|
+
var setProvider = exports.setProvider = function setProvider(provider) {
|
|
292
|
+
return function (tr) {
|
|
293
|
+
return tr.setMeta(_pluginKey.stateKey, {
|
|
294
|
+
action: _types.ACTIONS.SET_PROVIDER,
|
|
295
|
+
data: provider
|
|
296
|
+
});
|
|
297
|
+
};
|
|
288
298
|
};
|
|
@@ -186,7 +186,8 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
|
|
|
186
186
|
onChange: onChange,
|
|
187
187
|
isFocused: isFocused,
|
|
188
188
|
showPlaceholder: showPlaceholder,
|
|
189
|
-
providers: providerFactory
|
|
189
|
+
providers: providerFactory,
|
|
190
|
+
api: api
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
return /*#__PURE__*/_react.default.createElement(_popup.default, {
|
|
@@ -232,7 +233,8 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
|
|
|
232
233
|
isFocused: isFocused,
|
|
233
234
|
showPlaceholder: showPlaceholder,
|
|
234
235
|
providers: providerFactory,
|
|
235
|
-
disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission)
|
|
236
|
+
disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission),
|
|
237
|
+
api: api
|
|
236
238
|
});
|
|
237
239
|
},
|
|
238
240
|
placement: 'bottom-start'
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.tasksAndDecisionsPlugin = exports.taskItemSpecWithFixedToDOM = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _react = require("@emotion/react");
|
|
11
13
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
@@ -15,6 +17,7 @@ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
|
15
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
18
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
17
19
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
22
|
var _commands = require("./commands");
|
|
20
23
|
var _helpers = require("./pm-plugins/helpers");
|
|
@@ -123,11 +126,23 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
123
126
|
hasEditPermission = _ref2$config2.hasEditPermission,
|
|
124
127
|
hasRequestedEditPermission = _ref2$config2.hasRequestedEditPermission,
|
|
125
128
|
requestToEditContent = _ref2$config2.requestToEditContent,
|
|
129
|
+
taskDecisionProvider = _ref2$config2.taskDecisionProvider,
|
|
126
130
|
api = _ref2.api;
|
|
127
131
|
var getIdentifierProvider = function getIdentifierProvider() {
|
|
128
132
|
var _api$contextIdentifie;
|
|
129
133
|
return api === null || api === void 0 || (_api$contextIdentifie = api.contextIdentifier) === null || _api$contextIdentifie === void 0 || (_api$contextIdentifie = _api$contextIdentifie.sharedState.currentState()) === null || _api$contextIdentifie === void 0 ? void 0 : _api$contextIdentifie.contextIdentifierProvider;
|
|
130
134
|
};
|
|
135
|
+
var previousTaskAndDecisionProvider;
|
|
136
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_td_provider_from_plugin_config')) {
|
|
137
|
+
if (taskDecisionProvider) {
|
|
138
|
+
taskDecisionProvider.then(function (provider) {
|
|
139
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
140
|
+
var tr = _ref3.tr;
|
|
141
|
+
return (0, _commands.setProvider)(provider)(tr);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
131
146
|
return {
|
|
132
147
|
name: 'taskDecision',
|
|
133
148
|
nodes: function nodes() {
|
|
@@ -159,21 +174,22 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
159
174
|
outdentDisabled: indentLevel <= 1,
|
|
160
175
|
hasEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasEditPermission,
|
|
161
176
|
requestToEditContent: pluginState === null || pluginState === void 0 ? void 0 : pluginState.requestToEditContent,
|
|
162
|
-
hasRequestedEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasRequestedEditPermission
|
|
177
|
+
hasRequestedEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasRequestedEditPermission,
|
|
178
|
+
taskDecisionProvider: pluginState === null || pluginState === void 0 ? void 0 : pluginState.taskDecisionProvider
|
|
163
179
|
};
|
|
164
180
|
},
|
|
165
181
|
commands: {
|
|
166
182
|
updateEditPermission: function updateEditPermission(hasEditPermission) {
|
|
167
|
-
return function (
|
|
168
|
-
var tr =
|
|
183
|
+
return function (_ref4) {
|
|
184
|
+
var tr = _ref4.tr;
|
|
169
185
|
return tr.setMeta(_pluginKey.stateKey, {
|
|
170
186
|
hasEditPermission: hasEditPermission
|
|
171
187
|
});
|
|
172
188
|
};
|
|
173
189
|
},
|
|
174
190
|
updateHasRequestedEditPermission: function updateHasRequestedEditPermission(hasRequestedEditPermission) {
|
|
175
|
-
return function (
|
|
176
|
-
var tr =
|
|
191
|
+
return function (_ref5) {
|
|
192
|
+
var tr = _ref5.tr;
|
|
177
193
|
return tr.setMeta(_pluginKey.stateKey, {
|
|
178
194
|
hasRequestedEditPermission: hasRequestedEditPermission
|
|
179
195
|
});
|
|
@@ -183,38 +199,71 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
183
199
|
actions: {
|
|
184
200
|
insertTaskDecision: (0, _commands.insertTaskDecisionCommand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, getIdentifierProvider),
|
|
185
201
|
indentTaskList: (0, _keymaps.getIndentCommand)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
186
|
-
outdentTaskList: (0, _keymaps.getUnindentCommand)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)
|
|
202
|
+
outdentTaskList: (0, _keymaps.getUnindentCommand)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
203
|
+
setProvider: function () {
|
|
204
|
+
var _setProvider2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
205
|
+
var _api$core$actions$exe;
|
|
206
|
+
var provider;
|
|
207
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
208
|
+
while (1) switch (_context.prev = _context.next) {
|
|
209
|
+
case 0:
|
|
210
|
+
_context.next = 2;
|
|
211
|
+
return providerPromise;
|
|
212
|
+
case 2:
|
|
213
|
+
provider = _context.sent;
|
|
214
|
+
if (!(previousTaskAndDecisionProvider === provider || taskDecisionProvider === providerPromise)) {
|
|
215
|
+
_context.next = 5;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
return _context.abrupt("return", false);
|
|
219
|
+
case 5:
|
|
220
|
+
previousTaskAndDecisionProvider = provider;
|
|
221
|
+
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
222
|
+
var tr = _ref6.tr;
|
|
223
|
+
return (0, _commands.setProvider)(provider)(tr);
|
|
224
|
+
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
225
|
+
case 7:
|
|
226
|
+
case "end":
|
|
227
|
+
return _context.stop();
|
|
228
|
+
}
|
|
229
|
+
}, _callee);
|
|
230
|
+
}));
|
|
231
|
+
function setProvider(_x) {
|
|
232
|
+
return _setProvider2.apply(this, arguments);
|
|
233
|
+
}
|
|
234
|
+
return setProvider;
|
|
235
|
+
}()
|
|
187
236
|
},
|
|
188
237
|
pmPlugins: function pmPlugins() {
|
|
189
238
|
return [{
|
|
190
239
|
name: 'tasksAndDecisions',
|
|
191
|
-
plugin: function plugin(
|
|
192
|
-
var portalProviderAPI =
|
|
193
|
-
providerFactory =
|
|
194
|
-
eventDispatcher =
|
|
195
|
-
dispatch =
|
|
240
|
+
plugin: function plugin(_ref7) {
|
|
241
|
+
var portalProviderAPI = _ref7.portalProviderAPI,
|
|
242
|
+
providerFactory = _ref7.providerFactory,
|
|
243
|
+
eventDispatcher = _ref7.eventDispatcher,
|
|
244
|
+
dispatch = _ref7.dispatch;
|
|
196
245
|
return (0, _main.createPlugin)(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, useLongPressSelection, hasEditPermission, hasRequestedEditPermission, requestToEditContent);
|
|
197
246
|
}
|
|
198
247
|
}, {
|
|
199
248
|
name: 'tasksAndDecisionsInputRule',
|
|
200
|
-
plugin: function plugin(
|
|
249
|
+
plugin: function plugin(_ref8) {
|
|
201
250
|
var _api$analytics4;
|
|
202
|
-
var schema =
|
|
203
|
-
featureFlags =
|
|
251
|
+
var schema = _ref8.schema,
|
|
252
|
+
featureFlags = _ref8.featureFlags;
|
|
204
253
|
return (0, _inputRules.default)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, getIdentifierProvider)(schema, featureFlags);
|
|
205
254
|
}
|
|
206
255
|
}, {
|
|
207
256
|
name: 'tasksAndDecisionsKeyMap',
|
|
208
|
-
plugin: function plugin(
|
|
209
|
-
var schema =
|
|
257
|
+
plugin: function plugin(_ref9) {
|
|
258
|
+
var schema = _ref9.schema;
|
|
210
259
|
return (0, _keymaps.default)(schema, api, allowNestedTasks, consumeTabs);
|
|
211
260
|
}
|
|
212
261
|
} // Needs to be after "save-on-enter"
|
|
213
262
|
];
|
|
214
263
|
},
|
|
215
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
216
|
-
var editorView =
|
|
217
|
-
disabled =
|
|
264
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref10) {
|
|
265
|
+
var editorView = _ref10.editorView,
|
|
266
|
+
disabled = _ref10.disabled;
|
|
218
267
|
return (0, _react.jsx)("div", {
|
|
219
268
|
css: taskDecisionToolbarGroupStyles
|
|
220
269
|
}, (0, _react.jsx)(_ToolbarDecision.default, {
|
|
@@ -230,8 +279,8 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
230
279
|
}));
|
|
231
280
|
},
|
|
232
281
|
pluginsOptions: {
|
|
233
|
-
quickInsert: function quickInsert(
|
|
234
|
-
var formatMessage =
|
|
282
|
+
quickInsert: function quickInsert(_ref11) {
|
|
283
|
+
var formatMessage = _ref11.formatMessage;
|
|
235
284
|
return [{
|
|
236
285
|
id: 'action',
|
|
237
286
|
title: formatMessage(_messages.toolbarInsertBlockMessages.action),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.setProvider = exports.focusTaskDecision = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
var focusTaskDecision = exports.focusTaskDecision = function focusTaskDecision(state, action) {
|
|
12
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
13
|
+
focusedTaskItemLocalId: action.data
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var setProvider = exports.setProvider = function setProvider(state, action) {
|
|
17
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
18
|
+
taskDecisionProvider: action.data
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -16,6 +16,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _decisionLazyNodeView = require("../nodeviews/decision-lazy-node-view");
|
|
18
18
|
var _taskLazyNodeView = require("../nodeviews/task-lazy-node-view");
|
|
19
|
+
var _actions = require("./actions");
|
|
19
20
|
var _helpers = require("./helpers");
|
|
20
21
|
var _pluginKey = require("./plugin-key");
|
|
21
22
|
var _types = require("./types");
|
|
@@ -171,12 +172,14 @@ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispa
|
|
|
171
172
|
insideTaskDecisionItem: false,
|
|
172
173
|
hasEditPermission: hasEditPermission,
|
|
173
174
|
hasRequestedEditPermission: hasRequestedEditPermission,
|
|
174
|
-
requestToEditContent: requestToEditContent
|
|
175
|
+
requestToEditContent: requestToEditContent,
|
|
176
|
+
focusedTaskItemLocalId: null,
|
|
177
|
+
taskDecisionProvider: undefined
|
|
175
178
|
};
|
|
176
179
|
},
|
|
177
180
|
apply: function apply(tr, pluginState) {
|
|
178
181
|
var metaData = tr.getMeta(_pluginKey.stateKey);
|
|
179
|
-
var _ref = metaData
|
|
182
|
+
var _ref = metaData !== null && metaData !== void 0 ? metaData : {
|
|
180
183
|
action: null,
|
|
181
184
|
data: null
|
|
182
185
|
},
|
|
@@ -187,8 +190,15 @@ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispa
|
|
|
187
190
|
// Actions
|
|
188
191
|
switch (action) {
|
|
189
192
|
case _types.ACTIONS.FOCUS_BY_LOCALID:
|
|
190
|
-
newPluginState =
|
|
191
|
-
|
|
193
|
+
newPluginState = (0, _actions.focusTaskDecision)(newPluginState, {
|
|
194
|
+
action: _types.ACTIONS.FOCUS_BY_LOCALID,
|
|
195
|
+
data: data
|
|
196
|
+
});
|
|
197
|
+
break;
|
|
198
|
+
case _types.ACTIONS.SET_PROVIDER:
|
|
199
|
+
newPluginState = (0, _actions.setProvider)(newPluginState, {
|
|
200
|
+
action: _types.ACTIONS.SET_PROVIDER,
|
|
201
|
+
data: data
|
|
192
202
|
});
|
|
193
203
|
break;
|
|
194
204
|
}
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ACTIONS = void 0;
|
|
7
7
|
var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
8
|
-
ACTIONS[ACTIONS["
|
|
8
|
+
ACTIONS[ACTIONS["SET_PROVIDER"] = 0] = "SET_PROVIDER";
|
|
9
|
+
ACTIONS[ACTIONS["FOCUS_BY_LOCALID"] = 1] = "FOCUS_BY_LOCALID";
|
|
9
10
|
return ACTIONS;
|
|
10
|
-
}({});
|
|
11
|
+
}({}); // actions
|
|
12
|
+
// commands
|
|
@@ -17,10 +17,12 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
20
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
20
21
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
22
|
var _providerFactory2 = require("@atlaskit/editor-common/provider-factory");
|
|
23
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
24
|
var _taskItemWithProviders = _interopRequireDefault(require("./task-item-with-providers"));
|
|
23
|
-
var _excluded = ["providers", "intl"];
|
|
25
|
+
var _excluded = ["providers", "intl", "api"];
|
|
24
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
28
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
@@ -37,13 +39,20 @@ var TaskItem = exports.TaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
37
39
|
var _this$props = _this.props,
|
|
38
40
|
_providerFactory = _this$props.providers,
|
|
39
41
|
formatMessage = _this$props.intl.formatMessage,
|
|
42
|
+
api = _this$props.api,
|
|
40
43
|
otherProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
41
|
-
var
|
|
42
|
-
contextIdentifierProvider = providers.contextIdentifierProvider;
|
|
44
|
+
var contextIdentifierProvider = providers.contextIdentifierProvider;
|
|
43
45
|
var placeholder = formatMessage(_messages.tasksAndDecisionsMessages.taskPlaceholder);
|
|
46
|
+
var getTaskDecisionProvider = function getTaskDecisionProvider() {
|
|
47
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_td_provider_from_plugin_config')) {
|
|
48
|
+
var _this$props$taskDecis;
|
|
49
|
+
return (_this$props$taskDecis = _this.props.taskDecisionState) !== null && _this$props$taskDecis !== void 0 && _this$props$taskDecis.taskDecisionProvider ? Promise.resolve(_this.props.taskDecisionState.taskDecisionProvider) : undefined;
|
|
50
|
+
}
|
|
51
|
+
return providers.taskDecisionProvider;
|
|
52
|
+
};
|
|
44
53
|
return /*#__PURE__*/_react.default.createElement(_taskItemWithProviders.default, (0, _extends2.default)({}, otherProps, {
|
|
45
54
|
placeholder: placeholder,
|
|
46
|
-
taskDecisionProvider:
|
|
55
|
+
taskDecisionProvider: getTaskDecisionProvider(),
|
|
47
56
|
contextIdentifierProvider: contextIdentifierProvider
|
|
48
57
|
}));
|
|
49
58
|
});
|
|
@@ -62,8 +71,12 @@ var TaskItem = exports.TaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
62
71
|
}, {
|
|
63
72
|
key: "render",
|
|
64
73
|
value: function render() {
|
|
74
|
+
var providers = ['contextIdentifierProvider'];
|
|
75
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_td_provider_from_plugin_config')) {
|
|
76
|
+
providers.push('taskDecisionProvider');
|
|
77
|
+
}
|
|
65
78
|
return /*#__PURE__*/_react.default.createElement(_providerFactory2.WithProviders, {
|
|
66
|
-
providers:
|
|
79
|
+
providers: providers,
|
|
67
80
|
providerFactory: this.providerFactory,
|
|
68
81
|
renderNode: this.renderWithProvider
|
|
69
82
|
});
|
|
@@ -72,4 +85,11 @@ var TaskItem = exports.TaskItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
72
85
|
return TaskItem;
|
|
73
86
|
}(_react.PureComponent);
|
|
74
87
|
(0, _defineProperty2.default)(TaskItem, "displayName", 'TaskItem');
|
|
75
|
-
var
|
|
88
|
+
var TaskItemWrapper = function TaskItemWrapper(props) {
|
|
89
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(props.api, ['taskDecision']),
|
|
90
|
+
taskDecisionState = _useSharedPluginState.taskDecisionState;
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(TaskItem, (0, _extends2.default)({
|
|
92
|
+
taskDecisionState: taskDecisionState
|
|
93
|
+
}, props));
|
|
94
|
+
};
|
|
95
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(TaskItemWrapper);
|
package/dist/es2019/commands.js
CHANGED
|
@@ -6,6 +6,8 @@ import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
8
8
|
import { findParentNodeOfType, hasParentNodeOfType, replaceParentNodeOfType, safeInsert, setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { stateKey } from './pm-plugins/plugin-key';
|
|
10
|
+
import { ACTIONS } from './pm-plugins/types';
|
|
9
11
|
const getContextData = (contextProvider = {}) => {
|
|
10
12
|
const {
|
|
11
13
|
objectId,
|
|
@@ -276,4 +278,10 @@ export const createListAtSelection = (tr, list, item, schema, state, listLocalId
|
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
return safeInsert(emptyList)(tr);
|
|
281
|
+
};
|
|
282
|
+
export const setProvider = provider => tr => {
|
|
283
|
+
return tr.setMeta(stateKey, {
|
|
284
|
+
action: ACTIONS.SET_PROVIDER,
|
|
285
|
+
data: provider
|
|
286
|
+
});
|
|
279
287
|
};
|
|
@@ -161,7 +161,8 @@ const TaskItemWrapper = ({
|
|
|
161
161
|
onChange: onChange,
|
|
162
162
|
isFocused: isFocused,
|
|
163
163
|
showPlaceholder: showPlaceholder,
|
|
164
|
-
providers: providerFactory
|
|
164
|
+
providers: providerFactory,
|
|
165
|
+
api: api
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
@@ -207,7 +208,8 @@ const TaskItemWrapper = ({
|
|
|
207
208
|
isFocused: isFocused,
|
|
208
209
|
showPlaceholder: showPlaceholder,
|
|
209
210
|
providers: providerFactory,
|
|
210
|
-
disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3$sh = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3$sh !== void 0 && _api$taskDecision3$sh.hasEditPermission)
|
|
211
|
+
disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3$sh = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3$sh !== void 0 && _api$taskDecision3$sh.hasEditPermission),
|
|
212
|
+
api: api
|
|
211
213
|
});
|
|
212
214
|
},
|
|
213
215
|
placement: 'bottom-start'
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -11,8 +11,9 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
11
11
|
import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
13
13
|
import { TaskDecisionSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
|
-
import { getListTypes, insertTaskDecisionAction, insertTaskDecisionCommand } from './commands';
|
|
16
|
+
import { getListTypes, insertTaskDecisionAction, insertTaskDecisionCommand, setProvider } from './commands';
|
|
16
17
|
import { getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
17
18
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
18
19
|
import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
|
|
@@ -111,7 +112,8 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
111
112
|
useLongPressSelection,
|
|
112
113
|
hasEditPermission,
|
|
113
114
|
hasRequestedEditPermission,
|
|
114
|
-
requestToEditContent
|
|
115
|
+
requestToEditContent,
|
|
116
|
+
taskDecisionProvider
|
|
115
117
|
} = {},
|
|
116
118
|
api
|
|
117
119
|
}) => {
|
|
@@ -120,6 +122,16 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
120
122
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
121
123
|
return api === null || api === void 0 ? void 0 : (_api$contextIdentifie = api.contextIdentifier) === null || _api$contextIdentifie === void 0 ? void 0 : (_api$contextIdentifie2 = _api$contextIdentifie.sharedState.currentState()) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.contextIdentifierProvider;
|
|
122
124
|
};
|
|
125
|
+
let previousTaskAndDecisionProvider;
|
|
126
|
+
if (fg('platform_editor_td_provider_from_plugin_config')) {
|
|
127
|
+
if (taskDecisionProvider) {
|
|
128
|
+
taskDecisionProvider.then(provider => {
|
|
129
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
130
|
+
tr
|
|
131
|
+
}) => setProvider(provider)(tr));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
123
135
|
return {
|
|
124
136
|
name: 'taskDecision',
|
|
125
137
|
nodes() {
|
|
@@ -151,7 +163,8 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
151
163
|
outdentDisabled: indentLevel <= 1,
|
|
152
164
|
hasEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasEditPermission,
|
|
153
165
|
requestToEditContent: pluginState === null || pluginState === void 0 ? void 0 : pluginState.requestToEditContent,
|
|
154
|
-
hasRequestedEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasRequestedEditPermission
|
|
166
|
+
hasRequestedEditPermission: pluginState === null || pluginState === void 0 ? void 0 : pluginState.hasRequestedEditPermission,
|
|
167
|
+
taskDecisionProvider: pluginState === null || pluginState === void 0 ? void 0 : pluginState.taskDecisionProvider
|
|
155
168
|
};
|
|
156
169
|
},
|
|
157
170
|
commands: {
|
|
@@ -169,7 +182,19 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
169
182
|
actions: {
|
|
170
183
|
insertTaskDecision: insertTaskDecisionCommand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, getIdentifierProvider),
|
|
171
184
|
indentTaskList: getIndentCommand(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
172
|
-
outdentTaskList: getUnindentCommand(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)
|
|
185
|
+
outdentTaskList: getUnindentCommand(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
186
|
+
setProvider: async providerPromise => {
|
|
187
|
+
var _api$core$actions$exe;
|
|
188
|
+
const provider = await providerPromise;
|
|
189
|
+
// Prevent someone trying to set the exact same provider twice for performance reasons+
|
|
190
|
+
if (previousTaskAndDecisionProvider === provider || taskDecisionProvider === providerPromise) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
previousTaskAndDecisionProvider = provider;
|
|
194
|
+
return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
195
|
+
tr
|
|
196
|
+
}) => setProvider(provider)(tr))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
|
|
197
|
+
}
|
|
173
198
|
},
|
|
174
199
|
pmPlugins() {
|
|
175
200
|
return [{
|
|
@@ -7,6 +7,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { lazyDecisionView } from '../nodeviews/decision-lazy-node-view';
|
|
9
9
|
import { lazyTaskView } from '../nodeviews/task-lazy-node-view';
|
|
10
|
+
import { focusTaskDecision, setProvider } from './actions';
|
|
10
11
|
import { focusCheckboxAndUpdateSelection, getTaskItemDataAtPos, getTaskItemDataToFocus, removeCheckboxFocus } from './helpers';
|
|
11
12
|
import { stateKey } from './plugin-key';
|
|
12
13
|
import { ACTIONS } from './types';
|
|
@@ -163,7 +164,9 @@ export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory
|
|
|
163
164
|
insideTaskDecisionItem: false,
|
|
164
165
|
hasEditPermission,
|
|
165
166
|
hasRequestedEditPermission,
|
|
166
|
-
requestToEditContent
|
|
167
|
+
requestToEditContent,
|
|
168
|
+
focusedTaskItemLocalId: null,
|
|
169
|
+
taskDecisionProvider: undefined
|
|
167
170
|
};
|
|
168
171
|
},
|
|
169
172
|
apply(tr, pluginState) {
|
|
@@ -171,7 +174,7 @@ export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory
|
|
|
171
174
|
const {
|
|
172
175
|
action,
|
|
173
176
|
data
|
|
174
|
-
} = metaData
|
|
177
|
+
} = metaData !== null && metaData !== void 0 ? metaData : {
|
|
175
178
|
action: null,
|
|
176
179
|
data: null
|
|
177
180
|
};
|
|
@@ -180,10 +183,16 @@ export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory
|
|
|
180
183
|
// Actions
|
|
181
184
|
switch (action) {
|
|
182
185
|
case ACTIONS.FOCUS_BY_LOCALID:
|
|
183
|
-
newPluginState = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
186
|
+
newPluginState = focusTaskDecision(newPluginState, {
|
|
187
|
+
action: ACTIONS.FOCUS_BY_LOCALID,
|
|
188
|
+
data
|
|
189
|
+
});
|
|
190
|
+
break;
|
|
191
|
+
case ACTIONS.SET_PROVIDER:
|
|
192
|
+
newPluginState = setProvider(newPluginState, {
|
|
193
|
+
action: ACTIONS.SET_PROVIDER,
|
|
194
|
+
data
|
|
195
|
+
});
|
|
187
196
|
break;
|
|
188
197
|
}
|
|
189
198
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
2
|
-
ACTIONS[ACTIONS["
|
|
2
|
+
ACTIONS[ACTIONS["SET_PROVIDER"] = 0] = "SET_PROVIDER";
|
|
3
|
+
ACTIONS[ACTIONS["FOCUS_BY_LOCALID"] = 1] = "FOCUS_BY_LOCALID";
|
|
3
4
|
return ACTIONS;
|
|
4
|
-
}({});
|
|
5
|
+
}({});
|
|
6
|
+
|
|
7
|
+
// actions
|
|
8
|
+
|
|
9
|
+
// commands
|
|
@@ -2,8 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React, { PureComponent } from 'react';
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
6
7
|
import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import TaskItemWithProviders from './task-item-with-providers';
|
|
8
10
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
9
11
|
export class TaskItem extends PureComponent {
|
|
@@ -15,16 +17,23 @@ export class TaskItem extends PureComponent {
|
|
|
15
17
|
intl: {
|
|
16
18
|
formatMessage
|
|
17
19
|
},
|
|
20
|
+
api,
|
|
18
21
|
...otherProps
|
|
19
22
|
} = this.props;
|
|
20
23
|
const {
|
|
21
|
-
taskDecisionProvider,
|
|
22
24
|
contextIdentifierProvider
|
|
23
25
|
} = providers;
|
|
24
26
|
const placeholder = formatMessage(tasksAndDecisionsMessages.taskPlaceholder);
|
|
27
|
+
const getTaskDecisionProvider = () => {
|
|
28
|
+
if (fg('platform_editor_td_provider_from_plugin_config')) {
|
|
29
|
+
var _this$props$taskDecis;
|
|
30
|
+
return (_this$props$taskDecis = this.props.taskDecisionState) !== null && _this$props$taskDecis !== void 0 && _this$props$taskDecis.taskDecisionProvider ? Promise.resolve(this.props.taskDecisionState.taskDecisionProvider) : undefined;
|
|
31
|
+
}
|
|
32
|
+
return providers.taskDecisionProvider;
|
|
33
|
+
};
|
|
25
34
|
return /*#__PURE__*/React.createElement(TaskItemWithProviders, _extends({}, otherProps, {
|
|
26
35
|
placeholder: placeholder,
|
|
27
|
-
taskDecisionProvider:
|
|
36
|
+
taskDecisionProvider: getTaskDecisionProvider(),
|
|
28
37
|
contextIdentifierProvider: contextIdentifierProvider
|
|
29
38
|
}));
|
|
30
39
|
});
|
|
@@ -38,12 +47,24 @@ export class TaskItem extends PureComponent {
|
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
render() {
|
|
50
|
+
const providers = ['contextIdentifierProvider'];
|
|
51
|
+
if (!fg('platform_editor_td_provider_from_plugin_config')) {
|
|
52
|
+
providers.push('taskDecisionProvider');
|
|
53
|
+
}
|
|
41
54
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
42
|
-
providers:
|
|
55
|
+
providers: providers,
|
|
43
56
|
providerFactory: this.providerFactory,
|
|
44
57
|
renderNode: this.renderWithProvider
|
|
45
58
|
});
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
_defineProperty(TaskItem, "displayName", 'TaskItem');
|
|
49
|
-
|
|
62
|
+
const TaskItemWrapper = props => {
|
|
63
|
+
const {
|
|
64
|
+
taskDecisionState
|
|
65
|
+
} = useSharedPluginState(props.api, ['taskDecision']);
|
|
66
|
+
return /*#__PURE__*/React.createElement(TaskItem, _extends({
|
|
67
|
+
taskDecisionState: taskDecisionState
|
|
68
|
+
}, props));
|
|
69
|
+
};
|
|
70
|
+
export default injectIntl(TaskItemWrapper);
|
package/dist/esm/commands.js
CHANGED
|
@@ -9,6 +9,8 @@ import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
|
9
9
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
|
|
11
11
|
import { findParentNodeOfType, hasParentNodeOfType, replaceParentNodeOfType, safeInsert, setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
+
import { stateKey } from './pm-plugins/plugin-key';
|
|
13
|
+
import { ACTIONS } from './pm-plugins/types';
|
|
12
14
|
var getContextData = function getContextData() {
|
|
13
15
|
var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
16
|
var objectId = contextProvider.objectId,
|
|
@@ -278,4 +280,12 @@ export var createListAtSelection = function createListAtSelection(tr, list, item
|
|
|
278
280
|
}
|
|
279
281
|
}
|
|
280
282
|
return safeInsert(emptyList)(tr);
|
|
283
|
+
};
|
|
284
|
+
export var setProvider = function setProvider(provider) {
|
|
285
|
+
return function (tr) {
|
|
286
|
+
return tr.setMeta(stateKey, {
|
|
287
|
+
action: ACTIONS.SET_PROVIDER,
|
|
288
|
+
data: provider
|
|
289
|
+
});
|
|
290
|
+
};
|
|
281
291
|
};
|