@atlaskit/editor-core 189.3.25 → 189.3.27
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 +15 -0
- package/dist/cjs/plugins/extension/actions.js +15 -1
- package/dist/cjs/plugins/extension/index.js +7 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +37 -38
- package/dist/cjs/plugins/paste/pm-plugins/main.js +25 -8
- package/dist/cjs/plugins/tasks-and-decisions/index.js +16 -7
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +3 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
- package/dist/cjs/ui/ConfigPanel/LoadingState.js +3 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/extension/actions.js +16 -0
- package/dist/es2019/plugins/extension/index.js +7 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +6 -6
- package/dist/es2019/plugins/paste/pm-plugins/main.js +25 -8
- package/dist/es2019/plugins/tasks-and-decisions/index.js +115 -107
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -2
- package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +1 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
- package/dist/es2019/ui/ConfigPanel/LoadingState.js +3 -2
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/extension/actions.js +14 -0
- package/dist/esm/plugins/extension/index.js +7 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +37 -38
- package/dist/esm/plugins/paste/pm-plugins/main.js +25 -8
- package/dist/esm/plugins/tasks-and-decisions/index.js +14 -8
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -2
- package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
- package/dist/esm/ui/ConfigPanel/LoadingState.js +3 -2
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/extension/actions.d.ts +6 -0
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +1 -2
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +3 -3
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +3 -3
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +7 -0
- package/dist/types/plugins/tasks-and-decisions/ui/Decision/index.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/ui/Task/index.d.ts +4 -3
- package/dist/types/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +3 -2
- package/dist/types/presets/default.d.ts +4 -0
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +6 -0
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/commands.d.ts +1 -2
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +3 -3
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +7 -0
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Decision/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/index.d.ts +4 -3
- package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +3 -2
- package/dist/types-ts4.5/presets/default.d.ts +4 -0
- package/package.json +7 -7
- /package/dist/cjs/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
- /package/dist/es2019/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
- /package/dist/esm/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
- /package/dist/types/{plugins/tasks-and-decisions/styles.d.ts → ui/ContentStyles/tasks-and-decisions.d.ts} +0 -0
- /package/dist/types-ts4.5/{plugins/tasks-and-decisions/styles.d.ts → ui/ContentStyles/tasks-and-decisions.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.3.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43060](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43060) [`f576ff89904`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f576ff89904) - ED-20278 Fix backslash duplication in codeBlock when pasting as plain text
|
|
8
|
+
- [#43343](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43343) [`62499cd0af0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62499cd0af0) - Decouple tasks and decisions plugin from editor core.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 189.3.26
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#43164](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43164) [`3aeedf55e29`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3aeedf55e29) - [ED-20068] Move editSelectedExtension to ExtensionPluginActions
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 189.3.25
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -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.performNodeUpdate = exports.editSelectedExtension = exports.editExtension = exports.buildExtensionNode = void 0;
|
|
7
|
+
exports.performNodeUpdate = exports.editSelectedExtension = exports.editExtension = exports.createEditSelectedExtensionAction = exports.buildExtensionNode = void 0;
|
|
8
8
|
Object.defineProperty(exports, "transformSliceToRemoveOpenBodiedExtension", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
@@ -216,4 +216,18 @@ var editExtension = exports.editExtension = function editExtension(macroProvider
|
|
|
216
216
|
}
|
|
217
217
|
return true;
|
|
218
218
|
};
|
|
219
|
+
};
|
|
220
|
+
var createEditSelectedExtensionAction = exports.createEditSelectedExtensionAction = function createEditSelectedExtensionAction(_ref2) {
|
|
221
|
+
var editorViewRef = _ref2.editorViewRef,
|
|
222
|
+
editorAnalyticsAPI = _ref2.editorAnalyticsAPI;
|
|
223
|
+
return function () {
|
|
224
|
+
var view = editorViewRef.current;
|
|
225
|
+
if (!view) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
var _getPluginState3 = (0, _main.getPluginState)(view.state),
|
|
229
|
+
updateExtension = _getPluginState3.updateExtension,
|
|
230
|
+
applyChangeToContextPanel = _getPluginState3.applyChangeToContextPanel;
|
|
231
|
+
return editExtension(null, applyChangeToContextPanel, editorAnalyticsAPI, updateExtension)(view.state, view.dispatch, view);
|
|
232
|
+
};
|
|
219
233
|
};
|
|
@@ -15,8 +15,9 @@ var _uniqueId = require("./pm-plugins/unique-id");
|
|
|
15
15
|
var _toolbar = require("./toolbar");
|
|
16
16
|
var _contextPanel = require("./context-panel");
|
|
17
17
|
var _extensionApi = require("./extension-api");
|
|
18
|
+
var _actions2 = require("./actions");
|
|
18
19
|
var extensionPlugin = function extensionPlugin(_ref) {
|
|
19
|
-
var _api$featureFlags, _api$analytics2, _api$contextPanel3, _api$
|
|
20
|
+
var _api$featureFlags, _api$analytics2, _api$analytics3, _api$contextPanel3, _api$analytics4, _api$contextPanel4;
|
|
20
21
|
var _ref$config = _ref.config,
|
|
21
22
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
22
23
|
_api = _ref.api;
|
|
@@ -97,6 +98,10 @@ var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
97
98
|
});
|
|
98
99
|
},
|
|
99
100
|
insertMacroFromMacroBrowser: (0, _actions.insertMacroFromMacroBrowser)(_api === null || _api === void 0 || (_api$analytics2 = _api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
101
|
+
editSelectedExtension: (0, _actions2.createEditSelectedExtensionAction)({
|
|
102
|
+
editorViewRef: editorViewRef,
|
|
103
|
+
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics3 = _api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions
|
|
104
|
+
}),
|
|
100
105
|
runMacroAutoConvert: _actions.runMacroAutoConvert
|
|
101
106
|
},
|
|
102
107
|
pluginsOptions: {
|
|
@@ -104,7 +109,7 @@ var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
104
109
|
breakoutEnabled: options.breakoutEnabled,
|
|
105
110
|
hoverDecoration: _api === null || _api === void 0 ? void 0 : _api.decorations.actions.hoverDecoration,
|
|
106
111
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel3 = _api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange,
|
|
107
|
-
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$
|
|
112
|
+
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
|
|
108
113
|
}),
|
|
109
114
|
contextPanel: (0, _contextPanel.getContextPanel)(function () {
|
|
110
115
|
var _editorViewRef$curren;
|
|
@@ -22,7 +22,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
22
22
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
23
23
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
24
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
|
-
var _commands = require("../../../tasks-and-decisions/commands");
|
|
26
25
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
27
26
|
var _messages = require("./messages");
|
|
28
27
|
var _createItems3 = require("./create-items");
|
|
@@ -249,40 +248,41 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
249
248
|
}
|
|
250
249
|
return true;
|
|
251
250
|
});
|
|
252
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTaskDecision", function (
|
|
253
|
-
return function (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
251
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertTaskDecision", function (name, inputMethod) {
|
|
252
|
+
return function () {
|
|
253
|
+
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
254
|
+
var _this$props7 = _this.props,
|
|
255
|
+
_this$props7$editorVi = _this$props7.editorView,
|
|
256
|
+
state = _this$props7$editorVi.state,
|
|
257
|
+
dispatch = _this$props7$editorVi.dispatch,
|
|
258
|
+
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
259
|
+
var listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
260
|
+
return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
|
|
261
261
|
};
|
|
262
262
|
});
|
|
263
263
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
264
264
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
265
|
-
var _this$props7 = _this.props,
|
|
266
|
-
_this$props7$editorVi = _this$props7.editorView,
|
|
267
|
-
state = _this$props7$editorVi.state,
|
|
268
|
-
dispatch = _this$props7$editorVi.dispatch,
|
|
269
|
-
pluginInjectionApi = _this$props7.pluginInjectionApi;
|
|
270
|
-
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
271
|
-
});
|
|
272
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
273
|
-
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
274
265
|
var _this$props8 = _this.props,
|
|
275
266
|
_this$props8$editorVi = _this$props8.editorView,
|
|
276
267
|
state = _this$props8$editorVi.state,
|
|
277
268
|
dispatch = _this$props8$editorVi.dispatch,
|
|
278
269
|
pluginInjectionApi = _this$props8.pluginInjectionApi;
|
|
270
|
+
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
271
|
+
});
|
|
272
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
273
|
+
var _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
274
|
+
var _this$props9 = _this.props,
|
|
275
|
+
_this$props9$editorVi = _this$props9.editorView,
|
|
276
|
+
state = _this$props9$editorVi.state,
|
|
277
|
+
dispatch = _this$props9$editorVi.dispatch,
|
|
278
|
+
pluginInjectionApi = _this$props9.pluginInjectionApi;
|
|
279
279
|
return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.expand) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.actions.insertExpand(state, dispatch)) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
|
|
280
280
|
});
|
|
281
281
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
282
282
|
return function () {
|
|
283
|
-
var _this$
|
|
284
|
-
editorView = _this$
|
|
285
|
-
onInsertBlockType = _this$
|
|
283
|
+
var _this$props10 = _this.props,
|
|
284
|
+
editorView = _this$props10.editorView,
|
|
285
|
+
onInsertBlockType = _this$props10.onInsertBlockType;
|
|
286
286
|
var state = editorView.state,
|
|
287
287
|
dispatch = editorView.dispatch;
|
|
288
288
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -303,14 +303,13 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
303
303
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
304
304
|
});
|
|
305
305
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
|
|
306
|
-
var _this$props$pluginInj;
|
|
307
306
|
var item = _ref2.item,
|
|
308
307
|
inputMethod = _ref2.inputMethod;
|
|
309
|
-
var _this$
|
|
310
|
-
editorView = _this$
|
|
311
|
-
editorActions = _this$
|
|
312
|
-
handleImageUpload = _this$
|
|
313
|
-
expandEnabled = _this$
|
|
308
|
+
var _this$props11 = _this.props,
|
|
309
|
+
editorView = _this$props11.editorView,
|
|
310
|
+
editorActions = _this$props11.editorActions,
|
|
311
|
+
handleImageUpload = _this$props11.handleImageUpload,
|
|
312
|
+
expandEnabled = _this$props11.expandEnabled;
|
|
314
313
|
|
|
315
314
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
316
315
|
if (!editorView.hasFocus()) {
|
|
@@ -346,7 +345,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
346
345
|
break;
|
|
347
346
|
case 'action':
|
|
348
347
|
case 'decision':
|
|
349
|
-
_this.insertTaskDecision(
|
|
348
|
+
_this.insertTaskDecision(item.value.name, inputMethod)();
|
|
350
349
|
break;
|
|
351
350
|
case 'horizontalrule':
|
|
352
351
|
_this.insertHorizontalRule(inputMethod);
|
|
@@ -426,12 +425,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
426
425
|
key: "renderPopup",
|
|
427
426
|
value: function renderPopup() {
|
|
428
427
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
429
|
-
var _this$
|
|
430
|
-
popupsMountPoint = _this$
|
|
431
|
-
popupsBoundariesElement = _this$
|
|
432
|
-
popupsScrollableElement = _this$
|
|
433
|
-
emojiProvider = _this$
|
|
434
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
428
|
+
var _this$props12 = this.props,
|
|
429
|
+
popupsMountPoint = _this$props12.popupsMountPoint,
|
|
430
|
+
popupsBoundariesElement = _this$props12.popupsBoundariesElement,
|
|
431
|
+
popupsScrollableElement = _this$props12.popupsScrollableElement,
|
|
432
|
+
emojiProvider = _this$props12.emojiProvider,
|
|
433
|
+
replacePlusMenuWithElementBrowser = _this$props12.replacePlusMenuWithElementBrowser;
|
|
435
434
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
436
435
|
var name = _ref4.value.name;
|
|
437
436
|
return name === 'emoji';
|
|
@@ -468,9 +467,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
468
467
|
buttons = _this$state.buttons,
|
|
469
468
|
dropdownItems = _this$state.dropdownItems,
|
|
470
469
|
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
471
|
-
var _this$
|
|
472
|
-
isDisabled = _this$
|
|
473
|
-
isReducedSpacing = _this$
|
|
470
|
+
var _this$props13 = this.props,
|
|
471
|
+
isDisabled = _this$props13.isDisabled,
|
|
472
|
+
isReducedSpacing = _this$props13.isReducedSpacing;
|
|
474
473
|
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
475
474
|
return null;
|
|
476
475
|
}
|
|
@@ -43,20 +43,37 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
43
43
|
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
44
44
|
var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _paste.md);
|
|
45
45
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
46
|
-
var textInput = text;
|
|
47
|
-
var textSplitByCodeBlock = textInput.split(/```/);
|
|
48
|
-
for (var i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
49
|
-
if (i % 2 === 0) {
|
|
50
|
-
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
textInput = textSplitByCodeBlock.join('```');
|
|
46
|
+
var textInput = escapeBackslashExceptCodeblock(text);
|
|
54
47
|
var doc = atlassianMarkDownParser.parse((0, _util.escapeLinks)(textInput));
|
|
55
48
|
if (doc && doc.content) {
|
|
56
49
|
return new _model.Slice(doc.content, openStart, openEnd);
|
|
57
50
|
}
|
|
58
51
|
return;
|
|
59
52
|
}
|
|
53
|
+
function escapeBackslashExceptCodeblock(textInput) {
|
|
54
|
+
var codeToken = '```';
|
|
55
|
+
if (!textInput.includes(codeToken)) {
|
|
56
|
+
return textInput.replace(/\\/g, '\\\\');
|
|
57
|
+
}
|
|
58
|
+
var isInsideCodeblock = false;
|
|
59
|
+
var textSplitByNewLine = textInput.split('\n');
|
|
60
|
+
// In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
|
|
61
|
+
textSplitByNewLine = textSplitByNewLine.map(function (text) {
|
|
62
|
+
if (text === codeToken) {
|
|
63
|
+
isInsideCodeblock = !isInsideCodeblock;
|
|
64
|
+
} else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
|
|
65
|
+
// if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
|
|
66
|
+
isInsideCodeblock = true;
|
|
67
|
+
}
|
|
68
|
+
if (!isInsideCodeblock) {
|
|
69
|
+
// only escape text which is not inside a codeblock
|
|
70
|
+
text = text.replace(/\\/g, '\\\\');
|
|
71
|
+
}
|
|
72
|
+
return text;
|
|
73
|
+
});
|
|
74
|
+
textInput = textSplitByNewLine.join('\n');
|
|
75
|
+
return textInput;
|
|
76
|
+
}
|
|
60
77
|
var extensionAutoConverter;
|
|
61
78
|
function setExtensionAutoConverter(_x, _x2) {
|
|
62
79
|
return _setExtensionAutoConverter.apply(this, arguments);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -14,7 +15,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
14
15
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
15
16
|
var _commands = require("./commands");
|
|
16
17
|
var _inputRules = _interopRequireDefault(require("./pm-plugins/input-rules"));
|
|
17
|
-
var _keymaps =
|
|
18
|
+
var _keymaps = _interopRequireWildcard(require("./pm-plugins/keymaps"));
|
|
18
19
|
var _main = require("./pm-plugins/main");
|
|
19
20
|
var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
|
|
20
21
|
var _ToolbarTask = _interopRequireDefault(require("./ui/ToolbarTask"));
|
|
@@ -22,6 +23,8 @@ var _helpers = require("./pm-plugins/helpers");
|
|
|
22
23
|
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
23
24
|
var _templateObject;
|
|
24
25
|
/** @jsx jsx */
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
28
|
var taskDecisionToolbarGroup = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
|
|
26
29
|
var addItem = function addItem(insert, listType, schema) {
|
|
27
30
|
return function (_ref) {
|
|
@@ -38,6 +41,7 @@ var addItem = function addItem(insert, listType, schema) {
|
|
|
38
41
|
};
|
|
39
42
|
};
|
|
40
43
|
var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
44
|
+
var _api$analytics, _api$analytics2, _api$analytics3;
|
|
41
45
|
var _ref2$config = _ref2.config,
|
|
42
46
|
_ref2$config2 = _ref2$config === void 0 ? {} : _ref2$config,
|
|
43
47
|
allowNestedTasks = _ref2$config2.allowNestedTasks,
|
|
@@ -75,6 +79,11 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
75
79
|
outdentDisabled: indentLevel <= 1
|
|
76
80
|
};
|
|
77
81
|
},
|
|
82
|
+
actions: {
|
|
83
|
+
insertTaskDecision: (0, _commands.insertTaskDecisionCommand)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
84
|
+
indentTaskList: (0, _keymaps.getIndentCommand)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
85
|
+
outdentTaskList: (0, _keymaps.getUnindentCommand)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)
|
|
86
|
+
},
|
|
78
87
|
pmPlugins: function pmPlugins() {
|
|
79
88
|
return [{
|
|
80
89
|
name: 'tasksAndDecisions',
|
|
@@ -88,10 +97,10 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
88
97
|
}, {
|
|
89
98
|
name: 'tasksAndDecisionsInputRule',
|
|
90
99
|
plugin: function plugin(_ref4) {
|
|
91
|
-
var _api$
|
|
100
|
+
var _api$analytics4;
|
|
92
101
|
var schema = _ref4.schema,
|
|
93
102
|
featureFlags = _ref4.featureFlags;
|
|
94
|
-
return (0, _inputRules.default)(api === null || api === void 0 || (_api$
|
|
103
|
+
return (0, _inputRules.default)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(schema, featureFlags);
|
|
95
104
|
}
|
|
96
105
|
}, {
|
|
97
106
|
name: 'tasksAndDecisionsKeyMap',
|
|
@@ -133,8 +142,8 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
133
142
|
return (0, _react.jsx)(_quickInsert.IconAction, null);
|
|
134
143
|
},
|
|
135
144
|
action: function action(insert, state) {
|
|
136
|
-
var _api$
|
|
137
|
-
return (0, _commands.insertTaskDecisionAction)(api === null || api === void 0 || (_api$
|
|
145
|
+
var _api$analytics5;
|
|
146
|
+
return (0, _commands.insertTaskDecisionAction)(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)(state, 'taskList', _analytics.INPUT_METHOD.QUICK_INSERT, addItem(insert, 'taskList', state.schema));
|
|
138
147
|
}
|
|
139
148
|
}, {
|
|
140
149
|
id: 'decision',
|
|
@@ -146,8 +155,8 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
|
|
|
146
155
|
return (0, _react.jsx)(_quickInsert.IconDecision, null);
|
|
147
156
|
},
|
|
148
157
|
action: function action(insert, state) {
|
|
149
|
-
var _api$
|
|
150
|
-
return (0, _commands.insertTaskDecisionAction)(api === null || api === void 0 || (_api$
|
|
158
|
+
var _api$analytics6;
|
|
159
|
+
return (0, _commands.insertTaskDecisionAction)(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(state, 'decisionList', _analytics.INPUT_METHOD.QUICK_INSERT, addItem(insert, 'decisionList', state.schema));
|
|
151
160
|
}
|
|
152
161
|
}];
|
|
153
162
|
}
|
|
@@ -16,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
18
|
var _decision = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/decision"));
|
|
19
|
-
var
|
|
19
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
20
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
21
|
var _commands = require("../../commands");
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -58,8 +58,8 @@ var ToolbarDecision = exports.ToolbarDecision = /*#__PURE__*/function (_PureComp
|
|
|
58
58
|
isReducedSpacing = _this$props2.isReducedSpacing,
|
|
59
59
|
formatMessage = _this$props2.intl.formatMessage;
|
|
60
60
|
var label = formatMessage(_messages.toolbarInsertBlockMessages.decision);
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
62
|
-
buttonId:
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
|
|
62
|
+
buttonId: _uiMenu.TOOLBAR_BUTTON.DECISION_LIST,
|
|
63
63
|
onClick: this.handleInsertDecision,
|
|
64
64
|
disabled: disabled || isDisabled,
|
|
65
65
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -16,7 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
18
|
var _task = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/task"));
|
|
19
|
-
var
|
|
19
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
20
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
21
|
var _commands = require("../../commands");
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -58,8 +58,8 @@ var ToolbarTask = exports.ToolbarTask = /*#__PURE__*/function (_PureComponent) {
|
|
|
58
58
|
isReducedSpacing = _this$props2.isReducedSpacing,
|
|
59
59
|
formatMessage = _this$props2.intl.formatMessage;
|
|
60
60
|
var label = formatMessage(_messages.toolbarInsertBlockMessages.action);
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
62
|
-
buttonId:
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
|
|
62
|
+
buttonId: _uiMenu.TOOLBAR_BUTTON.TASK_LIST,
|
|
63
63
|
onClick: this.handleInsertTask,
|
|
64
64
|
disabled: disabled || isDisabled,
|
|
65
65
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.onItemActivated = void 0;
|
|
7
|
-
var _keymaps = require("../../tasks-and-decisions/pm-plugins/keymaps");
|
|
8
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
9
8
|
var onItemActivated = exports.onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode) {
|
|
10
9
|
return function (_ref) {
|
|
@@ -28,8 +27,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
28
27
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
29
28
|
}
|
|
30
29
|
if (node === 'taskList') {
|
|
31
|
-
var _pluginInjectionApi$
|
|
32
|
-
|
|
30
|
+
var _pluginInjectionApi$t;
|
|
31
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t === void 0 || _pluginInjectionApi$t.actions.indentTaskList(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
33
32
|
}
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -44,8 +43,8 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
44
43
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
45
44
|
}
|
|
46
45
|
if (_node === 'taskList') {
|
|
47
|
-
var _pluginInjectionApi$
|
|
48
|
-
|
|
46
|
+
var _pluginInjectionApi$t2;
|
|
47
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t2 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t2 === void 0 || _pluginInjectionApi$t2.actions.outdentTaskList(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
49
48
|
}
|
|
50
49
|
break;
|
|
51
50
|
}
|
|
@@ -10,10 +10,11 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
11
11
|
var _templateObject;
|
|
12
12
|
/** @jsx jsx */
|
|
13
|
-
var spinnerWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n margin-top:
|
|
13
|
+
var spinnerWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n margin-top: ", ";\n"])), "var(--ds-space-800, 64px)");
|
|
14
14
|
var LoadingState = function LoadingState() {
|
|
15
15
|
return (0, _react.jsx)("div", {
|
|
16
|
-
css: spinnerWrapper
|
|
16
|
+
css: spinnerWrapper,
|
|
17
|
+
"data-testid": "ConfigPanelLoading"
|
|
17
18
|
}, (0, _react.jsx)(_spinner.default, {
|
|
18
19
|
size: "small"
|
|
19
20
|
}));
|
|
@@ -24,7 +24,7 @@ var _styles5 = require("@atlaskit/editor-plugin-placeholder-text/styles");
|
|
|
24
24
|
var _extension = require("./extension");
|
|
25
25
|
var _expand = require("./expand");
|
|
26
26
|
var _styles6 = require("../../plugins/find-replace/styles");
|
|
27
|
-
var
|
|
27
|
+
var _tasksAndDecisions = require("./tasks-and-decisions");
|
|
28
28
|
var _status = require("./status");
|
|
29
29
|
var _date = require("./date");
|
|
30
30
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
@@ -47,7 +47,7 @@ var placeholderStyles = exports.placeholderStyles = (0, _react2.css)(_templateOb
|
|
|
47
47
|
var contentStyles = function contentStyles(props) {
|
|
48
48
|
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
49
49
|
theme: props.theme
|
|
50
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _layout.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _panel.panelStyles)(props), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _extension.extensionStyles, (0, _expand.expandStyles)(props), _styles6.findReplaceStyles, _styles4.textHighlightStyle,
|
|
50
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles5.placeholderTextStyles, placeholderStyles, (0, _codeBlock.codeBlockStyles)(props), (0, _styles3.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, ruleStyles(props), _media.mediaStyles, (0, _layout.layoutStyles)(props), _styles2.telepointerStyle, _selection.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _panel.panelStyles)(props), mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _extension.extensionStyles, (0, _expand.expandStyles)(props), _styles6.findReplaceStyles, _styles4.textHighlightStyle, _tasksAndDecisions.taskDecisionStyles, _status.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _date.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
51
51
|
};
|
|
52
52
|
var createEditorContentStyle = exports.createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
53
53
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
@@ -181,4 +181,20 @@ export const editExtension = (macroProvider, applyChangeToContextPanel, editorAn
|
|
|
181
181
|
editInLegacyMacroBrowser();
|
|
182
182
|
}
|
|
183
183
|
return true;
|
|
184
|
+
};
|
|
185
|
+
export const createEditSelectedExtensionAction = ({
|
|
186
|
+
editorViewRef,
|
|
187
|
+
editorAnalyticsAPI
|
|
188
|
+
}) => () => {
|
|
189
|
+
const {
|
|
190
|
+
current: view
|
|
191
|
+
} = editorViewRef;
|
|
192
|
+
if (!view) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
const {
|
|
196
|
+
updateExtension,
|
|
197
|
+
applyChangeToContextPanel
|
|
198
|
+
} = getPluginState(view.state);
|
|
199
|
+
return editExtension(null, applyChangeToContextPanel, editorAnalyticsAPI, updateExtension)(view.state, view.dispatch, view);
|
|
184
200
|
};
|
|
@@ -8,11 +8,12 @@ import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
|
8
8
|
import { getToolbarConfig } from './toolbar';
|
|
9
9
|
import { getContextPanel } from './context-panel';
|
|
10
10
|
import { createExtensionAPI } from './extension-api';
|
|
11
|
+
import { createEditSelectedExtensionAction } from './actions';
|
|
11
12
|
const extensionPlugin = ({
|
|
12
13
|
config: options = {},
|
|
13
14
|
api
|
|
14
15
|
}) => {
|
|
15
|
-
var _api$featureFlags, _api$analytics2, _api$contextPanel3, _api$
|
|
16
|
+
var _api$featureFlags, _api$analytics2, _api$analytics3, _api$contextPanel3, _api$analytics4, _api$contextPanel4;
|
|
16
17
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
17
18
|
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
18
19
|
//This is needed to get the current selection in the editor
|
|
@@ -88,6 +89,10 @@ const extensionPlugin = ({
|
|
|
88
89
|
});
|
|
89
90
|
},
|
|
90
91
|
insertMacroFromMacroBrowser: insertMacroFromMacroBrowser(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
92
|
+
editSelectedExtension: createEditSelectedExtensionAction({
|
|
93
|
+
editorViewRef,
|
|
94
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions
|
|
95
|
+
}),
|
|
91
96
|
runMacroAutoConvert
|
|
92
97
|
},
|
|
93
98
|
pluginsOptions: {
|
|
@@ -95,7 +100,7 @@ const extensionPlugin = ({
|
|
|
95
100
|
breakoutEnabled: options.breakoutEnabled,
|
|
96
101
|
hoverDecoration: api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration,
|
|
97
102
|
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel3 = api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange,
|
|
98
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
103
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
|
|
99
104
|
}),
|
|
100
105
|
contextPanel: getContextPanel(() => {
|
|
101
106
|
var _editorViewRef$curren;
|
|
@@ -9,7 +9,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
9
9
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
10
10
|
import { separatorStyles, buttonGroupStyle, wrapperStyle } from '@atlaskit/editor-common/styles';
|
|
11
11
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
|
-
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
13
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import { messages } from './messages';
|
|
15
14
|
import { createItems } from './create-items';
|
|
@@ -242,15 +241,17 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
242
241
|
}
|
|
243
242
|
return true;
|
|
244
243
|
});
|
|
245
|
-
_defineProperty(this, "insertTaskDecision",
|
|
244
|
+
_defineProperty(this, "insertTaskDecision", (name, inputMethod) => () => {
|
|
245
|
+
var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
|
|
246
246
|
const {
|
|
247
247
|
editorView: {
|
|
248
248
|
state,
|
|
249
249
|
dispatch
|
|
250
|
-
}
|
|
250
|
+
},
|
|
251
|
+
pluginInjectionApi
|
|
251
252
|
} = this.props;
|
|
252
253
|
const listType = name === 'action' ? 'taskList' : 'decisionList';
|
|
253
|
-
return
|
|
254
|
+
return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
|
|
254
255
|
});
|
|
255
256
|
_defineProperty(this, "insertHorizontalRule", inputMethod => {
|
|
256
257
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
@@ -307,7 +308,6 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
307
308
|
item,
|
|
308
309
|
inputMethod
|
|
309
310
|
}) => {
|
|
310
|
-
var _this$props$pluginInj, _this$props$pluginInj2;
|
|
311
311
|
const {
|
|
312
312
|
editorView,
|
|
313
313
|
editorActions,
|
|
@@ -351,7 +351,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
351
351
|
break;
|
|
352
352
|
case 'action':
|
|
353
353
|
case 'decision':
|
|
354
|
-
this.insertTaskDecision(
|
|
354
|
+
this.insertTaskDecision(item.value.name, inputMethod)();
|
|
355
355
|
break;
|
|
356
356
|
case 'horizontalrule':
|
|
357
357
|
this.insertHorizontalRule(inputMethod);
|
|
@@ -28,20 +28,37 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
28
28
|
const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
29
29
|
const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
|
|
30
30
|
function getMarkdownSlice(text, openStart, openEnd) {
|
|
31
|
-
let textInput = text;
|
|
32
|
-
const textSplitByCodeBlock = textInput.split(/```/);
|
|
33
|
-
for (let i = 0; i < textSplitByCodeBlock.length; i++) {
|
|
34
|
-
if (i % 2 === 0) {
|
|
35
|
-
textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
textInput = textSplitByCodeBlock.join('```');
|
|
31
|
+
let textInput = escapeBackslashExceptCodeblock(text);
|
|
39
32
|
const doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
|
|
40
33
|
if (doc && doc.content) {
|
|
41
34
|
return new Slice(doc.content, openStart, openEnd);
|
|
42
35
|
}
|
|
43
36
|
return;
|
|
44
37
|
}
|
|
38
|
+
function escapeBackslashExceptCodeblock(textInput) {
|
|
39
|
+
const codeToken = '```';
|
|
40
|
+
if (!textInput.includes(codeToken)) {
|
|
41
|
+
return textInput.replace(/\\/g, '\\\\');
|
|
42
|
+
}
|
|
43
|
+
let isInsideCodeblock = false;
|
|
44
|
+
let textSplitByNewLine = textInput.split('\n');
|
|
45
|
+
// In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
|
|
46
|
+
textSplitByNewLine = textSplitByNewLine.map(text => {
|
|
47
|
+
if (text === codeToken) {
|
|
48
|
+
isInsideCodeblock = !isInsideCodeblock;
|
|
49
|
+
} else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
|
|
50
|
+
// if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
|
|
51
|
+
isInsideCodeblock = true;
|
|
52
|
+
}
|
|
53
|
+
if (!isInsideCodeblock) {
|
|
54
|
+
// only escape text which is not inside a codeblock
|
|
55
|
+
text = text.replace(/\\/g, '\\\\');
|
|
56
|
+
}
|
|
57
|
+
return text;
|
|
58
|
+
});
|
|
59
|
+
textInput = textSplitByNewLine.join('\n');
|
|
60
|
+
return textInput;
|
|
61
|
+
}
|
|
45
62
|
let extensionAutoConverter;
|
|
46
63
|
async function setExtensionAutoConverter(name, extensionProviderPromise) {
|
|
47
64
|
if (name !== 'extensionProvider' || !extensionProviderPromise) {
|