@atlaskit/editor-plugin-find-replace 11.0.14 → 12.0.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/findReplacePlugin/package.json +1 -8
  3. package/findReplacePluginType/package.json +1 -8
  4. package/package.json +21 -29
  5. package/styles/package.json +1 -8
  6. package/types/package.json +1 -8
  7. package/dist/types-ts4.5/entry-points/findReplacePlugin.d.ts +0 -1
  8. package/dist/types-ts4.5/entry-points/findReplacePluginType.d.ts +0 -1
  9. package/dist/types-ts4.5/entry-points/styles.d.ts +0 -1
  10. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  11. package/dist/types-ts4.5/findReplacePlugin.d.ts +0 -2
  12. package/dist/types-ts4.5/findReplacePluginType.d.ts +0 -30
  13. package/dist/types-ts4.5/index.d.ts +0 -3
  14. package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -64
  15. package/dist/types-ts4.5/pm-plugins/commands-with-analytics.d.ts +0 -27
  16. package/dist/types-ts4.5/pm-plugins/commands.d.ts +0 -13
  17. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -4
  18. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -7
  19. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +0 -8
  20. package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +0 -3
  21. package/dist/types-ts4.5/pm-plugins/reducer.d.ts +0 -4
  22. package/dist/types-ts4.5/pm-plugins/utils/batch-decorations.d.ts +0 -36
  23. package/dist/types-ts4.5/pm-plugins/utils/commands.d.ts +0 -2
  24. package/dist/types-ts4.5/pm-plugins/utils/index.d.ts +0 -73
  25. package/dist/types-ts4.5/types/index.d.ts +0 -68
  26. package/dist/types-ts4.5/ui/Find.d.ts +0 -80
  27. package/dist/types-ts4.5/ui/FindReplace.d.ts +0 -57
  28. package/dist/types-ts4.5/ui/FindReplaceDropDownOrToolbarButtonWithState.d.ts +0 -4
  29. package/dist/types-ts4.5/ui/FindReplaceDropdown.d.ts +0 -17
  30. package/dist/types-ts4.5/ui/FindReplaceToolbarButton.d.ts +0 -26
  31. package/dist/types-ts4.5/ui/FindReplaceTooltipButton.d.ts +0 -23
  32. package/dist/types-ts4.5/ui/Replace.d.ts +0 -39
  33. package/dist/types-ts4.5/ui/hooks/useFindReplacePluginStateSelector.d.ts +0 -4
  34. package/dist/types-ts4.5/ui/styles.d.ts +0 -7
  35. package/dist/types-ts4.5/ui/ui-styles.d.ts +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 12.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
8
+ Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
9
+
10
+ Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
11
+
12
+ Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
13
+
14
+ ```diff
15
+ - "typesVersions": {
16
+ - ">=4.5 <4.9": {
17
+ - "*": [
18
+ - "dist/types-ts4.5/*",
19
+ - "dist/types-ts4.5/index.d.ts"
20
+ - ]
21
+ - }
22
+ - },
23
+ ```
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
29
+ ## 11.0.15
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies
34
+
3
35
  ## 11.0.14
4
36
 
5
37
  ### Patch Changes
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/findReplacePlugin.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/findReplacePlugin.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/findReplacePlugin.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/findReplacePluginType.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/findReplacePluginType.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/findReplacePluginType.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "11.0.14",
3
+ "version": "12.0.0",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -15,38 +15,30 @@
15
15
  "module": "dist/esm/index.js",
16
16
  "module:es2019": "dist/es2019/index.js",
17
17
  "types": "dist/types/index.d.ts",
18
- "typesVersions": {
19
- ">=4.5 <4.9": {
20
- "*": [
21
- "dist/types-ts4.5/*",
22
- "dist/types-ts4.5/index.d.ts"
23
- ]
24
- }
25
- },
26
18
  "sideEffects": [
27
19
  "*.compiled.css"
28
20
  ],
29
21
  "atlaskit:src": "src/index.ts",
