@atlaskit/editor-plugin-code-block 13.1.15 → 13.1.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 +12 -0
- package/codeBlockPlugin/package.json +1 -8
- package/codeBlockPluginType/package.json +1 -8
- package/package.json +2 -2
- package/types/package.json +1 -8
- package/dist/types-ts4.5/codeBlockPlugin.d.ts +0 -3
- package/dist/types-ts4.5/codeBlockPluginType.d.ts +0 -40
- package/dist/types-ts4.5/editor-commands/index.d.ts +0 -37
- package/dist/types-ts4.5/entry-points/codeBlockPlugin.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/codeBlockPluginType.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -3
- package/dist/types-ts4.5/nodeviews/code-block.d.ts +0 -30
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -10
- package/dist/types-ts4.5/pm-plugins/auto-detect-state.d.ts +0 -16
- package/dist/types-ts4.5/pm-plugins/auto-detect.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/codeBlockAutoFullStopTransformPlugin.d.ts +0 -4
- package/dist/types-ts4.5/pm-plugins/codeBlockCopySelectionPlugin.d.ts +0 -16
- package/dist/types-ts4.5/pm-plugins/decorators.d.ts +0 -36
- package/dist/types-ts4.5/pm-plugins/ide-ux/bracket-handling.d.ts +0 -12
- package/dist/types-ts4.5/pm-plugins/ide-ux/commands.d.ts +0 -7
- package/dist/types-ts4.5/pm-plugins/ide-ux/line-handling.d.ts +0 -25
- package/dist/types-ts4.5/pm-plugins/ide-ux/paired-character-handling.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/ide-ux/quote-handling.d.ts +0 -12
- package/dist/types-ts4.5/pm-plugins/ide-ux.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +0 -4
- package/dist/types-ts4.5/pm-plugins/keymaps.d.ts +0 -4
- package/dist/types-ts4.5/pm-plugins/language-list.d.ts +0 -1800
- package/dist/types-ts4.5/pm-plugins/main-state.d.ts +0 -26
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -13
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/refresh-browser-selection.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +0 -12
- package/dist/types-ts4.5/pm-plugins/transform-to-code-block.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -6
- package/dist/types-ts4.5/types/index.d.ts +0 -34
- package/dist/types-ts4.5/ui/CodeBlockLanguagePicker.d.ts +0 -11
- package/dist/types-ts4.5/ui/CodeBlockMenuItem.d.ts +0 -4
- package/dist/types-ts4.5/ui/FormatCodeErrorFlag.d.ts +0 -6
- package/dist/types-ts4.5/ui/LanguagePicker.d.ts +0 -18
- package/dist/types-ts4.5/ui/class-names.d.ts +0 -10
- package/dist/types-ts4.5/ui/icons/WrapIcon.d.ts +0 -2
- package/dist/types-ts4.5/ui/language-picker-options.d.ts +0 -21
- package/dist/types-ts4.5/ui/recent-languages.d.ts +0 -4
- package/dist/types-ts4.5/utils/auto-detect-state.d.ts +0 -11
- package/dist/types-ts4.5/utils/auto-detect-view.d.ts +0 -8
- package/dist/types-ts4.5/utils/format-code/format-code-state.d.ts +0 -4
- package/dist/types-ts4.5/utils/format-code/formatter.d.ts +0 -5
- package/dist/types-ts4.5/utils/language-detect.d.ts +0 -3
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { FormatCodeResult, LanguageSource } from '../utils/format-code/formatter';
|
|
4
|
-
export type PendingFormatRequest = {
|
|
5
|
-
languageSource: LanguageSource;
|
|
6
|
-
pos: number;
|
|
7
|
-
requestId: string;
|
|
8
|
-
};
|
|
9
|
-
export type ResolveFormatCodeOutcome = 'failed' | 'formatted' | 'unchanged';
|
|
10
|
-
export type FormatCodeErrorState = {
|
|
11
|
-
errorType: Extract<FormatCodeResult, {
|
|
12
|
-
status: 'failed';
|
|
13
|
-
}>['errorType'];
|
|
14
|
-
languageSource: LanguageSource;
|
|
15
|
-
localId: string;
|
|
16
|
-
};
|
|
17
|
-
export type CodeBlockState = {
|
|
18
|
-
contentCopied: boolean;
|
|
19
|
-
decorations: DecorationSet;
|
|
20
|
-
formatCodeErrors: Record<string, FormatCodeErrorState>;
|
|
21
|
-
isNodeSelected: boolean;
|
|
22
|
-
pendingFormats: Record<string, PendingFormatRequest>;
|
|
23
|
-
pos: number | null;
|
|
24
|
-
shouldIgnoreFollowingMutations: boolean;
|
|
25
|
-
};
|
|
26
|
-
export declare const getPluginState: (state: EditorState) => CodeBlockState;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { CodeBlockPlugin } from '../index';
|
|
6
|
-
import type { CodeBlockState } from './main-state';
|
|
7
|
-
export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompositionInputOverride, api, }: {
|
|
8
|
-
allowCompositionInputOverride?: boolean;
|
|
9
|
-
api?: ExtractInjectionAPI<CodeBlockPlugin>;
|
|
10
|
-
decorations?: DecorationSet;
|
|
11
|
-
getIntl: () => IntlShape;
|
|
12
|
-
useLongPressSelection?: boolean;
|
|
13
|
-
}) => SafePlugin<CodeBlockState>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
declare const refreshBrowserSelection: () => void;
|
|
3
|
-
declare const refreshBrowserSelectionOnChange: (transaction: Readonly<Transaction>, editorState: EditorState) => void;
|
|
4
|
-
export default refreshBrowserSelectionOnChange;
|
|
5
|
-
export { refreshBrowserSelection };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI, FloatingToolbarHandler, SelectOption } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { CodeBlockPlugin } from '../index';
|
|
3
|
-
import type { CodeBlockFormatProvider } from '../types';
|
|
4
|
-
import type { Language } from './language-list';
|
|
5
|
-
export declare const getToolbarConfig: (allowCopyToClipboard: boolean | undefined, api: ExtractInjectionAPI<CodeBlockPlugin> | undefined, overrideLanguageName?: ((name: Language["name"]) => string) | undefined, formatCodeProvider?: CodeBlockFormatProvider | undefined) => FloatingToolbarHandler;
|
|
6
|
-
/**
|
|
7
|
-
* Filters language list based on both name and alias properties.
|
|
8
|
-
* @param option
|
|
9
|
-
* @param rawInput
|
|
10
|
-
* @example
|
|
11
|
-
*/
|
|
12
|
-
export declare const languageListFilter: (option: SelectOption, rawInput: string) => any;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export declare function transformToCodeBlockAction(state: EditorState, start: number, attrs?: any): Transaction;
|
|
3
|
-
export declare function isConvertableToCodeBlock(state: EditorState): boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState, ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
export declare function getCursor(selection: Selection): ResolvedPos | undefined;
|
|
5
|
-
export declare function getAllCodeBlockNodesInDoc(state: EditorState): NodeWithPos[];
|
|
6
|
-
export declare function getAllChangedCodeBlocksInTransaction(tr: ReadonlyTransaction): NodeWithPos[];
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
2
|
-
export type FormatResult = {
|
|
3
|
-
content: string;
|
|
4
|
-
language: string;
|
|
5
|
-
status: 'formatted' | 'unchanged';
|
|
6
|
-
} | {
|
|
7
|
-
errorType: 'formatter-execution-failed' | 'formatter-load-failed';
|
|
8
|
-
language: string;
|
|
9
|
-
status: 'failed';
|
|
10
|
-
};
|
|
11
|
-
export type CodeBlockFormatProvider = {
|
|
12
|
-
formatCode: (args: {
|
|
13
|
-
content: string;
|
|
14
|
-
language: string;
|
|
15
|
-
}) => Promise<FormatResult>;
|
|
16
|
-
isSupportedLanguage: (language: string | null | undefined) => boolean;
|
|
17
|
-
preload?: (language: string) => Promise<void>;
|
|
18
|
-
};
|
|
19
|
-
export interface CodeBlockPluginOptions extends LongPressSelectionPluginOptions {
|
|
20
|
-
allowCompositionInputOverride?: boolean;
|
|
21
|
-
allowCopyToClipboard?: boolean;
|
|
22
|
-
formatCodeProvider?: CodeBlockFormatProvider;
|
|
23
|
-
overrideLanguageName?: (name: string) => string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
* @deprecated Use {@link CodeBlockPluginOptions} instead.
|
|
28
|
-
* @see https://product-fabric.atlassian.net/browse/ED-27496
|
|
29
|
-
*/
|
|
30
|
-
export type CodeBlockOptions = CodeBlockPluginOptions;
|
|
31
|
-
export type CodeBlockLineAttributes = {
|
|
32
|
-
lineNumber: number;
|
|
33
|
-
lineStart: number;
|
|
34
|
-
};
|
|
@@ -1,11 +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 { CodeBlockPlugin } from '../index';
|
|
5
|
-
import type { LanguagePickerProps } from './LanguagePicker';
|
|
6
|
-
type CodeBlockLanguagePickerProps = Omit<LanguagePickerProps, 'recentLanguageValues' | 'onMenuOpen' | 'onSelection'> & {
|
|
7
|
-
api: ExtractInjectionAPI<CodeBlockPlugin> | undefined;
|
|
8
|
-
editorView: EditorView;
|
|
9
|
-
};
|
|
10
|
-
export declare const CodeBlockLanguagePicker: ({ api, defaultValue, editorView, filterOption, formatMessage, languagePickerOptions, }: CodeBlockLanguagePickerProps) => React.JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { CodeBlockPlugin } from '../codeBlockPluginType';
|
|
4
|
-
export declare const createCodeBlockMenuItem: (api: ExtractInjectionAPI<CodeBlockPlugin> | undefined) => () => React.JSX.Element;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { CodeBlockPlugin } from '../index';
|
|
4
|
-
export declare const FormatCodeErrorFlag: ({ api, }: {
|
|
5
|
-
api?: ExtractInjectionAPI<CodeBlockPlugin>;
|
|
6
|
-
}) => React.JSX.Element | null;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import type { IntlShape } from 'react-intl';
|
|
7
|
-
import type { SelectOption } from '@atlaskit/editor-common/types';
|
|
8
|
-
import { type LanguagePickerOption, type LanguagePickerSelectionSource } from './language-picker-options';
|
|
9
|
-
export type LanguagePickerProps = {
|
|
10
|
-
defaultValue?: LanguagePickerOption;
|
|
11
|
-
filterOption: (option: SelectOption<LanguagePickerOption>, rawInput: string) => boolean;
|
|
12
|
-
formatMessage: IntlShape['formatMessage'];
|
|
13
|
-
languagePickerOptions: LanguagePickerOption[];
|
|
14
|
-
onMenuOpen?: () => void;
|
|
15
|
-
onSelection: (option: LanguagePickerOption, selectionSource: LanguagePickerSelectionSource) => void;
|
|
16
|
-
recentLanguageValues?: string[];
|
|
17
|
-
};
|
|
18
|
-
export declare const LanguagePicker: ({ defaultValue, filterOption, formatMessage, languagePickerOptions, recentLanguageValues, onMenuOpen, onSelection, }: LanguagePickerProps) => React.JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { GroupType } from '@atlaskit/select';
|
|
3
|
-
export declare const NONE_LANGUAGE_VALUE = "none";
|
|
4
|
-
export declare const DETECT_LANGUAGE_VALUE = "autodetect";
|
|
5
|
-
export declare const PLAIN_TEXT_LANGUAGE_VALUE = "text";
|
|
6
|
-
export type LanguagePickerSelectionSource = 'all' | 'pinned' | 'recentlyUsed' | 'search';
|
|
7
|
-
export type LanguagePickerOption = {
|
|
8
|
-
alias: readonly string[];
|
|
9
|
-
label: string;
|
|
10
|
-
selectionSource?: LanguagePickerSelectionSource;
|
|
11
|
-
value: string;
|
|
12
|
-
};
|
|
13
|
-
export type LanguagePickerOptionGroup = GroupType<LanguagePickerOption>;
|
|
14
|
-
type CreateGroupedLanguageOptionsProps = {
|
|
15
|
-
formatMessage: IntlShape['formatMessage'];
|
|
16
|
-
languages: LanguagePickerOption[];
|
|
17
|
-
recentlyUsedLanguages?: LanguagePickerOption[];
|
|
18
|
-
};
|
|
19
|
-
export declare const getDetectLanguageOption: (formatMessage: IntlShape["formatMessage"]) => LanguagePickerOption;
|
|
20
|
-
export declare const createGroupedLanguageOptions: ({ formatMessage, languages, recentlyUsedLanguages, }: CreateGroupedLanguageOptionsProps) => LanguagePickerOptionGroup[];
|
|
21
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { AutoDetectEntry, AutoDetectState } from '../pm-plugins/auto-detect-state';
|
|
4
|
-
export declare const shouldTriggerLargeChangeDetection: (lastObservedText: string, text: string) => boolean;
|
|
5
|
-
export declare const getFirstLine: (text: string) => string;
|
|
6
|
-
export declare const hasEnoughTextForAutoDetection: (text: string) => boolean;
|
|
7
|
-
export declare const getLocalId: (node: PMNode) => string | null;
|
|
8
|
-
export declare const createAutoDetectEntry: (node: PMNode, pos: number, isPending: boolean, previous?: AutoDetectEntry) => AutoDetectEntry;
|
|
9
|
-
export declare const queueAutoDetection: (languageDetectionMap: AutoDetectState["languageDetectionMap"], node: PMNode, pos: number, isPending: boolean) => AutoDetectState["languageDetectionMap"];
|
|
10
|
-
export declare const removeAutoDetection: (languageDetectionMap: AutoDetectState["languageDetectionMap"], localId: string) => AutoDetectState["languageDetectionMap"];
|
|
11
|
-
export declare const updateAutoDetectState: (tr: ReadonlyTransaction, pluginState: AutoDetectState) => AutoDetectState["languageDetectionMap"];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { CodeBlockPlugin } from '../index';
|
|
4
|
-
export type AutoDetectTimer = {
|
|
5
|
-
lastObservedText: string;
|
|
6
|
-
timer: ReturnType<typeof setTimeout>;
|
|
7
|
-
};
|
|
8
|
-
export declare const syncPendingDetectionTimers: (view: EditorView, timers: Map<string, AutoDetectTimer>, api?: ExtractInjectionAPI<CodeBlockPlugin>) => void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { CodeBlockState } from '../../pm-plugins/main-state';
|
|
3
|
-
export declare const mapPendingFormats: (pendingFormats: CodeBlockState["pendingFormats"], tr: ReadonlyTransaction, newState: EditorState) => CodeBlockState["pendingFormats"];
|
|
4
|
-
export declare const applyFormatCodeMeta: (pluginState: CodeBlockState, meta: ReturnType<ReadonlyTransaction["getMeta"]>) => CodeBlockState;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { CodeBlockFormatProvider, FormatResult } from '../../types';
|
|
3
|
-
export type LanguageSource = 'auto-detected' | 'selected';
|
|
4
|
-
export type FormatCodeResult = FormatResult;
|
|
5
|
-
export declare const preloadFormatterOnIntent: (formatCodeProvider: CodeBlockFormatProvider | undefined, language: string | undefined) => Command;
|