@atlaskit/editor-plugin-paste-options-toolbar 12.0.14 → 12.0.15

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/current-pasted-smart-link/package.json +1 -8
  3. package/package.json +2 -2
  4. package/paste-options-toolbar-plugin/package.json +1 -8
  5. package/paste-options-toolbar-plugin-type/package.json +1 -8
  6. package/dist/types-ts4.5/editor-actions/actions.d.ts +0 -36
  7. package/dist/types-ts4.5/editor-commands/commands.d.ts +0 -16
  8. package/dist/types-ts4.5/entry-points/current-pasted-smart-link.d.ts +0 -1
  9. package/dist/types-ts4.5/entry-points/paste-options-toolbar-plugin-type.d.ts +0 -2
  10. package/dist/types-ts4.5/entry-points/paste-options-toolbar-plugin.d.ts +0 -1
  11. package/dist/types-ts4.5/index.d.ts +0 -2
  12. package/dist/types-ts4.5/pasteOptionsToolbarPlugin.d.ts +0 -2
  13. package/dist/types-ts4.5/pasteOptionsToolbarPluginType.d.ts +0 -66
  14. package/dist/types-ts4.5/pm-plugins/constants.d.ts +0 -10
  15. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -6
  16. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +0 -8
  17. package/dist/types-ts4.5/pm-plugins/reducer.d.ts +0 -3
  18. package/dist/types-ts4.5/pm-plugins/util/format-handlers.d.ts +0 -9
  19. package/dist/types-ts4.5/pm-plugins/util/index.d.ts +0 -6
  20. package/dist/types-ts4.5/types/types.d.ts +0 -28
  21. package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteActionsMenu.d.ts +0 -89
  22. package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteActionsMenuContent.d.ts +0 -10
  23. package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteMenuComponents.d.ts +0 -10
  24. package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteOptionsDropdownButton.d.ts +0 -19
  25. package/dist/types-ts4.5/ui/on-paste-actions-menu/exposure-v2.d.ts +0 -3
  26. package/dist/types-ts4.5/ui/on-paste-actions-menu/exposure.d.ts +0 -3
  27. package/dist/types-ts4.5/ui/on-paste-actions-menu/hasVisibleButton.d.ts +0 -11
  28. package/dist/types-ts4.5/ui/toolbar.d.ts +0 -9
  29. package/dist/types-ts4.5/ui/utils/current-pasted-smart-link.d.ts +0 -2
  30. package/dist/types-ts4.5/ui/utils/paste-menu-rules/hasMixedNodes.d.ts +0 -10
  31. package/dist/types-ts4.5/ui/utils/paste-menu-rules/hasTableNode.d.ts +0 -2
  32. package/dist/types-ts4.5/ui/utils/paste-menu-rules/isNotProse.d.ts +0 -1
  33. package/dist/types-ts4.5/ui/utils/paste-menu-rules/isNotSingleLink.d.ts +0 -17
  34. package/dist/types-ts4.5/ui/utils/paste-menu-rules/rules.d.ts +0 -8
  35. package/dist/types-ts4.5/ui/utils/paste-menu-rules/types.d.ts +0 -112
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-paste-options-toolbar
2
2
 
3
+ ## 12.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 12.0.14
4
10
 
5
11
  ### Patch Changes
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/current-pasted-smart-link.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/current-pasted-smart-link.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/current-pasted-smart-link.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste-options-toolbar",
3
- "version": "12.0.14",
3
+ "version": "12.0.15",
4
4
  "description": "Paste options toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/icon": "^35.4.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/primitives": "^19.0.0",
45
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
46
46
  "@atlaskit/tokens": "^13.4.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@compiled/react": "^0.20.0",
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/paste-options-toolbar-plugin.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/paste-options-toolbar-plugin.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/paste-options-toolbar-plugin.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/paste-options-toolbar-plugin-type.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/paste-options-toolbar-plugin-type.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/paste-options-toolbar-plugin-type.d.ts"
17
10
  }