30
22
  "dependencies": {
31
- "@atlaskit/button": "^23.11.0",
32
- "@atlaskit/editor-plugin-analytics": "^11.0.0",
33
- "@atlaskit/editor-plugin-card": "^17.4.0",
34
- "@atlaskit/editor-plugin-expand": "^12.0.0",
35
- "@atlaskit/editor-plugin-mentions": "^13.3.0",
36
- "@atlaskit/editor-plugin-primary-toolbar": "^12.0.0",
37
- "@atlaskit/editor-plugin-synced-block": "^9.1.0",
38
- "@atlaskit/editor-prosemirror": "^7.3.0",
39
- "@atlaskit/editor-shared-styles": "^3.11.0",
40
- "@atlaskit/form": "^15.5.0",
41
- "@atlaskit/icon": "^35.4.0",
42
- "@atlaskit/icon-lab": "^6.14.0",
43
- "@atlaskit/mention": "^26.2.0",
44
- "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/primitives": "^19.0.0",
46
- "@atlaskit/textfield": "^8.3.0",
47
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
48
- "@atlaskit/tokens": "^13.4.0",
49
- "@atlaskit/tooltip": "^22.6.0",
23
+ "@atlaskit/button": "^24.0.0",
24
+ "@atlaskit/editor-plugin-analytics": "^12.0.0",
25
+ "@atlaskit/editor-plugin-card": "^18.0.0",
26
+ "@atlaskit/editor-plugin-expand": "^13.0.0",
27
+ "@atlaskit/editor-plugin-mentions": "^14.0.0",
28
+ "@atlaskit/editor-plugin-primary-toolbar": "^13.0.0",
29
+ "@atlaskit/editor-plugin-synced-block": "^10.0.0",
30
+ "@atlaskit/editor-prosemirror": "^8.0.0",
31
+ "@atlaskit/editor-shared-styles": "^4.0.0",
32
+ "@atlaskit/form": "^16.0.0",
33
+ "@atlaskit/icon": "^36.0.0",
34
+ "@atlaskit/icon-lab": "^7.0.0",
35
+ "@atlaskit/mention": "^27.0.0",
36
+ "@atlaskit/platform-feature-flags": "^2.0.0",
37
+ "@atlaskit/primitives": "^20.0.0",
38
+ "@atlaskit/textfield": "^9.0.0",
39
+ "@atlaskit/tmp-editor-statsig": "^104.0.0",
40
+ "@atlaskit/tokens": "^14.0.0",
41
+ "@atlaskit/tooltip": "^23.0.0",
50
42
  "@babel/runtime": "^7.0.0",
51
43
  "@emotion/react": "^11.7.1",
52
44
  "classnames": "^2.2.5",
@@ -63,7 +55,7 @@
63
55
  "react-intl": "^6.6.2"
64
56
  },
65
57
  "peerDependencies": {
66
- "@atlaskit/editor-common": "^115.15.0",
58
+ "@atlaskit/editor-common": "^116.0.0",
67
59
  "react": "^18.2.0",
68
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
69
61
  },
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/styles.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/styles.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/styles.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/types.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/types.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/types.d.ts"
17
10
  }
