@atlaskit/editor-plugin-floating-toolbar 1.12.4 → 1.13.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 +12 -0
- package/dist/cjs/plugin.js +13 -10
- package/dist/es2019/plugin.js +10 -5
- package/dist/esm/plugin.js +11 -10
- package/dist/types/plugin.d.ts +9 -1
- package/dist/types-ts4.5/plugin.d.ts +9 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 1.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#140163](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140163)
|
|
8
|
+
[`8393ffa4eb45a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8393ffa4eb45a) -
|
|
9
|
+
PGEXP-275 Extend floating toolbar API to pass config list
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.12.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.ContentComponent = ContentComponent;
|
|
9
|
-
exports.
|
|
9
|
+
exports.floatingToolbarPlugin = void 0;
|
|
10
|
+
exports.floatingToolbarPluginFactory = floatingToolbarPluginFactory;
|
|
11
|
+
exports.pluginKey = exports.getRelevantConfig = void 0;
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
var _react = _interopRequireDefault(require("react"));
|
|
12
14
|
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
@@ -131,12 +133,10 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
|
|
|
131
133
|
// Should be after all toolbar plugins
|
|
132
134
|
name: 'floatingToolbar',
|
|
133
135
|
plugin: function plugin(_ref2) {
|
|
134
|
-
var
|
|
135
|
-
providerFactory = _ref2.providerFactory,
|
|
136
|
+
var providerFactory = _ref2.providerFactory,
|
|
136
137
|
getIntl = _ref2.getIntl;
|
|
137
138
|
return floatingToolbarPluginFactory({
|
|
138
139
|
floatingToolbarHandlers: floatingToolbarHandlers,
|
|
139
|
-
dispatch: dispatch,
|
|
140
140
|
providerFactory: providerFactory,
|
|
141
141
|
getIntl: getIntl
|
|
142
142
|
});
|
|
@@ -384,15 +384,18 @@ function floatingToolbarPluginFactory(options) {
|
|
|
384
384
|
getIntl = options.getIntl;
|
|
385
385
|
var intl = getIntl();
|
|
386
386
|
var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
|
|
387
|
-
var activeConfigs =
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
var activeConfigs = [];
|
|
388
|
+
for (var index = 0; index < floatingToolbarHandlers.length; index++) {
|
|
389
|
+
var handler = floatingToolbarHandlers[index];
|
|
390
|
+
var config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
391
|
+
if (config) {
|
|
392
|
+
activeConfigs.push(sanitizeFloatingToolbarConfig(config));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
392
395
|
var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
|
|
393
396
|
return relevantConfig;
|
|
394
397
|
};
|
|
395
|
-
var apply = function apply(
|
|
398
|
+
var apply = function apply() {
|
|
396
399
|
var newPluginState = {
|
|
397
400
|
getConfigWithNodeInfo: getConfigWithNodeInfo
|
|
398
401
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -120,12 +120,10 @@ export const floatingToolbarPlugin = ({
|
|
|
120
120
|
// Should be after all toolbar plugins
|
|
121
121
|
name: 'floatingToolbar',
|
|
122
122
|
plugin: ({
|
|
123
|
-
dispatch,
|
|
124
123
|
providerFactory,
|
|
125
124
|
getIntl
|
|
126
125
|
}) => floatingToolbarPluginFactory({
|
|
127
126
|
floatingToolbarHandlers,
|
|
128
|
-
dispatch,
|
|
129
127
|
providerFactory,
|
|
130
128
|
getIntl
|
|
131
129
|
})
|
|
@@ -361,7 +359,7 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
361
359
|
}
|
|
362
360
|
return config;
|
|
363
361
|
}
|
|
364
|
-
function floatingToolbarPluginFactory(options) {
|
|
362
|
+
export function floatingToolbarPluginFactory(options) {
|
|
365
363
|
const {
|
|
366
364
|
floatingToolbarHandlers,
|
|
367
365
|
providerFactory,
|
|
@@ -369,11 +367,18 @@ function floatingToolbarPluginFactory(options) {
|
|
|
369
367
|
} = options;
|
|
370
368
|
const intl = getIntl();
|
|
371
369
|
const getConfigWithNodeInfo = editorState => {
|
|
372
|
-
|
|
370
|
+
let activeConfigs = [];
|
|
371
|
+
for (let index = 0; index < floatingToolbarHandlers.length; index++) {
|
|
372
|
+
const handler = floatingToolbarHandlers[index];
|
|
373
|
+
const config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
374
|
+
if (config) {
|
|
375
|
+
activeConfigs.push(sanitizeFloatingToolbarConfig(config));
|
|
376
|
+
}
|
|
377
|
+
}
|
|
373
378
|
const relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
|
|
374
379
|
return relevantConfig;
|
|
375
380
|
};
|
|
376
|
-
const apply = (
|
|
381
|
+
const apply = () => {
|
|
377
382
|
const newPluginState = {
|
|
378
383
|
getConfigWithNodeInfo
|
|
379
384
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -121,12 +121,10 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
|
|
|
121
121
|
// Should be after all toolbar plugins
|
|
122
122
|
name: 'floatingToolbar',
|
|
123
123
|
plugin: function plugin(_ref2) {
|
|
124
|
-
var
|
|
125
|
-
providerFactory = _ref2.providerFactory,
|
|
124
|
+
var providerFactory = _ref2.providerFactory,
|
|
126
125
|
getIntl = _ref2.getIntl;
|
|
127
126
|
return floatingToolbarPluginFactory({
|
|
128
127
|
floatingToolbarHandlers: floatingToolbarHandlers,
|
|
129
|
-
dispatch: dispatch,
|
|
130
128
|
providerFactory: providerFactory,
|
|
131
129
|
getIntl: getIntl
|
|
132
130
|
});
|
|
@@ -368,21 +366,24 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
368
366
|
}
|
|
369
367
|
return config;
|
|
370
368
|
}
|
|
371
|
-
function floatingToolbarPluginFactory(options) {
|
|
369
|
+
export function floatingToolbarPluginFactory(options) {
|
|
372
370
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
373
371
|
providerFactory = options.providerFactory,
|
|
374
372
|
getIntl = options.getIntl;
|
|
375
373
|
var intl = getIntl();
|
|
376
374
|
var getConfigWithNodeInfo = function getConfigWithNodeInfo(editorState) {
|
|
377
|
-
var activeConfigs =
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
375
|
+
var activeConfigs = [];
|
|
376
|
+
for (var index = 0; index < floatingToolbarHandlers.length; index++) {
|
|
377
|
+
var handler = floatingToolbarHandlers[index];
|
|
378
|
+
var config = handler(editorState, intl, providerFactory, activeConfigs);
|
|
379
|
+
if (config) {
|
|
380
|
+
activeConfigs.push(sanitizeFloatingToolbarConfig(config));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
382
383
|
var relevantConfig = activeConfigs && getRelevantConfig(editorState.selection, activeConfigs);
|
|
383
384
|
return relevantConfig;
|
|
384
385
|
};
|
|
385
|
-
var apply = function apply(
|
|
386
|
+
var apply = function apply() {
|
|
386
387
|
var newPluginState = {
|
|
387
388
|
getConfigWithNodeInfo: getConfigWithNodeInfo
|
|
388
389
|
};
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import type { ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarHandler, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
6
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
8
|
import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './types';
|
|
@@ -14,3 +17,8 @@ export declare function ContentComponent({ pluginInjectionApi, editorView, popup
|
|
|
14
17
|
*
|
|
15
18
|
*/
|
|
16
19
|
export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
20
|
+
export declare function floatingToolbarPluginFactory(options: {
|
|
21
|
+
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
22
|
+
getIntl: () => IntlShape;
|
|
23
|
+
providerFactory: ProviderFactory;
|
|
24
|
+
}): SafePlugin<FloatingToolbarPluginState>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import type { ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarHandler, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
6
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
8
|
import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './types';
|
|
@@ -14,3 +17,8 @@ export declare function ContentComponent({ pluginInjectionApi, editorView, popup
|
|
|
14
17
|
*
|
|
15
18
|
*/
|
|
16
19
|
export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
20
|
+
export declare function floatingToolbarPluginFactory(options: {
|
|
21
|
+
floatingToolbarHandlers: Array<FloatingToolbarHandler>;
|
|
22
|
+
getIntl: () => IntlShape;
|
|
23
|
+
providerFactory: ProviderFactory;
|
|
24
|
+
}): SafePlugin<FloatingToolbarPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@atlaskit/adf-utils": "^19.8.0",
|
|
27
27
|
"@atlaskit/button": "^20.1.0",
|
|
28
28
|
"@atlaskit/checkbox": "^14.0.0",
|
|
29
|
-
"@atlaskit/editor-common": "^89.
|
|
29
|
+
"@atlaskit/editor-common": "^89.1.0",
|
|
30
30
|
"@atlaskit/editor-palette": "1.6.0",
|
|
31
31
|
"@atlaskit/editor-plugin-block-controls": "^1.13.0",
|
|
32
32
|
"@atlaskit/editor-plugin-context-panel": "^1.3.0",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-table": "^7.25.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
41
41
|
"@atlaskit/emoji": "^67.7.0",
|
|
42
|
-
"@atlaskit/icon": "^22.
|
|
42
|
+
"@atlaskit/icon": "^22.17.0",
|
|
43
43
|
"@atlaskit/menu": "^2.12.0",
|
|
44
44
|
"@atlaskit/modal-dialog": "^12.15.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/primitives": "^12.1.0",
|
|
47
|
-
"@atlaskit/select": "^17.
|
|
47
|
+
"@atlaskit/select": "^17.17.0",
|
|
48
48
|
"@atlaskit/theme": "^13.0.0",
|
|
49
49
|
"@atlaskit/tokens": "^1.59.0",
|
|
50
50
|
"@atlaskit/tooltip": "^18.7.0",
|