@atlaskit/editor-plugin-expand 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +30 -0
- package/dist/cjs/commands.js +184 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/nodeviews/index.js +494 -0
- package/dist/cjs/plugin.js +101 -0
- package/dist/cjs/pm-plugins/keymap.js +170 -0
- package/dist/cjs/pm-plugins/main.js +85 -0
- package/dist/cjs/pm-plugins/plugin-factory.js +15 -0
- package/dist/cjs/reducer.js +20 -0
- package/dist/cjs/toolbar.js +59 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/ExpandIconButton.js +107 -0
- package/dist/cjs/utils.js +24 -0
- package/dist/es2019/commands.js +161 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/nodeviews/index.js +484 -0
- package/dist/es2019/plugin.js +86 -0
- package/dist/es2019/pm-plugins/keymap.js +197 -0
- package/dist/es2019/pm-plugins/main.js +73 -0
- package/dist/es2019/pm-plugins/plugin-factory.js +9 -0
- package/dist/es2019/reducer.js +11 -0
- package/dist/es2019/toolbar.js +52 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/ExpandIconButton.js +88 -0
- package/dist/es2019/utils.js +1 -0
- package/dist/esm/commands.js +177 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/nodeviews/index.js +486 -0
- package/dist/esm/plugin.js +88 -0
- package/dist/esm/pm-plugins/keymap.js +165 -0
- package/dist/esm/pm-plugins/main.js +77 -0
- package/dist/esm/pm-plugins/plugin-factory.js +9 -0
- package/dist/esm/reducer.js +13 -0
- package/dist/esm/toolbar.js +52 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/ExpandIconButton.js +98 -0
- package/dist/esm/utils.js +1 -0
- package/dist/types/commands.d.ts +13 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/nodeviews/index.d.ts +55 -0
- package/dist/types/plugin.d.ts +24 -0
- package/dist/types/pm-plugins/keymap.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +7 -0
- package/dist/types/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types/reducer.d.ts +3 -0
- package/dist/types/toolbar.d.ts +3 -0
- package/dist/types/types.d.ts +31 -0
- package/dist/types/ui/ExpandIconButton.d.ts +43 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/types-ts4.5/commands.d.ts +13 -0
- package/dist/types-ts4.5/index.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/index.d.ts +55 -0
- package/dist/types-ts4.5/plugin.d.ts +24 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types-ts4.5/reducer.d.ts +3 -0
- package/dist/types-ts4.5/toolbar.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +31 -0
- package/dist/types-ts4.5/ui/ExpandIconButton.d.ts +43 -0
- package/dist/types-ts4.5/utils.d.ts +1 -0
- package/package.json +104 -0
- package/report.api.md +93 -0
- package/tmp/api-report-tmp.d.ts +62 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { backspace, bindKeymapWithCommand, moveDown, moveLeft, moveRight, moveUp, tab } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { isPositionNearTableRow } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { isEmptyNode } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
7
|
+
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import { deleteExpand, focusTitle } from '../commands';
|
|
9
|
+
import { findExpand } from '../utils';
|
|
10
|
+
var isExpandNode = function isExpandNode(node) {
|
|
11
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
|
|
12
|
+
};
|
|
13
|
+
var isExpandSelected = function isExpandSelected(selection) {
|
|
14
|
+
return selection instanceof NodeSelection && isExpandNode(selection.node);
|
|
15
|
+
};
|
|
16
|
+
export function expandKeymap(api) {
|
|
17
|
+
var list = {};
|
|
18
|
+
bindKeymapWithCommand(moveRight.common, function (state, dispatch, editorView) {
|
|
19
|
+
if (!editorView) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
var selection = state.selection;
|
|
23
|
+
var selectionSharedState = (api === null || api === void 0 ? void 0 : api.selection.sharedState.currentState()) || {};
|
|
24
|
+
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
25
|
+
if (isExpandSelected(selection) && selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
26
|
+
return focusTitle(selection.from + 1)(state, dispatch, editorView);
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}, list);
|
|
30
|
+
bindKeymapWithCommand(moveLeft.common, function (state, dispatch, editorView) {
|
|
31
|
+
if (!editorView) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
var selection = state.selection;
|
|
35
|
+
var selectionSharedState = (api === null || api === void 0 ? void 0 : api.selection.sharedState.currentState()) || {};
|
|
36
|
+
var selectionRelativeToNode = selectionSharedState.selectionRelativeToNode;
|
|
37
|
+
if (isExpandSelected(selection) && (selectionRelativeToNode === undefined || selectionRelativeToNode === RelativeSelectionPos.End)) {
|
|
38
|
+
return focusTitle(selection.from + 1)(state, dispatch, editorView);
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}, list);
|
|
42
|
+
bindKeymapWithCommand(tab.common, function (state, dispatch, editorView) {
|
|
43
|
+
if (state.selection instanceof NodeSelection && state.selection.node.type === state.schema.nodes.expand && editorView && editorView.dom instanceof HTMLElement) {
|
|
44
|
+
var from = state.selection.from;
|
|
45
|
+
var expand = editorView.nodeDOM(from);
|
|
46
|
+
if (!expand || !(expand instanceof HTMLElement)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
var iconContainer = expand.querySelector(".".concat(expandClassNames.iconContainer));
|
|
50
|
+
if (iconContainer && iconContainer.focus) {
|
|
51
|
+
var tr = state.tr;
|
|
52
|
+
var pos = state.selection.from;
|
|
53
|
+
tr.setSelection(new TextSelection(tr.doc.resolve(pos)));
|
|
54
|
+
if (dispatch) {
|
|
55
|
+
dispatch(tr);
|
|
56
|
+
}
|
|
57
|
+
editorView.dom.blur();
|
|
58
|
+
iconContainer.focus();
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}, list);
|
|
64
|
+
bindKeymapWithCommand(moveUp.common, function (state, dispatch, editorView) {
|
|
65
|
+
if (!editorView) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
var selection = state.selection,
|
|
69
|
+
schema = state.schema;
|
|
70
|
+
var nodeBefore = selection.$from.nodeBefore;
|
|
71
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && !nodeBefore.attrs.__expanded) {
|
|
72
|
+
var _$from = selection.$from;
|
|
73
|
+
return focusTitle(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
|
|
74
|
+
}
|
|
75
|
+
var $from = state.selection.$from;
|
|
76
|
+
if (editorView.endOfTextblock('up')) {
|
|
77
|
+
var expand = findExpand(state);
|
|
78
|
+
|
|
79
|
+
// Moving UP in a table should move the cursor to the row above
|
|
80
|
+
// however when an expand is in a table cell to the left of the
|
|
81
|
+
// current table cell, arrow UP moves the cursor to the left
|
|
82
|
+
// see ED-15425
|
|
83
|
+
if (isPositionNearTableRow($from, schema, 'before') && !expand) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
var prevCursorPos = Math.max($from.pos - $from.parentOffset - 1, 0);
|
|
87
|
+
// move cursor from expand's content to its title
|
|
88
|
+
if (expand && expand.start === prevCursorPos) {
|
|
89
|
+
return focusTitle(expand.start)(state, dispatch, editorView);
|
|
90
|
+
}
|
|
91
|
+
var sel = Selection.findFrom(state.doc.resolve(prevCursorPos), -1);
|
|
92
|
+
var expandBefore = findExpand(state, sel);
|
|
93
|
+
if (sel && expandBefore) {
|
|
94
|
+
// moving cursor from outside of an expand to the title when it is collapsed
|
|
95
|
+
if (!expandBefore.node.attrs.__expanded) {
|
|
96
|
+
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
97
|
+
}
|
|
98
|
+
// moving cursor from outside of an expand to the content when it is expanded
|
|
99
|
+
else if (dispatch) {
|
|
100
|
+
dispatch(state.tr.setSelection(sel));
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}, list);
|
|
107
|
+
bindKeymapWithCommand(moveDown.common, function (state, dispatch, editorView) {
|
|
108
|
+
if (!editorView) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
112
|
+
expand = _state$schema$nodes.expand,
|
|
113
|
+
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
114
|
+
var selection = state.selection;
|
|
115
|
+
var nodeAfter = selection.$from.nodeAfter;
|
|
116
|
+
if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && !nodeAfter.attrs.__expanded) {
|
|
117
|
+
var $from = selection.$from;
|
|
118
|
+
return focusTitle($from.pos + 1)(state, dispatch, editorView);
|
|
119
|
+
}
|
|
120
|
+
if (editorView.endOfTextblock('down')) {
|
|
121
|
+
var _$from2 = state.selection.$from;
|
|
122
|
+
if (_$from2.depth === 0) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
var $after = state.doc.resolve(_$from2.after());
|
|
126
|
+
if ($after.nodeAfter && ($after.nodeAfter.type === expand || $after.nodeAfter.type === nestedExpand)) {
|
|
127
|
+
return focusTitle($after.pos + 1)(state, dispatch, editorView);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}, list);
|
|
132
|
+
bindKeymapWithCommand(backspace.common, function (state, dispatch, editorView) {
|
|
133
|
+
var selection = state.selection;
|
|
134
|
+
var $from = selection.$from;
|
|
135
|
+
if (!editorView || !selection.empty) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
139
|
+
expand = _state$schema$nodes2.expand,
|
|
140
|
+
nestedExpand = _state$schema$nodes2.nestedExpand;
|
|
141
|
+
var expandNode = findExpand(state);
|
|
142
|
+
if (!expandNode) {
|
|
143
|
+
// @see ED-7977
|
|
144
|
+
var sel = Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
|
|
145
|
+
var expandBefore = findExpand(state, sel);
|
|
146
|
+
if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && !expandBefore.node.attrs.__expanded) {
|
|
147
|
+
return focusTitle(expandBefore.start)(state, dispatch, editorView);
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
var parentNode = state.doc.nodeAt($from.before(Math.max($from.depth - 1, 1)));
|
|
152
|
+
// ED-10012 catch cases where the expand has another node nested within it and
|
|
153
|
+
// the backspace should be applied only to the inner node instead of the expand
|
|
154
|
+
if (parentNode && !isExpandNode(parentNode)) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
var textSel = Selection.findFrom(state.doc.resolve(expandNode.pos), 1, true);
|
|
158
|
+
if (textSel && selection.$from.pos === textSel.$from.pos && isEmptyNode(state.schema)(expandNode.node) && dispatch) {
|
|
159
|
+
var _api$analytics;
|
|
160
|
+
return deleteExpand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(state, dispatch);
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}, list);
|
|
164
|
+
return keymap(list);
|
|
165
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
+
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { setExpandRef } from '../commands';
|
|
6
|
+
import ExpandNodeView from '../nodeviews';
|
|
7
|
+
import { findExpand } from '../utils';
|
|
8
|
+
import { createPluginState, getPluginState, pluginKey } from './plugin-factory';
|
|
9
|
+
export function containsClass(element, className) {
|
|
10
|
+
var _element$classList;
|
|
11
|
+
return Boolean(element === null || element === void 0 || (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(className));
|
|
12
|
+
}
|
|
13
|
+
export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
14
|
+
var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
|
|
15
|
+
var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
16
|
+
var featureFlags = arguments.length > 4 ? arguments[4] : undefined;
|
|
17
|
+
var api = arguments.length > 5 ? arguments[5] : undefined;
|
|
18
|
+
var state = createPluginState(dispatch, {});
|
|
19
|
+
var isMobile = appearance === 'mobile';
|
|
20
|
+
return new SafePlugin({
|
|
21
|
+
state: state,
|
|
22
|
+
key: pluginKey,
|
|
23
|
+
props: {
|
|
24
|
+
nodeViews: {
|
|
25
|
+
expand: ExpandNodeView({
|
|
26
|
+
getIntl: getIntl,
|
|
27
|
+
isMobile: isMobile,
|
|
28
|
+
featureFlags: featureFlags,
|
|
29
|
+
api: api
|
|
30
|
+
}),
|
|
31
|
+
nestedExpand: ExpandNodeView({
|
|
32
|
+
getIntl: getIntl,
|
|
33
|
+
isMobile: isMobile,
|
|
34
|
+
featureFlags: featureFlags,
|
|
35
|
+
api: api
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
handleKeyDown: function handleKeyDown(_view, event) {
|
|
39
|
+
return containsClass(event.target, expandClassNames.titleContainer);
|
|
40
|
+
},
|
|
41
|
+
handleKeyPress: function handleKeyPress(_view, event) {
|
|
42
|
+
return containsClass(event.target, expandClassNames.titleContainer);
|
|
43
|
+
},
|
|
44
|
+
handleScrollToSelection: function handleScrollToSelection() {
|
|
45
|
+
return containsClass(document.activeElement, expandClassNames.titleInput);
|
|
46
|
+
},
|
|
47
|
+
handleClickOn: createSelectionClickHandler(['expand', 'nestedExpand'], function (target) {
|
|
48
|
+
return target.classList.contains(expandClassNames.prefix);
|
|
49
|
+
}, {
|
|
50
|
+
useLongPressSelection: useLongPressSelection
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
// @see ED-8027 to follow up on this work-around
|
|
54
|
+
filterTransaction: function filterTransaction(tr) {
|
|
55
|
+
if (containsClass(document.activeElement, expandClassNames.titleInput) && tr.selectionSet && (!tr.steps.length || tr.isGeneric)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
view: function view(editorView) {
|
|
61
|
+
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
62
|
+
return {
|
|
63
|
+
update: function update(view) {
|
|
64
|
+
var state = view.state,
|
|
65
|
+
dispatch = view.dispatch;
|
|
66
|
+
var node = findExpand(state);
|
|
67
|
+
if (node) {
|
|
68
|
+
var expandRef = findDomRefAtPos(node.pos, domAtPos);
|
|
69
|
+
if (getPluginState(state).expandRef !== expandRef) {
|
|
70
|
+
setExpandRef(expandRef)(state, dispatch);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import reducer from '../reducer';
|
|
4
|
+
export var pluginKey = new PluginKey('expandPlugin');
|
|
5
|
+
var _pluginFactory = pluginFactory(pluginKey, reducer),
|
|
6
|
+
createPluginState = _pluginFactory.createPluginState,
|
|
7
|
+
createCommand = _pluginFactory.createCommand,
|
|
8
|
+
getPluginState = _pluginFactory.getPluginState;
|
|
9
|
+
export { createPluginState, createCommand, getPluginState };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
export default (function (pluginState, action) {
|
|
5
|
+
switch (action.type) {
|
|
6
|
+
case 'SET_EXPAND_REF':
|
|
7
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
8
|
+
expandRef: action.data.ref
|
|
9
|
+
});
|
|
10
|
+
default:
|
|
11
|
+
return pluginState;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import commonMessages from '@atlaskit/editor-common/messages';
|
|
2
|
+
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
3
|
+
import { deleteExpand } from './commands';
|
|
4
|
+
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
5
|
+
export var getToolbarConfig = function getToolbarConfig(api) {
|
|
6
|
+
return function (state, _ref) {
|
|
7
|
+
var _api$decorations$acti, _api$decorations, _api$analytics;
|
|
8
|
+
var formatMessage = _ref.formatMessage;
|
|
9
|
+
var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
|
|
10
|
+
hoverDecoration = _ref2.hoverDecoration;
|
|
11
|
+
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
12
|
+
var _getPluginState = getPluginState(state),
|
|
13
|
+
expandRef = _getPluginState.expandRef;
|
|
14
|
+
if (expandRef) {
|
|
15
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
16
|
+
nestedExpand = _state$schema$nodes.nestedExpand,
|
|
17
|
+
expand = _state$schema$nodes.expand;
|
|
18
|
+
return {
|
|
19
|
+
title: 'Expand toolbar',
|
|
20
|
+
getDomRef: function getDomRef() {
|
|
21
|
+
return expandRef;
|
|
22
|
+
},
|
|
23
|
+
nodeType: [nestedExpand, expand],
|
|
24
|
+
offset: [0, 6],
|
|
25
|
+
items: [{
|
|
26
|
+
type: 'copy-button',
|
|
27
|
+
items: [{
|
|
28
|
+
state: state,
|
|
29
|
+
formatMessage: formatMessage,
|
|
30
|
+
nodeType: [nestedExpand, expand]
|
|
31
|
+
}, {
|
|
32
|
+
type: 'separator'
|
|
33
|
+
}]
|
|
34
|
+
}, {
|
|
35
|
+
id: 'editor.expand.delete',
|
|
36
|
+
type: 'button',
|
|
37
|
+
appearance: 'danger',
|
|
38
|
+
focusEditoronEnter: true,
|
|
39
|
+
icon: RemoveIcon,
|
|
40
|
+
onClick: deleteExpand(editorAnalyticsAPI),
|
|
41
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
42
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
43
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
44
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
45
|
+
title: formatMessage(commonMessages.remove),
|
|
46
|
+
tabIndex: null
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
+
var _excluded = ["buttonStyles"];
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
/** @jsx jsx */
|
|
15
|
+
import React, { useCallback } from 'react';
|
|
16
|
+
import { jsx } from '@emotion/react';
|
|
17
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
18
|
+
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
19
|
+
import { expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef, expandMessages } from '@atlaskit/editor-common/ui';
|
|
20
|
+
import { akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
21
|
+
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
22
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
23
|
+
export var withTooltip = function withTooltip(WrapperComponent) {
|
|
24
|
+
return /*#__PURE__*/function (_React$Component) {
|
|
25
|
+
_inherits(WithSortableColumn, _React$Component);
|
|
26
|
+
var _super = _createSuper(WithSortableColumn);
|
|
27
|
+
function WithSortableColumn(props) {
|
|
28
|
+
_classCallCheck(this, WithSortableColumn);
|
|
29
|
+
return _super.call(this, props);
|
|
30
|
+
}
|
|
31
|
+
_createClass(WithSortableColumn, [{
|
|
32
|
+
key: "render",
|
|
33
|
+
value: function render() {
|
|
34
|
+
var label = this.props.label;
|
|
35
|
+
return jsx(Tooltip, {
|
|
36
|
+
content: label,
|
|
37
|
+
position: "top",
|
|
38
|
+
tag: ExpandLayoutWrapperWithRef
|
|
39
|
+
}, jsx(WrapperComponent, this.props));
|
|
40
|
+
}
|
|
41
|
+
}]);
|
|
42
|
+
return WithSortableColumn;
|
|
43
|
+
}(React.Component);
|
|
44
|
+
};
|
|
45
|
+
export var CustomButton = function CustomButton(props) {
|
|
46
|
+
var label = props.label,
|
|
47
|
+
allowInteractiveExpand = props.allowInteractiveExpand;
|
|
48
|
+
var useTheme = useCallback(function (currentTheme, themeProps) {
|
|
49
|
+
var _currentTheme = currentTheme(themeProps),
|
|
50
|
+
buttonStyles = _currentTheme.buttonStyles,
|
|
51
|
+
rest = _objectWithoutProperties(_currentTheme, _excluded);
|
|
52
|
+
return _objectSpread({
|
|
53
|
+
buttonStyles: _objectSpread(_objectSpread({}, buttonStyles), {}, {
|
|
54
|
+
height: '100%',
|
|
55
|
+
'& svg': {
|
|
56
|
+
transform: props.expanded ? 'transform: rotate(90deg);' : 'transform: rotate(0deg);',
|
|
57
|
+
transition: "transform 0.2s ".concat(akEditorSwoopCubicBezier, ";")
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}, rest);
|
|
61
|
+
}, [props]);
|
|
62
|
+
return jsx(Button, {
|
|
63
|
+
appearance: "subtle",
|
|
64
|
+
className: expandClassNames.iconContainer,
|
|
65
|
+
iconBefore: jsx(ChevronRightIcon, {
|
|
66
|
+
label: label
|
|
67
|
+
}),
|
|
68
|
+
shouldFitContainer: true,
|
|
69
|
+
theme: useTheme,
|
|
70
|
+
isDisabled: !allowInteractiveExpand
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var ButtonWithTooltip = withTooltip(CustomButton);
|
|
74
|
+
var ButtonWithoutTooltip = CustomButton;
|
|
75
|
+
export var ExpandIconButton = function ExpandIconButton(props) {
|
|
76
|
+
var expanded = props.expanded,
|
|
77
|
+
intl = props.intl;
|
|
78
|
+
var message = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
|
|
79
|
+
var label = intl && intl.formatMessage(message) || message.defaultMessage;
|
|
80
|
+
// check to ensure device supports any-hover
|
|
81
|
+
var supportsAnyHover = !!window.matchMedia ? window.matchMedia('(any-hover: hover)').matches !== window.matchMedia('(any-hover: none)').matches : false;
|
|
82
|
+
var hoverEventCheck = supportsAnyHover ? window.matchMedia('(any-hover: hover)').matches : true;
|
|
83
|
+
|
|
84
|
+
// hoverEventCheck is to disable tooltips for mobile to prevent incorrect hover state causing issues on iOS
|
|
85
|
+
if (props.allowInteractiveExpand && hoverEventCheck) {
|
|
86
|
+
return jsx(ButtonWithTooltip, _extends({
|
|
87
|
+
label: label
|
|
88
|
+
}, props));
|
|
89
|
+
}
|
|
90
|
+
return (
|
|
91
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
92
|
+
jsx("div", {
|
|
93
|
+
css: expandLayoutWrapperStyle
|
|
94
|
+
}, jsx(ButtonWithoutTooltip, _extends({
|
|
95
|
+
label: label
|
|
96
|
+
}, props)))
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
export declare const setExpandRef: (ref?: HTMLDivElement | null) => Command;
|
|
6
|
+
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
7
|
+
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
8
|
+
export declare const updateExpandTitle: (title: string, pos: number, nodeType: NodeType) => Command;
|
|
9
|
+
export declare const toggleExpandExpanded: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (pos: number, nodeType: NodeType) => Command;
|
|
10
|
+
export declare const createExpandNode: (state: EditorState) => PMNode | null;
|
|
11
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
12
|
+
export declare const focusTitle: (pos: number) => Command;
|
|
13
|
+
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { ExpandPlugin } from '../types';
|
|
8
|
+
export declare class ExpandNodeView implements NodeView {
|
|
9
|
+
private selectNearNode;
|
|
10
|
+
node: PmNode;
|
|
11
|
+
view: EditorView;
|
|
12
|
+
dom: HTMLElement;
|
|
13
|
+
contentDOM?: HTMLElement;
|
|
14
|
+
icon?: HTMLElement | null;
|
|
15
|
+
input?: HTMLInputElement | null;
|
|
16
|
+
titleContainer?: HTMLElement | null;
|
|
17
|
+
content?: HTMLElement | null;
|
|
18
|
+
getPos: getPosHandlerNode;
|
|
19
|
+
intl: IntlShape;
|
|
20
|
+
allowInteractiveExpand: boolean;
|
|
21
|
+
isMobile: boolean;
|
|
22
|
+
featureFlags: FeatureFlags;
|
|
23
|
+
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
24
|
+
constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, featureFlags: FeatureFlags, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined);
|
|
25
|
+
private initHandlers;
|
|
26
|
+
private focusTitle;
|
|
27
|
+
private handleIconKeyDown;
|
|
28
|
+
private renderIcon;
|
|
29
|
+
private isAllowInteractiveExpandEnabled;
|
|
30
|
+
private handleClick;
|
|
31
|
+
private handleInput;
|
|
32
|
+
private handleFocus;
|
|
33
|
+
private handleTitleKeydown;
|
|
34
|
+
private deleteExpand;
|
|
35
|
+
private toggleExpand;
|
|
36
|
+
private moveToOutsideOfTitle;
|
|
37
|
+
private isCollapsed;
|
|
38
|
+
private setRightGapCursor;
|
|
39
|
+
private setLeftGapCursor;
|
|
40
|
+
private handleArrowRightFromTitle;
|
|
41
|
+
private handleArrowLeftFromTitle;
|
|
42
|
+
stopEvent(event: Event): boolean;
|
|
43
|
+
ignoreMutation(mutationRecord: MutationRecord | {
|
|
44
|
+
type: 'selection';
|
|
45
|
+
target: Element;
|
|
46
|
+
}): boolean;
|
|
47
|
+
update(node: PmNode, _decorations: readonly Decoration[]): boolean;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
}
|
|
50
|
+
export default function ({ getIntl, isMobile, featureFlags, api, }: {
|
|
51
|
+
getIntl: () => IntlShape;
|
|
52
|
+
isMobile: boolean;
|
|
53
|
+
featureFlags: FeatureFlags;
|
|
54
|
+
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
55
|
+
}): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
6
|
+
import { insertExpand } from './commands';
|
|
7
|
+
interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
8
|
+
allowInsertion?: boolean;
|
|
9
|
+
appearance?: EditorAppearance;
|
|
10
|
+
}
|
|
11
|
+
export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
12
|
+
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
13
|
+
dependencies: [
|
|
14
|
+
FeatureFlagsPlugin,
|
|
15
|
+
DecorationsPlugin,
|
|
16
|
+
SelectionPlugin,
|
|
17
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
18
|
+
];
|
|
19
|
+
actions: {
|
|
20
|
+
insertExpand: ReturnType<typeof insertExpand>;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
export declare const expandPlugin: ExpandPlugin;
|
|
24
|
+
export { pluginKey } from './pm-plugins/plugin-factory';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { ExpandPlugin } from '../types';
|
|
4
|
+
export declare function expandKeymap(api: ExtractInjectionAPI<ExpandPlugin> | undefined): SafePlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import type { EditorAppearance, ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { ExpandPlugin } from '../types';
|
|
6
|
+
export declare function containsClass(element: Element | null, className: string): boolean;
|
|
7
|
+
export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, featureFlags: FeatureFlags, api: ExtractInjectionAPI<ExpandPlugin> | undefined) => SafePlugin<import("../types").ExpandPluginState>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
export declare const pluginKey: PluginKey<any>;
|
|
3
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("..").ExpandPluginState | ((state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState)) => import("prosemirror-state").SafeStateField<import("..").ExpandPluginState>, createCommand: <A = import("../types").ExpandPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").ExpandPluginState;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EditorAppearance, LongPressSelectionPluginOptions, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
6
|
+
import type { insertExpand } from './commands';
|
|
7
|
+
export interface ExpandPluginState {
|
|
8
|
+
expandRef?: HTMLDivElement | null;
|
|
9
|
+
}
|
|
10
|
+
export type ExpandPluginAction = {
|
|
11
|
+
type: 'SET_EXPAND_REF';
|
|
12
|
+
data: {
|
|
13
|
+
ref?: HTMLDivElement | null;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
17
|
+
allowInsertion?: boolean;
|
|
18
|
+
appearance?: EditorAppearance;
|
|
19
|
+
}
|
|
20
|
+
export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
21
|
+
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
22
|
+
dependencies: [
|
|
23
|
+
FeatureFlagsPlugin,
|
|
24
|
+
DecorationsPlugin,
|
|
25
|
+
SelectionPlugin,
|
|
26
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
27
|
+
];
|
|
28
|
+
actions: {
|
|
29
|
+
insertExpand: ReturnType<typeof insertExpand>;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { IntlShape } from 'react-intl-next';
|
|
5
|
+
interface ExpandIconButtonProps {
|
|
6
|
+
allowInteractiveExpand: boolean;
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
intl?: IntlShape;
|
|
9
|
+
}
|
|
10
|
+
interface ExpandIconButtonWithLabelProps extends ExpandIconButtonProps {
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const withTooltip: (WrapperComponent: React.ElementType) => {
|
|
14
|
+
new (props: ExpandIconButtonWithLabelProps): {
|
|
15
|
+
render(): jsx.JSX.Element;
|
|
16
|
+
context: any;
|
|
17
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ExpandIconButtonWithLabelProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
18
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
19
|
+
readonly props: Readonly<ExpandIconButtonWithLabelProps> & Readonly<{
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}>;
|
|
22
|
+
state: Readonly<{}>;
|
|
23
|
+
refs: {
|
|
24
|
+
[key: string]: React.ReactInstance;
|
|
25
|
+
};
|
|
26
|
+
componentDidMount?(): void;
|
|
27
|
+
shouldComponentUpdate?(nextProps: Readonly<ExpandIconButtonWithLabelProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
28
|
+
componentWillUnmount?(): void;
|
|
29
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
30
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<ExpandIconButtonWithLabelProps>, prevState: Readonly<{}>): any;
|
|
31
|
+
componentDidUpdate?(prevProps: Readonly<ExpandIconButtonWithLabelProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
32
|
+
componentWillMount?(): void;
|
|
33
|
+
UNSAFE_componentWillMount?(): void;
|
|
34
|
+
componentWillReceiveProps?(nextProps: Readonly<ExpandIconButtonWithLabelProps>, nextContext: any): void;
|
|
35
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<ExpandIconButtonWithLabelProps>, nextContext: any): void;
|
|
36
|
+
componentWillUpdate?(nextProps: Readonly<ExpandIconButtonWithLabelProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
37
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<ExpandIconButtonWithLabelProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
38
|
+
};
|
|
39
|
+
contextType?: React.Context<any> | undefined;
|
|
40
|
+
};
|
|
41
|
+
export declare const CustomButton: (props: ExpandIconButtonWithLabelProps) => jsx.JSX.Element;
|
|
42
|
+
export declare const ExpandIconButton: (props: ExpandIconButtonProps) => jsx.JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand, } from '@atlaskit/editor-common/transforms';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
export declare const setExpandRef: (ref?: HTMLDivElement | null) => Command;
|
|
6
|
+
export declare const deleteExpandAtPos: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (expandNodePos: number, expandNode: PMNode) => Command;
|
|
7
|
+
export declare const deleteExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
8
|
+
export declare const updateExpandTitle: (title: string, pos: number, nodeType: NodeType) => Command;
|
|
9
|
+
export declare const toggleExpandExpanded: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (pos: number, nodeType: NodeType) => Command;
|
|
10
|
+
export declare const createExpandNode: (state: EditorState) => PMNode | null;
|
|
11
|
+
export declare const insertExpand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
12
|
+
export declare const focusTitle: (pos: number) => Command;
|
|
13
|
+
export declare const setSelectionInsideExpand: (expandPos: number) => Command;
|