@atlaskit/editor-core 189.3.2 → 189.3.3
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 +6 -0
- package/dist/cjs/plugins/code-block/actions.js +1 -1
- package/dist/cjs/plugins/code-block/ide-ux/line-handling.js +1 -1
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/cjs/plugins/code-block/pm-plugins/keymaps.js +7 -4
- package/dist/cjs/plugins/code-block/toolbar.js +5 -3
- package/dist/cjs/plugins/code-block/utils.js +5 -1
- package/dist/cjs/plugins/expand/index.js +3 -3
- package/dist/cjs/plugins/feedback-dialog/index.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +2 -2
- package/dist/cjs/{plugins/code-block/styles.js → ui/ContentStyles/code-block.js} +1 -2
- package/dist/cjs/ui/ContentStyles/index.js +7 -7
- package/dist/cjs/utils/index.js +0 -53
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/code-block/actions.js +1 -1
- package/dist/es2019/plugins/code-block/ide-ux/line-handling.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/keymaps.js +5 -2
- package/dist/es2019/plugins/code-block/toolbar.js +1 -2
- package/dist/es2019/plugins/code-block/utils.js +4 -1
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- 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/code-block/styles.js → ui/ContentStyles/code-block.js} +5 -6
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/utils/index.js +0 -36
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/code-block/actions.js +1 -1
- package/dist/esm/plugins/code-block/ide-ux/line-handling.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/keymaps.js +5 -2
- package/dist/esm/plugins/code-block/toolbar.js +1 -2
- package/dist/esm/plugins/code-block/utils.js +4 -1
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- 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/code-block/styles.js → ui/ContentStyles/code-block.js} +2 -3
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/utils/index.js +0 -50
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/code-block/actions.d.ts +1 -1
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/code-block/types.d.ts +1 -2
- package/dist/types/plugins/code-block/utils.d.ts +3 -0
- package/dist/{types-ts4.5/plugins/code-block/styles.d.ts → types/ui/ContentStyles/code-block.d.ts} +1 -1
- package/dist/types/utils/index.d.ts +2 -18
- package/dist/types-ts4.5/plugins/code-block/actions.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/plugins/code-block/types.d.ts +1 -2
- package/dist/types-ts4.5/plugins/code-block/utils.d.ts +3 -0
- package/dist/{types/plugins/code-block/styles.d.ts → types-ts4.5/ui/ContentStyles/code-block.d.ts} +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +2 -39
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42734](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42734) [`9a298d1b3c3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9a298d1b3c3) - Decouple code-block plugin from editor-core.
|
|
8
|
+
|
|
3
9
|
## 189.3.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
13
13
|
var _pluginKey = require("./plugin-key");
|
|
14
14
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
15
15
|
var _actions = require("./pm-plugins/actions");
|
|
16
|
-
var _clipboard = require("
|
|
16
|
+
var _clipboard = require("@atlaskit/editor-common/clipboard");
|
|
17
17
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
18
18
|
var _transformToCodeBlock = require("./transform-to-code-block");
|
|
19
19
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getLineInfo = exports.getEndOfCurrentLine = exports.forEachLine = void 0;
|
|
7
7
|
exports.getLinesFromSelection = getLinesFromSelection;
|
|
8
8
|
exports.isSelectionEntirelyInsideCodeBlock = exports.isCursorInsideCodeBlock = exports.getStartOfCurrentLine = void 0;
|
|
9
|
-
var _utils = require("
|
|
9
|
+
var _utils = require("../utils");
|
|
10
10
|
var isSelectionEntirelyInsideCodeBlock = exports.isSelectionEntirelyInsideCodeBlock = function isSelectionEntirelyInsideCodeBlock(state) {
|
|
11
11
|
return state.selection.$from.sameParent(state.selection.$to) && state.selection.$from.parent.type === state.schema.nodes.codeBlock;
|
|
12
12
|
};
|
|
@@ -8,7 +8,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _utils2 = require("
|
|
11
|
+
var _utils2 = require("../utils");
|
|
12
12
|
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _pairedCharacterHandling = require("../ide-ux/paired-character-handling");
|
|
14
14
|
var _bracketHandling = require("../ide-ux/bracket-handling");
|
|
@@ -8,7 +8,8 @@ exports.keymapPlugin = keymapPlugin;
|
|
|
8
8
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _utils2 = require("
|
|
11
|
+
var _utils2 = require("../utils");
|
|
12
|
+
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
12
13
|
var deleteCurrentItem = function deleteCurrentItem($from) {
|
|
13
14
|
return function (tr) {
|
|
14
15
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
@@ -44,15 +45,17 @@ function keymapPlugin(schema) {
|
|
|
44
45
|
dispatch(state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, []).setBlockType($cursor.pos, $cursor.pos, paragraph));
|
|
45
46
|
return true;
|
|
46
47
|
}
|
|
47
|
-
if ($cursor.node && (0,
|
|
48
|
+
if ($cursor.node && (0, _utils3.isEmptyNode)(schema)($cursor.node()) && ((0, _utils.hasParentNodeOfType)(layoutColumn)(state.selection) || (0, _utils.hasParentNodeOfType)(table)(state.selection))) {
|
|
48
49
|
var tr = state.tr;
|
|
49
50
|
var insertPos = $cursor.pos;
|
|
50
|
-
|
|
51
|
+
deleteCurrentItem($cursor)(tr);
|
|
52
|
+
setTextSelection(insertPos)(tr);
|
|
53
|
+
dispatch(tr.scrollIntoView());
|
|
51
54
|
return true;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
// Handle not nested empty code block
|
|
55
|
-
if ((0,
|
|
58
|
+
if ((0, _utils3.isEmptyNode)(schema)($cursor.node())) {
|
|
56
59
|
dispatch(deleteCurrentItem($cursor)(state === null || state === void 0 ? void 0 : state.tr));
|
|
57
60
|
return true;
|
|
58
61
|
}
|
|
@@ -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
|
});
|
|
@@ -10,11 +11,12 @@ var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove
|
|
|
10
11
|
var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
|
|
11
12
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
13
|
var _actions = require("./actions");
|
|
13
|
-
var _messages =
|
|
14
|
-
var _messages2 = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
15
15
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
16
16
|
var _pluginKey = require("./plugin-key");
|
|
17
17
|
var _languageList = require("./language-list");
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
18
20
|
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
19
21
|
selectLanguage: {
|
|
20
22
|
id: 'fabric.editor.selectLanguage',
|
|
@@ -80,7 +82,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
80
82
|
// note: copyContentToClipboard contains logic that also removes the
|
|
81
83
|
// visual feedback for the copy button
|
|
82
84
|
onClick: _actions.copyContentToClipboard,
|
|
83
|
-
title: formatMessage(codeBlockState.contentCopied ?
|
|
85
|
+
title: formatMessage(codeBlockState.contentCopied ? _messages.codeBlockButtonMessages.copiedCodeToClipboard : _messages.codeBlockButtonMessages.copyCodeToClipboard),
|
|
84
86
|
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
85
87
|
// note: resetCopiedState contains logic that also removes the
|
|
86
88
|
// visual feedback for the copy button
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "findCodeBlock", {
|
|
|
9
9
|
return _transforms.findCodeBlock;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
exports.getCursor = getCursor;
|
|
12
13
|
Object.defineProperty(exports, "transformSingleLineCodeBlockToCodeMark", {
|
|
13
14
|
enumerable: true,
|
|
14
15
|
get: function get() {
|
|
@@ -21,4 +22,7 @@ Object.defineProperty(exports, "transformSliceToJoinAdjacentCodeBlocks", {
|
|
|
21
22
|
return _transforms.transformSliceToJoinAdjacentCodeBlocks;
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
25
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
26
|
+
function getCursor(selection) {
|
|
27
|
+
return selection.$cursor || undefined;
|
|
28
|
+
}
|
|
@@ -21,7 +21,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
21
21
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
22
22
|
var _toolbar = require("./toolbar");
|
|
23
23
|
var _commands = require("./commands");
|
|
24
|
-
var _messages = require("
|
|
24
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
25
25
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
26
26
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
27
27
|
var expandPlugin = function expandPlugin(_ref) {
|
|
@@ -68,8 +68,8 @@ var expandPlugin = function expandPlugin(_ref) {
|
|
|
68
68
|
}
|
|
69
69
|
return [{
|
|
70
70
|
id: 'expand',
|
|
71
|
-
title: formatMessage(_messages.
|
|
72
|
-
description: formatMessage(_messages.
|
|
71
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.expand),
|
|
72
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.expandDescription),
|
|
73
73
|
keywords: ['accordion', 'collapse'],
|
|
74
74
|
priority: 600,
|
|
75
75
|
icon: function icon() {
|
|
@@ -14,7 +14,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
14
14
|
var _versionWrapper = require("../../version-wrapper");
|
|
15
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
16
|
var _loadJiraCollectorDialogScript = _interopRequireDefault(require("./loadJiraCollectorDialogScript"));
|
|
17
|
-
var _messages = require("
|
|
17
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
20
20
|
var showJiraCollectorDialog;
|
|
@@ -98,8 +98,8 @@ var feedbackDialog = function feedbackDialog(_ref3) {
|
|
|
98
98
|
var formatMessage = _ref4.formatMessage;
|
|
99
99
|
return [{
|
|
100
100
|
id: 'feedbackdialog',
|
|
101
|
-
title: formatMessage(_messages.
|
|
102
|
-
description: formatMessage(_messages.
|
|
101
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialog),
|
|
102
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.feedbackDialogDescription),
|
|
103
103
|
priority: 400,
|
|
104
104
|
keywords: ['bug'],
|
|
105
105
|
icon: function icon() {
|
|
@@ -17,7 +17,7 @@ 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
19
|
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
20
|
-
var _messages = require("
|
|
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); }
|
|
23
23
|
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; }
|
|
@@ -57,7 +57,7 @@ var ToolbarDecision = exports.ToolbarDecision = /*#__PURE__*/function (_PureComp
|
|
|
57
57
|
isDisabled = _this$props2.isDisabled,
|
|
58
58
|
isReducedSpacing = _this$props2.isReducedSpacing,
|
|
59
59
|
formatMessage = _this$props2.intl.formatMessage;
|
|
60
|
-
var label = formatMessage(_messages.
|
|
60
|
+
var label = formatMessage(_messages.toolbarInsertBlockMessages.decision);
|
|
61
61
|
return /*#__PURE__*/_react.default.createElement(_ToolbarButton.default, {
|
|
62
62
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.DECISION_LIST,
|
|
63
63
|
onClick: this.handleInsertDecision,
|
|
@@ -17,7 +17,7 @@ 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
19
|
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
20
|
-
var _messages = require("
|
|
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); }
|
|
23
23
|
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; }
|
|
@@ -57,7 +57,7 @@ var ToolbarTask = exports.ToolbarTask = /*#__PURE__*/function (_PureComponent) {
|
|
|
57
57
|
isDisabled = _this$props2.isDisabled,
|
|
58
58
|
isReducedSpacing = _this$props2.isReducedSpacing,
|
|
59
59
|
formatMessage = _this$props2.intl.formatMessage;
|
|
60
|
-
var label = formatMessage(_messages.
|
|
60
|
+
var label = formatMessage(_messages.toolbarInsertBlockMessages.action);
|
|
61
61
|
return /*#__PURE__*/_react.default.createElement(_ToolbarButton.default, {
|
|
62
62
|
buttonId: _ToolbarButton.TOOLBAR_BUTTON.TASK_LIST,
|
|
63
63
|
onClick: this.handleInsertTask,
|
|
@@ -9,12 +9,11 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
|
-
var _classNames = require("./ui/class-names");
|
|
13
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
13
|
var _templateObject, _templateObject2;
|
|
15
14
|
var GutterDangerOverlay = function GutterDangerOverlay() {
|
|
16
15
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &::after {\n height: 100%;\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: 24px;\n background-color: ", ";\n }\n"])), "var(--ds-blanket-danger, none)");
|
|
17
16
|
};
|
|
18
17
|
var codeBlockStyles = exports.codeBlockStyles = function codeBlockStyles(props) {
|
|
19
|
-
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror li {\n /* if same list item has multiple code blocks we need top margin for all but first */\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), (0, _styles.codeBlockSharedStyles)(props), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"),
|
|
18
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror li {\n /* if same list item has multiple code blocks we need top margin for all but first */\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), (0, _styles.codeBlockSharedStyles)(props), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-danger, ".concat(_colors.R75, ")"), "var(--ds-text-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), GutterDangerOverlay(), _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-blanket-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _styles.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-danger, rgba(255, 143, 115, 0.5))", "var(--ds-text-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), GutterDangerOverlay(), _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-blanket-danger, rgba(255, 189, 173, 0.5))");
|
|
20
19
|
};
|
|
@@ -16,15 +16,15 @@ var _styles2 = require("../../plugins/collab-edit/styles");
|
|
|
16
16
|
var _commonStyles = require("@atlaskit/editor-plugin-table/ui/common-styles");
|
|
17
17
|
var _styles3 = require("@atlaskit/editor-plugin-block-type/styles");
|
|
18
18
|
var _styles4 = require("@atlaskit/editor-plugin-paste-options-toolbar/styles");
|
|
19
|
-
var
|
|
19
|
+
var _codeBlock = require("./code-block");
|
|
20
20
|
var _media = require("./media");
|
|
21
21
|
var _layout = require("./layout");
|
|
22
22
|
var _panel = require("./panel");
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
23
|
+
var _styles5 = require("@atlaskit/editor-plugin-placeholder-text/styles");
|
|
24
|
+
var _styles6 = require("../../plugins/extension/ui/styles");
|
|
25
|
+
var _styles7 = require("../../plugins/expand/ui/styles");
|
|
26
|
+
var _styles8 = require("../../plugins/find-replace/styles");
|
|
27
|
+
var _styles9 = require("../../plugins/tasks-and-decisions/styles");
|
|
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)",
|
|
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, _styles6.extensionStyles, (0, _styles7.expandStyles)(props), _styles8.findReplaceStyles, _styles4.textHighlightStyle, _styles9.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) {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -16,14 +16,12 @@ Object.defineProperty(exports, "checkNodeDown", {
|
|
|
16
16
|
return _utils2.checkNodeDown;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
exports.compose = compose;
|
|
20
19
|
Object.defineProperty(exports, "findFarthestParentNode", {
|
|
21
20
|
enumerable: true,
|
|
22
21
|
get: function get() {
|
|
23
22
|
return _document.findFarthestParentNode;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
|
-
exports.getCursor = getCursor;
|
|
27
25
|
Object.defineProperty(exports, "getNodesCount", {
|
|
28
26
|
enumerable: true,
|
|
29
27
|
get: function get() {
|
|
@@ -124,7 +122,6 @@ Object.defineProperty(exports, "nonNullable", {
|
|
|
124
122
|
return _utils2.nonNullable;
|
|
125
123
|
}
|
|
126
124
|
});
|
|
127
|
-
exports.pipe = pipe;
|
|
128
125
|
Object.defineProperty(exports, "setNodeSelection", {
|
|
129
126
|
enumerable: true,
|
|
130
127
|
get: function get() {
|
|
@@ -161,9 +158,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
161
158
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
162
159
|
return (0, _commands.toggleMark)(markType)(state);
|
|
163
160
|
}
|
|
164
|
-
function getCursor(selection) {
|
|
165
|
-
return selection.$cursor || undefined;
|
|
166
|
-
}
|
|
167
161
|
|
|
168
162
|
/**
|
|
169
163
|
* Check if a mark is allowed at the current selection / cursor based on a given state.
|
|
@@ -250,53 +244,6 @@ var isInsideBlockQuote = exports.isInsideBlockQuote = function isInsideBlockQuot
|
|
|
250
244
|
var blockquote = state.schema.nodes.blockquote;
|
|
251
245
|
return (0, _utils.hasParentNodeOfType)(blockquote)(state.selection);
|
|
252
246
|
};
|
|
253
|
-
/** Helper type for single arg function */
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Compose 1 to n functions.
|
|
257
|
-
* @param func first function
|
|
258
|
-
* @param funcs additional functions
|
|
259
|
-
*/
|
|
260
|
-
function compose(func) {
|
|
261
|
-
for (var _len = arguments.length, funcs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
262
|
-
funcs[_key - 1] = arguments[_key];
|
|
263
|
-
}
|
|
264
|
-
var allFuncs = [func].concat(funcs);
|
|
265
|
-
return function composed(raw) {
|
|
266
|
-
return allFuncs.reduceRight(function (memo, func) {
|
|
267
|
-
return func(memo);
|
|
268
|
-
}, raw);
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// one function
|
|
273
|
-
|
|
274
|
-
// two function
|
|
275
|
-
|
|
276
|
-
// three function
|
|
277
|
-
|
|
278
|
-
// If needed add more than 3 function
|
|
279
|
-
// Generic
|
|
280
|
-
|
|
281
|
-
// rest
|
|
282
|
-
function pipe() {
|
|
283
|
-
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
284
|
-
fns[_key2] = arguments[_key2];
|
|
285
|
-
}
|
|
286
|
-
if (fns.length === 0) {
|
|
287
|
-
return function (a) {
|
|
288
|
-
return a;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
if (fns.length === 1) {
|
|
292
|
-
return fns[0];
|
|
293
|
-
}
|
|
294
|
-
return fns.reduce(function (prevFn, nextFn) {
|
|
295
|
-
return function () {
|
|
296
|
-
return nextFn(prevFn.apply(void 0, arguments));
|
|
297
|
-
};
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
247
|
function sum(arr, f) {
|
|
301
248
|
return arr.reduce(function (val, x) {
|
|
302
249
|
return val + f(x);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "189.3.
|
|
8
|
+
var version = exports.version = "189.3.3";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -3,7 +3,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { pluginKey } from './plugin-key';
|
|
4
4
|
import { copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
5
5
|
import { ACTIONS } from './pm-plugins/actions';
|
|
6
|
-
import { copyToClipboard } from '
|
|
6
|
+
import { copyToClipboard } from '@atlaskit/editor-common/clipboard';
|
|
7
7
|
import { shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
8
8
|
import { transformToCodeBlockAction } from './transform-to-code-block';
|
|
9
9
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCursor } from '
|
|
1
|
+
import { getCursor } from '../utils';
|
|
2
2
|
export const isSelectionEntirelyInsideCodeBlock = state => state.selection.$from.sameParent(state.selection.$to) && state.selection.$from.parent.type === state.schema.nodes.codeBlock;
|
|
3
3
|
export const isCursorInsideCodeBlock = state => !!getCursor(state.selection) && isSelectionEntirelyInsideCodeBlock(state);
|
|
4
4
|
export const getStartOfCurrentLine = state => {
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { getCursor } from '
|
|
5
|
+
import { getCursor } from '../utils';
|
|
6
6
|
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isCursorBeforeClosingCharacter, isClosingCharacter } from '../ide-ux/paired-character-handling';
|
|
8
8
|
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bracket-handling';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { getCursor
|
|
4
|
+
import { getCursor } from '../utils';
|
|
5
|
+
import { isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
5
6
|
const deleteCurrentItem = $from => tr => {
|
|
6
7
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
7
8
|
};
|
|
@@ -39,7 +40,9 @@ export function keymapPlugin(schema) {
|
|
|
39
40
|
tr
|
|
40
41
|
} = state;
|
|
41
42
|
const insertPos = $cursor.pos;
|
|
42
|
-
|
|
43
|
+
deleteCurrentItem($cursor)(tr);
|
|
44
|
+
setTextSelection(insertPos)(tr);
|
|
45
|
+
dispatch(tr.scrollIntoView());
|
|
43
46
|
return true;
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -3,8 +3,7 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
3
3
|
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
4
4
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { removeCodeBlock, changeLanguage, copyContentToClipboard, resetCopiedState } from './actions';
|
|
6
|
-
import commonMessages from '
|
|
7
|
-
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import commonMessages, { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
8
7
|
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
9
8
|
import { pluginKey } from './plugin-key';
|
|
10
9
|
import { createLanguageList, getLanguageIdentifier, DEFAULT_LANGUAGES } from './language-list';
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
|
|
1
|
+
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
export function getCursor(selection) {
|
|
3
|
+
return selection.$cursor || undefined;
|
|
4
|
+
}
|
|
@@ -6,7 +6,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { getToolbarConfig } from './toolbar';
|
|
8
8
|
import { createExpandNode, insertExpand } from './commands';
|
|
9
|
-
import { messages } from '
|
|
9
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
11
11
|
const expandPlugin = ({
|
|
12
12
|
config: options = {},
|
|
@@ -3,7 +3,7 @@ import { IconFeedback } from '@atlaskit/editor-common/quick-insert';
|
|
|
3
3
|
import { version as coreVersion } from '../../version-wrapper';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import loadJiraCollectorDialogScript from './loadJiraCollectorDialogScript';
|
|
6
|
-
import { messages } from '
|
|
6
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
let showJiraCollectorDialog;
|
|
8
8
|
let feedbackInfoHash;
|
|
9
9
|
let defaultFeedbackInfo;
|
|
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
4
|
import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
|
|
5
5
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
6
|
-
import { messages } from '
|
|
6
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { insertTaskDecisionCommand } from '../../commands';
|
|
8
8
|
export class ToolbarDecision extends PureComponent {
|
|
9
9
|
constructor(...args) {
|
|
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
4
|
import TaskIcon from '@atlaskit/icon/glyph/editor/task';
|
|
5
5
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
6
|
-
import { messages } from '
|
|
6
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { insertTaskDecisionCommand } from '../../commands';
|
|
8
8
|
export class ToolbarTask extends PureComponent {
|
|
9
9
|
constructor(...args) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { R75 } from '@atlaskit/theme/colors';
|
|
3
3
|
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import {
|
|
5
|
-
import { codeBlockSharedStyles } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { codeBlockSharedStyles, CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
6
5
|
const GutterDangerOverlay = () => css`
|
|
7
6
|
&::after {
|
|
8
7
|
height: 100%;
|
|
@@ -43,26 +42,26 @@ export const codeBlockStyles = props => css`
|
|
|
43
42
|
box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px
|
|
44
43
|
${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
|
|
45
44
|
|
|
46
|
-
.${
|
|
45
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER} {
|
|
47
46
|
background-color: ${`var(--ds-background-danger, ${R75})`};
|
|
48
47
|
color: ${`var(--ds-text-danger, ${akEditorDeleteIconColor})`};
|
|
49
48
|
${GutterDangerOverlay()};
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
.${
|
|
51
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT} {
|
|
53
52
|
background-color: ${`var(--ds-blanket-danger, ${akEditorDeleteBackground})`};
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/* Danger when nested node */
|
|
58
57
|
.ProseMirror .danger .code-block {
|
|
59
|
-
.${
|
|
58
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER} {
|
|
60
59
|
background-color: ${"var(--ds-background-danger, rgba(255, 143, 115, 0.5))"};
|
|
61
60
|
color: ${`var(--ds-text-danger, ${akEditorDeleteIconColor})`};
|
|
62
61
|
${GutterDangerOverlay()};
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
.${
|
|
64
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT} {
|
|
66
65
|
background-color: ${"var(--ds-blanket-danger, rgba(255, 189, 173, 0.5))"};
|
|
67
66
|
}
|
|
68
67
|
}
|
|
@@ -8,7 +8,7 @@ import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
|
8
8
|
import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
9
9
|
import { blocktypeStyles } from '@atlaskit/editor-plugin-block-type/styles';
|
|
10
10
|
import { textHighlightStyle } from '@atlaskit/editor-plugin-paste-options-toolbar/styles';
|
|
11
|
-
import { codeBlockStyles } from '
|
|
11
|
+
import { codeBlockStyles } from './code-block';
|
|
12
12
|
import { mediaStyles } from './media';
|
|
13
13
|
import { layoutStyles } from './layout';
|
|
14
14
|
import { panelStyles } from './panel';
|
|
@@ -12,9 +12,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
12
12
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
13
13
|
return toggleMark(markType)(state);
|
|
14
14
|
}
|
|
15
|
-
export function getCursor(selection) {
|
|
16
|
-
return selection.$cursor || undefined;
|
|
17
|
-
}
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* Check if a mark is allowed at the current selection / cursor based on a given state.
|
|
@@ -104,39 +101,6 @@ export const isInsideBlockQuote = state => {
|
|
|
104
101
|
return hasParentNodeOfType(blockquote)(state.selection);
|
|
105
102
|
};
|
|
106
103
|
export { isTextSelection, isElementInTableCell, isLastItemMediaGroup, nonNullable } from '@atlaskit/editor-common/utils';
|
|
107
|
-
|
|
108
|
-
/** Helper type for single arg function */
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Compose 1 to n functions.
|
|
112
|
-
* @param func first function
|
|
113
|
-
* @param funcs additional functions
|
|
114
|
-
*/
|
|
115
|
-
export function compose(func, ...funcs) {
|
|
116
|
-
const allFuncs = [func, ...funcs];
|
|
117
|
-
return function composed(raw) {
|
|
118
|
-
return allFuncs.reduceRight((memo, func) => func(memo), raw);
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// one function
|
|
123
|
-
|
|
124
|
-
// two function
|
|
125
|
-
|
|
126
|
-
// three function
|
|
127
|
-
|
|
128
|
-
// If needed add more than 3 function
|
|
129
|
-
// Generic
|
|
130
|
-
// rest
|
|
131
|
-
export function pipe(...fns) {
|
|
132
|
-
if (fns.length === 0) {
|
|
133
|
-
return a => a;
|
|
134
|
-
}
|
|
135
|
-
if (fns.length === 1) {
|
|
136
|
-
return fns[0];
|
|
137
|
-
}
|
|
138
|
-
return fns.reduce((prevFn, nextFn) => (...args) => nextFn(prevFn(...args)));
|
|
139
|
-
}
|
|
140
104
|
export function sum(arr, f) {
|
|
141
105
|
return arr.reduce((val, x) => val + f(x), 0);
|
|
142
106
|
}
|
|
@@ -3,7 +3,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { pluginKey } from './plugin-key';
|
|
4
4
|
import { copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
5
5
|
import { ACTIONS } from './pm-plugins/actions';
|
|
6
|
-
import { copyToClipboard } from '
|
|
6
|
+
import { copyToClipboard } from '@atlaskit/editor-common/clipboard';
|
|
7
7
|
import { shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
8
8
|
import { transformToCodeBlockAction } from './transform-to-code-block';
|
|
9
9
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCursor } from '
|
|
1
|
+
import { getCursor } from '../utils';
|
|
2
2
|
export var isSelectionEntirelyInsideCodeBlock = function isSelectionEntirelyInsideCodeBlock(state) {
|
|
3
3
|
return state.selection.$from.sameParent(state.selection.$to) && state.selection.$from.parent.type === state.schema.nodes.codeBlock;
|
|
4
4
|
};
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { getCursor } from '
|
|
5
|
+
import { getCursor } from '../utils';
|
|
6
6
|
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isCursorBeforeClosingCharacter, isClosingCharacter } from '../ide-ux/paired-character-handling';
|
|
8
8
|
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bracket-handling';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
2
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { getCursor
|
|
4
|
+
import { getCursor } from '../utils';
|
|
5
|
+
import { isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
5
6
|
var deleteCurrentItem = function deleteCurrentItem($from) {
|
|
6
7
|
return function (tr) {
|
|
7
8
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
@@ -40,7 +41,9 @@ export function keymapPlugin(schema) {
|
|
|
40
41
|
if ($cursor.node && isEmptyNode(schema)($cursor.node()) && (hasParentNodeOfType(layoutColumn)(state.selection) || hasParentNodeOfType(table)(state.selection))) {
|
|
41
42
|
var tr = state.tr;
|
|
42
43
|
var insertPos = $cursor.pos;
|
|
43
|
-
|
|
44
|
+
deleteCurrentItem($cursor)(tr);
|
|
45
|
+
setTextSelection(insertPos)(tr);
|
|
46
|
+
dispatch(tr.scrollIntoView());
|
|
44
47
|
return true;
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -3,8 +3,7 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
3
3
|
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
4
4
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { removeCodeBlock, changeLanguage, copyContentToClipboard, resetCopiedState } from './actions';
|
|
6
|
-
import commonMessages from '
|
|
7
|
-
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import commonMessages, { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
8
7
|
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
9
8
|
import { pluginKey } from './plugin-key';
|
|
10
9
|
import { createLanguageList, getLanguageIdentifier, DEFAULT_LANGUAGES } from './language-list';
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
|
|
1
|
+
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
export function getCursor(selection) {
|
|
3
|
+
return selection.$cursor || undefined;
|
|
4
|
+
}
|
|
@@ -7,7 +7,7 @@ import { IconExpand } from '@atlaskit/editor-common/quick-insert';
|
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { getToolbarConfig } from './toolbar';
|
|
9
9
|
import { createExpandNode, insertExpand } from './commands';
|
|
10
|
-
import { messages } from '
|
|
10
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
12
12
|
var expandPlugin = function expandPlugin(_ref) {
|
|
13
13
|
var _api$featureFlags, _api$analytics;
|
|
@@ -9,7 +9,7 @@ import { IconFeedback } from '@atlaskit/editor-common/quick-insert';
|
|
|
9
9
|
import { version as coreVersion } from '../../version-wrapper';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
11
11
|
import loadJiraCollectorDialogScript from './loadJiraCollectorDialogScript';
|
|
12
|
-
import { messages } from '
|
|
12
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
var showJiraCollectorDialog;
|
|
14
14
|
var feedbackInfoHash;
|
|
15
15
|
var defaultFeedbackInfo;
|
|
@@ -11,7 +11,7 @@ import React, { PureComponent } from 'react';
|
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
|
|
13
13
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
14
|
-
import { messages } from '
|
|
14
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { insertTaskDecisionCommand } from '../../commands';
|
|
16
16
|
export var ToolbarDecision = /*#__PURE__*/function (_PureComponent) {
|
|
17
17
|
_inherits(ToolbarDecision, _PureComponent);
|
|
@@ -11,7 +11,7 @@ import React, { PureComponent } from 'react';
|
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import TaskIcon from '@atlaskit/icon/glyph/editor/task';
|
|
13
13
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
14
|
-
import { messages } from '
|
|
14
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { insertTaskDecisionCommand } from '../../commands';
|
|
16
16
|
export var ToolbarTask = /*#__PURE__*/function (_PureComponent) {
|
|
17
17
|
_inherits(ToolbarTask, _PureComponent);
|
|
@@ -3,11 +3,10 @@ var _templateObject, _templateObject2;
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { R75 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import {
|
|
7
|
-
import { codeBlockSharedStyles } from '@atlaskit/editor-common/styles';
|
|
6
|
+
import { codeBlockSharedStyles, CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
8
7
|
var GutterDangerOverlay = function GutterDangerOverlay() {
|
|
9
8
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::after {\n height: 100%;\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n width: 24px;\n background-color: ", ";\n }\n"])), "var(--ds-blanket-danger, none)");
|
|
10
9
|
};
|
|
11
10
|
export var codeBlockStyles = function codeBlockStyles(props) {
|
|
12
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror li {\n /* if same list item has multiple code blocks we need top margin for all but first */\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), codeBlockSharedStyles(props), blockNodesVerticalMargin, blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"),
|
|
11
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror li {\n /* if same list item has multiple code blocks we need top margin for all but first */\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), codeBlockSharedStyles(props), blockNodesVerticalMargin, blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-danger, ".concat(R75, ")"), "var(--ds-text-danger, ".concat(akEditorDeleteIconColor, ")"), GutterDangerOverlay(), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-blanket-danger, ".concat(akEditorDeleteBackground, ")"), CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-danger, rgba(255, 143, 115, 0.5))", "var(--ds-text-danger, ".concat(akEditorDeleteIconColor, ")"), GutterDangerOverlay(), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, "var(--ds-blanket-danger, rgba(255, 189, 173, 0.5))");
|
|
13
12
|
};
|
|
@@ -10,7 +10,7 @@ import { telepointerStyle } from '../../plugins/collab-edit/styles';
|
|
|
10
10
|
import { tableStyles } from '@atlaskit/editor-plugin-table/ui/common-styles';
|
|
11
11
|
import { blocktypeStyles } from '@atlaskit/editor-plugin-block-type/styles';
|
|
12
12
|
import { textHighlightStyle } from '@atlaskit/editor-plugin-paste-options-toolbar/styles';
|
|
13
|
-
import { codeBlockStyles } from '
|
|
13
|
+
import { codeBlockStyles } from './code-block';
|
|
14
14
|
import { mediaStyles } from './media';
|
|
15
15
|
import { layoutStyles } from './layout';
|
|
16
16
|
import { panelStyles } from './panel';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -12,9 +12,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
12
12
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
13
13
|
return toggleMark(markType)(state);
|
|
14
14
|
}
|
|
15
|
-
export function getCursor(selection) {
|
|
16
|
-
return selection.$cursor || undefined;
|
|
17
|
-
}
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* Check if a mark is allowed at the current selection / cursor based on a given state.
|
|
@@ -102,53 +99,6 @@ export var isInsideBlockQuote = function isInsideBlockQuote(state) {
|
|
|
102
99
|
return hasParentNodeOfType(blockquote)(state.selection);
|
|
103
100
|
};
|
|
104
101
|
export { isTextSelection, isElementInTableCell, isLastItemMediaGroup, nonNullable } from '@atlaskit/editor-common/utils';
|
|
105
|
-
|
|
106
|
-
/** Helper type for single arg function */
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Compose 1 to n functions.
|
|
110
|
-
* @param func first function
|
|
111
|
-
* @param funcs additional functions
|
|
112
|
-
*/
|
|
113
|
-
export function compose(func) {
|
|
114
|
-
for (var _len = arguments.length, funcs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
115
|
-
funcs[_key - 1] = arguments[_key];
|
|
116
|
-
}
|
|
117
|
-
var allFuncs = [func].concat(funcs);
|
|
118
|
-
return function composed(raw) {
|
|
119
|
-
return allFuncs.reduceRight(function (memo, func) {
|
|
120
|
-
return func(memo);
|
|
121
|
-
}, raw);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// one function
|
|
126
|
-
|
|
127
|
-
// two function
|
|
128
|
-
|
|
129
|
-
// three function
|
|
130
|
-
|
|
131
|
-
// If needed add more than 3 function
|
|
132
|
-
// Generic
|
|
133
|
-
// rest
|
|
134
|
-
export function pipe() {
|
|
135
|
-
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
136
|
-
fns[_key2] = arguments[_key2];
|
|
137
|
-
}
|
|
138
|
-
if (fns.length === 0) {
|
|
139
|
-
return function (a) {
|
|
140
|
-
return a;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
if (fns.length === 1) {
|
|
144
|
-
return fns[0];
|
|
145
|
-
}
|
|
146
|
-
return fns.reduce(function (prevFn, nextFn) {
|
|
147
|
-
return function () {
|
|
148
|
-
return nextFn(prevFn.apply(void 0, arguments));
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
102
|
export function sum(arr, f) {
|
|
153
103
|
return arr.reduce(function (val, x) {
|
|
154
104
|
return val + f(x);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Command } from '
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
export declare const removeCodeBlock: Command;
|
|
5
5
|
export declare const changeLanguage: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (language: string) => Command;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { getPosHandlerNode, getPosHandler } from '
|
|
3
|
+
import type { getPosHandlerNode, getPosHandler } from '@atlaskit/editor-common/types';
|
|
4
4
|
export declare class CodeBlockView {
|
|
5
5
|
node: Node;
|
|
6
6
|
dom: HTMLElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type codeBlockPlugin from '../';
|
|
3
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type codeBlockPlugin from '../';
|
|
4
4
|
declare const ideUX: (pluginInjectionApi: ExtractInjectionAPI<typeof codeBlockPlugin> | undefined) => SafePlugin<any>;
|
|
5
5
|
export default ideUX;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { CodeBlockState } from './main-state';
|
|
5
5
|
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, }: {
|
|
6
6
|
useLongPressSelection?: boolean | undefined;
|
|
7
7
|
getIntl: () => IntlShape;
|
|
8
|
-
appearance:
|
|
8
|
+
appearance: EditorAppearance;
|
|
9
9
|
allowCompositionInputOverride?: boolean | undefined;
|
|
10
10
|
}) => SafePlugin<CodeBlockState>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { EditorAppearance } from '
|
|
2
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { LongPressSelectionPluginOptions, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
2
|
export interface CodeBlockOptions extends LongPressSelectionPluginOptions {
|
|
4
3
|
allowCopyToClipboard?: boolean;
|
|
5
4
|
allowCompositionInputOverride?: boolean;
|
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare function getCursor(selection: Selection): ResolvedPos | undefined;
|
package/dist/{types-ts4.5/plugins/code-block/styles.d.ts → types/ui/ContentStyles/code-block.d.ts}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const codeBlockStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MarkType,
|
|
2
|
-
import type { EditorState
|
|
1
|
+
import type { MarkType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, toJSON, nodeToJSON, } from '@atlaskit/editor-common/utils';
|
|
5
5
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
@@ -8,7 +8,6 @@ export { isParagraph, isText, isLinkMark } from './nodes';
|
|
|
8
8
|
export { setNodeSelection, setTextSelection } from './selection';
|
|
9
9
|
export type { JSONDocNode };
|
|
10
10
|
export { default as measurements } from './performance/measure-enum';
|
|
11
|
-
export declare function getCursor(selection: Selection): ResolvedPos | undefined;
|
|
12
11
|
/**
|
|
13
12
|
* Check if a mark is allowed at the current selection / cursor based on a given state.
|
|
14
13
|
* This method looks at both the currently active marks on the transaction, as well as
|
|
@@ -25,20 +24,5 @@ export declare const isTemporary: (id: string) => boolean;
|
|
|
25
24
|
export declare const hasOpenEnd: (slice: Slice) => boolean;
|
|
26
25
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
27
26
|
export { isTextSelection, isElementInTableCell, isLastItemMediaGroup, nonNullable, } from '@atlaskit/editor-common/utils';
|
|
28
|
-
/** Helper type for single arg function */
|
|
29
|
-
type Func<A, B> = (a: A) => B;
|
|
30
|
-
type FuncN<A extends any[], B> = (...args: A) => B;
|
|
31
|
-
/**
|
|
32
|
-
* Compose 1 to n functions.
|
|
33
|
-
* @param func first function
|
|
34
|
-
* @param funcs additional functions
|
|
35
|
-
*/
|
|
36
|
-
export declare function compose<F1 extends Func<any, any>, FN extends Array<Func<any, any>>, R extends FN extends [] ? F1 : FN extends [Func<infer A, any>] ? (a: A) => ReturnType<F1> : FN extends [any, Func<infer A, any>] ? (a: A) => ReturnType<F1> : FN extends [any, any, Func<infer A, any>] ? (a: A) => ReturnType<F1> : FN extends [any, any, any, Func<infer A, any>] ? (a: A) => ReturnType<F1> : FN extends [any, any, any, any, Func<infer A, any>] ? (a: A) => ReturnType<F1> : Func<any, ReturnType<F1>>>(func: F1, ...funcs: FN): R;
|
|
37
|
-
export declare function pipe(): <R>(a: R) => R;
|
|
38
|
-
export declare function pipe<F extends Function>(f: F): F;
|
|
39
|
-
export declare function pipe<F1 extends FuncN<any, any>>(f1: F1): (...args: Parameters<F1>) => ReturnType<F1>;
|
|
40
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>>(f1: F1, f2: F2): (...args: Parameters<F1>) => ReturnType<F2>;
|
|
41
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>, F3 extends Func<ReturnType<F2>, any>>(f1: F1, f2: F2, f3: F3): (...args: Parameters<F1>) => ReturnType<F3>;
|
|
42
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>, F3 extends Func<ReturnType<F2>, any>, FN extends Array<Func<any, any>>>(f1: F1, f2: F2, f3: F3, ...fn: FN): (...args: Parameters<F1>) => any;
|
|
43
27
|
export declare function sum<T>(arr: Array<T>, f: (val: T) => number): number;
|
|
44
28
|
export { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Command } from '
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
export declare const removeCodeBlock: Command;
|
|
5
5
|
export declare const changeLanguage: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (language: string) => Command;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { getPosHandlerNode, getPosHandler } from '
|
|
3
|
+
import type { getPosHandlerNode, getPosHandler } from '@atlaskit/editor-common/types';
|
|
4
4
|
export declare class CodeBlockView {
|
|
5
5
|
node: Node;
|
|
6
6
|
dom: HTMLElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type codeBlockPlugin from '../';
|
|
3
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type codeBlockPlugin from '../';
|
|
4
4
|
declare const ideUX: (pluginInjectionApi: ExtractInjectionAPI<typeof codeBlockPlugin> | undefined) => SafePlugin<any>;
|
|
5
5
|
export default ideUX;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { CodeBlockState } from './main-state';
|
|
5
5
|
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, }: {
|
|
6
6
|
useLongPressSelection?: boolean | undefined;
|
|
7
7
|
getIntl: () => IntlShape;
|
|
8
|
-
appearance:
|
|
8
|
+
appearance: EditorAppearance;
|
|
9
9
|
allowCompositionInputOverride?: boolean | undefined;
|
|
10
10
|
}) => SafePlugin<CodeBlockState>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { EditorAppearance } from '
|
|
2
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { LongPressSelectionPluginOptions, EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
2
|
export interface CodeBlockOptions extends LongPressSelectionPluginOptions {
|
|
4
3
|
allowCopyToClipboard?: boolean;
|
|
5
4
|
allowCompositionInputOverride?: boolean;
|
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare function getCursor(selection: Selection): ResolvedPos | undefined;
|
package/dist/{types/plugins/code-block/styles.d.ts → types-ts4.5/ui/ContentStyles/code-block.d.ts}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const codeBlockStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MarkType,
|
|
2
|
-
import type { EditorState
|
|
1
|
+
import type { MarkType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
export { isEmptyNode, isSelectionInsideLastNodeInDocument, checkNodeDown, insideTableCell, isInListItem, toJSON, nodeToJSON, } from '@atlaskit/editor-common/utils';
|
|
5
5
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
@@ -8,7 +8,6 @@ export { isParagraph, isText, isLinkMark } from './nodes';
|
|
|
8
8
|
export { setNodeSelection, setTextSelection } from './selection';
|
|
9
9
|
export type { JSONDocNode };
|
|
10
10
|
export { default as measurements } from './performance/measure-enum';
|
|
11
|
-
export declare function getCursor(selection: Selection): ResolvedPos | undefined;
|
|
12
11
|
/**
|
|
13
12
|
* Check if a mark is allowed at the current selection / cursor based on a given state.
|
|
14
13
|
* This method looks at both the currently active marks on the transaction, as well as
|
|
@@ -25,41 +24,5 @@ export declare const isTemporary: (id: string) => boolean;
|
|
|
25
24
|
export declare const hasOpenEnd: (slice: Slice) => boolean;
|
|
26
25
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
27
26
|
export { isTextSelection, isElementInTableCell, isLastItemMediaGroup, nonNullable, } from '@atlaskit/editor-common/utils';
|
|
28
|
-
/** Helper type for single arg function */
|
|
29
|
-
type Func<A, B> = (a: A) => B;
|
|
30
|
-
type FuncN<A extends any[], B> = (...args: A) => B;
|
|
31
|
-
/**
|
|
32
|
-
* Compose 1 to n functions.
|
|
33
|
-
* @param func first function
|
|
34
|
-
* @param funcs additional functions
|
|
35
|
-
*/
|
|
36
|
-
export declare function compose<F1 extends Func<any, any>, FN extends Array<Func<any, any>>, R extends FN extends [
|
|
37
|
-
] ? F1 : FN extends [
|
|
38
|
-
Func<infer A, any>
|
|
39
|
-
] ? (a: A) => ReturnType<F1> : FN extends [
|
|
40
|
-
any,
|
|
41
|
-
Func<infer A, any>
|
|
42
|
-
] ? (a: A) => ReturnType<F1> : FN extends [
|
|
43
|
-
any,
|
|
44
|
-
any,
|
|
45
|
-
Func<infer A, any>
|
|
46
|
-
] ? (a: A) => ReturnType<F1> : FN extends [
|
|
47
|
-
any,
|
|
48
|
-
any,
|
|
49
|
-
any,
|
|
50
|
-
Func<infer A, any>
|
|
51
|
-
] ? (a: A) => ReturnType<F1> : FN extends [
|
|
52
|
-
any,
|
|
53
|
-
any,
|
|
54
|
-
any,
|
|
55
|
-
any,
|
|
56
|
-
Func<infer A, any>
|
|
57
|
-
] ? (a: A) => ReturnType<F1> : Func<any, ReturnType<F1>>>(func: F1, ...funcs: FN): R;
|
|
58
|
-
export declare function pipe(): <R>(a: R) => R;
|
|
59
|
-
export declare function pipe<F extends Function>(f: F): F;
|
|
60
|
-
export declare function pipe<F1 extends FuncN<any, any>>(f1: F1): (...args: Parameters<F1>) => ReturnType<F1>;
|
|
61
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>>(f1: F1, f2: F2): (...args: Parameters<F1>) => ReturnType<F2>;
|
|
62
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>, F3 extends Func<ReturnType<F2>, any>>(f1: F1, f2: F2, f3: F3): (...args: Parameters<F1>) => ReturnType<F3>;
|
|
63
|
-
export declare function pipe<F1 extends FuncN<any, any>, F2 extends Func<ReturnType<F1>, any>, F3 extends Func<ReturnType<F2>, any>, FN extends Array<Func<any, any>>>(f1: F1, f2: F2, f3: F3, ...fn: FN): (...args: Parameters<F1>) => any;
|
|
64
27
|
export declare function sum<T>(arr: Array<T>, f: (val: T) => number): number;
|
|
65
28
|
export { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.3.
|
|
3
|
+
"version": "189.3.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -237,9 +237,6 @@
|
|
|
237
237
|
"platform.editor.custom-table-width": {
|
|
238
238
|
"type": "boolean"
|
|
239
239
|
},
|
|
240
|
-
"platform.linking-platform.editor.fix-link-insert-analytics": {
|
|
241
|
-
"type": "boolean"
|
|
242
|
-
},
|
|
243
240
|
"platform.editor.table-sticky-scrollbar": {
|
|
244
241
|
"type": "boolean"
|
|
245
242
|
},
|