@@ -1,36 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { ToolbarDropdownOption } from '../types/types';
3
- export declare enum PastePluginActionTypes {
4
- START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
5
- STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
6
- SHOW_PASTE_OPTIONS = "SHOW_PASTE_OPTIONS",
7
- HIDE_PASTE_OPTIONS = "HIDE_PASTE_OPTIONS",
8
- HIGHLIGHT_CONTENT = "HIGHLIGHT_CONTENT",
9
- CHANGE_FORMAT = "CHANGE_FORMAT"
10
- }
11
- export interface ShowPasteOptions {
12
- data: {
13
- isPlainText: boolean;
14
- pasteAncestorNodeNames: string[];
15
- pasteEndPos: number;
16
- pasteStartPos: number;
17
- plaintext: string;
18
- richTextSlice: Slice;
19
- selectedOption: ToolbarDropdownOption;
20
- showLegacyOptions: boolean;
21
- };
22
- type: PastePluginActionTypes.SHOW_PASTE_OPTIONS;
23
- }
24
- export interface HidePasteOptions {
25
- type: PastePluginActionTypes.HIDE_PASTE_OPTIONS;
26
- }
27
- export interface HighlightContent {
28
- type: PastePluginActionTypes.HIGHLIGHT_CONTENT;
29
- }
30
- export interface ChangeFormat {
31
- data: {
32
- selectedOption: ToolbarDropdownOption;
33
- };
34
- type: PastePluginActionTypes.CHANGE_FORMAT;
35
- }
36
- export type PastePluginAction = ShowPasteOptions | HidePasteOptions | HighlightContent | ChangeFormat;
@@ -1,16 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import { ToolbarDropdownOption } from '../types/types';
6
- export declare const showToolbar: (lastContentPasted: LastContentPasted, selectedOption: ToolbarDropdownOption, showLegacyOptions?: boolean, pasteAncestorNodeNames?: string[]) => Command;
7
- export declare const changeToPlainText: () => Command;
8
- export declare const changeToPlainTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, sliceSize: number, invokedFrom?: string) => () => Command;
9
- export declare const dropdownClickHandler: () => Command;
10
- export declare const changeToRichText: () => Command;
11
- export declare const changeToRichTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, invokedFrom?: string) => () => Command;
12
- export declare const changeToMarkDown: () => Command;
13
- export declare const changeToMarkdownWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, sliceSize: number, invokedFrom?: string) => () => Command;
14
- export declare const highlightContent: () => Command;
15
- export declare const hideToolbar: () => Command;
16
- export declare const checkAndHideToolbar: (view: EditorView) => void;
@@ -1 +0,0 @@
1
- export { getSingleSmartLinkUrlFromSlice } from '../ui/utils/current-pasted-smart-link';
@@ -1,2 +0,0 @@
1
- export type { PasteOptionsToolbarPlugin, PasteOptionsToolbarPluginConfiguration, PasteOptionsToolbarPluginDependencies, PasteOptionsToolbarPasteMenuContext, PasteOptionsToolbarSharedState, } from '../pasteOptionsToolbarPluginType';
2
- export type { PasteMenuRuleFactories } from '../ui/utils/paste-menu-rules/types';
@@ -1 +0,0 @@
1
- export { pasteOptionsToolbarPlugin } from '../pasteOptionsToolbarPlugin';
@@ -1,2 +0,0 @@
1
- export { pasteOptionsToolbarPlugin } from './pasteOptionsToolbarPlugin';
2
- export type { PasteOptionsToolbarPlugin, PasteOptionsToolbarPluginDependencies, PasteOptionsToolbarSharedState, } from './pasteOptionsToolbarPluginType';
@@ -1,2 +0,0 @@
1
- import type { PasteOptionsToolbarPlugin } from './pasteOptionsToolbarPluginType';
2
- export declare const pasteOptionsToolbarPlugin: PasteOptionsToolbarPlugin;
@@ -1,66 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
4
- import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
5
- import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
6
- import type { ToolbarDropdownOption } from './types/types';
7
- import type { PasteMenuRuleFactories } from './ui/utils/paste-menu-rules/types';
8
- export type PasteOptionsToolbarPluginDependencies = [
9
- OptionalPlugin<AnalyticsPlugin>,
10
- PastePlugin,
11
- OptionalPlugin<UiControlRegistryPlugin>
12
- ];
13
- export interface PasteOptionsToolbarSharedState {
14
- isPlainText: boolean;
15
- pasteAncestorNodeNames: string[];
16
- pasteEndPos: number;
17
- pasteStartPos: number;
18
- plaintextLength: number;
19
- selectedOption: ToolbarDropdownOption;
20
- showLegacyOptions: boolean;
21
- showToolbar: boolean;
22
- }
23
- export type PasteOptionsToolbarPasteMenuContext = {
24
- getCurrentPastedUrl: () => string | undefined;
25
- getCurrentPasteRange: () => {
26
- pasteEndPos: number;
27
- pasteStartPos: number;
28
- } | undefined;
29
- };
30
- export type PasteOptionsToolbarPluginConfiguration = {
31
- /**
32
- * Optional factory for composing product-specific paste menu buttons.
33
- * Called with the pre-bound rule factories so products can compose
34
- * `isHidden` callbacks before plugin setup.
35
- *
36
- * @example
37
- * pasteMenuButtonsFactory: (rules) => [
38
- * {
39
- * type: 'menu-item',
40
- * key: 'my-product-button',
41
- * isHidden: rules.allRules(rules.notProseRule, rules.minCharsRule(100)),
42
- * component: () => <MyProductButton />,
43
- * },
44
- * ]
45
- */
46
- pasteMenuButtonsFactory?: (rules: PasteMenuRuleFactories, context?: PasteOptionsToolbarPasteMenuContext) => RegisterComponent[];
47
- usePopupBasedPasteActionsMenu?: boolean;
48
- };
49
- export type PasteOptionsToolbarPlugin = NextEditorPlugin<'pasteOptionsToolbarPlugin', {
50
- actions: {
51
- /**
52
- * Returns the collection of paste-menu rule factories.
53
- * External plugins (e.g. `editor-plugin-ai`, `editor-plugin-card`) use
54
- * this to compose `isHidden` callbacks without static cross-package
55
- * imports.
56
- *
57
- * @example
58
- * const { minCharsRule, allRules } =
59
- * api.pasteOptionsToolbarPlugin.actions.getPasteMenuRules();
60
- */
61
- getPasteMenuRules: () => PasteMenuRuleFactories;
62
- };
63
- dependencies: PasteOptionsToolbarPluginDependencies;
64
- pluginConfiguration?: PasteOptionsToolbarPluginConfiguration;
65
- sharedState: PasteOptionsToolbarSharedState;
66
- }>;
@@ -1,10 +0,0 @@
1
- export declare const PASTE_TOOLBAR_CLASS = "ak-editor-paste-toolbar";
2
- export declare const PASTE_TOOLBAR_MENU_ID = "ak-editor-paste-toolbar-item-dropdownList";
3
- export declare const TEXT_HIGHLIGHT_CLASS = "text-highlight";
4
- export declare const PASTE_HIGHLIGHT_DECORATION_KEY = "paste-highlight-decoration-key";
5
- export declare const PASTE_TOOLBAR_ITEM_CLASS = "ak-editor-paste-toolbar-item";
6
- export declare const EDITOR_WRAPPER_CLASS = "akEditor";
7
- export declare const PASTE_OPTIONS_TEST_ID = "paste-options-testid";
8
- export declare const PASTE_OPTIONS_META_ID = "paste-options$";
9
- export declare const PASTE_MENU_GAP_HORIZONTAL = 8;
10
- export declare const PASTE_MENU_GAP_TOP = 24;
@@ -1,6 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { type PasteOptionsPluginState } from '../types/types';
4
- export declare function createPlugin(dispatch: Dispatch, options?: {
5
- useNewPasteMenu?: boolean;
6
- }): SafePlugin<PasteOptionsPluginState>;
@@ -1,8 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- import type { EditorState, SafeStateField, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import { type PastePluginAction } from '../editor-actions/actions';
5
- import type { PasteOptionsPluginState } from '../types/types';
6
- export declare const createPluginState: (dispatch: Dispatch, initialState: PasteOptionsPluginState | ((state: EditorState) => PasteOptionsPluginState)) => SafeStateField<PasteOptionsPluginState>;
7
- export declare const createCommand: <A = PastePluginAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
8
- export declare const getPluginState: (state: EditorState) => PasteOptionsPluginState;
@@ -1,3 +0,0 @@
1
- import type { PastePluginAction as Action } from '../editor-actions/actions';
2
- import type { PasteOptionsPluginState as State } from '../types/types';
3
- export declare const reducer: (state: State, action: Action) => State;
@@ -1,9 +0,0 @@
1
- import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { Slice } from '@atlaskit/editor-prosemirror/model';
3
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import { Selection } from '@atlaskit/editor-prosemirror/state';
5
- import type { PasteOptionsPluginState } from '../../types/types';
6
- export declare const formatMarkdown: (tr: Transaction, pluginState: PasteOptionsPluginState) => Transaction;
7
- export declare const formatRichText: (tr: Transaction, pluginState: PasteOptionsPluginState) => Transaction;
8
- export declare const formatPlainText: (tr: Transaction, pluginState: PasteOptionsPluginState) => Transaction;
9
- export declare function getMarkdownSlice(text: string, schema: Schema, selection: Selection): Slice | undefined;
@@ -1,6 +0,0 @@
1
- import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
- export declare function isPastedFromFabricEditor(pastedFrom: string): boolean;
3
- export declare function escapeLinks(text: string): string;
4
- export declare const hasMediaNode: (slice: Slice | undefined) => boolean;
5
- export declare const hasRuleNode: (slice: Slice, schema: Schema) => boolean;
6
- export declare const hasLinkMark: (slice: Slice) => boolean;
@@ -1,28 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
- export declare const pasteOptionsPluginKey: PluginKey;
5
- export declare enum ToolbarDropdownOption {
6
- Markdown = 0,
7
- RichText = 1,
8
- PlainText = 2,
9
- None = 3
10
- }
11
- export interface PasteOptionsPluginState {
12
- highlightContent: boolean;
13
- highlightDecorationSet: DecorationSet;
14
- isPlainText: boolean;
15
- pasteAncestorNodeNames: string[];
16
- pasteEndPos: number;
17
- pasteStartPos: number;
18
- plaintext: string;
19
- richTextSlice: Slice;
20
- selectedOption: ToolbarDropdownOption;
21
- showLegacyOptions: boolean;
22
- showToolbar: boolean;
23
- }
24
- export interface Position {
25
- left?: number;
26
- top?: number;
27
- }
28
- export type PasteType = 'rich-text' | 'markdown' | 'plain-text';
@@ -1,89 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { PasteOptionsToolbarPlugin } from '../../pasteOptionsToolbarPluginType';
5
- interface PasteActionsMenuProps {
6
- api: ExtractInjectionAPI<PasteOptionsToolbarPlugin> | undefined;
7
- boundariesElement?: HTMLElement;
8
- editorView: EditorView;
9
- mountTo?: HTMLElement;
10
- scrollableElement?: HTMLElement;
11
- }
12
- /**
13
- * Returns the DOM element at the given document position for use as a Popup anchor.
14
- * For empty blocks (BR elements), returns the parent element to ensure correct positioning.
15
- */
16
- export declare function getTargetElement(editorView: EditorView, pos: number): HTMLElement | null;
17
- /**
18
- * Returns the position immediately after a table ancestor of `pos`, or
19
- * `undefined` if not inside a table. Safe to cache per document version.
20
- */
21
- export declare function resolveTableAfterPos(editorView: EditorView, pos: number): number | undefined;
22
- /**
23
- * Returns the visual bottom of the pasted content. For positions inside a
24
- * table, uses the pre-computed `tableAfterPos` to get the correct bottom edge.
25
- */
26
- export declare function getVisualEndBottom(editorView: EditorView, pasteEndPos: number, tableAfterPos?: number): number;
27
- /**
28
- * Finds the DOM element for the nearest block-level ProseMirror ancestor of
29
- * the given document position. Uses ProseMirror's schema (`node.isBlock`)
30
- * rather than CSS display properties, so the check is always in sync with the
31
- * document model.
32
- *
33
- * Returns `null` if no block ancestor can be resolved to a DOM element.
34
- */
35
- export declare function findBlockAncestorDOM(editorView: EditorView, pos: number): HTMLElement | null;
36
- /**
37
- * Positions the paste menu inline, immediately to the right of the cursor
38
- * at the paste end position, vertically centered with the line.
39
- * Used for short pastes without AI actions.
40
- */
41
- export declare function onInlinePositionCalculated(editorView: EditorView, pasteEndPos: number, targetElement: HTMLElement, popupContentRef: React.RefObject<HTMLDivElement | null>): (position: {
42
- bottom?: number;
43
- left?: number;
44
- right?: number;
45
- top?: number;
46
- }) => {
47
- bottom?: number;
48
- left?: number;
49
- right?: number;
50
- top: number;
51
- };
52
- /**
53
- * Adjusts the position of the paste menu so that:
54
- *
55
- * **Vertical:** The menu aligns with the top of the pasted content using the
56
- * exact coordinates at the paste start position, and sticks to the top of the
57
- * scroll container when the pasted content scrolls above the visible area.
58
- *
59
- * The Popup uses alignY="bottom", which positions the popup below the target
60
- * element's bottom edge. This override:
61
- *
62
- * 1. Shifts the popup from the target's bottom edge to align with the paste
63
- * start position.
64
- * 2. When the paste start scrolls above the scroll container, clamps the menu
65
- * to the scroll container's top edge (sticky-top).
66
- * 3. Stops sticking once the entire pasted range (pasteEndPos) has scrolled
67
- * above the visible area.
68
- *
69
- * **Horizontal:** When the target element is an inline element (e.g. a mark
70
- * wrapper like `<strong>`, or an inline node like an emoji), the Popup's
71
- * `alignX="end"` would place the menu at the right edge of that narrow
72
- * element. This override resolves the nearest block-level ProseMirror
73
- * ancestor (using `node.isBlock` from the document schema) and re-anchors
74
- * the horizontal position to its right edge, so the menu consistently
75
- * appears at the right side of the content area.
76
- */
77
- export declare function onPositionCalculated(editorView: EditorView, pasteStartPos: number, pasteEndPos: number, targetElement: HTMLElement, scrollableElement?: HTMLElement | false): (position: {
78
- bottom?: number;
79
- left?: number;
80
- right?: number;
81
- top?: number;
82
- }) => {
83
- bottom?: number;
84
- left?: number;
85
- right?: number;
86
- top: number;
87
- };
88
- export declare const PasteActionsMenu: ({ api, editorView, mountTo, boundariesElement, scrollableElement, }: PasteActionsMenuProps) => React.JSX.Element | null;
89
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
3
- interface PasteActionsMenuContentProps {
4
- components: RegisterComponent[];
5
- contentRef?: React.RefObject<HTMLDivElement | null>;
6
- onMouseDown: (e: React.MouseEvent) => void;
7
- onMouseEnter: () => void;
8
- }
9
- export declare const PasteActionsMenuContent: ({ onMouseDown, onMouseEnter, components, contentRef, }: PasteActionsMenuContentProps) => React.JSX.Element;
10
- export {};
@@ -1,10 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
3
- import type { PasteOptionsToolbarPlugin } from '../../pasteOptionsToolbarPluginType';
4
- import { ToolbarDropdownOption, type PasteType } from '../../types/types';
5
- export declare const isPasteOptionSelected: (pasteType: PasteType, selectedOption: ToolbarDropdownOption) => boolean;
6
- interface PasteMenuComponentsConfig {
7
- api: ExtractInjectionAPI<PasteOptionsToolbarPlugin> | undefined;
8
- }
9
- export declare const getPasteMenuComponents: ({ api }: PasteMenuComponentsConfig) => RegisterComponent[];
10
- export {};
@@ -1,19 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- /**
7
- * A compact dropdown button for paste options, styled like floating toolbar buttons.
8
- * Renders as a ToolbarButton with an icon and dropdown caret that opens a
9
- * dropdown menu below. Used when AI actions are not visible and the paste
10
- * options menu is the only content.
11
- */
12
- export declare const PasteOptionsDropdownButton: ({ children, elemBefore, elemAfter, label, testId, tooltipContent, }: {
13
- children?: React.ReactNode;
14
- elemAfter: React.ReactNode;
15
- elemBefore: React.ReactNode;
16
- label: string;
17
- testId?: string;
18
- tooltipContent?: string;
19
- }) => JSX.Element;
@@ -1,3 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- export declare const firePasteActionsMenuV2ExperimentExposure: (contentLength: number, state: EditorState, pasteStartPos?: number, pasteEndPos?: number, pastedText?: string, pastedSlice?: Slice) => void;
@@ -1,3 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- export declare const firePasteActionsMenuExperimentExposure: (contentLength: number, state: EditorState, pasteStartPos?: number, pasteEndPos?: number, pastedText?: string, pastedSlice?: Slice) => void;
@@ -1,11 +0,0 @@
1
- import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
2
- /**
3
- * Returns the keys of visible button/menu-item components in the list.
4
- * A component is visible when neither it nor any of its ancestors are hidden.
5
- */
6
- export declare const getVisibleKeys: (components: RegisterComponent[], types?: RegisterComponent["type"][]) => string[];
7
- /**
8
- * Returns true when at least one menu-item button in the list is visible.
9
- * A button is visible when neither it nor any of its ancestors are hidden.
10
- */
11
- export declare const hasVisibleButton: (components: RegisterComponent[]) => boolean;
@@ -1,9 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command, FloatingToolbarConfig, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
4
- import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
5
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
- import type { PasteOptionsPluginState } from '../types/types';
7
- export declare const isToolbarVisible: (state: EditorState, lastContentPasted: LastContentPasted) => boolean;
8
- export declare const getToolbarMenuConfig: (pluginState: PasteOptionsPluginState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarDropdown<Command>;
9
- export declare const buildToolbar: (state: EditorState, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarConfig | undefined;
@@ -1,2 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- export declare const getSingleSmartLinkUrlFromSlice: (slice: Slice | undefined) => string | undefined;
@@ -1,10 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Returns true if the slice contains sibling block nodes of different types
4
- * at the same level anywhere in the document tree.
5
- *
6
- * Structural container nodes (bulletList, orderedList, taskList, decisionList,
7
- * table, tableRow) are excluded from the sibling check because their children
8
- * are typed by structure, not content. All other container nodes are checked.
9
- */
10
- export declare const hasMixedNodes: (slice: Slice | undefined) => boolean;
@@ -1,2 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- export declare const hasTableNode: (slice: Slice | undefined) => boolean;
@@ -1 +0,0 @@
1
- export declare const isNotProse: (text: string) => boolean;
@@ -1,17 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Returns `true` when the pasted content is NOT a single standalone link.
4
- *
5
- * A paste is considered a "single link" (returns `false`) when:
6
- * - The slice contains exactly one paragraph with one text node whose text
7
- * equals its `link` mark href (bare URL link, no custom label), OR
8
- * - The slice contains exactly one paragraph with a single `inlineCard` node
9
- * (smartlink from the renderer or editor).
10
- *
11
- * Returns `true` (not a single link) when:
12
- * - The pasted link has a custom label (text ≠ href)
13
- * - There are multiple paragraphs or sibling nodes
14
- * - There is additional text alongside the link in the same paragraph
15
- * - The slice is absent (plain-text paste)
16
- */
17
- export declare const isNotSingleLink: (slice: Slice | undefined) => boolean;
@@ -1,8 +0,0 @@
1
- import type { PasteMenuRuleContext, PasteMenuRuleFactories } from './types';
2
- /**
3
- * Creates the `PasteMenuRuleFactories` object with every rule pre-bound to the
4
- * given context supplier. Called inside `getPasteMenuRules()` so the plugin
5
- * API and paste state are already available in the closure — external callers
6
- * never need to construct or pass a context object.
7
- */
8
- export declare const createPasteMenuRuleFactories: (getContext: () => PasteMenuRuleContext) => PasteMenuRuleFactories;
@@ -1,112 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Context object passed to each `PasteMenuRule`.
4
- * Provides lazy accessors over the current paste state so that rule
5
- * implementations remain decoupled from the plugin's internal state shape.
6
- */
7
- export interface PasteMenuRuleContext {
8
- /**
9
- * Returns the names of ancestor nodes at the paste insertion point
10
- * (e.g. `['table', 'tableRow', 'tableCell']`).
11
- */
12
- getAncestorNodeNames: () => string[];
13
- /**
14
- * Returns the set of ProseMirror node-type names present in the pasted
15
- * content (derived from the rich-text slice).
16
- */
17
- getNodeTypes: () => string[];
18
- /** Returns the rich-text `Slice` that was pasted, if available. */
19
- getPastedSlice: () => Slice | undefined;
20
- /** Returns the raw pasted text content. */
21
- getPastedText: () => string;
22
- /**
23
- * Returns the paste source identifier, e.g. `'external'`, `'internal'`,
24
- * `'markdown'`, etc. Returns `undefined` when the source is unknown.
25
- */
26
- getPasteSource: () => string | undefined;
27
- /** Returns the character length of the pasted plain-text string. */
28
- getPlaintextLength: () => number;
29
- }
30
- /**
31
- * Internal rule function that receives an explicit context object.
32
- * Used only within this package — external callers see `PasteMenuRule`.
33
- */
34
- export type PasteMenuRuleWithContext = (context: PasteMenuRuleContext) => boolean;
35
- /**
36
- * A rule function returned by `getPasteMenuRules()`. The context is already
37
- * bound by the plugin, so callers simply invoke it with no arguments.
38
- */
39
- export type PasteMenuRule = () => boolean;
40
- /**
41
- * The collection of rule factories exposed via the plugin API.
42
- * External plugins consume this object through
43
- * `api?.pasteOptionsToolbarPlugin?.actions.getPasteMenuRules()`.
44
- * Every rule already has the paste context pre-bound — callers do not need to
45
- * construct or pass a context object.
46
- */
47
- export interface PasteMenuRuleFactories {
48
- /**
49
- * Combines multiple rules with short-circuit evaluation: returns `true`
50
- * (hidden) as soon as the first rule returns `true`.
51
- */
52
- allRules: (...rules: PasteMenuRuleWithContext[]) => PasteMenuRule;
53
- /**
54
- * A rule that hides the button when the pasted content contains a table
55
- * node as an ancestor at the insertion point.
56
- */
57
- containsTableRule: PasteMenuRule;
58
- /**
59
- * Returns a rule that hides the button when any of the specified node
60
- * names appear in the ancestor list at the insertion point.
61
- */
62
- excludedAncestorRule: (excludedNames: string[]) => PasteMenuRule;
63
- /**
64
- * A rule that hides the button when the pasted content contains more than
65
- * one node type.
66
- */
67
- hideIfMixedNodesRule: PasteMenuRule;
68
- /**
69
- * A rule that hides the button when the pasted content contains only a
70
- * single node type.
71
- */
72
- hideIfSingleNodeRule: PasteMenuRule;
73
- /**
74
- * A rule that hides the button when the pasted content IS a single
75
- * standalone link (the inverse of `notSingleLinkRule`).
76
- *
77
- * Use this to hide buttons that should NOT appear for single-link pastes,
78
- * e.g. Improve Writing, Fix Spelling — leaving only Ask Rovo visible.
79
- */
80
- isSingleLinkRule: PasteMenuRule;
81
- /**
82
- * Returns a rule that hides the button when the pasted plain-text is
83
- * longer than `maxChars` characters.
84
- */
85
- maxCharsRule: (maxChars: number) => PasteMenuRule;
86
- /**
87
- * Returns a rule that hides the button when the pasted plain-text is
88
- * shorter than `minChars` characters.
89
- */
90
- minCharsRule: (minChars: number) => PasteMenuRule;
91
- /**
92
- * A rule that hides the button when the paste source is NOT an external
93
- * application (i.e. the content was pasted from within the Fabric editor
94
- * or renderer rather than from a third-party source).
95
- */
96
- notExternalPasteRule: PasteMenuRule;
97
- /**
98
- * A rule that hides the button when the pasted content is plain text
99
- * (i.e. not rich-text / prose).
100
- */
101
- notProseRule: PasteMenuRule;
102
- /**
103
- * A rule that hides the button when the pasted content is a single
104
- * standalone link — i.e. a bare URL link (text equals href) alone in a
105
- * paragraph, or a single inline card (smartlink) alone in a paragraph.
106
- *
107
- * Returns `true` (hidden) when the paste is NOT a single link — e.g. a
108
- * link with a custom label, a link with sibling text or nodes, or
109
- * multiple paragraphs.
110
- */
111
- notSingleLinkRule: PasteMenuRule;
112
- }