@atlaskit/editor-core 187.9.2 → 187.10.1
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/.eslintrc.js +1 -0
- package/CHANGELOG.md +17 -0
- package/dist/cjs/commands/index.js +8 -134
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/base/index.js +2 -2
- package/dist/cjs/plugins/block-type/commands/block-type.js +34 -36
- package/dist/cjs/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/cjs/plugins/block-type/index.js +16 -13
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +19 -18
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -14
- package/dist/cjs/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +7 -7
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +3 -4
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +13 -5
- package/dist/cjs/plugins/block-type/utils.js +73 -2
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +154 -132
- package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +11 -10
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
- package/dist/cjs/plugins/media/toolbar/alt-text.js +6 -6
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -1
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/cjs/plugins/media/utils/media-common.js +5 -5
- package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +2 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +3 -3
- package/dist/cjs/ui/styles.js +4 -11
- package/dist/cjs/utils/index.js +4 -80
- package/dist/cjs/utils/input-rules.js +6 -66
- package/dist/cjs/utils/mark.js +2 -38
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/commands/index.js +1 -128
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/base/index.js +1 -1
- package/dist/es2019/plugins/block-type/commands/block-type.js +11 -13
- package/dist/es2019/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/es2019/plugins/block-type/index.js +21 -12
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/es2019/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +21 -2
- package/dist/es2019/plugins/block-type/utils.js +70 -1
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +152 -128
- package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +12 -8
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +5 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +12 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +3 -1
- package/dist/es2019/plugins/media/toolbar/alt-text.js +10 -6
- package/dist/es2019/plugins/media/toolbar/linking.js +8 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +5 -3
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/ui/styles.js +0 -16
- package/dist/es2019/utils/index.js +0 -80
- package/dist/es2019/utils/input-rules.js +4 -61
- package/dist/es2019/utils/mark.js +0 -33
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/commands/index.js +7 -125
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/base/index.js +1 -1
- package/dist/esm/plugins/block-type/commands/block-type.js +11 -13
- package/dist/esm/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/esm/plugins/block-type/index.js +15 -12
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/esm/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +8 -4
- package/dist/esm/plugins/block-type/utils.js +69 -1
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +153 -131
- package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +9 -7
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +6 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
- package/dist/esm/plugins/media/toolbar/alt-text.js +6 -6
- package/dist/esm/plugins/media/toolbar/linking.js +4 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/esm/ui/ColorPickerButton/index.js +3 -3
- package/dist/esm/ui/styles.js +3 -6
- package/dist/esm/utils/index.js +3 -77
- package/dist/esm/utils/input-rules.js +4 -61
- package/dist/esm/utils/mark.js +0 -35
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +0 -6
- package/dist/types/labs/next/presets/default.d.ts +40 -8
- package/dist/types/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types/plugins/block-type/index.d.ts +1 -1
- package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/block-type/styles.d.ts +1 -1
- package/dist/types/plugins/block-type/types.d.ts +2 -3
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types/plugins/block-type/utils.d.ts +15 -1
- package/dist/types/plugins/date/index.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/index.d.ts +1 -7
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/index.d.ts +2 -2
- package/dist/types/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/styles.d.ts +0 -3
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/input-rules.d.ts +4 -16
- package/dist/types/utils/mark.d.ts +0 -1
- package/dist/types-ts4.5/commands/index.d.ts +0 -6
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +44 -8
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/block-type/styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types-ts4.5/plugins/block-type/utils.d.ts +15 -1
- package/dist/types-ts4.5/plugins/date/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +1 -7
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types-ts4.5/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/styles.d.ts +0 -3
- package/dist/types-ts4.5/utils/index.d.ts +0 -6
- package/dist/types-ts4.5/utils/input-rules.d.ts +4 -16
- package/dist/types-ts4.5/utils/mark.d.ts +0 -1
- package/package.json +6 -5
- package/report.api.md +9 -37
- package/tmp/api-report-tmp.d.ts +8 -34
- package/dist/cjs/plugins/editor-disabled/index.js +0 -75
- package/dist/cjs/types/allowed-block-types.js +0 -5
- package/dist/cjs/utils/keymap.js +0 -38
- package/dist/es2019/plugins/editor-disabled/index.js +0 -62
- package/dist/es2019/types/allowed-block-types.js +0 -1
- package/dist/es2019/utils/keymap.js +0 -33
- package/dist/esm/plugins/editor-disabled/index.js +0 -66
- package/dist/esm/types/allowed-block-types.js +0 -1
- package/dist/esm/utils/keymap.js +0 -33
- package/dist/types/plugins/editor-disabled/index.d.ts +0 -13
- package/dist/types/types/allowed-block-types.d.ts +0 -1
- package/dist/types/utils/keymap.d.ts +0 -11
- package/dist/types-ts4.5/plugins/editor-disabled/index.d.ts +0 -13
- package/dist/types-ts4.5/types/allowed-block-types.d.ts +0 -1
- package/dist/types-ts4.5/utils/keymap.d.ts +0 -11
- /package/dist/cjs/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/es2019/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/esm/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/types/{keymaps → plugins/block-type}/consts.d.ts +0 -0
- /package/dist/types-ts4.5/{keymaps → plugins/block-type}/consts.d.ts +0 -0
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { toggleMark } from '@atlaskit/editor-prosemirror/commands';
|
|
2
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer';
|
|
4
3
|
import { FakeTextCursorSelection } from '../plugins/fake-text-cursor/cursor';
|
|
5
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
5
|
import { isNodeEmpty } from './document';
|
|
7
|
-
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
|
-
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
6
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
7
|
export { isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
8
|
export { sanitiseMarksInSelection } from './mark';
|
|
@@ -18,37 +15,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
18
15
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
19
16
|
return toggleMark(markType)(state);
|
|
20
17
|
}
|
|
21
|
-
export function canMoveUp(state) {
|
|
22
|
-
var selection = state.selection;
|
|
23
|
-
/**
|
|
24
|
-
* If there's a media element on the selection it will use a gap cursor to move
|
|
25
|
-
*/
|
|
26
|
-
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
if (selection instanceof TextSelection) {
|
|
30
|
-
if (!selection.empty) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return !atTheBeginningOfDoc(state);
|
|
35
|
-
}
|
|
36
|
-
export function canMoveDown(state) {
|
|
37
|
-
var selection = state.selection;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* If there's a media element on the selection it will use a gap cursor to move
|
|
41
|
-
*/
|
|
42
|
-
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
if (selection instanceof TextSelection) {
|
|
46
|
-
if (!selection.empty) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return !atTheEndOfDoc(state);
|
|
51
|
-
}
|
|
52
18
|
export function isSelectionInsideLastNodeInDocument(selection) {
|
|
53
19
|
var docNode = selection.$anchor.node(0);
|
|
54
20
|
var rootNode = selection.$anchor.node(1);
|
|
@@ -173,46 +139,6 @@ export function whichTransitionEvent() {
|
|
|
173
139
|
}
|
|
174
140
|
return;
|
|
175
141
|
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Function will create a list of wrapper blocks present in a selection.
|
|
179
|
-
*/
|
|
180
|
-
function getSelectedWrapperNodes(state) {
|
|
181
|
-
var nodes = [];
|
|
182
|
-
if (state.selection) {
|
|
183
|
-
var _state$selection = state.selection,
|
|
184
|
-
$from = _state$selection.$from,
|
|
185
|
-
$to = _state$selection.$to;
|
|
186
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
187
|
-
blockquote = _state$schema$nodes.blockquote,
|
|
188
|
-
panel = _state$schema$nodes.panel,
|
|
189
|
-
orderedList = _state$schema$nodes.orderedList,
|
|
190
|
-
bulletList = _state$schema$nodes.bulletList,
|
|
191
|
-
listItem = _state$schema$nodes.listItem,
|
|
192
|
-
codeBlock = _state$schema$nodes.codeBlock,
|
|
193
|
-
decisionItem = _state$schema$nodes.decisionItem,
|
|
194
|
-
decisionList = _state$schema$nodes.decisionList,
|
|
195
|
-
taskItem = _state$schema$nodes.taskItem,
|
|
196
|
-
taskList = _state$schema$nodes.taskList;
|
|
197
|
-
state.doc.nodesBetween($from.pos, $to.pos, function (node) {
|
|
198
|
-
if (node.isBlock && [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList].indexOf(node.type) >= 0) {
|
|
199
|
-
nodes.push(node.type);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return nodes;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Function will check if changing block types: Paragraph, Heading is enabled.
|
|
208
|
-
*/
|
|
209
|
-
export function areBlockTypesDisabled(state) {
|
|
210
|
-
var nodesTypes = getSelectedWrapperNodes(state);
|
|
211
|
-
var panel = state.schema.nodes.panel;
|
|
212
|
-
return nodesTypes.filter(function (type) {
|
|
213
|
-
return type !== panel;
|
|
214
|
-
}).length > 0;
|
|
215
|
-
}
|
|
216
142
|
export var isTemporary = function isTemporary(id) {
|
|
217
143
|
return id.indexOf('temporary:') === 0;
|
|
218
144
|
};
|
|
@@ -269,9 +195,9 @@ export var isEmptyNode = function isEmptyNode(schema) {
|
|
|
269
195
|
return innerIsEmptyNode;
|
|
270
196
|
};
|
|
271
197
|
export var insideTableCell = function insideTableCell(state) {
|
|
272
|
-
var _state$schema$
|
|
273
|
-
tableCell = _state$schema$
|
|
274
|
-
tableHeader = _state$schema$
|
|
198
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
199
|
+
tableCell = _state$schema$nodes.tableCell,
|
|
200
|
+
tableHeader = _state$schema$nodes.tableHeader;
|
|
275
201
|
return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
|
|
276
202
|
};
|
|
277
203
|
export var isInListItem = function isInListItem(state) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { canJoin, findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
5
|
-
import { createRule } from '@atlaskit/prosemirror-input-rules';
|
|
6
4
|
import { addAnalytics } from '../plugins/analytics';
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* @deprecated Use import {inputRuleWithAnalytics} from "@atlaskit/editor-common/utils"; instead
|
|
8
|
+
*/
|
|
8
9
|
export var ruleWithAnalytics = function ruleWithAnalytics(getPayload) {
|
|
9
10
|
return function (originalRule) {
|
|
10
11
|
var onHandlerApply = function onHandlerApply(state, tr, matchResult) {
|
|
@@ -18,62 +19,4 @@ export var ruleWithAnalytics = function ruleWithAnalytics(getPayload) {
|
|
|
18
19
|
onHandlerApply: onHandlerApply
|
|
19
20
|
});
|
|
20
21
|
};
|
|
21
|
-
};
|
|
22
|
-
export var createWrappingTextBlockRule = function createWrappingTextBlockRule(_ref) {
|
|
23
|
-
var match = _ref.match,
|
|
24
|
-
nodeType = _ref.nodeType,
|
|
25
|
-
getAttrs = _ref.getAttrs;
|
|
26
|
-
var handler = function handler(state, match, start, end) {
|
|
27
|
-
var fixedStart = Math.max(start, 1);
|
|
28
|
-
var $start = state.doc.resolve(fixedStart);
|
|
29
|
-
var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
|
|
30
|
-
var nodeBefore = $start.node(-1);
|
|
31
|
-
if (nodeBefore && !nodeBefore.canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return state.tr.delete(fixedStart, end).setBlockType(fixedStart, fixedStart, nodeType, attrs);
|
|
35
|
-
};
|
|
36
|
-
return createRule(match, handler);
|
|
37
|
-
};
|
|
38
|
-
export var createWrappingJoinRule = function createWrappingJoinRule(_ref2) {
|
|
39
|
-
var match = _ref2.match,
|
|
40
|
-
nodeType = _ref2.nodeType,
|
|
41
|
-
getAttrs = _ref2.getAttrs,
|
|
42
|
-
joinPredicate = _ref2.joinPredicate;
|
|
43
|
-
var handler = function handler(state, match, start, end) {
|
|
44
|
-
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
45
|
-
var tr = state.tr;
|
|
46
|
-
var fixedStart = Math.max(start, 1);
|
|
47
|
-
tr.delete(fixedStart, end);
|
|
48
|
-
var $start = tr.doc.resolve(fixedStart);
|
|
49
|
-
var range = $start.blockRange();
|
|
50
|
-
var wrapping = range && findWrapping(range, nodeType, attrs);
|
|
51
|
-
if (!wrapping || !range) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
var parentNodePosMapped = tr.mapping.map(range.start);
|
|
55
|
-
var parentNode = tr.doc.nodeAt(parentNodePosMapped);
|
|
56
|
-
var lastWrap = wrapping[wrapping.length - 1];
|
|
57
|
-
if (parentNode && lastWrap) {
|
|
58
|
-
var allowedMarks = lastWrap.type.allowedMarks(parentNode.marks) || [];
|
|
59
|
-
tr.setNodeMarkup(parentNodePosMapped, parentNode.type, parentNode.attrs, allowedMarks);
|
|
60
|
-
}
|
|
61
|
-
tr.wrap(range, wrapping);
|
|
62
|
-
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
63
|
-
if (before && before.type === nodeType && canJoin(tr.doc, fixedStart - 1) && (!joinPredicate || joinPredicate(match, before, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST.JOINED_TO_LIST_ABOVE))) {
|
|
64
|
-
tr.join(fixedStart - 1);
|
|
65
|
-
}
|
|
66
|
-
return tr;
|
|
67
|
-
};
|
|
68
|
-
return createRule(match, handler);
|
|
69
|
-
};
|
|
70
|
-
export var createJoinNodesRule = function createJoinNodesRule(match, nodeType) {
|
|
71
|
-
return createWrappingJoinRule({
|
|
72
|
-
nodeType: nodeType,
|
|
73
|
-
match: match,
|
|
74
|
-
getAttrs: {},
|
|
75
|
-
joinPredicate: function joinPredicate(_, node) {
|
|
76
|
-
return node.type === nodeType;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
22
|
};
|
package/dist/esm/utils/mark.js
CHANGED
|
@@ -32,41 +32,6 @@ export var isMarkExcluded = function isMarkExcluded(type, marks) {
|
|
|
32
32
|
}
|
|
33
33
|
return false;
|
|
34
34
|
};
|
|
35
|
-
var not = function not(fn) {
|
|
36
|
-
return function (arg) {
|
|
37
|
-
return !fn(arg);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export var removeBlockMarks = function removeBlockMarks(state, marks) {
|
|
41
|
-
var selection = state.selection,
|
|
42
|
-
schema = state.schema;
|
|
43
|
-
var tr = state.tr;
|
|
44
|
-
|
|
45
|
-
// Marks might not exist in Schema
|
|
46
|
-
var marksToRemove = marks.filter(Boolean);
|
|
47
|
-
if (marksToRemove.length === 0) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Saves an extra dispatch */
|
|
52
|
-
var blockMarksExists = false;
|
|
53
|
-
var hasMark = function hasMark(mark) {
|
|
54
|
-
return marksToRemove.indexOf(mark.type) > -1;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* When you need to toggle the selection
|
|
58
|
-
* when another type which does not allow alignment is applied
|
|
59
|
-
*/
|
|
60
|
-
state.doc.nodesBetween(selection.from, selection.to, function (node, pos) {
|
|
61
|
-
if (node.type === schema.nodes.paragraph && node.marks.some(hasMark)) {
|
|
62
|
-
blockMarksExists = true;
|
|
63
|
-
var resolvedPos = state.doc.resolve(pos);
|
|
64
|
-
var withoutBlockMarks = node.marks.filter(not(hasMark));
|
|
65
|
-
tr = tr.setNodeMarkup(resolvedPos.pos, undefined, node.attrs, withoutBlockMarks);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return blockMarksExists ? tr : undefined;
|
|
69
|
-
};
|
|
70
35
|
|
|
71
36
|
/**
|
|
72
37
|
* Removes marks from nodes in the current selection that are not supported
|
package/dist/esm/version.json
CHANGED
|
@@ -2,12 +2,6 @@ import type { MarkType, NodeType, Node as PMNode, Schema } from '@atlaskit/edito
|
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { AlignmentState } from '../plugins/alignment/pm-plugins/types';
|
|
4
4
|
import type { Command } from '../types';
|
|
5
|
-
export declare function preventDefault(): Command;
|
|
6
|
-
export declare function insertNewLine(): Command;
|
|
7
|
-
export declare const insertNewLineWithAnalytics: Command;
|
|
8
|
-
export declare const createNewParagraphAbove: Command;
|
|
9
|
-
export declare const createNewParagraphBelow: Command;
|
|
10
|
-
export declare function createParagraphNear(append?: boolean): Command;
|
|
11
5
|
export declare function addParagraphAtEnd(tr: Transaction): void;
|
|
12
6
|
export declare function createParagraphAtEnd(): Command;
|
|
13
7
|
export declare const changeImageAlignment: (align?: AlignmentState) => Command;
|
|
@@ -155,10 +155,18 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
155
155
|
actions: {
|
|
156
156
|
applyChange: (tr: import("prosemirror-state").Transaction) => import("prosemirror-state").Transaction;
|
|
157
157
|
};
|
|
158
|
-
}
|
|
158
|
+
}>>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
159
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
160
|
+
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
161
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
162
|
+
}>];
|
|
159
163
|
actions: {
|
|
160
164
|
forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
|
|
161
165
|
};
|
|
166
|
+
sharedState: {
|
|
167
|
+
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
168
|
+
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
169
|
+
} | undefined;
|
|
162
170
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"floatingToolbar", {
|
|
163
171
|
dependencies: [(config: import("@atlaskit/editor-common/types").FeatureFlags, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"featureFlags", {
|
|
164
172
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
@@ -186,18 +194,26 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
186
194
|
actions: {
|
|
187
195
|
applyChange: (tr: import("prosemirror-state").Transaction) => import("prosemirror-state").Transaction;
|
|
188
196
|
};
|
|
189
|
-
}
|
|
197
|
+
}>>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
198
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
199
|
+
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
200
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
201
|
+
}>];
|
|
190
202
|
actions: {
|
|
191
203
|
forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
|
|
192
204
|
};
|
|
205
|
+
sharedState: {
|
|
206
|
+
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
207
|
+
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
208
|
+
} | undefined;
|
|
193
209
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"fakeTextCursor", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"fakeTextCursor", {}>, (config?: ((editorView: import("prosemirror-view").EditorView) => void) | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"submitEditor", {
|
|
194
210
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
195
211
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"submitEditor", {
|
|
196
212
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
197
213
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
198
|
-
sharedState: import("
|
|
214
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
199
215
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
200
|
-
sharedState: import("
|
|
216
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
201
217
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
202
218
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
203
219
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
@@ -480,10 +496,18 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
480
496
|
actions: {
|
|
481
497
|
applyChange: (tr: import("prosemirror-state").Transaction) => import("prosemirror-state").Transaction;
|
|
482
498
|
};
|
|
483
|
-
}
|
|
499
|
+
}>>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
500
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
501
|
+
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
502
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
503
|
+
}>];
|
|
484
504
|
actions: {
|
|
485
505
|
forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
|
|
486
506
|
};
|
|
507
|
+
sharedState: {
|
|
508
|
+
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
509
|
+
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
510
|
+
} | undefined;
|
|
487
511
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"floatingToolbar", {
|
|
488
512
|
dependencies: [(config: import("@atlaskit/editor-common/types").FeatureFlags, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"featureFlags", {
|
|
489
513
|
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
@@ -511,18 +535,26 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
511
535
|
actions: {
|
|
512
536
|
applyChange: (tr: import("prosemirror-state").Transaction) => import("prosemirror-state").Transaction;
|
|
513
537
|
};
|
|
514
|
-
}
|
|
538
|
+
}>>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
539
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
540
|
+
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
541
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
542
|
+
}>];
|
|
515
543
|
actions: {
|
|
516
544
|
forceFocusSelector: import("@atlaskit/editor-plugin-floating-toolbar").ForceFocusSelector;
|
|
517
545
|
};
|
|
546
|
+
sharedState: {
|
|
547
|
+
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
548
|
+
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
549
|
+
} | undefined;
|
|
518
550
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"fakeTextCursor", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"fakeTextCursor", {}>, (config?: ((editorView: import("prosemirror-view").EditorView) => void) | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"submitEditor", {
|
|
519
551
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
520
552
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"submitEditor", {
|
|
521
553
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
522
554
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"editorDisabled", {
|
|
523
|
-
sharedState: import("
|
|
555
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
524
556
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"editorDisabled", {
|
|
525
|
-
sharedState: import("
|
|
557
|
+
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
526
558
|
}>, (config?: undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"unsupportedContent", {}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"unsupportedContent", {}>, (config?: TypeAheadPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"typeAhead", {
|
|
527
559
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
528
560
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"typeAhead", {
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
/// <reference path="../../../../../../../../typings/prosemirror-state.d.ts" />
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { Command } from '
|
|
6
|
-
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { HeadingLevelsAndNormalText, Command } from '@atlaskit/editor-common/types';
|
|
7
6
|
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
8
7
|
export type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FORMATTING | INPUT_METHOD.KEYBOARD;
|
|
9
8
|
export declare function setBlockType(name: string): Command;
|
|
10
|
-
export declare function setBlockTypeWithAnalytics(name: string, inputMethod: InputMethod): Command;
|
|
9
|
+
export declare function setBlockTypeWithAnalytics(name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
|
|
11
10
|
export declare function setNormalText(): Command;
|
|
12
|
-
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod): Command;
|
|
11
|
+
export declare function setNormalTextWithAnalytics(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
|
|
13
12
|
export declare function setHeading(level: HeadingLevelsAndNormalText): Command;
|
|
14
|
-
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod) => Command;
|
|
13
|
+
export declare const setHeadingWithAnalytics: (newHeadingLevel: HeadingLevelsAndNormalText, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
15
14
|
export declare function insertBlockType(name: string): Command;
|
|
16
15
|
/**
|
|
17
16
|
*
|
|
@@ -21,7 +20,7 @@ export declare function insertBlockType(name: string): Command;
|
|
|
21
20
|
* otherwise Editor becomes very sad and crashes
|
|
22
21
|
* @returns - command that inserts block type
|
|
23
22
|
*/
|
|
24
|
-
export declare const insertBlockTypesWithAnalytics: (name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) =>
|
|
23
|
+
export declare const insertBlockTypesWithAnalytics: (name: string, inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
25
24
|
/**
|
|
26
25
|
* This function creates a new transaction that wraps the current selection
|
|
27
26
|
* in the specified node type if it results in a valid transaction.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockTypePluginOptions } from './types';
|
|
3
2
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockTypePluginOptions } from './types';
|
|
4
4
|
declare const blockTypePlugin: NextEditorPlugin<'blockType', {
|
|
5
5
|
pluginConfiguration: BlockTypePluginOptions | undefined;
|
|
6
6
|
dependencies: [OptionalPlugin<typeof analyticsPlugin>];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
4
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
|
|
4
|
-
declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
|
+
declare function inputRulePlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined, schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
6
|
export default inputRulePlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
4
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
export default function keymapPlugin(editorAnalyticsApi: EditorAnalyticsAPI | undefined, schema: Schema, _featureFlags: FeatureFlags): SafePlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { BlockType } from '../types';
|
|
4
5
|
export type BlockTypeState = {
|
|
5
6
|
currentBlockType: BlockType;
|
|
@@ -8,4 +9,4 @@ export type BlockTypeState = {
|
|
|
8
9
|
availableWrapperBlockTypes: BlockType[];
|
|
9
10
|
};
|
|
10
11
|
export declare const pluginKey: PluginKey<BlockTypeState>;
|
|
11
|
-
export declare const createPlugin: (dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<BlockTypeState>;
|
|
12
|
+
export declare const createPlugin: (editorAnalyticsApi: EditorAnalyticsAPI | undefined, dispatch: (eventName: string | PluginKey, data: any) => void, lastNodeMustBeParagraph?: boolean) => SafePlugin<BlockTypeState>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const blocktypeStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { MessageDescriptor } from '../../types/i18n';
|
|
1
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
3
2
|
import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { HeadingLevelsAndNormalText } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { HeadingLevelsAndNormalText, AllowedBlockTypes } from '@atlaskit/editor-common/types';
|
|
5
4
|
export declare const NORMAL_TEXT: BlockType;
|
|
6
5
|
export declare const HEADING_1: BlockType;
|
|
7
6
|
export declare const HEADING_2: BlockType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
import type { MessageDescriptor } from '../../../../types/i18n';
|
|
3
|
+
import type { WrappedComponentProps, MessageDescriptor } from 'react-intl-next';
|
|
5
4
|
export interface BlockTypeButtonProps {
|
|
6
5
|
isSmall?: boolean;
|
|
7
6
|
isReducedSpacing?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
6
|
import type { BlockTypeState } from '../../pm-plugins/main';
|
|
5
7
|
import type { BlockType } from '../../types';
|
|
6
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
7
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
export type DropdownItem = MenuItem & {
|
|
9
9
|
value: BlockType;
|
|
10
10
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
1
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
2
2
|
export declare const blockTypeMenuItemStyle: (tagName: string, selected?: boolean) => (themeProps: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
3
3
|
export declare const keyboardShortcut: import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const keyboardShortcutSelect: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const buttonContentStyle: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const buttonContentReducedSpacingStyle: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const wrapperSmallStyle: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { Node as PMNode, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
|
|
2
4
|
export declare const isNodeAWrappingBlockNode: (node?: PMNode | null) => boolean;
|
|
5
|
+
export declare const createJoinNodesRule: (match: RegExp, nodeType: NodeType) => InputRuleWrapper;
|
|
6
|
+
type WrappingTextRuleProps = {
|
|
7
|
+
match: RegExp;
|
|
8
|
+
nodeType: NodeType;
|
|
9
|
+
getAttrs?: Record<string, any> | ((matchResult: RegExpExecArray) => Record<string, any>);
|
|
10
|
+
};
|
|
11
|
+
export declare const createWrappingTextBlockRule: ({ match, nodeType, getAttrs, }: WrappingTextRuleProps) => InputRuleWrapper;
|
|
12
|
+
/**
|
|
13
|
+
* Function will check if changing block types: Paragraph, Heading is enabled.
|
|
14
|
+
*/
|
|
15
|
+
export declare function areBlockTypesDisabled(state: EditorState): boolean;
|
|
16
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type
|
|
2
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
3
3
|
import type { DatePluginConfig } from './types';
|
|
4
4
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
5
|
declare const datePlugin: NextEditorPlugin<'date', {
|
|
6
6
|
pluginConfiguration: DatePluginConfig | undefined;
|
|
7
|
-
dependencies: [typeof analyticsPlugin,
|
|
7
|
+
dependencies: [typeof analyticsPlugin, EditorDisabledPlugin];
|
|
8
8
|
sharedState: {
|
|
9
9
|
showDatePickerAt?: number | null;
|
|
10
10
|
isNew: boolean;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { Selection, EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
3
|
import type { FloatingToolbarConfig } from './types';
|
|
5
|
-
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
4
|
+
import type { FloatingToolbarPlugin, ConfigWithNodeInfo } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
6
5
|
export type FloatingToolbarPluginState = {
|
|
7
6
|
getConfigWithNodeInfo: (state: EditorState) => ConfigWithNodeInfo | null | undefined;
|
|
8
7
|
};
|
|
9
|
-
export type ConfigWithNodeInfo = {
|
|
10
|
-
config: FloatingToolbarConfig | undefined;
|
|
11
|
-
pos: number;
|
|
12
|
-
node: Node;
|
|
13
|
-
};
|
|
14
8
|
export declare const getRelevantConfig: (selection: Selection, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
|
|
15
9
|
declare const floatingToolbarPlugin: FloatingToolbarPlugin;
|
|
16
10
|
export default floatingToolbarPlugin;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
export declare const forceFocusStateKey: PluginKey<any>;
|
|
@@ -11,7 +12,7 @@ export default _default;
|
|
|
11
12
|
/**
|
|
12
13
|
* The provided selector should be the floating toolbar button that needs focus.
|
|
13
14
|
*/
|
|
14
|
-
export declare
|
|
15
|
+
export declare const forceFocusSelector: (selector: string | null) => (tr: Transaction) => Transaction;
|
|
15
16
|
/**
|
|
16
17
|
* If a selector is set and the element exists, focus it.
|
|
17
18
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference path="../../../../../../../../../typings/prosemirror.d.ts" />
|
|
2
2
|
/// <reference path="../../../../../../../../../typings/prosemirror-state.d.ts" />
|
|
3
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("
|
|
3
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | ((state: import("prosemirror-state").EditorState) => import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData)) => import("prosemirror-state").SafeStateField<import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData>, createCommand: <A = import("./types").FloatingToolbarPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { FloatingToolbarPluginData } from '
|
|
2
|
+
import type { FloatingToolbarPluginData } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
3
3
|
export declare const pluginKey: PluginKey<FloatingToolbarPluginData>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { Dispatch } from '../../../../event-dispatcher';
|
|
3
|
-
export declare const createPlugin: (dispatch: Dispatch) => SafePlugin<import("
|
|
3
|
+
export declare const createPlugin: (dispatch: Dispatch) => SafePlugin<import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { FloatingToolbarPluginAction
|
|
1
|
+
import type { FloatingToolbarPluginAction } from './types';
|
|
2
|
+
import type { FloatingToolbarPluginData } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
2
3
|
export declare const reducer: (pluginState: FloatingToolbarPluginData, action: FloatingToolbarPluginAction) => FloatingToolbarPluginData;
|
|
@@ -5,7 +5,7 @@ import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
|
|
|
5
5
|
import type { ApplyChangeHandler } from '@atlaskit/editor-plugin-context-panel';
|
|
6
6
|
interface Props {
|
|
7
7
|
node: PMNode;
|
|
8
|
-
extensionProvider: ExtensionProvider
|
|
8
|
+
extensionProvider: Promise<ExtensionProvider>;
|
|
9
9
|
editorView: EditorView;
|
|
10
10
|
separator?: 'start' | 'end' | 'both';
|
|
11
11
|
applyChangeToContextPanel: ApplyChangeHandler | undefined;
|
|
@@ -24,7 +24,7 @@ export interface Props {
|
|
|
24
24
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
25
25
|
target?: HTMLElement;
|
|
26
26
|
node: Node;
|
|
27
|
-
extensionsProvider?: ExtensionProvider
|
|
27
|
+
extensionsProvider?: Promise<ExtensionProvider>;
|
|
28
28
|
scrollable?: boolean;
|
|
29
29
|
featureFlags: FeatureFlags;
|
|
30
30
|
api: PluginInjectionAPIWithDependencies<[
|