@atlaskit/editor-plugin-block-controls 3.15.11 → 3.16.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 +21 -0
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +25 -0
- package/dist/cjs/pm-plugins/main.js +55 -14
- package/dist/cjs/pm-plugins/quick-insert-calculate-position.js +70 -0
- package/dist/cjs/pm-plugins/vanilla-quick-insert.js +190 -0
- package/dist/cjs/pm-plugins/vanilla-tooltip.js +179 -0
- package/dist/cjs/ui/global-styles.js +86 -1
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +25 -0
- package/dist/es2019/pm-plugins/main.js +58 -16
- package/dist/es2019/pm-plugins/quick-insert-calculate-position.js +64 -0
- package/dist/es2019/pm-plugins/vanilla-quick-insert.js +189 -0
- package/dist/es2019/pm-plugins/vanilla-tooltip.js +147 -0
- package/dist/es2019/ui/global-styles.js +84 -1
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +25 -0
- package/dist/esm/pm-plugins/main.js +55 -14
- package/dist/esm/pm-plugins/quick-insert-calculate-position.js +64 -0
- package/dist/esm/pm-plugins/vanilla-quick-insert.js +183 -0
- package/dist/esm/pm-plugins/vanilla-tooltip.js +172 -0
- package/dist/esm/ui/global-styles.js +86 -1
- package/dist/types/pm-plugins/quick-insert-calculate-position.d.ts +12 -0
- package/dist/types/pm-plugins/vanilla-quick-insert.d.ts +21 -0
- package/dist/types/pm-plugins/vanilla-tooltip.d.ts +27 -0
- package/dist/types-ts4.5/pm-plugins/quick-insert-calculate-position.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/vanilla-quick-insert.d.ts +21 -0
- package/dist/types-ts4.5/pm-plugins/vanilla-tooltip.d.ts +27 -0
- package/package.json +8 -4
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { createPopper } from '@popperjs/core';
|
|
7
|
+
import { bind } from 'bind-event-listener';
|
|
8
|
+
var startingOffset = {
|
|
9
|
+
name: 'offset',
|
|
10
|
+
options: {
|
|
11
|
+
offset: [0, 4]
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var endingOffset = {
|
|
15
|
+
name: 'offset',
|
|
16
|
+
options: {
|
|
17
|
+
offset: [0, 8]
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
|
|
23
|
+
*
|
|
24
|
+
* Uses Popover API for accessibility + stacking context: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
|
|
25
|
+
* Uses popperJS for positioning
|
|
26
|
+
*
|
|
27
|
+
* @warning Still experimental. One day we can likely want to move this to a common package.
|
|
28
|
+
*/
|
|
29
|
+
export var VanillaTooltip = /*#__PURE__*/function () {
|
|
30
|
+
function VanillaTooltip(button, content,
|
|
31
|
+
/**
|
|
32
|
+
* Id associated to the tooltip - must be unique.
|
|
33
|
+
*/
|
|
34
|
+
id) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 300;
|
|
37
|
+
_classCallCheck(this, VanillaTooltip);
|
|
38
|
+
_defineProperty(this, "listeners", []);
|
|
39
|
+
_defineProperty(this, "shouldHidePopover", false);
|
|
40
|
+
_defineProperty(this, "isDisplayed", false);
|
|
41
|
+
this.button = button;
|
|
42
|
+
this.timeout = timeout;
|
|
43
|
+
var tooltip = document.createElement('span');
|
|
44
|
+
tooltip.role = 'tooltip';
|
|
45
|
+
tooltip.popover = 'hint';
|
|
46
|
+
// Warning: Currently this is used for styling - only works in the block controls package
|
|
47
|
+
tooltip.className = 'blocks-quick-insert-tooltip';
|
|
48
|
+
tooltip.id = id;
|
|
49
|
+
tooltip.textContent = content;
|
|
50
|
+
this.tooltip = tooltip;
|
|
51
|
+
|
|
52
|
+
// Button preparation
|
|
53
|
+
button.appendChild(tooltip);
|
|
54
|
+
// Prepare the button to have the popover target and accessibility properties
|
|
55
|
+
button.setAttribute('popovertarget', tooltip.id);
|
|
56
|
+
button.setAttribute('aria-describedby', tooltip.id);
|
|
57
|
+
var showEvents = ['mouseenter', 'focus'];
|
|
58
|
+
var hideEvents = ['mouseleave', 'blur'];
|
|
59
|
+
showEvents.forEach(function (event) {
|
|
60
|
+
_this.listeners.push(bind(button, {
|
|
61
|
+
type: event,
|
|
62
|
+
listener: function listener() {
|
|
63
|
+
return _this.show();
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
hideEvents.forEach(function (event) {
|
|
68
|
+
_this.listeners.push(bind(button, {
|
|
69
|
+
type: event,
|
|
70
|
+
listener: function listener() {
|
|
71
|
+
return _this.hide();
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
this.listeners.push(bind(window, {
|
|
76
|
+
type: 'keydown',
|
|
77
|
+
listener: function listener(e) {
|
|
78
|
+
if (e.key === 'Escape') {
|
|
79
|
+
_this.hide(true);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
// Hide the tooltip if the hide transition has completed
|
|
85
|
+
this.tooltip.ontransitionend = function () {
|
|
86
|
+
if (_this.shouldHidePopover) {
|
|
87
|
+
_this.tooltip.hidePopover();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return _createClass(VanillaTooltip, [{
|
|
92
|
+
key: "createPopperInstance",
|
|
93
|
+
value: function createPopperInstance() {
|
|
94
|
+
this.popperInstance = createPopper(this.button, this.tooltip, {
|
|
95
|
+
placement: 'top',
|
|
96
|
+
modifiers: [startingOffset]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "destroy",
|
|
101
|
+
value: function destroy() {
|
|
102
|
+
var _this$popperInstance;
|
|
103
|
+
(_this$popperInstance = this.popperInstance) === null || _this$popperInstance === void 0 || _this$popperInstance.destroy();
|
|
104
|
+
this.listeners.forEach(function (listener) {
|
|
105
|
+
listener();
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "hide",
|
|
110
|
+
value: function hide() {
|
|
111
|
+
var _this2 = this;
|
|
112
|
+
var immediate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
113
|
+
clearTimeout(this.currentTimeoutId);
|
|
114
|
+
this.shouldHidePopover = true;
|
|
115
|
+
// Disable the event listeners
|
|
116
|
+
this.currentTimeoutId = setTimeout(function () {
|
|
117
|
+
var _this2$popperInstance;
|
|
118
|
+
(_this2$popperInstance = _this2.popperInstance) === null || _this2$popperInstance === void 0 || _this2$popperInstance.setOptions(function (options) {
|
|
119
|
+
return _objectSpread(_objectSpread({}, options), {}, {
|
|
120
|
+
modifiers: [startingOffset, {
|
|
121
|
+
name: 'eventListeners',
|
|
122
|
+
enabled: false
|
|
123
|
+
}]
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
_this2.tooltip.style.opacity = '0';
|
|
127
|
+
_this2.isDisplayed = false;
|
|
128
|
+
// If transition animations are disabled immediately hide the popover
|
|
129
|
+
if (_this2.tooltip.style.transition === 'none') {
|
|
130
|
+
_this2.tooltip.hidePopover();
|
|
131
|
+
}
|
|
132
|
+
}, immediate ? 0 : this.timeout);
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "show",
|
|
136
|
+
value: function show() {
|
|
137
|
+
var _this3 = this;
|
|
138
|
+
if (this.isDisplayed) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
clearTimeout(this.currentTimeoutId);
|
|
142
|
+
this.shouldHidePopover = false;
|
|
143
|
+
|
|
144
|
+
// Make the tooltip visible - but hide until
|
|
145
|
+
this.tooltip.style.visibility = 'hidden';
|
|
146
|
+
this.tooltip.showPopover();
|
|
147
|
+
|
|
148
|
+
// Update its position
|
|
149
|
+
if (!this.popperInstance) {
|
|
150
|
+
this.createPopperInstance();
|
|
151
|
+
} else {
|
|
152
|
+
this.popperInstance.update();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Enable the event listeners
|
|
156
|
+
this.currentTimeoutId = setTimeout(function () {
|
|
157
|
+
var _this3$popperInstance;
|
|
158
|
+
_this3.tooltip.style.opacity = '1';
|
|
159
|
+
_this3.tooltip.style.visibility = 'visible';
|
|
160
|
+
(_this3$popperInstance = _this3.popperInstance) === null || _this3$popperInstance === void 0 || _this3$popperInstance.setOptions(function (options) {
|
|
161
|
+
return _objectSpread(_objectSpread({}, options), {}, {
|
|
162
|
+
modifiers: [endingOffset, {
|
|
163
|
+
name: 'eventListeners',
|
|
164
|
+
enabled: true
|
|
165
|
+
}]
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
_this3.isDisplayed = true;
|
|
169
|
+
}, this.timeout);
|
|
170
|
+
}
|
|
171
|
+
}]);
|
|
172
|
+
}();
|
|
@@ -5,9 +5,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
*/
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { css, Global, jsx } from '@emotion/react';
|
|
8
|
+
import { tableControlsSpacing } from '@atlaskit/editor-common/styles';
|
|
8
9
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
9
10
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport } from '@atlaskit/editor-shared-styles';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
11
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
14
|
import { DRAG_HANDLE_MAX_WIDTH_PLUS_GAP, DRAG_HANDLE_WIDTH } from './consts';
|
|
13
15
|
|
|
@@ -118,6 +120,89 @@ var globalStyles = function globalStyles() {
|
|
|
118
120
|
}
|
|
119
121
|
});
|
|
120
122
|
};
|
|
123
|
+
var quickInsertStyles = function quickInsertStyles() {
|
|
124
|
+
return css({
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
126
|
+
'.blocks-quick-insert-button': {
|
|
127
|
+
backgroundColor: 'transparent',
|
|
128
|
+
top: "var(--top-override,8px)",
|
|
129
|
+
position: 'sticky',
|
|
130
|
+
boxSizing: 'border-box',
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
height: "var(--ds-space-300, 24px)",
|
|
136
|
+
width: "var(--ds-space-300, 24px)",
|
|
137
|
+
border: 'none',
|
|
138
|
+
borderRadius: '50%',
|
|
139
|
+
zIndex: layers.card(),
|
|
140
|
+
outline: 'none',
|
|
141
|
+
cursor: 'pointer',
|
|
142
|
+
color: "var(--ds-icon-subtle, #626F86)"
|
|
143
|
+
},
|
|
144
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
145
|
+
'[data-blocks-quick-insert-container]:has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
146
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
147
|
+
'--top-override': "".concat(tableControlsSpacing, "px")
|
|
148
|
+
},
|
|
149
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
150
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-quick-insert-container]):has(~ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
151
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
152
|
+
'--top-override': "".concat(tableControlsSpacing, "px")
|
|
153
|
+
},
|
|
154
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
155
|
+
'.blocks-quick-insert-button:hover': {
|
|
156
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
157
|
+
},
|
|
158
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
159
|
+
'.blocks-quick-insert-button:active': {
|
|
160
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
161
|
+
},
|
|
162
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
163
|
+
'.blocks-quick-insert-button:focus': {
|
|
164
|
+
outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
|
|
165
|
+
},
|
|
166
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
167
|
+
'.blocks-quick-insert-visible-container': {
|
|
168
|
+
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out',
|
|
169
|
+
opacity: 1,
|
|
170
|
+
visibility: 'visible'
|
|
171
|
+
},
|
|
172
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
173
|
+
'.blocks-quick-insert-invisible-container': {
|
|
174
|
+
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out',
|
|
175
|
+
opacity: 0,
|
|
176
|
+
visibility: 'hidden'
|
|
177
|
+
},
|
|
178
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
179
|
+
'.blocks-quick-insert-tooltip': {
|
|
180
|
+
zIndex: layers.tooltip(),
|
|
181
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
182
|
+
padding: "var(--ds-space-050, 4px)".concat(" 0"),
|
|
183
|
+
boxSizing: 'border-box',
|
|
184
|
+
maxWidth: '240px',
|
|
185
|
+
backgroundColor: "var(--ds-background-neutral-bold, #44546F)",
|
|
186
|
+
color: "var(--ds-text-inverse, #FFFFFF)",
|
|
187
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
188
|
+
insetBlockStart: "var(--ds-space-0, 0px)",
|
|
189
|
+
insetInlineStart: "var(--ds-space-0, 0px)",
|
|
190
|
+
overflowWrap: 'break-word',
|
|
191
|
+
paddingBlockEnd: "var(--ds-space-025, 2px)",
|
|
192
|
+
paddingBlockStart: "var(--ds-space-025, 2px)",
|
|
193
|
+
paddingInlineEnd: "var(--ds-space-075, 6px)",
|
|
194
|
+
paddingInlineStart: "var(--ds-space-075, 6px)",
|
|
195
|
+
wordWrap: 'break-word',
|
|
196
|
+
pointerEvents: 'none',
|
|
197
|
+
userSelect: 'none',
|
|
198
|
+
// Based on: platform/packages/design-system/motion/src/entering/keyframes-motion.tsx
|
|
199
|
+
transition: 'opacity .1s ease-in-out, transform .1s ease-in-out, visibility .1s ease-in-out',
|
|
200
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
201
|
+
transition: 'none'
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
};
|
|
121
206
|
var topLevelNodeMarginStyles = css({
|
|
122
207
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
123
208
|
'.ProseMirror': {
|
|
@@ -194,6 +279,6 @@ var blockCardWithoutLayout = css({
|
|
|
194
279
|
});
|
|
195
280
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
196
281
|
return jsx(Global, {
|
|
197
|
-
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_fix_safari_cursor_hidden_empty') ? withRelativePosStyle : withRelativePosStyleLegacy, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
|
|
282
|
+
styles: [globalStyles(), globalDnDStyle, extendedHoverZone(), editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_widget_visibility') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_fix_safari_cursor_hidden_empty') ? withRelativePosStyle : withRelativePosStyleLegacy, topLevelNodeMarginStyles, withAnchorNameZindexStyle]
|
|
198
283
|
});
|
|
199
284
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
4
|
+
export declare const calculatePosition: ({ rootAnchorName, anchorName, view, getPos, rootNodeType, macroInteractionUpdates, anchorRectCache, }: {
|
|
5
|
+
rootAnchorName: string | undefined;
|
|
6
|
+
getPos: () => number | undefined;
|
|
7
|
+
view: EditorView;
|
|
8
|
+
rootNodeType: string;
|
|
9
|
+
anchorName: string;
|
|
10
|
+
macroInteractionUpdates: boolean | undefined;
|
|
11
|
+
anchorRectCache: AnchorRectCache | undefined;
|
|
12
|
+
}) => CSSProperties;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
5
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
|
+
type VanillaQuickInsertProps = {
|
|
7
|
+
formatMessage: IntlShape['formatMessage'];
|
|
8
|
+
api: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
9
|
+
view: EditorView;
|
|
10
|
+
getPos: () => number | undefined;
|
|
11
|
+
cleanupCallbacks: ((() => void) | undefined)[];
|
|
12
|
+
rootNodeType: string;
|
|
13
|
+
anchorRectCache?: AnchorRectCache;
|
|
14
|
+
anchorName: string;
|
|
15
|
+
rootAnchorName: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Create a Node which contains the quick insert button
|
|
19
|
+
*/
|
|
20
|
+
export declare const createVanillaButton: (props: VanillaQuickInsertProps) => Node;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
|
|
3
|
+
*
|
|
4
|
+
* Uses Popover API for accessibility + stacking context: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
|
|
5
|
+
* Uses popperJS for positioning
|
|
6
|
+
*
|
|
7
|
+
* @warning Still experimental. One day we can likely want to move this to a common package.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VanillaTooltip {
|
|
10
|
+
private button;
|
|
11
|
+
private timeout;
|
|
12
|
+
private popperInstance;
|
|
13
|
+
private listeners;
|
|
14
|
+
private currentTimeoutId;
|
|
15
|
+
private shouldHidePopover;
|
|
16
|
+
private tooltip;
|
|
17
|
+
private isDisplayed;
|
|
18
|
+
constructor(button: HTMLButtonElement, content: string,
|
|
19
|
+
/**
|
|
20
|
+
* Id associated to the tooltip - must be unique.
|
|
21
|
+
*/
|
|
22
|
+
id: string, timeout?: number);
|
|
23
|
+
private createPopperInstance;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
private hide;
|
|
26
|
+
private show;
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
4
|
+
export declare const calculatePosition: ({ rootAnchorName, anchorName, view, getPos, rootNodeType, macroInteractionUpdates, anchorRectCache, }: {
|
|
5
|
+
rootAnchorName: string | undefined;
|
|
6
|
+
getPos: () => number | undefined;
|
|
7
|
+
view: EditorView;
|
|
8
|
+
rootNodeType: string;
|
|
9
|
+
anchorName: string;
|
|
10
|
+
macroInteractionUpdates: boolean | undefined;
|
|
11
|
+
anchorRectCache: AnchorRectCache | undefined;
|
|
12
|
+
}) => CSSProperties;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
5
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
|
+
type VanillaQuickInsertProps = {
|
|
7
|
+
formatMessage: IntlShape['formatMessage'];
|
|
8
|
+
api: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
9
|
+
view: EditorView;
|
|
10
|
+
getPos: () => number | undefined;
|
|
11
|
+
cleanupCallbacks: ((() => void) | undefined)[];
|
|
12
|
+
rootNodeType: string;
|
|
13
|
+
anchorRectCache?: AnchorRectCache;
|
|
14
|
+
anchorName: string;
|
|
15
|
+
rootAnchorName: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Create a Node which contains the quick insert button
|
|
19
|
+
*/
|
|
20
|
+
export declare const createVanillaButton: (props: VanillaQuickInsertProps) => Node;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
|
|
3
|
+
*
|
|
4
|
+
* Uses Popover API for accessibility + stacking context: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
|
|
5
|
+
* Uses popperJS for positioning
|
|
6
|
+
*
|
|
7
|
+
* @warning Still experimental. One day we can likely want to move this to a common package.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VanillaTooltip {
|
|
10
|
+
private button;
|
|
11
|
+
private timeout;
|
|
12
|
+
private popperInstance;
|
|
13
|
+
private listeners;
|
|
14
|
+
private currentTimeoutId;
|
|
15
|
+
private shouldHidePopover;
|
|
16
|
+
private tooltip;
|
|
17
|
+
private isDisplayed;
|
|
18
|
+
constructor(button: HTMLButtonElement, content: string,
|
|
19
|
+
/**
|
|
20
|
+
* Id associated to the tooltip - must be unique.
|
|
21
|
+
*/
|
|
22
|
+
id: string, timeout?: number);
|
|
23
|
+
private createPopperInstance;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
private hide;
|
|
26
|
+
private show;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.4.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -56,11 +56,12 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^14.8.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.14.0",
|
|
60
|
+
"@atlaskit/tokens": "^5.1.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
64
|
+
"@popperjs/core": "^2.11.8",
|
|
64
65
|
"bind-event-listener": "^3.0.0",
|
|
65
66
|
"memoize-one": "^6.0.0",
|
|
66
67
|
"raf-schd": "^4.0.3",
|
|
@@ -179,6 +180,9 @@
|
|
|
179
180
|
"platform_editor_no_cursor_on_live_doc_init": {
|
|
180
181
|
"type": "boolean"
|
|
181
182
|
},
|
|
183
|
+
"platform_editor_drag_and_drop_perf_analytics": {
|
|
184
|
+
"type": "boolean"
|
|
185
|
+
},
|
|
182
186
|
"platform_editor_column_count_analytics": {
|
|
183
187
|
"type": "boolean"
|
|
184
188
|
},
|