@atlaskit/editor-core 189.3.24 → 189.3.25
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 +7 -0
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +2 -13
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -3
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +2 -11
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -2
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +2 -11
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -2
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +1 -3
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +1 -3
- package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -2
- package/package.json +2 -1
- package/dist/cjs/plugins/indentation/commands/index.js +0 -140
- package/dist/cjs/plugins/indentation/commands/utils.js +0 -92
- package/dist/cjs/plugins/indentation/getAttrsWithChangesRecorder.js +0 -38
- package/dist/cjs/plugins/indentation/index.js +0 -54
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +0 -26
- package/dist/es2019/plugins/indentation/commands/index.js +0 -130
- package/dist/es2019/plugins/indentation/commands/utils.js +0 -89
- package/dist/es2019/plugins/indentation/getAttrsWithChangesRecorder.js +0 -32
- package/dist/es2019/plugins/indentation/index.js +0 -55
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +0 -21
- package/dist/esm/plugins/indentation/commands/index.js +0 -133
- package/dist/esm/plugins/indentation/commands/utils.js +0 -85
- package/dist/esm/plugins/indentation/getAttrsWithChangesRecorder.js +0 -32
- package/dist/esm/plugins/indentation/index.js +0 -48
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +0 -19
- package/dist/types/plugins/indentation/commands/index.d.ts +0 -8
- package/dist/types/plugins/indentation/commands/utils.d.ts +0 -37
- package/dist/types/plugins/indentation/getAttrsWithChangesRecorder.d.ts +0 -23
- package/dist/types/plugins/indentation/index.d.ts +0 -18
- package/dist/types/plugins/indentation/pm-plugins/keymap.d.ts +0 -4
- package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +0 -8
- package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +0 -37
- package/dist/types-ts4.5/plugins/indentation/getAttrsWithChangesRecorder.d.ts +0 -23
- package/dist/types-ts4.5/plugins/indentation/index.d.ts +0 -20
- package/dist/types-ts4.5/plugins/indentation/pm-plugins/keymap.d.ts +0 -4
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { indentation } from '@atlaskit/adf-schema';
|
|
2
|
-
import { keymapPlugin } from './pm-plugins/keymap';
|
|
3
|
-
import { getOutdentCommand, getIndentCommand, isIndentationAllowed } from './commands';
|
|
4
|
-
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
5
|
-
var indentationPlugin = function indentationPlugin(_ref) {
|
|
6
|
-
var _api$analytics, _api$analytics2;
|
|
7
|
-
var api = _ref.api;
|
|
8
|
-
return {
|
|
9
|
-
name: 'indentation',
|
|
10
|
-
marks: function marks() {
|
|
11
|
-
return [{
|
|
12
|
-
name: 'indentation',
|
|
13
|
-
mark: indentation
|
|
14
|
-
}];
|
|
15
|
-
},
|
|
16
|
-
actions: {
|
|
17
|
-
indentParagraphOrHeading: getIndentCommand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
|
|
18
|
-
outdentParagraphOrHeading: getOutdentCommand(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
19
|
-
},
|
|
20
|
-
getSharedState: function getSharedState(editorState) {
|
|
21
|
-
var _ref2;
|
|
22
|
-
if (!editorState) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
var selection = editorState.tr.selection,
|
|
26
|
-
indentation = editorState.schema.marks.indentation;
|
|
27
|
-
var node = selection.$from.node();
|
|
28
|
-
var indentationMark = node.marks.find(function (mark) {
|
|
29
|
-
return mark.type === indentation;
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
isIndentationAllowed: isIndentationAllowed(editorState.schema, node),
|
|
33
|
-
indentDisabled: (_ref2 = (indentationMark === null || indentationMark === void 0 ? void 0 : indentationMark.attrs.level) >= MAX_INDENTATION_LEVEL) !== null && _ref2 !== void 0 ? _ref2 : false,
|
|
34
|
-
outdentDisabled: !indentationMark
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
pmPlugins: function pmPlugins() {
|
|
38
|
-
return [{
|
|
39
|
-
name: 'indentationKeymap',
|
|
40
|
-
plugin: function plugin() {
|
|
41
|
-
var _api$analytics3;
|
|
42
|
-
return keymapPlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
43
|
-
}
|
|
44
|
-
}];
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export default indentationPlugin;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace } from '@atlaskit/editor-common/keymaps';
|
|
3
|
-
import { isTextSelection } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
export function keymapPlugin(editorAnalyticsAPI) {
|
|
7
|
-
var list = {};
|
|
8
|
-
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
-
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
10
|
-
bindKeymapWithCommand(findShortcutByKeymap(backspace), function (state, dispatch) {
|
|
11
|
-
var selection = state.selection;
|
|
12
|
-
if (isTextSelection(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
13
|
-
return dispatch ? getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}, list);
|
|
17
|
-
return keymap(list);
|
|
18
|
-
}
|
|
19
|
-
export default keymapPlugin;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { IndentationInputMethod } from './utils';
|
|
5
|
-
export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
|
|
6
|
-
export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
-
export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
|
-
export declare const removeIndentation: Command;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { GetAttrsChange } from '../getAttrsWithChangesRecorder';
|
|
5
|
-
export type PrevAttributes = IndentationMarkAttributes | undefined;
|
|
6
|
-
export type NewAttributes = IndentationMarkAttributes | undefined | false;
|
|
7
|
-
export type IndentationChangesOptions = {
|
|
8
|
-
direction: INDENT_DIRECTION;
|
|
9
|
-
};
|
|
10
|
-
export type IndentationInputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
11
|
-
/**
|
|
12
|
-
* Get the current indentation level given prev and new attributes
|
|
13
|
-
* @param prevAttrs - Previous attributes from indentation
|
|
14
|
-
* @param newAttrs - New attributes from indentation
|
|
15
|
-
*/
|
|
16
|
-
export declare function getNewIndentLevel(prevAttrs: PrevAttributes, newAttrs: NewAttributes): number;
|
|
17
|
-
/**
|
|
18
|
-
* Get the previous indentation level prev attributes
|
|
19
|
-
* @param prevAttrs - Previous attributes from indentation
|
|
20
|
-
*/
|
|
21
|
-
export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
22
|
-
/**
|
|
23
|
-
* Create a new dispatch function who add analytics events given a list of attributes changes
|
|
24
|
-
*
|
|
25
|
-
* @export
|
|
26
|
-
* @param {*} getAttrsChanges
|
|
27
|
-
* @param {*} state
|
|
28
|
-
* @param dispatch
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
|
-
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
|
-
inputMethod: IndentationInputMethod;
|
|
34
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
35
|
-
state: EditorState;
|
|
36
|
-
dispatch?: (tr: Transaction) => void;
|
|
37
|
-
}): (tr: Transaction) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
export interface GetAttrsChange<T, V> {
|
|
3
|
-
node: Node;
|
|
4
|
-
prevAttrs?: T;
|
|
5
|
-
newAttrs: T | false | undefined;
|
|
6
|
-
options: V;
|
|
7
|
-
}
|
|
8
|
-
export type GetAttrsWithChangesRecorder<T, V> = {
|
|
9
|
-
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
10
|
-
getAndResetAttrsChanges(): GetAttrsChange<T, V>[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Create a new getAttrs handler who will wrap the original function,
|
|
14
|
-
* and store the changes internally to be used for other
|
|
15
|
-
* tools like Analytics later in the code.
|
|
16
|
-
*
|
|
17
|
-
* @param getAttrs - Function who gets the new attributes
|
|
18
|
-
* @return object
|
|
19
|
-
* @property handler - New handler to get indentation attributes (It wraps the original)
|
|
20
|
-
* @property getChanges - Return all the stored changes.
|
|
21
|
-
* @property clear - Clear the changes
|
|
22
|
-
*/
|
|
23
|
-
export default function getAttrsWithChangesRecorder<T, V>(getAttrs: (prevAttrs?: T, node?: Node) => T | false | undefined, options: V): GetAttrsWithChangesRecorder<T, V>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import type { IndentationInputMethod } from './commands/utils';
|
|
4
|
-
type IndentationPluginSharedState = {
|
|
5
|
-
isIndentationAllowed: boolean;
|
|
6
|
-
indentDisabled: boolean;
|
|
7
|
-
outdentDisabled: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type IndentationPlugin = NextEditorPlugin<'indentation', {
|
|
10
|
-
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
11
|
-
actions: {
|
|
12
|
-
indentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
13
|
-
outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
14
|
-
};
|
|
15
|
-
sharedState: IndentationPluginSharedState | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
declare const indentationPlugin: IndentationPlugin;
|
|
18
|
-
export default indentationPlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
4
|
-
export default keymapPlugin;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { IndentationInputMethod } from './utils';
|
|
5
|
-
export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
|
|
6
|
-
export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
-
export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
|
-
export declare const removeIndentation: Command;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { GetAttrsChange } from '../getAttrsWithChangesRecorder';
|
|
5
|
-
export type PrevAttributes = IndentationMarkAttributes | undefined;
|
|
6
|
-
export type NewAttributes = IndentationMarkAttributes | undefined | false;
|
|
7
|
-
export type IndentationChangesOptions = {
|
|
8
|
-
direction: INDENT_DIRECTION;
|
|
9
|
-
};
|
|
10
|
-
export type IndentationInputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
|
|
11
|
-
/**
|
|
12
|
-
* Get the current indentation level given prev and new attributes
|
|
13
|
-
* @param prevAttrs - Previous attributes from indentation
|
|
14
|
-
* @param newAttrs - New attributes from indentation
|
|
15
|
-
*/
|
|
16
|
-
export declare function getNewIndentLevel(prevAttrs: PrevAttributes, newAttrs: NewAttributes): number;
|
|
17
|
-
/**
|
|
18
|
-
* Get the previous indentation level prev attributes
|
|
19
|
-
* @param prevAttrs - Previous attributes from indentation
|
|
20
|
-
*/
|
|
21
|
-
export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
22
|
-
/**
|
|
23
|
-
* Create a new dispatch function who add analytics events given a list of attributes changes
|
|
24
|
-
*
|
|
25
|
-
* @export
|
|
26
|
-
* @param {*} getAttrsChanges
|
|
27
|
-
* @param {*} state
|
|
28
|
-
* @param dispatch
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
|
-
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
|
-
inputMethod: IndentationInputMethod;
|
|
34
|
-
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
35
|
-
state: EditorState;
|
|
36
|
-
dispatch?: (tr: Transaction) => void;
|
|
37
|
-
}): (tr: Transaction) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
export interface GetAttrsChange<T, V> {
|
|
3
|
-
node: Node;
|
|
4
|
-
prevAttrs?: T;
|
|
5
|
-
newAttrs: T | false | undefined;
|
|
6
|
-
options: V;
|
|
7
|
-
}
|
|
8
|
-
export type GetAttrsWithChangesRecorder<T, V> = {
|
|
9
|
-
getAttrs(prevAttrs?: T | undefined, node?: Node): T | false | undefined;
|
|
10
|
-
getAndResetAttrsChanges(): GetAttrsChange<T, V>[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Create a new getAttrs handler who will wrap the original function,
|
|
14
|
-
* and store the changes internally to be used for other
|
|
15
|
-
* tools like Analytics later in the code.
|
|
16
|
-
*
|
|
17
|
-
* @param getAttrs - Function who gets the new attributes
|
|
18
|
-
* @return object
|
|
19
|
-
* @property handler - New handler to get indentation attributes (It wraps the original)
|
|
20
|
-
* @property getChanges - Return all the stored changes.
|
|
21
|
-
* @property clear - Clear the changes
|
|
22
|
-
*/
|
|
23
|
-
export default function getAttrsWithChangesRecorder<T, V>(getAttrs: (prevAttrs?: T, node?: Node) => T | false | undefined, options: V): GetAttrsWithChangesRecorder<T, V>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import type { IndentationInputMethod } from './commands/utils';
|
|
4
|
-
type IndentationPluginSharedState = {
|
|
5
|
-
isIndentationAllowed: boolean;
|
|
6
|
-
indentDisabled: boolean;
|
|
7
|
-
outdentDisabled: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type IndentationPlugin = NextEditorPlugin<'indentation', {
|
|
10
|
-
dependencies: [
|
|
11
|
-
OptionalPlugin<AnalyticsPlugin>
|
|
12
|
-
];
|
|
13
|
-
actions: {
|
|
14
|
-
indentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
15
|
-
outdentParagraphOrHeading: (inputMethod: IndentationInputMethod) => Command;
|
|
16
|
-
};
|
|
17
|
-
sharedState: IndentationPluginSharedState | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
declare const indentationPlugin: IndentationPlugin;
|
|
20
|
-
export default indentationPlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
4
|
-
export default keymapPlugin;
|