@atlaskit/editor-core 189.3.38 → 189.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/plugins/extension/commands.js +9 -2
- package/dist/cjs/plugins/extension/index.js +15 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/extension/toolbar.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/cjs/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/cjs/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +154 -0
- package/dist/cjs/plugins/extension/utils.js +6 -4
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/ui/ContentStyles/extension.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/extension/commands.js +10 -3
- package/dist/es2019/plugins/extension/index.js +16 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/extension/toolbar.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/es2019/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/es2019/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +159 -0
- package/dist/es2019/plugins/extension/utils.js +6 -4
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/ui/ContentStyles/extension.js +6 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/extension/commands.js +9 -2
- package/dist/esm/plugins/extension/index.js +16 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/extension/toolbar.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +1 -8
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +29 -10
- package/dist/esm/plugins/extension/ui/Extension/ExtensionNodeWrapper.js +7 -0
- package/dist/esm/plugins/extension/ui/Extension/MultiBodiedExtension/index.js +146 -0
- package/dist/esm/plugins/extension/utils.js +6 -4
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/ui/ContentStyles/extension.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/extension/commands.d.ts +2 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +1 -0
- package/dist/types/plugins/extension/ui/Extension/ExtensionNodeWrapper.d.ts +7 -0
- package/dist/types/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +16 -0
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +1 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionNodeWrapper.d.ts +7 -0
- package/dist/types-ts4.5/plugins/extension/ui/Extension/MultiBodiedExtension/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/package.json +7 -6
- package/dist/cjs/plugins/insert-block/index.js +0 -165
- package/dist/cjs/plugins/insert-block/types.js +0 -5
- package/dist/cjs/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -152
- package/dist/cjs/plugins/insert-block/ui/ElementBrowser/types.js +0 -5
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -42
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -66
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -217
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -49
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -565
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -250
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -12
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -20
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -30
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -11
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -5
- package/dist/es2019/plugins/insert-block/index.js +0 -159
- package/dist/es2019/plugins/insert-block/types.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -150
- package/dist/es2019/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -198
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -37
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -558
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -201
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -8
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -22
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -16
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +0 -158
- package/dist/esm/plugins/insert-block/types.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -146
- package/dist/esm/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -210
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -41
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -560
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -243
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -13
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -24
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -4
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +0 -16
- package/dist/types/plugins/insert-block/types.d.ts +0 -45
- package/dist/types/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
- package/dist/types/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -39
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +0 -16
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +0 -45
- package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
- package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -42
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _templateObject;
|
|
5
|
+
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; }
|
|
6
|
+
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) { _defineProperty(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; }
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
|
|
9
|
+
import { jsx, css } from '@emotion/react';
|
|
10
|
+
import { N30 } from '@atlaskit/theme/colors';
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_ref) {
|
|
13
|
+
var updateActiveChild = _ref.updateActiveChild,
|
|
14
|
+
editorView = _ref.editorView,
|
|
15
|
+
getPos = _ref.getPos,
|
|
16
|
+
node = _ref.node;
|
|
17
|
+
var actions = React.useMemo(function () {
|
|
18
|
+
return {
|
|
19
|
+
changeActive: function changeActive(index) {
|
|
20
|
+
return updateActiveChild(index);
|
|
21
|
+
},
|
|
22
|
+
addChild: function addChild() {
|
|
23
|
+
var state = editorView.state,
|
|
24
|
+
dispatch = editorView.dispatch;
|
|
25
|
+
if (node.content.childCount >= node.attrs.maxFrames) {
|
|
26
|
+
// TODO: add proper log on this
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
var p = state.schema.nodes.paragraph.createAndFill({});
|
|
30
|
+
if (!p) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
var frame = state.schema.nodes.extensionFrame.createAndFill({}, [p]);
|
|
34
|
+
var pos = getPos();
|
|
35
|
+
if (typeof pos !== 'number' || !frame) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
var insertAt = Math.min((pos || 1) + node.content.size, state.doc.content.size);
|
|
39
|
+
dispatch(state.tr.insert(insertAt, frame));
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
getChildrenCount: function getChildrenCount() {
|
|
43
|
+
return node.content.childCount;
|
|
44
|
+
},
|
|
45
|
+
removeChild: function removeChild(index) {
|
|
46
|
+
var pos = getPos();
|
|
47
|
+
// TODO: Add child index validation here, don't trust this data
|
|
48
|
+
if (typeof pos !== 'number' || typeof index !== 'number') {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
var state = editorView.state,
|
|
52
|
+
dispatch = editorView.dispatch;
|
|
53
|
+
if (node.content.childCount === 1) {
|
|
54
|
+
var _tr = state.tr;
|
|
55
|
+
_tr.deleteRange(pos, pos + node.content.size);
|
|
56
|
+
dispatch(_tr);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
var $pos = state.doc.resolve(pos);
|
|
60
|
+
var $startNodePos = state.doc.resolve($pos.start($pos.depth + 1));
|
|
61
|
+
var startFramePosition = $startNodePos.posAtIndex(index);
|
|
62
|
+
var maybeFrameNode = state.doc.nodeAt(startFramePosition);
|
|
63
|
+
if (!maybeFrameNode) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
var endFramePosition = maybeFrameNode.content.size + startFramePosition;
|
|
67
|
+
var tr = state.tr;
|
|
68
|
+
tr.deleteRange(startFramePosition, endFramePosition);
|
|
69
|
+
dispatch(tr);
|
|
70
|
+
return true;
|
|
71
|
+
},
|
|
72
|
+
updateParameters: function updateParameters(parameters) {
|
|
73
|
+
var state = editorView.state,
|
|
74
|
+
dispatch = editorView.dispatch;
|
|
75
|
+
var pos = getPos();
|
|
76
|
+
if (typeof pos !== 'number') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
80
|
+
parameters: parameters
|
|
81
|
+
}));
|
|
82
|
+
dispatch(tr);
|
|
83
|
+
return true;
|
|
84
|
+
},
|
|
85
|
+
getChildren: function getChildren() {
|
|
86
|
+
var _state$doc$nodeAt;
|
|
87
|
+
var state = editorView.state;
|
|
88
|
+
var pos = getPos();
|
|
89
|
+
if (typeof pos !== 'number') {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
var children = (_state$doc$nodeAt = state.doc.nodeAt(pos)) === null || _state$doc$nodeAt === void 0 ? void 0 : _state$doc$nodeAt.content;
|
|
93
|
+
return children ? children.toJSON() : [];
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, [node, editorView, getPos, updateActiveChild]);
|
|
97
|
+
return actions;
|
|
98
|
+
};
|
|
99
|
+
var MultiBodiedExtension = function MultiBodiedExtension(_ref2) {
|
|
100
|
+
var node = _ref2.node,
|
|
101
|
+
handleContentDOMRef = _ref2.handleContentDOMRef,
|
|
102
|
+
getPos = _ref2.getPos,
|
|
103
|
+
tryExtensionHandler = _ref2.tryExtensionHandler,
|
|
104
|
+
editorView = _ref2.editorView;
|
|
105
|
+
var _useState = useState(0),
|
|
106
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
107
|
+
activeChildIndex = _useState2[0],
|
|
108
|
+
setActiveChildIndex = _useState2[1];
|
|
109
|
+
// Adding to avoid aliasing `this` for the callbacks
|
|
110
|
+
var updateActiveChild = React.useCallback(function (index) {
|
|
111
|
+
if (typeof index !== 'number') {
|
|
112
|
+
// TODO: Make sure we log this somewhere if this happens
|
|
113
|
+
setActiveChildIndex(0);
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
setActiveChildIndex(index);
|
|
117
|
+
return true;
|
|
118
|
+
}, [setActiveChildIndex]);
|
|
119
|
+
var actions = useMultiBodiedExtensionActions({
|
|
120
|
+
updateActiveChild: updateActiveChild,
|
|
121
|
+
editorView: editorView,
|
|
122
|
+
getPos: getPos,
|
|
123
|
+
node: node
|
|
124
|
+
});
|
|
125
|
+
var extensionHandlerResult = React.useMemo(function () {
|
|
126
|
+
return tryExtensionHandler(actions);
|
|
127
|
+
}, [tryExtensionHandler, actions]);
|
|
128
|
+
var articleRef = React.useCallback(function (node) {
|
|
129
|
+
return handleContentDOMRef(node);
|
|
130
|
+
}, [handleContentDOMRef]);
|
|
131
|
+
var containerCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n padding: ", ";\n .multiBodiedExtension-content-dom-wrapper > [data-extension-frame='true'] {\n display: none;\n }\n\n .multiBodiedExtension-content-dom-wrapper\n > [data-extension-frame='true']:nth-of-type(", ") {\n display: block;\n }\n "])), "var(--ds-border, ".concat(N30, ")"), "var(--ds-space-050, 4px)", activeChildIndex + 1);
|
|
132
|
+
return jsx("section", {
|
|
133
|
+
className: "multiBodiedExtension--container",
|
|
134
|
+
css: containerCss,
|
|
135
|
+
"data-testid": "multiBodiedExtension--container",
|
|
136
|
+
"data-active-child-index": activeChildIndex
|
|
137
|
+
}, jsx("nav", {
|
|
138
|
+
className: "multiBodiedExtension-navigation",
|
|
139
|
+
"data-testid": "multiBodiedExtension-navigation"
|
|
140
|
+
}, extensionHandlerResult), jsx("article", {
|
|
141
|
+
className: "multiBodiedExtension--frames",
|
|
142
|
+
"data-testid": "multiBodiedExtension--frames",
|
|
143
|
+
ref: articleRef
|
|
144
|
+
}));
|
|
145
|
+
};
|
|
146
|
+
export default MultiBodiedExtension;
|
|
@@ -5,8 +5,9 @@ export var getSelectedExtension = function getSelectedExtension(state) {
|
|
|
5
5
|
var _state$schema$nodes = state.schema.nodes,
|
|
6
6
|
inlineExtension = _state$schema$nodes.inlineExtension,
|
|
7
7
|
extension = _state$schema$nodes.extension,
|
|
8
|
-
bodiedExtension = _state$schema$nodes.bodiedExtension
|
|
9
|
-
|
|
8
|
+
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
9
|
+
multiBodiedExtension = _state$schema$nodes.multiBodiedExtension;
|
|
10
|
+
var nodeTypes = [extension, bodiedExtension, inlineExtension, multiBodiedExtension];
|
|
10
11
|
return findSelectedNodeOfType(nodeTypes)(state.selection) || searchParent && findParentNodeOfType(nodeTypes)(state.selection) || undefined;
|
|
11
12
|
};
|
|
12
13
|
export var findExtensionWithLocalId = function findExtensionWithLocalId(state, localId) {
|
|
@@ -20,8 +21,9 @@ export var findExtensionWithLocalId = function findExtensionWithLocalId(state, l
|
|
|
20
21
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
21
22
|
inlineExtension = _state$schema$nodes2.inlineExtension,
|
|
22
23
|
extension = _state$schema$nodes2.extension,
|
|
23
|
-
bodiedExtension = _state$schema$nodes2.bodiedExtension
|
|
24
|
-
|
|
24
|
+
bodiedExtension = _state$schema$nodes2.bodiedExtension,
|
|
25
|
+
multiBodiedExtension = _state$schema$nodes2.multiBodiedExtension;
|
|
26
|
+
var nodeTypes = [extension, bodiedExtension, inlineExtension, multiBodiedExtension];
|
|
25
27
|
var matched;
|
|
26
28
|
state.doc.descendants(function (node, pos) {
|
|
27
29
|
if (nodeTypes.includes(node.type) && node.attrs.localId === localId) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
|
|
2
2
|
export { default as collabEditPlugin } from './collab-edit';
|
|
3
3
|
export { default as extensionPlugin } from './extension';
|
|
4
|
-
export { default as insertBlockPlugin } from './insert-block';
|
|
5
4
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
6
5
|
export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
|
|
7
6
|
export { default as pastePlugin } from './paste';
|
|
@@ -2,13 +2,14 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
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; }
|
|
4
4
|
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) { _defineProperty(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; }
|
|
5
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin,
|
|
5
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, jiraIssuePlugin, toolbarListsIndentationPlugin, alignmentPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
|
|
6
6
|
import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
|
|
7
7
|
import { panelPlugin } from '@atlaskit/editor-plugin-panel';
|
|
8
8
|
import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
|
|
9
9
|
import { historyPlugin } from '@atlaskit/editor-plugin-history';
|
|
10
10
|
import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
|
|
11
11
|
import { statusPlugin } from '@atlaskit/editor-plugin-status';
|
|
12
|
+
import { insertBlockPlugin } from '@atlaskit/editor-plugin-insert-block';
|
|
12
13
|
import { datePlugin } from '@atlaskit/editor-plugin-date';
|
|
13
14
|
import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
|
|
14
15
|
import { captionPlugin } from '@atlaskit/editor-plugin-caption';
|
|
@@ -2,4 +2,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { blockNodesVerticalMargin, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
|
|
5
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
6
|
+
export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .multiBodiedExtensionView-content-wrap.", ":not(.danger) {\n ", "\n }\n\n .extensionView-content-wrap,\n .multiBodiedExtensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n\n [data-mark-type='fragment'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n }\n\n &:first-child {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n }\n }\n\n &:nth-last-of-type(-n + 2):not(:first-of-type) {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n }\n }\n }\n"])), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), blockNodesVerticalMargin, blockNodesVerticalMargin);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "189.
|
|
2
|
+
export var version = "189.4.1";
|
|
@@ -3,6 +3,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { ExtensionState } from './types';
|
|
4
4
|
import type { Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/src/extensions';
|
|
5
5
|
import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
|
|
6
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
export declare function updateState(state: Partial<ExtensionState>): import("@atlaskit/editor-common/types").Command;
|
|
7
8
|
export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
|
|
8
9
|
export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -10,3 +11,4 @@ export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandl
|
|
|
10
11
|
export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
|
|
11
12
|
export declare const removeExtension: () => import("@atlaskit/editor-common/types").Command;
|
|
12
13
|
export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
|
|
14
|
+
export declare const checkAndRemoveExtensionNode: (state: EditorState, tr: Transaction) => Transaction;
|
|
@@ -3,5 +3,12 @@ type Props = {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
nodeType: string;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* If inlineExtension, add zero width space to the end of the nodes and wrap with span;
|
|
8
|
+
* else wrap with a div (for multi bodied extensions)
|
|
9
|
+
*
|
|
10
|
+
* @param param0
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
6
13
|
declare const ExtensionNodeWrapper: ({ children, nodeType }: Props) => JSX.Element;
|
|
7
14
|
export default ExtensionNodeWrapper;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { MultiBodiedExtensionActions } from '@atlaskit/editor-common/extensions';
|
|
5
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
export type TryExtensionHandlerType = (actions: MultiBodiedExtensionActions | undefined) => React.ReactElement | null;
|
|
8
|
+
type Props = {
|
|
9
|
+
node: PmNode;
|
|
10
|
+
handleContentDOMRef: (node: HTMLElement | null) => void;
|
|
11
|
+
editorView: EditorView;
|
|
12
|
+
getPos: () => number | undefined;
|
|
13
|
+
tryExtensionHandler: TryExtensionHandlerType;
|
|
14
|
+
};
|
|
15
|
+
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, }: Props) => jsx.JSX.Element;
|
|
16
|
+
export default MultiBodiedExtension;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
|
|
2
2
|
export { default as collabEditPlugin } from './collab-edit';
|
|
3
3
|
export { default as extensionPlugin } from './extension';
|
|
4
|
-
export { default as insertBlockPlugin } from './insert-block';
|
|
5
4
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
6
5
|
export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
|
|
7
6
|
export { default as pastePlugin } from './paste';
|
|
@@ -3,6 +3,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { ExtensionState } from './types';
|
|
4
4
|
import type { Parameters, TransformBefore, TransformAfter } from '@atlaskit/editor-common/src/extensions';
|
|
5
5
|
import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
|
|
6
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
export declare function updateState(state: Partial<ExtensionState>): import("@atlaskit/editor-common/types").Command;
|
|
7
8
|
export declare function setEditingContextToContextPanel<T extends Parameters = Parameters>(processParametersBefore: TransformBefore<T>, processParametersAfter: TransformAfter<T>, applyChangeToContextPanel: ApplyChangeHandler | undefined): import("@atlaskit/editor-common/types").Command;
|
|
8
9
|
export declare const clearEditingContext: (applyChangeToContextPanel: ApplyChangeHandler | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -10,3 +11,4 @@ export declare const forceAutoSave: (applyChangeToContextPanel: ApplyChangeHandl
|
|
|
10
11
|
export declare const updateExtensionLayout: (layout: ExtensionLayout) => import("@atlaskit/editor-common/types").Command;
|
|
11
12
|
export declare const removeExtension: () => import("@atlaskit/editor-common/types").Command;
|
|
12
13
|
export declare const removeDescendantNodes: (sourceNode?: PMNode) => import("@atlaskit/editor-common/types").Command;
|
|
14
|
+
export declare const checkAndRemoveExtensionNode: (state: EditorState, tr: Transaction) => Transaction;
|
|
@@ -3,5 +3,12 @@ type Props = {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
nodeType: string;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* If inlineExtension, add zero width space to the end of the nodes and wrap with span;
|
|
8
|
+
* else wrap with a div (for multi bodied extensions)
|
|
9
|
+
*
|
|
10
|
+
* @param param0
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
6
13
|
declare const ExtensionNodeWrapper: ({ children, nodeType }: Props) => JSX.Element;
|
|
7
14
|
export default ExtensionNodeWrapper;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { MultiBodiedExtensionActions } from '@atlaskit/editor-common/extensions';
|
|
5
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
export type TryExtensionHandlerType = (actions: MultiBodiedExtensionActions | undefined) => React.ReactElement | null;
|
|
8
|
+
type Props = {
|
|
9
|
+
node: PmNode;
|
|
10
|
+
handleContentDOMRef: (node: HTMLElement | null) => void;
|
|
11
|
+
editorView: EditorView;
|
|
12
|
+
getPos: () => number | undefined;
|
|
13
|
+
tryExtensionHandler: TryExtensionHandlerType;
|
|
14
|
+
};
|
|
15
|
+
declare const MultiBodiedExtension: ({ node, handleContentDOMRef, getPos, tryExtensionHandler, editorView, }: Props) => jsx.JSX.Element;
|
|
16
|
+
export default MultiBodiedExtension;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as clearMarksOnChangeToEmptyDocumentPlugin } from './clear-marks-on-change-to-empty-document';
|
|
2
2
|
export { default as collabEditPlugin } from './collab-edit';
|
|
3
3
|
export { default as extensionPlugin } from './extension';
|
|
4
|
-
export { default as insertBlockPlugin } from './insert-block';
|
|
5
4
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
6
5
|
export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
|
|
7
6
|
export { default as pastePlugin } from './paste';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.
|
|
3
|
+
"version": "189.4.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/code": "^15.0.0",
|
|
53
53
|
"@atlaskit/date": "^0.10.0",
|
|
54
54
|
"@atlaskit/datetime-picker": "^13.0.0",
|
|
55
|
-
"@atlaskit/editor-common": "^76.
|
|
55
|
+
"@atlaskit/editor-common": "^76.23.0",
|
|
56
56
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
57
57
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
58
58
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"@atlaskit/editor-plugin-hyperlink": "^0.6.0",
|
|
86
86
|
"@atlaskit/editor-plugin-image-upload": "^0.2.0",
|
|
87
87
|
"@atlaskit/editor-plugin-indentation": "^0.2.0",
|
|
88
|
+
"@atlaskit/editor-plugin-insert-block": "^0.2.0",
|
|
88
89
|
"@atlaskit/editor-plugin-layout": "^0.1.0",
|
|
89
90
|
"@atlaskit/editor-plugin-list": "^1.3.0",
|
|
90
91
|
"@atlaskit/editor-plugin-max-content-size": "^0.1.0",
|
|
@@ -181,7 +182,7 @@
|
|
|
181
182
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
182
183
|
"@atlaskit/menu": "^2.1.0",
|
|
183
184
|
"@atlaskit/modal-dialog": "^12.8.0",
|
|
184
|
-
"@atlaskit/renderer": "^108.
|
|
185
|
+
"@atlaskit/renderer": "^108.17.0",
|
|
185
186
|
"@atlaskit/synchrony-test-helpers": "^2.3.0",
|
|
186
187
|
"@atlaskit/util-data-test": "^17.8.0",
|
|
187
188
|
"@atlaskit/visual-regression": "*",
|
|
@@ -318,15 +319,15 @@
|
|
|
318
319
|
"platform.editor.paste-options-toolbar": {
|
|
319
320
|
"type": "boolean"
|
|
320
321
|
},
|
|
321
|
-
"platform.editor.multi-bodied-extension_0rygg": {
|
|
322
|
-
"type": "boolean"
|
|
323
|
-
},
|
|
324
322
|
"platform.editor.a11y-find-replace": {
|
|
325
323
|
"type": "boolean"
|
|
326
324
|
},
|
|
327
325
|
"platform.editor.menu.group-items": {
|
|
328
326
|
"type": "boolean",
|
|
329
327
|
"referenceOnly": "true"
|
|
328
|
+
},
|
|
329
|
+
"platform.editor.multi-bodied-extension_0rygg": {
|
|
330
|
+
"type": "boolean"
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
333
|
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
10
|
-
var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
|
|
11
|
-
var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
12
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
-
var _types = require("@atlaskit/editor-common/types");
|
|
14
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
|
-
var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
16
|
-
switch (toolbarSize) {
|
|
17
|
-
case _types.ToolbarSize.XXL:
|
|
18
|
-
case _types.ToolbarSize.XL:
|
|
19
|
-
case _types.ToolbarSize.L:
|
|
20
|
-
case _types.ToolbarSize.M:
|
|
21
|
-
return 7;
|
|
22
|
-
case _types.ToolbarSize.S:
|
|
23
|
-
return 2;
|
|
24
|
-
default:
|
|
25
|
-
return 0;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Wrapper over insertBlockTypeWithAnalytics to autobind toolbar input method
|
|
30
|
-
* @param name Block name
|
|
31
|
-
*/
|
|
32
|
-
function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
|
|
33
|
-
return function (name) {
|
|
34
|
-
if (name === _consts.CODE_BLOCK.name && insertCodeBlock) {
|
|
35
|
-
return insertCodeBlock(_analytics.INPUT_METHOD.TOOLBAR);
|
|
36
|
-
}
|
|
37
|
-
if (name === _consts.PANEL.name && insertPanel) {
|
|
38
|
-
return insertPanel(_analytics.INPUT_METHOD.TOOLBAR);
|
|
39
|
-
}
|
|
40
|
-
if (name === _consts.BLOCK_QUOTE.name && insertBlockQuote) {
|
|
41
|
-
return insertBlockQuote(_analytics.INPUT_METHOD.TOOLBAR);
|
|
42
|
-
}
|
|
43
|
-
return function () {
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
49
|
-
var _api$featureFlags;
|
|
50
|
-
var _ref$config = _ref.config,
|
|
51
|
-
options = _ref$config === void 0 ? {} : _ref$config,
|
|
52
|
-
api = _ref.api;
|
|
53
|
-
var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
54
|
-
return {
|
|
55
|
-
name: 'insertBlock',
|
|
56
|
-
primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
|
|
57
|
-
var editorView = _ref2.editorView,
|
|
58
|
-
editorActions = _ref2.editorActions,
|
|
59
|
-
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
60
|
-
providerFactory = _ref2.providerFactory,
|
|
61
|
-
popupsMountPoint = _ref2.popupsMountPoint,
|
|
62
|
-
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
63
|
-
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
64
|
-
toolbarSize = _ref2.toolbarSize,
|
|
65
|
-
disabled = _ref2.disabled,
|
|
66
|
-
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing,
|
|
67
|
-
isLastItem = _ref2.isLastItem;
|
|
68
|
-
var renderNode = function renderNode(providers) {
|
|
69
|
-
return /*#__PURE__*/_react.default.createElement(ToolbarInsertBlockWithInjectionApi, {
|
|
70
|
-
pluginInjectionApi: api,
|
|
71
|
-
editorView: editorView,
|
|
72
|
-
editorActions: editorActions,
|
|
73
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
74
|
-
providerFactory: providerFactory,
|
|
75
|
-
popupsMountPoint: popupsMountPoint,
|
|
76
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
77
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
78
|
-
toolbarSize: toolbarSize,
|
|
79
|
-
disabled: disabled,
|
|
80
|
-
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
81
|
-
isLastItem: isLastItem,
|
|
82
|
-
featureFlags: featureFlags,
|
|
83
|
-
providers: providers,
|
|
84
|
-
options: options
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
88
|
-
providerFactory: providerFactory,
|
|
89
|
-
providers: ['emojiProvider'],
|
|
90
|
-
renderNode: renderNode
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
96
|
-
var _ref4, _ref5, _pluginInjectionApi$i, _pluginInjectionApi$c, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
|
|
97
|
-
var editorView = _ref3.editorView,
|
|
98
|
-
editorActions = _ref3.editorActions,
|
|
99
|
-
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
100
|
-
popupsMountPoint = _ref3.popupsMountPoint,
|
|
101
|
-
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
102
|
-
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
103
|
-
toolbarSize = _ref3.toolbarSize,
|
|
104
|
-
disabled = _ref3.disabled,
|
|
105
|
-
isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing,
|
|
106
|
-
isLastItem = _ref3.isLastItem,
|
|
107
|
-
providers = _ref3.providers,
|
|
108
|
-
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
109
|
-
options = _ref3.options,
|
|
110
|
-
featureFlags = _ref3.featureFlags;
|
|
111
|
-
var buttons = toolbarSizeToButtons(toolbarSize);
|
|
112
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
|
|
113
|
-
dateState = _useSharedPluginState.dateState,
|
|
114
|
-
hyperlinkState = _useSharedPluginState.hyperlinkState,
|
|
115
|
-
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
116
|
-
mentionState = _useSharedPluginState.mentionState,
|
|
117
|
-
emojiState = _useSharedPluginState.emojiState,
|
|
118
|
-
blockTypeState = _useSharedPluginState.blockTypeState,
|
|
119
|
-
mediaState = _useSharedPluginState.mediaState,
|
|
120
|
-
typeAheadState = _useSharedPluginState.typeAheadState,
|
|
121
|
-
placeholderTextState = _useSharedPluginState.placeholderTextState;
|
|
122
|
-
return /*#__PURE__*/_react.default.createElement(_ToolbarInsertBlock.default, {
|
|
123
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
124
|
-
buttons: buttons,
|
|
125
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
126
|
-
isDisabled: disabled,
|
|
127
|
-
isTypeAheadAllowed: Boolean(typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed),
|
|
128
|
-
editorView: editorView,
|
|
129
|
-
tableSupported: !!editorView.state.schema.nodes.table,
|
|
130
|
-
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
131
|
-
mentionsSupported: !!(mentionState && mentionState.mentionProvider),
|
|
132
|
-
mentionsDisabled: !!(mentionState && !mentionState.canInsertMention),
|
|
133
|
-
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
134
|
-
dateEnabled: !!dateState,
|
|
135
|
-
placeholderTextEnabled: placeholderTextState && placeholderTextState.allowInserting,
|
|
136
|
-
layoutSectionEnabled: Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.layout),
|
|
137
|
-
expandEnabled: !!options.allowExpand,
|
|
138
|
-
mediaUploadsEnabled: (_ref4 = mediaState && mediaState.allowsUploads) !== null && _ref4 !== void 0 ? _ref4 : undefined,
|
|
139
|
-
onShowMediaPicker: (_ref5 = mediaState && mediaState.showMediaPicker) !== null && _ref5 !== void 0 ? _ref5 : undefined,
|
|
140
|
-
mediaSupported: !!mediaState,
|
|
141
|
-
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
142
|
-
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
143
|
-
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
144
|
-
availableWrapperBlockTypes: blockTypeState && blockTypeState.availableWrapperBlockTypes,
|
|
145
|
-
linkSupported: !!hyperlinkState,
|
|
146
|
-
linkDisabled: !hyperlinkState || !hyperlinkState.canInsertLink || !!hyperlinkState.activeLinkMark,
|
|
147
|
-
emojiDisabled: !emojiState || !emojiState.emojiProvider,
|
|
148
|
-
emojiProvider: providers.emojiProvider,
|
|
149
|
-
nativeStatusSupported: options.nativeStatusSupported,
|
|
150
|
-
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
151
|
-
onInsertBlockType: handleInsertBlockType(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.codeBlock) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.insertCodeBlock, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$p = pluginInjectionApi.panel) === null || _pluginInjectionApi$p === void 0 ? void 0 : _pluginInjectionApi$p.actions.insertPanel, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$b = pluginInjectionApi.blockType) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.insertBlockQuote),
|
|
152
|
-
onInsertMacroFromMacroBrowser: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.extension) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.actions.insertMacroFromMacroBrowser,
|
|
153
|
-
popupsMountPoint: popupsMountPoint,
|
|
154
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
155
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
156
|
-
insertMenuItems: options.insertMenuItems,
|
|
157
|
-
editorActions: editorActions,
|
|
158
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
159
|
-
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
160
|
-
showElementBrowserLink: options.showElementBrowserLink,
|
|
161
|
-
showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S,
|
|
162
|
-
featureFlags: featureFlags
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
var _default = exports.default = insertBlockPlugin;
|