@atlaskit/editor-core 187.43.12 → 187.43.17
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 +13 -0
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/labs/next/presets/universal.js +1 -1
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +13 -54
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/selection/utils.js +29 -80
- package/dist/cjs/plugins/type-ahead/index.js +2 -2
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +2 -2
- package/dist/cjs/utils/clipboard.js +19 -127
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -2
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -53
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/selection/utils.js +3 -74
- package/dist/es2019/plugins/type-ahead/index.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +1 -1
- package/dist/es2019/utils/clipboard.js +1 -53
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/labs/next/presets/universal.js +2 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +3 -49
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/selection/utils.js +3 -72
- package/dist/esm/plugins/type-ahead/index.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +1 -1
- package/dist/esm/utils/clipboard.js +1 -119
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +68 -4
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/selection/utils.d.ts +2 -5
- package/dist/types/plugins/type-ahead/api.d.ts +1 -1
- package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +1 -1
- package/dist/types/plugins/type-ahead/commands/update-query.d.ts +1 -1
- package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +1 -1
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/type-ahead/types.d.ts +1 -1
- package/dist/types/utils/clipboard.d.ts +1 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +86 -0
- package/dist/types-ts4.5/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -5
- package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/clipboard.d.ts +1 -3
- package/package.json +12 -8
- package/report.api.md +1 -1
- package/tmp/api-report-tmp.d.ts +1 -1
- package/dist/cjs/plugins/copy-button/commands.js +0 -171
- package/dist/cjs/plugins/copy-button/index.js +0 -23
- package/dist/cjs/plugins/copy-button/pm-plugins/main.js +0 -104
- package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/copy-button/toolbar.js +0 -99
- package/dist/cjs/plugins/copy-button/utils.js +0 -22
- package/dist/es2019/plugins/copy-button/commands.js +0 -157
- package/dist/es2019/plugins/copy-button/index.js +0 -11
- package/dist/es2019/plugins/copy-button/pm-plugins/main.js +0 -97
- package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/copy-button/toolbar.js +0 -82
- package/dist/es2019/plugins/copy-button/utils.js +0 -15
- package/dist/esm/plugins/copy-button/commands.js +0 -159
- package/dist/esm/plugins/copy-button/index.js +0 -15
- package/dist/esm/plugins/copy-button/pm-plugins/main.js +0 -96
- package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/copy-button/toolbar.js +0 -89
- package/dist/esm/plugins/copy-button/utils.js +0 -14
- package/dist/types/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types/plugins/copy-button/index.d.ts +0 -3
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types/plugins/copy-button/utils.d.ts +0 -8
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types-ts4.5/plugins/copy-button/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +0 -8
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
5
|
-
import commonMessages from '../../messages';
|
|
6
|
-
import { createToolbarCopyCommandForNode, createToolbarCopyCommandForMark, resetCopiedState, getProvideMarkVisualFeedbackForCopyButtonCommand, removeMarkVisualFeedbackForCopyButtonCommand } from './commands';
|
|
7
|
-
import { copyButtonPluginKey } from './pm-plugins/plugin-key';
|
|
8
|
-
function isSeparator(item) {
|
|
9
|
-
return (item === null || item === void 0 ? void 0 : item.type) === 'separator';
|
|
10
|
-
}
|
|
11
|
-
function isNodeOptions(options) {
|
|
12
|
-
return 'nodeType' in options && options.nodeType !== undefined;
|
|
13
|
-
}
|
|
14
|
-
export function getCopyButtonConfig(options, hoverDecoration) {
|
|
15
|
-
var state = options.state,
|
|
16
|
-
formatMessage = options.formatMessage,
|
|
17
|
-
onMouseEnter = options.onMouseEnter,
|
|
18
|
-
onMouseLeave = options.onMouseLeave,
|
|
19
|
-
onFocus = options.onFocus,
|
|
20
|
-
onBlur = options.onBlur;
|
|
21
|
-
var copyButtonState = copyButtonPluginKey.getState(state);
|
|
22
|
-
var buttonActionHandlers;
|
|
23
|
-
if (isNodeOptions(options)) {
|
|
24
|
-
buttonActionHandlers = {
|
|
25
|
-
onClick: createToolbarCopyCommandForNode(options.nodeType),
|
|
26
|
-
// Note for future changes: these two handlers should perform
|
|
27
|
-
// the same action.
|
|
28
|
-
onMouseEnter: onMouseEnter || (hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(options.nodeType, true, 'ak-editor-selected-node')),
|
|
29
|
-
onFocus: onFocus || (hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(options.nodeType, true, 'ak-editor-selected-node')),
|
|
30
|
-
// Note for future changes: these two handlers should perform
|
|
31
|
-
// the same action.
|
|
32
|
-
onMouseLeave: resetCopiedState(options.nodeType, hoverDecoration, onMouseLeave),
|
|
33
|
-
onBlur: resetCopiedState(options.nodeType, hoverDecoration, onBlur)
|
|
34
|
-
};
|
|
35
|
-
} else {
|
|
36
|
-
buttonActionHandlers = {
|
|
37
|
-
onClick: createToolbarCopyCommandForMark(options.markType),
|
|
38
|
-
onMouseEnter: getProvideMarkVisualFeedbackForCopyButtonCommand(options.markType),
|
|
39
|
-
onFocus: getProvideMarkVisualFeedbackForCopyButtonCommand(options.markType),
|
|
40
|
-
onMouseLeave: removeMarkVisualFeedbackForCopyButtonCommand,
|
|
41
|
-
onBlur: removeMarkVisualFeedbackForCopyButtonCommand
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return _objectSpread(_objectSpread({
|
|
45
|
-
id: 'editor.floatingToolbar.copy',
|
|
46
|
-
type: 'button',
|
|
47
|
-
appearance: 'subtle',
|
|
48
|
-
icon: CopyIcon,
|
|
49
|
-
title: formatMessage(copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied ? commonMessages.copiedToClipboard : commonMessages.copyToClipboard)
|
|
50
|
-
}, buttonActionHandlers), {}, {
|
|
51
|
-
hideTooltipOnClick: false,
|
|
52
|
-
tabIndex: null
|
|
53
|
-
// TODO select and delete styling needs to be removed when keyboard cursor moves away
|
|
54
|
-
// problem already exist with delete as well
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export var showCopyButton = function showCopyButton(state) {
|
|
59
|
-
return state &&
|
|
60
|
-
// Check if the Copy button plugin is enabled
|
|
61
|
-
// @ts-ignore copyButtonPluginKey.key
|
|
62
|
-
state.plugins.find(function (p) {
|
|
63
|
-
return p.key === copyButtonPluginKey.key;
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Process floatingToolbar items for copyButton
|
|
69
|
-
*
|
|
70
|
-
* If copy button plugin not enabled, remove copy button item from toolbar items
|
|
71
|
-
* else process copy button to standard floatingtoobarbutton
|
|
72
|
-
*/
|
|
73
|
-
export function processCopyButtonItems(state) {
|
|
74
|
-
return function (items, hoverDecoration) {
|
|
75
|
-
return items.flatMap(function (item) {
|
|
76
|
-
switch (item.type) {
|
|
77
|
-
case 'copy-button':
|
|
78
|
-
if (item !== null && item !== void 0 && item.hidden || !showCopyButton(state)) {
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
return item === null || item === void 0 ? void 0 : item.items.map(function (copyButtonItem) {
|
|
82
|
-
return isSeparator(copyButtonItem) ? copyButtonItem : getCopyButtonConfig(copyButtonItem, hoverDecoration);
|
|
83
|
-
});
|
|
84
|
-
default:
|
|
85
|
-
return [item];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { findSelectedNodeOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
export function getSelectedNodeOrNodeParentByNodeType(_ref) {
|
|
4
|
-
var nodeType = _ref.nodeType,
|
|
5
|
-
selection = _ref.selection;
|
|
6
|
-
var node = findSelectedNodeOfType(nodeType)(selection);
|
|
7
|
-
if (!node) {
|
|
8
|
-
node = findParentNodeOfType(nodeType)(selection);
|
|
9
|
-
}
|
|
10
|
-
return node;
|
|
11
|
-
}
|
|
12
|
-
export var toDOM = function toDOM(node, schema) {
|
|
13
|
-
return DOMSerializer.fromSchema(schema).serializeNode(node);
|
|
14
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Command, CommandDispatch } from '../../types';
|
|
2
|
-
import type { MarkType, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
-
export declare function createToolbarCopyCommandForMark(markType: MarkType): Command;
|
|
6
|
-
export declare function getProvideMarkVisualFeedbackForCopyButtonCommand(markType: MarkType): (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
|
|
7
|
-
export declare function removeMarkVisualFeedbackForCopyButtonCommand(state: EditorState, dispatch: CommandDispatch | undefined): boolean;
|
|
8
|
-
export declare const createToolbarCopyCommandForNode: (nodeType: NodeType | Array<NodeType>) => Command;
|
|
9
|
-
export declare const resetCopiedState: (nodeType: NodeType | Array<NodeType>, hoverDecoration: HoverDecorationHandler | undefined, onMouseLeave?: Command) => Command;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Command } from '../../../src/types';
|
|
3
|
-
import type { FloatingToolbarButton, FloatingToolbarItem, MarkOptions, NodeOptions } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
-
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined): FloatingToolbarButton<Command>;
|
|
6
|
-
export declare const showCopyButton: (state?: EditorState) => import("prosemirror-state").Plugin<any> | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Process floatingToolbar items for copyButton
|
|
9
|
-
*
|
|
10
|
-
* If copy button plugin not enabled, remove copy button item from toolbar items
|
|
11
|
-
* else process copy button to standard floatingtoobarbutton
|
|
12
|
-
*/
|
|
13
|
-
export declare function processCopyButtonItems(state: EditorState): (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Schema, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
export declare function getSelectedNodeOrNodeParentByNodeType({ nodeType, selection, }: {
|
|
5
|
-
nodeType: NodeType | Array<NodeType>;
|
|
6
|
-
selection: Transaction['selection'];
|
|
7
|
-
}): import("prosemirror-utils/dist/types").FindResult;
|
|
8
|
-
export declare const toDOM: (node: PMNode, schema: Schema) => Node;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Command, CommandDispatch } from '../../types';
|
|
2
|
-
import type { MarkType, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
-
export declare function createToolbarCopyCommandForMark(markType: MarkType): Command;
|
|
6
|
-
export declare function getProvideMarkVisualFeedbackForCopyButtonCommand(markType: MarkType): (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
|
|
7
|
-
export declare function removeMarkVisualFeedbackForCopyButtonCommand(state: EditorState, dispatch: CommandDispatch | undefined): boolean;
|
|
8
|
-
export declare const createToolbarCopyCommandForNode: (nodeType: NodeType | Array<NodeType>) => Command;
|
|
9
|
-
export declare const resetCopiedState: (nodeType: NodeType | Array<NodeType>, hoverDecoration: HoverDecorationHandler | undefined, onMouseLeave?: Command) => Command;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Command } from '../../../src/types';
|
|
3
|
-
import type { FloatingToolbarButton, FloatingToolbarItem, MarkOptions, NodeOptions } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
-
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined): FloatingToolbarButton<Command>;
|
|
6
|
-
export declare const showCopyButton: (state?: EditorState) => import("prosemirror-state").Plugin<any> | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Process floatingToolbar items for copyButton
|
|
9
|
-
*
|
|
10
|
-
* If copy button plugin not enabled, remove copy button item from toolbar items
|
|
11
|
-
* else process copy button to standard floatingtoobarbutton
|
|
12
|
-
*/
|
|
13
|
-
export declare function processCopyButtonItems(state: EditorState): (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Schema, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
export declare function getSelectedNodeOrNodeParentByNodeType({ nodeType, selection, }: {
|
|
5
|
-
nodeType: NodeType | Array<NodeType>;
|
|
6
|
-
selection: Transaction['selection'];
|
|
7
|
-
}): import("prosemirror-utils/dist/types").FindResult;
|
|
8
|
-
export declare const toDOM: (node: PMNode, schema: Schema) => Node;
|