@atlaskit/editor-plugin-extension 13.5.8 → 13.5.10
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 +14 -0
- package/dist/cjs/editor-actions/actions.js +16 -16
- package/dist/cjs/pm-plugins/macro/actions.js +21 -21
- package/dist/cjs/pm-plugins/main.js +22 -22
- package/dist/cjs/pm-plugins/toolbar.js +15 -13
- package/dist/cjs/pm-plugins/update-edit-button.js +16 -16
- package/dist/cjs/pm-plugins/utils.js +36 -36
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +30 -30
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +17 -17
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +20 -20
- package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +7 -7
- package/dist/cjs/ui/ConfigPanel/transformers.js +108 -107
- package/dist/cjs/ui/context-panel.js +34 -33
- package/dist/cjs/ui/useConfigPanelPluginHook.js +25 -25
- package/dist/es2019/pm-plugins/toolbar.js +10 -7
- package/dist/esm/editor-actions/actions.js +16 -16
- package/dist/esm/pm-plugins/macro/actions.js +21 -21
- package/dist/esm/pm-plugins/main.js +22 -22
- package/dist/esm/pm-plugins/toolbar.js +15 -13
- package/dist/esm/pm-plugins/update-edit-button.js +16 -16
- package/dist/esm/pm-plugins/utils.js +36 -36
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +29 -29
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +16 -16
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +19 -19
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +7 -7
- package/dist/esm/ui/ConfigPanel/transformers.js +108 -107
- package/dist/esm/ui/context-panel.js +34 -33
- package/dist/esm/ui/useConfigPanelPluginHook.js +24 -24
- package/package.json +8 -8
|
@@ -26,7 +26,7 @@ var _HeaderAfterIconElement = _interopRequireDefault(require("./ConfigPanel/Head
|
|
|
26
26
|
var _HeaderIcon = _interopRequireDefault(require("./ConfigPanel/Header/HeaderIcon"));
|
|
27
27
|
var _contextPanel = require("./context-panel");
|
|
28
28
|
var _SaveIndicator = require("./SaveIndicator/SaveIndicator");
|
|
29
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
29
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
30
30
|
var selector = function selector(states) {
|
|
31
31
|
var _states$extensionStat, _states$extensionStat2, _states$extensionStat3;
|
|
32
32
|
return {
|
|
@@ -130,15 +130,15 @@ function showConfigPanel(_ref2) {
|
|
|
130
130
|
canClosePanel: function () {
|
|
131
131
|
var _canClosePanel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
132
132
|
var extensionState;
|
|
133
|
-
return _regenerator.default.wrap(function
|
|
133
|
+
return _regenerator.default.wrap(function (_context) {
|
|
134
134
|
while (1) switch (_context.prev = _context.next) {
|
|
135
135
|
case 0:
|
|
136
136
|
if (!editorView.isDestroyed) {
|
|
137
|
-
_context.next =
|
|
137
|
+
_context.next = 1;
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
140
|
return _context.abrupt("return", true);
|
|
141
|
-
case
|
|
141
|
+
case 1:
|
|
142
142
|
extensionState = (0, _pluginFactory.getPluginState)(editorView.state);
|
|
143
143
|
/**
|
|
144
144
|
* If context panel is open, then first update extension plugin state.
|
|
@@ -146,19 +146,19 @@ function showConfigPanel(_ref2) {
|
|
|
146
146
|
* which will call hideConfigPanel.
|
|
147
147
|
*/
|
|
148
148
|
if (!(extensionState !== null && extensionState !== void 0 && extensionState.showContextPanel)) {
|
|
149
|
-
_context.next =
|
|
149
|
+
_context.next = 3;
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
|
-
_context.next =
|
|
152
|
+
_context.next = 2;
|
|
153
153
|
return startClosingConfigPanel({
|
|
154
154
|
api: api,
|
|
155
155
|
editorView: editorView
|
|
156
156
|
});
|
|
157
|
-
case
|
|
157
|
+
case 2:
|
|
158
158
|
return _context.abrupt("return", false);
|
|
159
|
-
case
|
|
159
|
+
case 3:
|
|
160
160
|
return _context.abrupt("return", true);
|
|
161
|
-
case
|
|
161
|
+
case 4:
|
|
162
162
|
case "end":
|
|
163
163
|
return _context.stop();
|
|
164
164
|
}
|
|
@@ -179,32 +179,32 @@ function startClosingConfigPanel(_x) {
|
|
|
179
179
|
function _startClosingConfigPanel() {
|
|
180
180
|
_startClosingConfigPanel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref3) {
|
|
181
181
|
var _api$contextPanel3;
|
|
182
|
-
var api, editorView, applyChange;
|
|
183
|
-
return _regenerator.default.wrap(function
|
|
182
|
+
var api, editorView, applyChange, _t;
|
|
183
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
184
184
|
while (1) switch (_context3.prev = _context3.next) {
|
|
185
185
|
case 0:
|
|
186
186
|
api = _ref3.api, editorView = _ref3.editorView;
|
|
187
187
|
applyChange = api === null || api === void 0 || (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange; // Even if the save failed, we should proceed with closing the panel
|
|
188
188
|
(0, _commands.clearEditingContext)(applyChange)(editorView.state, editorView.dispatch);
|
|
189
|
-
_context3.prev =
|
|
190
|
-
_context3.next =
|
|
189
|
+
_context3.prev = 1;
|
|
190
|
+
_context3.next = 2;
|
|
191
191
|
return new Promise(function (resolve, reject) {
|
|
192
192
|
(0, _commands.forceAutoSave)(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
193
193
|
});
|
|
194
|
-
case
|
|
195
|
-
_context3.next =
|
|
194
|
+
case 2:
|
|
195
|
+
_context3.next = 4;
|
|
196
196
|
break;
|
|
197
|
-
case
|
|
198
|
-
_context3.prev =
|
|
199
|
-
|
|
197
|
+
case 3:
|
|
198
|
+
_context3.prev = 3;
|
|
199
|
+
_t = _context3["catch"](1);
|
|
200
200
|
// Even if the save failed, we should proceed with closing the panel
|
|
201
201
|
// eslint-disable-next-line no-console
|
|
202
|
-
console.error("Autosave failed with error",
|
|
203
|
-
case
|
|
202
|
+
console.error("Autosave failed with error", _t);
|
|
203
|
+
case 4:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context3.stop();
|
|
206
206
|
}
|
|
207
|
-
}, _callee3, null, [[
|
|
207
|
+
}, _callee3, null, [[1, 3]]);
|
|
208
208
|
}));
|
|
209
209
|
return _startClosingConfigPanel.apply(this, arguments);
|
|
210
210
|
}
|
|
@@ -254,17 +254,17 @@ var getContextPanelBodyComponent = exports.getContextPanelBodyComponent = functi
|
|
|
254
254
|
,
|
|
255
255
|
onChange: ( /*#__PURE__*/function () {
|
|
256
256
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(updatedParameters) {
|
|
257
|
-
return _regenerator.default.wrap(function
|
|
257
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
258
258
|
while (1) switch (_context2.prev = _context2.next) {
|
|
259
259
|
case 0:
|
|
260
|
-
_context2.next =
|
|
260
|
+
_context2.next = 1;
|
|
261
261
|
return (0, _contextPanel.onChangeAction)(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
262
|
-
case
|
|
262
|
+
case 1:
|
|
263
263
|
onSaveEnded();
|
|
264
264
|
if (autoSaveResolve) {
|
|
265
265
|
autoSaveResolve();
|
|
266
266
|
}
|
|
267
|
-
case
|
|
267
|
+
case 2:
|
|
268
268
|
case "end":
|
|
269
269
|
return _context2.stop();
|
|
270
270
|
}
|
|
@@ -24,19 +24,22 @@ import { copyUnsupportedContentToClipboard, getSelectedExtension, onCopyFailed }
|
|
|
24
24
|
const isNestedNBM = (state, selectedExtNode) => {
|
|
25
25
|
const {
|
|
26
26
|
schema: {
|
|
27
|
-
nodes
|
|
28
|
-
extension,
|
|
29
|
-
panel,
|
|
30
|
-
blockquote,
|
|
31
|
-
listItem
|
|
32
|
-
}
|
|
27
|
+
nodes
|
|
33
28
|
},
|
|
34
29
|
selection
|
|
35
30
|
} = state;
|
|
31
|
+
const {
|
|
32
|
+
extension,
|
|
33
|
+
panel,
|
|
34
|
+
blockquote,
|
|
35
|
+
listItem,
|
|
36
|
+
panel_c1
|
|
37
|
+
} = nodes;
|
|
36
38
|
if (!selectedExtNode) {
|
|
37
39
|
return false;
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
const parentNodeTypes = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? [panel, panel_c1, blockquote, listItem] : [panel, blockquote, listItem];
|
|
42
|
+
return selectedExtNode.node.type === extension && hasParentNodeOfType(parentNodeTypes.filter(Boolean))(selection);
|
|
40
43
|
};
|
|
41
44
|
const isLayoutSupported = (state, selectedExtNode) => {
|
|
42
45
|
const {
|
|
@@ -117,25 +117,25 @@ var updateExtensionParams = function updateExtensionParams(editorAnalyticsAPI) {
|
|
|
117
117
|
return function (updateExtension, node, actions) {
|
|
118
118
|
return /*#__PURE__*/function () {
|
|
119
119
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(state, dispatch, view) {
|
|
120
|
-
var _node$node, attrs, type, content, marks, parameters, newParameters, newAttrs;
|
|
121
|
-
return _regeneratorRuntime.wrap(function
|
|
120
|
+
var _node$node, attrs, type, content, marks, parameters, newParameters, newAttrs, _t;
|
|
121
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
122
122
|
while (1) switch (_context.prev = _context.next) {
|
|
123
123
|
case 0:
|
|
124
124
|
_node$node = node.node, attrs = _node$node.attrs, type = _node$node.type, content = _node$node.content, marks = _node$node.marks;
|
|
125
125
|
if (state.schema.nodes[type.name]) {
|
|
126
|
-
_context.next =
|
|
126
|
+
_context.next = 1;
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
return _context.abrupt("return", false);
|
|
130
|
-
case
|
|
130
|
+
case 1:
|
|
131
131
|
parameters = attrs.parameters;
|
|
132
|
-
_context.prev =
|
|
133
|
-
_context.next =
|
|
132
|
+
_context.prev = 2;
|
|
133
|
+
_context.next = 3;
|
|
134
134
|
return updateExtension(parameters, actions);
|
|
135
|
-
case
|
|
135
|
+
case 3:
|
|
136
136
|
newParameters = _context.sent;
|
|
137
137
|
if (!newParameters) {
|
|
138
|
-
_context.next =
|
|
138
|
+
_context.next = 4;
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
newAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
@@ -145,19 +145,19 @@ var updateExtensionParams = function updateExtensionParams(editorAnalyticsAPI) {
|
|
|
145
145
|
newAttrs.parameters.macroParams = _objectSpread(_objectSpread({}, parameters.macroParams), newParameters === null || newParameters === void 0 ? void 0 : newParameters.macroParams);
|
|
146
146
|
}
|
|
147
147
|
return _context.abrupt("return", performNodeUpdate(editorAnalyticsAPI)(type.name, newAttrs, content, marks, true)(state, dispatch, view));
|
|
148
|
-
case
|
|
149
|
-
_context.next =
|
|
148
|
+
case 4:
|
|
149
|
+
_context.next = 6;
|
|
150
150
|
break;
|
|
151
|
-
case
|
|
152
|
-
_context.prev =
|
|
153
|
-
|
|
154
|
-
case
|
|
151
|
+
case 5:
|
|
152
|
+
_context.prev = 5;
|
|
153
|
+
_t = _context["catch"](2);
|
|
154
|
+
case 6:
|
|
155
155
|
return _context.abrupt("return", true);
|
|
156
|
-
case
|
|
156
|
+
case 7:
|
|
157
157
|
case "end":
|
|
158
158
|
return _context.stop();
|
|
159
159
|
}
|
|
160
|
-
}, _callee, null, [[
|
|
160
|
+
}, _callee, null, [[2, 5]]);
|
|
161
161
|
}));
|
|
162
162
|
return function (_x, _x2, _x3) {
|
|
163
163
|
return _ref.apply(this, arguments);
|
|
@@ -16,21 +16,21 @@ export var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(ed
|
|
|
16
16
|
return /*#__PURE__*/function () {
|
|
17
17
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(view) {
|
|
18
18
|
var newMacro, state, dispatch, currentLayout, node, selection, schema, _schema$nodes, extension, inlineExtension, bodiedExtension, multiBodiedExtension, updateSelectionsByNodeType, extensionState, targetSelectionSource, tr, isBodiedExtensionSelected, isMultiBodiedExtensionSelected, pos, _macroNode$attrs, extensionType, extensionKey, layout, localId;
|
|
19
|
-
return _regeneratorRuntime.wrap(function
|
|
19
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
22
|
if (macroProvider) {
|
|
23
|
-
_context.next =
|
|
23
|
+
_context.next = 1;
|
|
24
24
|
break;
|
|
25
25
|
}
|
|
26
26
|
return _context.abrupt("return", false);
|
|
27
|
-
case
|
|
28
|
-
_context.next =
|
|
27
|
+
case 1:
|
|
28
|
+
_context.next = 2;
|
|
29
29
|
return macroProvider.openMacroBrowser(macroNode);
|
|
30
|
-
case
|
|
30
|
+
case 2:
|
|
31
31
|
newMacro = _context.sent;
|
|
32
32
|
if (!(newMacro && macroNode)) {
|
|
33
|
-
_context.next =
|
|
33
|
+
_context.next = 4;
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
36
|
state = view.state, dispatch = view.dispatch;
|
|
@@ -39,11 +39,11 @@ export var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(ed
|
|
|
39
39
|
layout: currentLayout
|
|
40
40
|
});
|
|
41
41
|
if (node) {
|
|
42
|
-
_context.next =
|
|
42
|
+
_context.next = 3;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
return _context.abrupt("return", false);
|
|
46
|
-
case
|
|
46
|
+
case 3:
|
|
47
47
|
selection = state.selection, schema = state.schema;
|
|
48
48
|
_schema$nodes = schema.nodes, extension = _schema$nodes.extension, inlineExtension = _schema$nodes.inlineExtension, bodiedExtension = _schema$nodes.bodiedExtension, multiBodiedExtension = _schema$nodes.multiBodiedExtension;
|
|
49
49
|
updateSelectionsByNodeType = function updateSelectionsByNodeType(nodeType) {
|
|
@@ -104,9 +104,9 @@ export var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(ed
|
|
|
104
104
|
dispatch(tr.scrollIntoView());
|
|
105
105
|
}
|
|
106
106
|
return _context.abrupt("return", true);
|
|
107
|
-
case
|
|
107
|
+
case 4:
|
|
108
108
|
return _context.abrupt("return", false);
|
|
109
|
-
case
|
|
109
|
+
case 5:
|
|
110
110
|
case "end":
|
|
111
111
|
return _context.stop();
|
|
112
112
|
}
|
|
@@ -157,32 +157,32 @@ export var runMacroAutoConvert = function runMacroAutoConvert(state, text) {
|
|
|
157
157
|
export var setMacroProvider = function setMacroProvider(provider) {
|
|
158
158
|
return /*#__PURE__*/function () {
|
|
159
159
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(view) {
|
|
160
|
-
var resolvedProvider;
|
|
161
|
-
return _regeneratorRuntime.wrap(function
|
|
160
|
+
var resolvedProvider, _t;
|
|
161
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
162
162
|
while (1) switch (_context2.prev = _context2.next) {
|
|
163
163
|
case 0:
|
|
164
164
|
_context2.prev = 0;
|
|
165
|
-
_context2.next =
|
|
165
|
+
_context2.next = 1;
|
|
166
166
|
return provider;
|
|
167
|
-
case
|
|
167
|
+
case 1:
|
|
168
168
|
resolvedProvider = _context2.sent;
|
|
169
169
|
assert(resolvedProvider && resolvedProvider.openMacroBrowser, "MacroProvider promise did not resolve to a valid instance of MacroProvider - ".concat(resolvedProvider));
|
|
170
|
-
_context2.next =
|
|
170
|
+
_context2.next = 3;
|
|
171
171
|
break;
|
|
172
|
-
case
|
|
173
|
-
_context2.prev =
|
|
174
|
-
|
|
172
|
+
case 2:
|
|
173
|
+
_context2.prev = 2;
|
|
174
|
+
_t = _context2["catch"](0);
|
|
175
175
|
resolvedProvider = null;
|
|
176
|
-
case
|
|
176
|
+
case 3:
|
|
177
177
|
view.dispatch(view.state.tr.setMeta(pluginKey, {
|
|
178
178
|
macroProvider: resolvedProvider
|
|
179
179
|
}));
|
|
180
180
|
return _context2.abrupt("return", true);
|
|
181
|
-
case
|
|
181
|
+
case 4:
|
|
182
182
|
case "end":
|
|
183
183
|
return _context2.stop();
|
|
184
184
|
}
|
|
185
|
-
}, _callee2, null, [[0,
|
|
185
|
+
}, _callee2, null, [[0, 2]]);
|
|
186
186
|
}));
|
|
187
187
|
return function (_x2) {
|
|
188
188
|
return _ref2.apply(this, arguments);
|
|
@@ -23,31 +23,31 @@ var shouldShowEditButton = function shouldShowEditButton(extensionHandler, exten
|
|
|
23
23
|
var getUpdateExtensionPromise = /*#__PURE__*/function () {
|
|
24
24
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(view, extensionHandler, extensionProvider) {
|
|
25
25
|
var updateMethod;
|
|
26
|
-
return _regeneratorRuntime.wrap(function
|
|
26
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
29
29
|
if (!(extensionHandler && _typeof(extensionHandler) === 'object')) {
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 1;
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
return _context.abrupt("return", extensionHandler.update);
|
|
34
|
-
case
|
|
34
|
+
case 1:
|
|
35
35
|
if (!extensionProvider) {
|
|
36
|
-
_context.next =
|
|
36
|
+
_context.next = 3;
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
|
-
_context.next =
|
|
39
|
+
_context.next = 2;
|
|
40
40
|
return updateEditButton(view, extensionProvider);
|
|
41
|
-
case
|
|
41
|
+
case 2:
|
|
42
42
|
updateMethod = _context.sent;
|
|
43
43
|
if (!updateMethod) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 3;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
return _context.abrupt("return", updateMethod);
|
|
48
|
-
case
|
|
48
|
+
case 3:
|
|
49
49
|
throw new Error('No update method available');
|
|
50
|
-
case
|
|
50
|
+
case 4:
|
|
51
51
|
case "end":
|
|
52
52
|
return _context.stop();
|
|
53
53
|
}
|
|
@@ -60,38 +60,38 @@ var getUpdateExtensionPromise = /*#__PURE__*/function () {
|
|
|
60
60
|
export var createExtensionProviderHandler = function createExtensionProviderHandler(view) {
|
|
61
61
|
return /*#__PURE__*/function () {
|
|
62
62
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(name, provider) {
|
|
63
|
-
var extensionProvider;
|
|
64
|
-
return _regeneratorRuntime.wrap(function
|
|
63
|
+
var extensionProvider, _t;
|
|
64
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
65
65
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
66
|
case 0:
|
|
67
67
|
if (!(name === 'extensionProvider' && provider)) {
|
|
68
|
-
_context2.next =
|
|
68
|
+
_context2.next = 5;
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
_context2.prev = 1;
|
|
72
|
-
_context2.next =
|
|
72
|
+
_context2.next = 2;
|
|
73
73
|
return provider;
|
|
74
|
-
case
|
|
74
|
+
case 2:
|
|
75
75
|
extensionProvider = _context2.sent;
|
|
76
76
|
updateState({
|
|
77
77
|
extensionProvider: extensionProvider
|
|
78
78
|
})(view.state, view.dispatch);
|
|
79
|
-
_context2.next =
|
|
79
|
+
_context2.next = 3;
|
|
80
80
|
return updateEditButton(view, extensionProvider);
|
|
81
|
-
case
|
|
82
|
-
_context2.next =
|
|
81
|
+
case 3:
|
|
82
|
+
_context2.next = 5;
|
|
83
83
|
break;
|
|
84
|
-
case
|
|
85
|
-
_context2.prev =
|
|
86
|
-
|
|
84
|
+
case 4:
|
|
85
|
+
_context2.prev = 4;
|
|
86
|
+
_t = _context2["catch"](1);
|
|
87
87
|
updateState({
|
|
88
88
|
extensionProvider: undefined
|
|
89
89
|
})(view.state, view.dispatch);
|
|
90
|
-
case
|
|
90
|
+
case 5:
|
|
91
91
|
case "end":
|
|
92
92
|
return _context2.stop();
|
|
93
93
|
}
|
|
94
|
-
}, _callee2, null, [[1,
|
|
94
|
+
}, _callee2, null, [[1, 4]]);
|
|
95
95
|
}));
|
|
96
96
|
return function (_x4, _x5) {
|
|
97
97
|
return _ref2.apply(this, arguments);
|
|
@@ -26,25 +26,27 @@ import { copyUnsupportedContentToClipboard, getSelectedExtension, onCopyFailed }
|
|
|
26
26
|
|
|
27
27
|
// non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
|
|
28
28
|
var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
|
|
29
|
-
var
|
|
30
|
-
extension = _state$schema$nodes.extension,
|
|
31
|
-
panel = _state$schema$nodes.panel,
|
|
32
|
-
blockquote = _state$schema$nodes.blockquote,
|
|
33
|
-
listItem = _state$schema$nodes.listItem,
|
|
29
|
+
var nodes = state.schema.nodes,
|
|
34
30
|
selection = state.selection;
|
|
31
|
+
var extension = nodes.extension,
|
|
32
|
+
panel = nodes.panel,
|
|
33
|
+
blockquote = nodes.blockquote,
|
|
34
|
+
listItem = nodes.listItem,
|
|
35
|
+
panel_c1 = nodes.panel_c1;
|
|
35
36
|
if (!selectedExtNode) {
|
|
36
37
|
return false;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
var parentNodeTypes = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? [panel, panel_c1, blockquote, listItem] : [panel, blockquote, listItem];
|
|
40
|
+
return selectedExtNode.node.type === extension && hasParentNodeOfType(parentNodeTypes.filter(Boolean))(selection);
|
|
39
41
|
};
|
|
40
42
|
var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
41
|
-
var _state$schema$
|
|
42
|
-
bodiedExtension = _state$schema$
|
|
43
|
-
extension = _state$schema$
|
|
44
|
-
layoutSection = _state$schema$
|
|
45
|
-
table = _state$schema$
|
|
46
|
-
expand = _state$schema$
|
|
47
|
-
multiBodiedExtension = _state$schema$
|
|
43
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
44
|
+
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
45
|
+
extension = _state$schema$nodes.extension,
|
|
46
|
+
layoutSection = _state$schema$nodes.layoutSection,
|
|
47
|
+
table = _state$schema$nodes.table,
|
|
48
|
+
expand = _state$schema$nodes.expand,
|
|
49
|
+
multiBodiedExtension = _state$schema$nodes.multiBodiedExtension,
|
|
48
50
|
selection = state.selection;
|
|
49
51
|
if (!selectedExtNode) {
|
|
50
52
|
return false;
|
|
@@ -6,28 +6,28 @@ import { getSelectedExtension } from './utils';
|
|
|
6
6
|
var maybeGetUpdateMethodFromExtensionProvider = /*#__PURE__*/function () {
|
|
7
7
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(view, extensionProvider) {
|
|
8
8
|
var nodeWithPos, _nodeWithPos$node$att, extensionType, extensionKey, extensionModuleNode, newNodeWithPos;
|
|
9
|
-
return _regeneratorRuntime.wrap(function
|
|
9
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
10
10
|
while (1) switch (_context.prev = _context.next) {
|
|
11
11
|
case 0:
|
|
12
12
|
nodeWithPos = getSelectedExtension(view.state, true);
|
|
13
13
|
if (nodeWithPos) {
|
|
14
|
-
_context.next =
|
|
14
|
+
_context.next = 1;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
throw new Error('There is no selection');
|
|
18
|
-
case
|
|
18
|
+
case 1:
|
|
19
19
|
_nodeWithPos$node$att = nodeWithPos.node.attrs, extensionType = _nodeWithPos$node$att.extensionType, extensionKey = _nodeWithPos$node$att.extensionKey;
|
|
20
|
-
_context.next =
|
|
20
|
+
_context.next = 2;
|
|
21
21
|
return getExtensionModuleNode(extensionProvider, extensionType, extensionKey);
|
|
22
|
-
case
|
|
22
|
+
case 2:
|
|
23
23
|
extensionModuleNode = _context.sent;
|
|
24
24
|
newNodeWithPos = getSelectedExtension(view.state, true);
|
|
25
25
|
if (!(newNodeWithPos && newNodeWithPos.node.attrs.extensionType === extensionType && newNodeWithPos.node.attrs.extensionKey === extensionKey && newNodeWithPos.pos === nodeWithPos.pos && extensionModuleNode)) {
|
|
26
|
-
_context.next =
|
|
26
|
+
_context.next = 3;
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
29
29
|
return _context.abrupt("return", extensionModuleNode.update);
|
|
30
|
-
case
|
|
30
|
+
case 3:
|
|
31
31
|
case "end":
|
|
32
32
|
return _context.stop();
|
|
33
33
|
}
|
|
@@ -39,28 +39,28 @@ var maybeGetUpdateMethodFromExtensionProvider = /*#__PURE__*/function () {
|
|
|
39
39
|
}();
|
|
40
40
|
export var updateEditButton = /*#__PURE__*/function () {
|
|
41
41
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(view, extensionProvider) {
|
|
42
|
-
var updateMethod;
|
|
43
|
-
return _regeneratorRuntime.wrap(function
|
|
42
|
+
var updateMethod, _t;
|
|
43
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
44
44
|
while (1) switch (_context2.prev = _context2.next) {
|
|
45
45
|
case 0:
|
|
46
46
|
_context2.prev = 0;
|
|
47
|
-
_context2.next =
|
|
47
|
+
_context2.next = 1;
|
|
48
48
|
return maybeGetUpdateMethodFromExtensionProvider(view, extensionProvider);
|
|
49
|
-
case
|
|
49
|
+
case 1:
|
|
50
50
|
updateMethod = _context2.sent;
|
|
51
51
|
updateState({
|
|
52
52
|
showEditButton: !!updateMethod,
|
|
53
53
|
updateExtension: updateMethod && Promise.resolve(updateMethod) || undefined
|
|
54
54
|
})(view.state, view.dispatch);
|
|
55
55
|
return _context2.abrupt("return", updateMethod);
|
|
56
|
-
case
|
|
57
|
-
_context2.prev =
|
|
58
|
-
|
|
59
|
-
case
|
|
56
|
+
case 2:
|
|
57
|
+
_context2.prev = 2;
|
|
58
|
+
_t = _context2["catch"](0);
|
|
59
|
+
case 3:
|
|
60
60
|
case "end":
|
|
61
61
|
return _context2.stop();
|
|
62
62
|
}
|
|
63
|
-
}, _callee2, null, [[0,
|
|
63
|
+
}, _callee2, null, [[0, 2]]);
|
|
64
64
|
}));
|
|
65
65
|
return function updateEditButton(_x3, _x4) {
|
|
66
66
|
return _ref2.apply(this, arguments);
|
|
@@ -145,54 +145,54 @@ var convertNodeToText = function convertNodeToText(node, mentionSet, parent, loc
|
|
|
145
145
|
var resolveMentionsInText = /*#__PURE__*/function () {
|
|
146
146
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, mentionSet, api) {
|
|
147
147
|
var _api$mention;
|
|
148
|
-
var mentionProvider, resolvedText, _iterator2, _step2, id, mention;
|
|
149
|
-
return _regeneratorRuntime.wrap(function
|
|
148
|
+
var mentionProvider, resolvedText, _iterator2, _step2, id, mention, _t;
|
|
149
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
150
150
|
while (1) switch (_context.prev = _context.next) {
|
|
151
151
|
case 0:
|
|
152
152
|
mentionProvider = api === null || api === void 0 || (_api$mention = api.mention) === null || _api$mention === void 0 || (_api$mention = _api$mention.sharedState) === null || _api$mention === void 0 || (_api$mention = _api$mention.currentState()) === null || _api$mention === void 0 ? void 0 : _api$mention.mentionProvider;
|
|
153
153
|
if (!(!mentionProvider || !isResolvingMentionProvider(mentionProvider))) {
|
|
154
|
-
_context.next =
|
|
154
|
+
_context.next = 1;
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
return _context.abrupt("return", text);
|
|
158
|
-
case
|
|
158
|
+
case 1:
|
|
159
159
|
resolvedText = text;
|
|
160
160
|
_iterator2 = _createForOfIteratorHelper(mentionSet);
|
|
161
|
-
_context.prev =
|
|
161
|
+
_context.prev = 2;
|
|
162
162
|
_iterator2.s();
|
|
163
|
-
case
|
|
163
|
+
case 3:
|
|
164
164
|
if ((_step2 = _iterator2.n()).done) {
|
|
165
|
-
_context.next =
|
|
165
|
+
_context.next = 6;
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
id = _step2.value;
|
|
169
|
-
_context.next =
|
|
169
|
+
_context.next = 4;
|
|
170
170
|
return mentionProvider.resolveMentionName(id);
|
|
171
|
-
case
|
|
171
|
+
case 4:
|
|
172
172
|
mention = _context.sent;
|
|
173
173
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-split-replace -- Ignored via go/ees017 (to be fixed)
|
|
174
174
|
resolvedText = resolvedText.replace("@".concat(id), "@".concat(mention.name) || '@…');
|
|
175
|
-
case
|
|
176
|
-
_context.next =
|
|
175
|
+
case 5:
|
|
176
|
+
_context.next = 3;
|
|
177
177
|
break;
|
|
178
|
-
case
|
|
179
|
-
_context.next =
|
|
178
|
+
case 6:
|
|
179
|
+
_context.next = 8;
|
|
180
180
|
break;
|
|
181
|
-
case
|
|
182
|
-
_context.prev =
|
|
183
|
-
|
|
184
|
-
_iterator2.e(
|
|
185
|
-
case
|
|
186
|
-
_context.prev =
|
|
181
|
+
case 7:
|
|
182
|
+
_context.prev = 7;
|
|
183
|
+
_t = _context["catch"](2);
|
|
184
|
+
_iterator2.e(_t);
|
|
185
|
+
case 8:
|
|
186
|
+
_context.prev = 8;
|
|
187
187
|
_iterator2.f();
|
|
188
|
-
return _context.finish(
|
|
189
|
-
case
|
|
188
|
+
return _context.finish(8);
|
|
189
|
+
case 9:
|
|
190
190
|
return _context.abrupt("return", resolvedText);
|
|
191
|
-
case
|
|
191
|
+
case 10:
|
|
192
192
|
case "end":
|
|
193
193
|
return _context.stop();
|
|
194
194
|
}
|
|
195
|
-
}, _callee, null, [[
|
|
195
|
+
}, _callee, null, [[2, 7, 8, 9]]);
|
|
196
196
|
}));
|
|
197
197
|
return function resolveMentionsInText(_x, _x2, _x3) {
|
|
198
198
|
return _ref2.apply(this, arguments);
|
|
@@ -204,18 +204,18 @@ var resolveMentionsInText = /*#__PURE__*/function () {
|
|
|
204
204
|
*/
|
|
205
205
|
export var copyUnsupportedContentToClipboard = /*#__PURE__*/function () {
|
|
206
206
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
|
|
207
|
-
var locale, schema, unsupportedContent, api, transformer, pmNode, text, mentionSet;
|
|
208
|
-
return _regeneratorRuntime.wrap(function
|
|
207
|
+
var locale, schema, unsupportedContent, api, transformer, pmNode, text, mentionSet, _t2;
|
|
208
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
209
209
|
while (1) switch (_context2.prev = _context2.next) {
|
|
210
210
|
case 0:
|
|
211
211
|
locale = _ref3.locale, schema = _ref3.schema, unsupportedContent = _ref3.unsupportedContent, api = _ref3.api;
|
|
212
212
|
_context2.prev = 1;
|
|
213
213
|
if (unsupportedContent) {
|
|
214
|
-
_context2.next =
|
|
214
|
+
_context2.next = 2;
|
|
215
215
|
break;
|
|
216
216
|
}
|
|
217
217
|
throw new Error('No nested content found');
|
|
218
|
-
case
|
|
218
|
+
case 2:
|
|
219
219
|
if (unsupportedContent.type !== 'doc') {
|
|
220
220
|
unsupportedContent = {
|
|
221
221
|
version: 1,
|
|
@@ -233,22 +233,22 @@ export var copyUnsupportedContentToClipboard = /*#__PURE__*/function () {
|
|
|
233
233
|
|
|
234
234
|
// Trim leading/trailing whitespace from the collected text
|
|
235
235
|
text = text.trim();
|
|
236
|
-
_context2.next =
|
|
236
|
+
_context2.next = 3;
|
|
237
237
|
return resolveMentionsInText(text, mentionSet, api);
|
|
238
|
-
case
|
|
238
|
+
case 3:
|
|
239
239
|
text = _context2.sent;
|
|
240
240
|
copyToClipboard(text);
|
|
241
|
-
_context2.next =
|
|
241
|
+
_context2.next = 5;
|
|
242
242
|
break;
|
|
243
|
-
case
|
|
244
|
-
_context2.prev =
|
|
245
|
-
|
|
246
|
-
throw
|
|
247
|
-
case
|
|
243
|
+
case 4:
|
|
244
|
+
_context2.prev = 4;
|
|
245
|
+
_t2 = _context2["catch"](1);
|
|
246
|
+
throw _t2 instanceof Error ? _t2 : new Error('Failed to copy content');
|
|
247
|
+
case 5:
|
|
248
248
|
case "end":
|
|
249
249
|
return _context2.stop();
|
|
250
250
|
}
|
|
251
|
-
}, _callee2, null, [[1,
|
|
251
|
+
}, _callee2, null, [[1, 4]]);
|
|
252
252
|
}));
|
|
253
253
|
return function copyUnsupportedContentToClipboard(_x4) {
|
|
254
254
|
return _ref4.apply(this, arguments);
|