@@ -1 +0,0 @@
1
- export { findReplacePlugin } from '../findReplacePlugin';
@@ -1 +0,0 @@
1
- export type { FindReplacePlugin, FindReplacePluginOptions, FindReplacePluginDependencies, } from '../findReplacePluginType';
@@ -1 +0,0 @@
1
- export { blockSearchMatchClass, darkModeSearchMatchClass, searchMatchClass, searchMatchExpandTitleClass, searchMatchTextClass, selectedBlockSearchMatchClass, selectedSearchMatchClass, } from '../ui/styles';
@@ -1 +0,0 @@
1
- export type { FindReplaceToolbarButtonActionProps, FindReplaceOptions, FindReplacePluginState, } from '../types/index';
@@ -1,2 +0,0 @@
1
- import type { FindReplacePlugin } from './findReplacePluginType';
2
- export declare const findReplacePlugin: FindReplacePlugin;
@@ -1,30 +0,0 @@
1
- import type { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { CardPlugin } from '@atlaskit/editor-plugin-card';
5
- import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
6
- import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
7
- import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
- import type { SyncedBlockPlugin } from '@atlaskit/editor-plugin-synced-block';
9
- import type { FindReplacePluginState, FindReplaceToolbarButtonActionProps } from './types';
10
- export type FindReplacePluginOptions = {
11
- takeFullWidth: boolean;
12
- twoLineEditorToolbar: boolean;
13
- };
14
- export type FindReplacePluginDependencies = [
15
- OptionalPlugin<AnalyticsPlugin>,
16
- OptionalPlugin<PrimaryToolbarPlugin>,
17
- OptionalPlugin<MentionsPlugin>,
18
- OptionalPlugin<CardPlugin>,
19
- OptionalPlugin<ExpandPlugin>,
20
- OptionalPlugin<SyncedBlockPlugin>
21
- ];
22
- export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
23
- actions: {
24
- activateFindReplace: (triggerMethod?: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL) => boolean;
25
- registerToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
26
- };
27
- dependencies: FindReplacePluginDependencies;
28
- pluginConfiguration: FindReplacePluginOptions;
29
- sharedState: FindReplacePluginState | undefined;
30
- }>;
@@ -1,3 +0,0 @@
1
- export type { FindReplaceToolbarButtonActionProps, FindReplaceOptions, FindReplacePluginState, } from './types';
2
- export { findReplacePlugin } from './findReplacePlugin';
3
- export type { FindReplacePlugin, FindReplacePluginOptions, FindReplacePluginDependencies, } from './findReplacePluginType';
@@ -1,64 +0,0 @@
1
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
- import type { Match } from '../types';
3
- export declare enum FindReplaceActionTypes {
4
- ACTIVATE = "ACTIVATE",
5
- FIND = "FIND",
6
- UPDATE_DECORATIONS = "UPDATE_DECORATIONS",
7
- FIND_NEXT = "FIND_NEXT",
8
- FIND_PREVIOUS = "FIND_PREVIOUS",
9
- REPLACE = "REPLACE",
10
- REPLACE_ALL = "REPLACE_ALL",
11
- CANCEL = "CANCEL",
12
- BLUR = "BLUR",
13
- TOGGLE_MATCH_CASE = "TOGGLE_MATCH_CASE"
14
- }
15
- export interface Activate {
16
- findText?: string;
17
- index?: number;
18
- matches?: Match[];
19
- type: FindReplaceActionTypes.ACTIVATE;
20
- }
21
- export interface Find {
22
- findText: string;
23
- index: number;
24
- matches: Match[];
25
- type: FindReplaceActionTypes.FIND;
26
- }
27
- export interface FindNext {
28
- decorationSet: DecorationSet;
29
- index: number;
30
- type: FindReplaceActionTypes.FIND_NEXT;
31
- }
32
- export interface FindPrevious {
33
- decorationSet: DecorationSet;
34
- index: number;
35
- type: FindReplaceActionTypes.FIND_PREVIOUS;
36
- }
37
- export interface Replace {
38
- decorationSet: DecorationSet;
39
- index: number;
40
- matches: Match[];
41
- replaceText: string;
42
- type: FindReplaceActionTypes.REPLACE;
43
- }
44
- export interface ReplaceAll {
45
- decorationSet: DecorationSet;
46
- index: number;
47
- matches: Match[];
48
- replaceText: string;
49
- type: FindReplaceActionTypes.REPLACE_ALL;
50
- }
51
- export interface Cancel {
52
- type: FindReplaceActionTypes.CANCEL;
53
- }
54
- export interface Blur {
55
- type: FindReplaceActionTypes.BLUR;
56
- }
57
- export interface UpdateDecorations {
58
- decorationSet: DecorationSet;
59
- type: FindReplaceActionTypes.UPDATE_DECORATIONS;
60
- }
61
- export interface ToggleMatchCase {
62
- type: FindReplaceActionTypes.TOGGLE_MATCH_CASE;
63
- }
64
- export type FindReplaceAction = Activate | Find | FindNext | FindPrevious | Replace | ReplaceAll | Cancel | Blur | UpdateDecorations | ToggleMatchCase;
@@ -1,27 +0,0 @@
1
- import type { EditorAnalyticsAPI, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- export declare const activateWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ triggerMethod, }: {
5
- triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL;
6
- }) => Command;
7
- export declare const findWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ editorView, containerElement, keyword, }: {
8
- containerElement: HTMLElement | null;
9
- editorView: EditorView;
10
- keyword?: string;
11
- }) => Command;
12
- export declare const findNextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorView: EditorView) => ({ triggerMethod, }: {
13
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
14
- }) => Command;
15
- export declare const findPrevWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorView: EditorView) => ({ triggerMethod, }: {
16
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
17
- }) => Command;
18
- export declare const replaceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ triggerMethod, replaceText, }: {
19
- replaceText: string;
20
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
21
- }) => Command;
22
- export declare const replaceAllWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ replaceText }: {
23
- replaceText: string;
24
- }) => Command;
25
- export declare const cancelSearchWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ triggerMethod, }: {
26
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
27
- }) => Command;
@@ -1,13 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
3
- export declare const activate: () => Command;
4
- export declare const find: (editorView: EditorView, containerElement: HTMLElement | null, keyword?: string) => Command;
5
- export declare const findNext: (editorView: EditorView) => Command;
6
- export declare const findPrevious: (editorView: EditorView) => Command;
7
- export declare const replace: (replaceText: string) => Command;
8
- export declare const replaceAll: (replaceText: string) => Command;
9
- export declare const addDecorations: (decorations: Decoration[]) => Command;
10
- export declare const removeDecorations: (decorations: Decoration[]) => Command;
11
- export declare const cancelSearch: () => Command;
12
- export declare const blur: () => Command;
13
- export declare const toggleMatchCase: () => Command;
@@ -1,4 +0,0 @@
1
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- declare const keymapPlugin: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => SafePlugin;
4
- export default keymapPlugin;
@@ -1,7 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
- import type { FindReplacePlugin } from '../findReplacePluginType';
5
- import type { FindReplacePluginState } from '../types';
6
- export declare const initialState: FindReplacePluginState;
7
- export declare const createPlugin: (dispatch: Dispatch, getIntl: PMPluginFactoryParams["getIntl"], api?: ExtractInjectionAPI<FindReplacePlugin>) => SafePlugin<FindReplacePluginState>;
@@ -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 { FindReplacePluginState } from '../types';
5
- import type { FindReplaceAction } from './actions';
6
- export declare const createCommand: <A = FindReplaceAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
7
- export declare const getPluginState: (state: EditorState) => FindReplacePluginState;
8
- export declare const createPluginState: (dispatch: Dispatch, initialState: FindReplacePluginState | ((state: EditorState) => FindReplacePluginState)) => SafeStateField<FindReplacePluginState>;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { FindReplacePluginState } from '../types';
3
- export declare const findReplacePluginKey: PluginKey<FindReplacePluginState>;
@@ -1,4 +0,0 @@
1
- import type { FindReplacePluginState } from '../types';
2
- import type { FindReplaceAction } from './actions';
3
- declare const reducer: (getInitialState: () => FindReplacePluginState) => (state: FindReplacePluginState, action: FindReplaceAction) => FindReplacePluginState;
4
- export default reducer;
@@ -1,36 +0,0 @@
1
- import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
2
- /**
3
- * Provides support for applying search match highlight decorations in batches
4
- */
5
- declare class BatchDecorations {
6
- private rafId?;
7
- private addDecorations?;
8
- private removeDecorations?;
9
- stop(): void;
10
- /**
11
- * Applies the decorations needed for the current search results
12
- * It does so async, splitting them up into batches to help with performance
13
- */
14
- applyAllSearchDecorations(editorView: EditorView, containerElement: HTMLElement | null, addDecorations: (decorations: Decoration[]) => void, removeDecorations: (decorations: Decoration[]) => void): Promise<void>;
15
- private updateDecorationsBetween;
16
- private addDecorationsBetween;
17
- private removeDecorationsBetween;
18
- /**
19
- * Calculates Prosemirror start and end positions we want to apply the decorations
20
- * between
21
- * Also calculates the positions the are the start and end of the user's viewport
22
- * so we can apply decorations there first and work outwards
23
- */
24
- private calcDecorationPositions;
25
- private getStartPos;
26
- private getEndPos;
27
- /**
28
- * Util to batch function calls by animation frames
29
- * A counter will start at 0 and increment by provided value until reaches limit
30
- * Passed in fn receives the counter as a param, return false to skip waiting
31
- * for the animation frame for the next call
32
- */
33
- private batchRequests;
34
- }
35
- declare const batchDecorations: BatchDecorations;
36
- export default batchDecorations;
@@ -1,2 +0,0 @@
1
- import type { HigherOrderCommand } from '@atlaskit/editor-common/types';
2
- export declare const withScrollIntoView: HigherOrderCommand;
@@ -1,73 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { Fragment, Node as PmNode, Slice } from '@atlaskit/editor-prosemirror/model';
4
- import type { ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
5
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
6
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
7
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
8
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
- import type { FindReplacePlugin } from '../../findReplacePluginType';
10
- import type { Match } from '../../types';
11
- /**
12
- * Recursively extracts all text content from an ADF entity tree.
13
- * Used to search inside reference sync blocks whose content lives outside the PM document.
14
- */
15
- type SimpleADFNode = {
16
- attrs?: {
17
- title?: string;
18
- };
19
- content?: SimpleADFNode[];
20
- text?: string;
21
- type?: string;
22
- };
23
- export declare function extractTextFromADFContent(nodes: SimpleADFNode[]): string;
24
- export declare function getSelectedText(selection: TextSelection): string;
25
- export declare const createDecorations: (selectedIndex: number, matches: Match[]) => Decoration[];
26
- export declare const createDecoration: (match: Match, isSelected?: Boolean) => Decoration;
27
- type FindMatchesType = {
28
- api?: ExtractInjectionAPI<FindReplacePlugin>;
29
- content: PmNode | Fragment;
30
- contentIndex?: number;
31
- getIntl?: () => IntlShape;
32
- searchText: string;
33
- shouldMatchCase: boolean;
34
- };
35
- export declare function findMatches({ content, searchText, shouldMatchCase, contentIndex, getIntl, api, }: FindMatchesType): Match[];
36
- export declare function findClosestMatch(selectionPos: number, matches: Match[]): number;
37
- /**
38
- * Finds index of first item in matches array that comes after user's cursor pos.
39
- * If `backward` is `true`, finds index of first item that comes before instead.
40
- */
41
- export declare function findSearchIndex(selectionPos: number, matches: Match[], backward?: boolean): number;
42
- export declare const nextIndex: (currentIndex: number, total: number) => number;
43
- export declare const prevIndex: (currentIndex: number, total: number) => number;
44
- export declare const getSelectionForMatch: (selection: Selection, doc: PmNode, index: number, matches: Match[], offset?: number) => Selection;
45
- export declare const findDecorationFromMatch: (decorationSet: DecorationSet, match: Match) => Decoration | undefined;
46
- export declare const removeDecorationsFromSet: (decorationSet: DecorationSet, decorationsToRemove: Decoration[], doc: PmNode) => DecorationSet;
47
- export declare const removeMatchesFromSet: (decorationSet: DecorationSet, matches: Match[], doc: PmNode) => DecorationSet;
48
- /**
49
- * Finds decorations in prevDecorations that are not in newDecorations or decorationsToRemove
50
- * These decorations have been lost by Prosemirror during an over eager decoration removal
51
- * We need to be smart to cope with thousands of decorations without crashing everything
52
- */
53
- export declare const findLostAdjacentDecorations: (decorationsToRemove: Decoration[], prevDecorations: Decoration[], newDecorations: Decoration[]) => Decoration[];
54
- /**
55
- * Searches through array in bumps of 100 to return the index of the first
56
- * decoration whose 'from' value is before or equal to the position
57
- */
58
- export declare const findIndexBeforePosition: (items: Decoration[], position: number) => number;
59
- /**
60
- * Determines whether a find/replace text Match will be changed as a result
61
- * of a Step modification to the document. This is evaluated by checking
62
- * both mapped and unmapped versions of the Step as in different cases the
63
- * matches will match.
64
- *
65
- * **Note:** Match state received here is after step has been applied.
66
- */
67
- export declare const isMatchAffectedByStep: (match: Match, step: Step & {
68
- from: number;
69
- slice: Slice;
70
- to: number;
71
- }, tr: ReadonlyTransaction) => boolean;
72
- export declare function findUniqueItemsIn<T>(findIn: Array<T>, checkWith: Array<T>, comparator?: (firstItem: T, secondItem: T) => boolean): Array<T>;
73
- export {};
@@ -1,68 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { FindReplacePlugin } from '../findReplacePluginType';
6
- export interface FindReplacePluginState {
7
- /** api */
8
- api?: ExtractInjectionAPI<FindReplacePlugin>;
9
- /** Decorations for the search results */
10
- decorationSet: DecorationSet;
11
- /** Search keyword */
12
- findText: string;
13
- /** Intl object */
14
- getIntl?: () => IntlShape;
15
- /** Index of selected word in array of matches, this gets updated as user finds next/prev */
16
- index: number;
17
- /** Whether find/replace is active, i.e. displayed */
18
- isActive: boolean;
19
- /** Positions of find results */
20
- matches: Match[];
21
- /** Text to replace with */
22
- replaceText: string;
23
- /**
24
- * Whether we should set focus into and select all text of find textfield
25
- * This will be true if user highlights a word and hits cmd+f
26
- */
27
- shouldFocus: boolean;
28
- /** Whether find/replace should match case when searching for results */
29
- shouldMatchCase: boolean;
30
- }
31
- export type FindReplaceToolbarButtonWithStateProps = {
32
- api: ExtractInjectionAPI<FindReplacePlugin> | undefined;
33
- containerElement: HTMLElement | null;
34
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
35
- doesNotHaveButton?: boolean;
36
- editorView: EditorView;
37
- isButtonHidden?: boolean;
38
- isToolbarReducedSpacing?: boolean;
39
- popupsBoundariesElement?: HTMLElement;
40
- popupsMountPoint?: HTMLElement;
41
- popupsScrollableElement?: HTMLElement;
42
- takeFullWidth?: boolean;
43
- };
44
- export type FindReplaceToolbarButtonActionProps = Omit<FindReplaceToolbarButtonWithStateProps, 'api'>;
45
- export type Match = {
46
- /** Boolean for whether the match can be replaced */
47
- canReplace?: boolean;
48
- /** End position */
49
- end: number;
50
- /** Type of the node of the match */
51
- nodeType?: string;
52
- /** Start position */
53
- start: number;
54
- };
55
- export type TextGrouping = {
56
- /** Start position */
57
- pos: number;
58
- /** The concatenated text across nodes */
59
- text: string;
60
- } | null;
61
- export type FindReplaceOptions = {
62
- allowMatchCase?: boolean;
63
- };
64
- export type MatchCaseProps = {
65
- allowMatchCase?: boolean;
66
- onToggleMatchCase?: () => void;
67
- shouldMatchCase?: boolean;
68
- };
@@ -1,80 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
7
- import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
8
- import type { MatchCaseProps } from '../types';
9
- export declare const FIND_DEBOUNCE_MS = 100;
10
- export type FindProps = {
11
- count: {
12
- index: number;
13
- total: number;
14
- };
15
- findText?: string;
16
- findTyped: boolean;
17
- onArrowDown: () => void;
18
- onCancel: ({ triggerMethod, }: {
19
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
20
- }) => void;
21
- onFind: (findText?: string) => void;
22
- onFindBlur: () => void;
23
- onFindNext: ({ triggerMethod, }: {
24
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
25
- }) => void;
26
- onFindPrev: ({ triggerMethod, }: {
27
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
28
- }) => void;
29
- onFindTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
30
- setFindTyped: (value: boolean) => void;
31
- shouldFocus: boolean;
32
- } & MatchCaseProps;
33
- declare const _default_1: React.FC<WithIntlProps<{
34
- count: {
35
- index: number;
36
- total: number;
37
- };
38
- findText?: string;
39
- findTyped: boolean;
40
- onArrowDown: () => void;
41
- onCancel: ({ triggerMethod, }: {
42
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
43
- }) => void;
44
- onFind: (findText?: string) => void;
45
- onFindBlur: () => void;
46
- onFindNext: ({ triggerMethod, }: {
47
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
48
- }) => void;
49
- onFindPrev: ({ triggerMethod, }: {
50
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
51
- }) => void;
52
- onFindTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
53
- setFindTyped: (value: boolean) => void;
54
- shouldFocus: boolean;
55
- } & MatchCaseProps & WrappedComponentProps>> & {
56
- WrappedComponent: React.ComponentType<{
57
- count: {
58
- index: number;
59
- total: number;
60
- };
61
- findText?: string;
62
- findTyped: boolean;
63
- onArrowDown: () => void;
64
- onCancel: ({ triggerMethod, }: {
65
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
66
- }) => void;
67
- onFind: (findText?: string) => void;
68
- onFindBlur: () => void;
69
- onFindNext: ({ triggerMethod, }: {
70
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
71
- }) => void;
72
- onFindPrev: ({ triggerMethod, }: {
73
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
74
- }) => void;
75
- onFindTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
76
- setFindTyped: (value: boolean) => void;
77
- shouldFocus: boolean;
78
- } & MatchCaseProps & WrappedComponentProps>;
79
- };
80
- export default _default_1;
@@ -1,57 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- import { jsx } from '@emotion/react';
7
- import type { IntlShape } from 'react-intl';
8
- import type { DispatchAnalyticsEvent, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
9
- import type { MatchCaseProps } from '../types';
10
- export type FindReplaceProps = {
11
- count: {
12
- index: number;
13
- total: number;
14
- totalReplaceable?: number;
15
- };
16
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
17
- findText?: string;
18
- focusToolbarButton?: () => void;
19
- intl?: IntlShape;
20
- isReplaceable?: boolean;
21
- onCancel: ({ triggerMethod, }: {
22
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
23
- }) => void;
24
- onFind: (findText?: string) => void;
25
- onFindBlur: () => void;
26
- onFindNext: ({ triggerMethod, }: {
27
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
28
- }) => void;
29
- onFindPrev: ({ triggerMethod, }: {
30
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
31
- }) => void;
32
- onReplace: ({ triggerMethod, replaceText, }: {
33
- replaceText: string;
34
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
35
- }) => void;
36
- onReplaceAll: ({ replaceText }: {
37
- replaceText: string;
38
- }) => void;
39
- replaceText?: string;
40
- shouldFocus: boolean;
41
- } & MatchCaseProps;
42
- declare class FindReplace extends React.PureComponent<FindReplaceProps> {
43
- private findTextfield;
44
- private replaceTextfield?;
45
- private modalRef;
46
- constructor(props: FindReplaceProps);
47
- state: {
48
- findTyped: boolean;
49
- };
50
- setFindTyped: (value: boolean) => void;
51
- setFindTextfieldRef: (findTextfieldRef: React.RefObject<HTMLInputElement>) => void;
52
- setReplaceTextfieldRef: (replaceTextfieldRef: React.RefObject<HTMLInputElement>) => void;
53
- setFocusToFind: () => void;
54
- setFocusToReplace: () => void;
55
- render(): jsx.JSX.Element;
56
- }
57
- export default FindReplace;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { FindReplaceToolbarButtonWithStateProps } from '../types';
3
- declare const _default_1: React.MemoExoticComponent<({ popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, isToolbarReducedSpacing, editorView, containerElement, dispatchAnalyticsEvent, takeFullWidth, api, isButtonHidden, doesNotHaveButton, }: FindReplaceToolbarButtonWithStateProps) => React.JSX.Element | null>;
4
- export default _default_1;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { type WithIntlProps, type WrappedComponentProps } from 'react-intl';
3
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
- import type { FindReplaceProps } from './FindReplace';
5
- export interface FindReplaceDropdownProps extends Omit<FindReplaceProps, 'count'> {
6
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
7
- index: number;
8
- isActive: boolean;
9
- isReplaceable?: boolean;
10
- numMatches: number;
11
- numReplaceable?: number;
12
- popupsMountPoint?: HTMLElement;
13
- }
14
- declare const _default_1: React.FC<WithIntlProps<FindReplaceDropdownProps & WrappedComponentProps>> & {
15
- WrappedComponent: React.ComponentType<FindReplaceDropdownProps & WrappedComponentProps>;
16
- };
17
- export default _default_1;
@@ -1,26 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
7
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
8
- import type { FindReplaceProps } from './FindReplace';
9
- export interface FindReplaceToolbarButtonProps extends Omit<FindReplaceProps, 'count'> {
10
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
11
- index: number;
12
- isActive: boolean;
13
- isButtonHidden?: boolean;
14
- isReducedSpacing?: boolean;
15
- numMatches: number;
16
- numReplaceable?: number;
17
- onActivate: () => void;
18
- popupsBoundariesElement?: HTMLElement;
19
- popupsMountPoint?: HTMLElement;
20
- popupsScrollableElement?: HTMLElement;
21
- takeFullWidth: boolean;
22
- }
23
- declare const _default_1: React.FC<WithIntlProps<FindReplaceToolbarButtonProps & WrappedComponentProps>> & {
24
- WrappedComponent: React.ComponentType<FindReplaceToolbarButtonProps & WrappedComponentProps>;
25
- };
26
- export default _default_1;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import type { IconProps } from '@atlaskit/icon/types';
3
- interface Props {
4
- appearance?: 'default' | 'primary' | 'subtle';
5
- disabled?: boolean;
6
- icon: React.ComponentType<React.PropsWithChildren<IconProps>>;
7
- iconLabel: string;
8
- iconSize?: 'small' | undefined;
9
- isPressed?: boolean;
10
- keymapDescription: string;
11
- onClick: (ref: React.RefObject<HTMLButtonElement>) => void;
12
- title: string;
13
- }
14
- export declare class FindReplaceTooltipButton extends React.PureComponent<Props> {
15
- private buttonRef;
16
- static defaultProps: {
17
- keymapDescription: string;
18
- appearance: string;
19
- };
20
- handleClick: () => void;
21
- render(): React.JSX.Element;
22
- }
23
- export {};
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
3
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
- import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
5
- export type ReplaceProps = {
6
- canReplace: boolean;
7
- count: {
8
- index: number;
9
- total: number;
10
- totalReplaceable?: number;
11
- };
12
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
13
- findTyped: boolean;
14
- focusToolbarButton: () => void;
15
- onArrowUp: () => void;
16
- onCancel: ({ triggerMethod, }: {
17
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
18
- }) => void;
19
- onFindNext: ({ triggerMethod, }: {
20
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
21
- }) => void;
22
- onFindPrev: ({ triggerMethod, }: {
23
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
24
- }) => void;
25
- onReplace: ({ triggerMethod, replaceText, }: {
26
- replaceText: string;
27
- triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
28
- }) => void;
29
- onReplaceAll: ({ replaceText }: {
30
- replaceText: string;
31
- }) => void;
32
- onReplaceTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
33
- replaceText?: string;
34
- setFindTyped: (value: boolean) => void;
35
- };
36
- declare const _default_1: React.FC<WithIntlProps<ReplaceProps & WrappedComponentProps>> & {
37
- WrappedComponent: React.ComponentType<ReplaceProps & WrappedComponentProps>;
38
- };
39
- export default _default_1;
@@ -1,4 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { FindReplacePlugin } from '../../findReplacePluginType';
3
- import type { FindReplacePluginState } from '../../types';
4
- export declare function useFindReplacePluginStateSelector<Key extends keyof FindReplacePluginState>(api: ExtractInjectionAPI<FindReplacePlugin> | null | undefined, key: Key): FindReplacePluginState[Key] | undefined;
@@ -1,7 +0,0 @@
1
- export declare const searchMatchClass = "search-match";
2
- export declare const searchMatchTextClass = "search-match-text";
3
- export declare const selectedSearchMatchClass = "selected-search-match";
4
- export declare const blockSearchMatchClass = "search-match-block";
5
- export declare const selectedBlockSearchMatchClass = "search-match-block-selected";
6
- export declare const darkModeSearchMatchClass = "search-match-dark";
7
- export declare const searchMatchExpandTitleClass = "search-match-expand-title";
@@ -1,20 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type SerializedStyles } from '@emotion/react';
6
- export declare const ruleStyles: SerializedStyles;
7
- export declare const wrapperStyles: SerializedStyles;
8
- export declare const wrapperPaddingStyles: SerializedStyles;
9
- export declare const sectionWrapperStyles: SerializedStyles;
10
- export declare const sectionWrapperStylesAlternate: SerializedStyles;
11
- export declare const sectionWrapperJustified: SerializedStyles;
12
- export declare const textFieldWrapper: SerializedStyles;
13
- export declare const afterInputSection: SerializedStyles;
14
- export declare const matchCaseSection: SerializedStyles;
15
- export declare const nextPreviousItemStyles: SerializedStyles;
16
- export declare const countStyles: SerializedStyles;
17
- export declare const countStylesAlternateStyles: SerializedStyles;
18
- export declare const countWrapperStyles: SerializedStyles;
19
- export declare const orderZeroStyles: SerializedStyles;
20
- export declare const orderOneStyles: SerializedStyles;