@atlaskit/editor-core 187.34.2 → 187.35.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/CHANGELOG.md +18 -0
- package/dist/cjs/index.js +10 -42
- package/dist/cjs/plugins/block-type/commands/block-type.js +19 -211
- package/dist/cjs/plugins/block-type/commands/index.js +2 -28
- package/dist/cjs/plugins/block-type/index.js +21 -4
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +9 -64
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/code-block/actions.js +83 -6
- package/dist/cjs/plugins/code-block/index.js +27 -12
- package/dist/cjs/plugins/code-block/pm-plugins/input-rule.js +68 -0
- package/dist/cjs/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/cjs/plugins/expand/commands.js +3 -3
- package/dist/cjs/plugins/expand/index.js +2 -2
- package/dist/cjs/plugins/index.js +1 -7
- package/dist/cjs/plugins/insert-block/index.js +34 -29
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +36 -26
- package/dist/cjs/plugins/panel/actions.js +26 -2
- package/dist/cjs/plugins/panel/index.js +9 -5
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +16 -2
- package/dist/es2019/plugins/block-type/commands/block-type.js +15 -217
- package/dist/es2019/plugins/block-type/commands/index.js +1 -3
- package/dist/es2019/plugins/block-type/index.js +21 -4
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -56
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/code-block/actions.js +84 -3
- package/dist/es2019/plugins/code-block/index.js +22 -7
- package/dist/es2019/plugins/code-block/pm-plugins/input-rule.js +60 -0
- package/dist/es2019/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/es2019/plugins/expand/commands.js +1 -1
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +47 -42
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +35 -26
- package/dist/es2019/plugins/panel/actions.js +26 -2
- package/dist/es2019/plugins/panel/index.js +8 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +16 -2
- package/dist/esm/plugins/block-type/commands/block-type.js +17 -205
- package/dist/esm/plugins/block-type/commands/index.js +1 -3
- package/dist/esm/plugins/block-type/index.js +21 -4
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -58
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/code-block/actions.js +76 -3
- package/dist/esm/plugins/code-block/index.js +25 -11
- package/dist/esm/plugins/code-block/pm-plugins/input-rule.js +62 -0
- package/dist/esm/plugins/date/ui/DatePicker/index.js +3 -2
- package/dist/esm/plugins/expand/commands.js +1 -1
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +27 -22
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +37 -27
- package/dist/esm/plugins/panel/actions.js +24 -2
- package/dist/esm/plugins/panel/index.js +8 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +16 -3
- package/dist/types/labs/next/presets/default.d.ts +6 -0
- package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -25
- package/dist/types/plugins/block-type/commands/index.d.ts +1 -3
- package/dist/types/plugins/block-type/index.d.ts +10 -2
- package/dist/types/plugins/code-block/actions.d.ts +11 -0
- package/dist/types/plugins/code-block/index.d.ts +6 -1
- package/dist/types/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
- package/dist/types/plugins/date/ui/DatePicker/index.d.ts +2 -2
- package/dist/types/plugins/index.d.ts +0 -2
- package/dist/types/plugins/insert-block/types.d.ts +7 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -3
- package/dist/types/plugins/panel/actions.d.ts +4 -1
- package/dist/types/plugins/panel/index.d.ts +11 -2
- package/dist/types-ts4.5/index.d.ts +16 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +6 -0
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -25
- package/dist/types-ts4.5/plugins/block-type/commands/index.d.ts +1 -3
- package/dist/types-ts4.5/plugins/block-type/index.d.ts +10 -2
- package/dist/types-ts4.5/plugins/code-block/actions.d.ts +11 -0
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +6 -1
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/input-rule.d.ts +3 -0
- package/dist/types-ts4.5/plugins/date/ui/DatePicker/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +7 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -3
- package/dist/types-ts4.5/plugins/panel/actions.d.ts +4 -1
- package/dist/types-ts4.5/plugins/panel/index.d.ts +9 -2
- package/package.json +3 -3
- package/report.api.md +62 -23
- package/tmp/api-report-tmp.d.ts +49 -15
- package/dist/cjs/plugins/block-type/commands/insert-block.js +0 -60
- package/dist/es2019/plugins/block-type/commands/insert-block.js +0 -55
- package/dist/esm/plugins/block-type/commands/insert-block.js +0 -53
- package/dist/types/plugins/block-type/commands/insert-block.d.ts +0 -5
- package/dist/types-ts4.5/plugins/block-type/commands/insert-block.d.ts +0 -5
- /package/dist/cjs/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/es2019/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/esm/plugins/{block-type/commands → code-block}/transform-to-code-block.js +0 -0
- /package/dist/types/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
- /package/dist/types-ts4.5/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts +0 -0
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.insertBlock = void 0;
|
|
7
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var insertBlock = function insertBlock(state, nodeType, nodeName, start, end, attrs) {
|
|
10
|
-
// To ensure that match is done after HardBreak.
|
|
11
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
12
|
-
hardBreak = _state$schema$nodes.hardBreak,
|
|
13
|
-
codeBlock = _state$schema$nodes.codeBlock,
|
|
14
|
-
listItem = _state$schema$nodes.listItem;
|
|
15
|
-
var $pos = state.doc.resolve(start);
|
|
16
|
-
if ($pos.nodeAfter.type !== hardBreak) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// To ensure no nesting is done. (unless we're inserting a codeBlock inside lists)
|
|
21
|
-
if ($pos.depth > 1 && !(nodeType === codeBlock && (0, _utils.hasParentNodeOfType)(listItem)(state.selection))) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Split at the start of autoformatting and delete formatting characters.
|
|
26
|
-
var tr = state.tr.delete(start, end).split(start);
|
|
27
|
-
var currentNode = tr.doc.nodeAt(start + 1);
|
|
28
|
-
|
|
29
|
-
// If node has more content split at the end of autoformatting.
|
|
30
|
-
var nodeHasMoreContent = false;
|
|
31
|
-
tr.doc.nodesBetween(start, start + currentNode.nodeSize, function (node, pos) {
|
|
32
|
-
if (!nodeHasMoreContent && node.type === hardBreak) {
|
|
33
|
-
nodeHasMoreContent = true;
|
|
34
|
-
tr = tr.split(pos + 1).delete(pos, pos + 1);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (nodeHasMoreContent) {
|
|
38
|
-
currentNode = tr.doc.nodeAt(start + 1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Create new node and fill with content of current node.
|
|
42
|
-
var _state$schema$nodes2 = state.schema.nodes,
|
|
43
|
-
blockquote = _state$schema$nodes2.blockquote,
|
|
44
|
-
paragraph = _state$schema$nodes2.paragraph;
|
|
45
|
-
var content;
|
|
46
|
-
var depth;
|
|
47
|
-
if (nodeType === blockquote) {
|
|
48
|
-
depth = 3;
|
|
49
|
-
content = [paragraph.create({}, currentNode.content)];
|
|
50
|
-
} else {
|
|
51
|
-
depth = 2;
|
|
52
|
-
content = currentNode.content;
|
|
53
|
-
}
|
|
54
|
-
var newNode = nodeType.create(attrs, content);
|
|
55
|
-
|
|
56
|
-
// Add new node.
|
|
57
|
-
tr = tr.setSelection(new _state.NodeSelection(tr.doc.resolve(start + 1))).replaceSelectionWith(newNode).setSelection(new _state.TextSelection(tr.doc.resolve(start + depth)));
|
|
58
|
-
return tr;
|
|
59
|
-
};
|
|
60
|
-
exports.insertBlock = insertBlock;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export const insertBlock = (state, nodeType, nodeName, start, end, attrs) => {
|
|
4
|
-
// To ensure that match is done after HardBreak.
|
|
5
|
-
const {
|
|
6
|
-
hardBreak,
|
|
7
|
-
codeBlock,
|
|
8
|
-
listItem
|
|
9
|
-
} = state.schema.nodes;
|
|
10
|
-
const $pos = state.doc.resolve(start);
|
|
11
|
-
if ($pos.nodeAfter.type !== hardBreak) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// To ensure no nesting is done. (unless we're inserting a codeBlock inside lists)
|
|
16
|
-
if ($pos.depth > 1 && !(nodeType === codeBlock && hasParentNodeOfType(listItem)(state.selection))) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Split at the start of autoformatting and delete formatting characters.
|
|
21
|
-
let tr = state.tr.delete(start, end).split(start);
|
|
22
|
-
let currentNode = tr.doc.nodeAt(start + 1);
|
|
23
|
-
|
|
24
|
-
// If node has more content split at the end of autoformatting.
|
|
25
|
-
let nodeHasMoreContent = false;
|
|
26
|
-
tr.doc.nodesBetween(start, start + currentNode.nodeSize, (node, pos) => {
|
|
27
|
-
if (!nodeHasMoreContent && node.type === hardBreak) {
|
|
28
|
-
nodeHasMoreContent = true;
|
|
29
|
-
tr = tr.split(pos + 1).delete(pos, pos + 1);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
if (nodeHasMoreContent) {
|
|
33
|
-
currentNode = tr.doc.nodeAt(start + 1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Create new node and fill with content of current node.
|
|
37
|
-
const {
|
|
38
|
-
blockquote,
|
|
39
|
-
paragraph
|
|
40
|
-
} = state.schema.nodes;
|
|
41
|
-
let content;
|
|
42
|
-
let depth;
|
|
43
|
-
if (nodeType === blockquote) {
|
|
44
|
-
depth = 3;
|
|
45
|
-
content = [paragraph.create({}, currentNode.content)];
|
|
46
|
-
} else {
|
|
47
|
-
depth = 2;
|
|
48
|
-
content = currentNode.content;
|
|
49
|
-
}
|
|
50
|
-
const newNode = nodeType.create(attrs, content);
|
|
51
|
-
|
|
52
|
-
// Add new node.
|
|
53
|
-
tr = tr.setSelection(new NodeSelection(tr.doc.resolve(start + 1))).replaceSelectionWith(newNode).setSelection(new TextSelection(tr.doc.resolve(start + depth)));
|
|
54
|
-
return tr;
|
|
55
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export var insertBlock = function insertBlock(state, nodeType, nodeName, start, end, attrs) {
|
|
4
|
-
// To ensure that match is done after HardBreak.
|
|
5
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
6
|
-
hardBreak = _state$schema$nodes.hardBreak,
|
|
7
|
-
codeBlock = _state$schema$nodes.codeBlock,
|
|
8
|
-
listItem = _state$schema$nodes.listItem;
|
|
9
|
-
var $pos = state.doc.resolve(start);
|
|
10
|
-
if ($pos.nodeAfter.type !== hardBreak) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// To ensure no nesting is done. (unless we're inserting a codeBlock inside lists)
|
|
15
|
-
if ($pos.depth > 1 && !(nodeType === codeBlock && hasParentNodeOfType(listItem)(state.selection))) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Split at the start of autoformatting and delete formatting characters.
|
|
20
|
-
var tr = state.tr.delete(start, end).split(start);
|
|
21
|
-
var currentNode = tr.doc.nodeAt(start + 1);
|
|
22
|
-
|
|
23
|
-
// If node has more content split at the end of autoformatting.
|
|
24
|
-
var nodeHasMoreContent = false;
|
|
25
|
-
tr.doc.nodesBetween(start, start + currentNode.nodeSize, function (node, pos) {
|
|
26
|
-
if (!nodeHasMoreContent && node.type === hardBreak) {
|
|
27
|
-
nodeHasMoreContent = true;
|
|
28
|
-
tr = tr.split(pos + 1).delete(pos, pos + 1);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (nodeHasMoreContent) {
|
|
32
|
-
currentNode = tr.doc.nodeAt(start + 1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Create new node and fill with content of current node.
|
|
36
|
-
var _state$schema$nodes2 = state.schema.nodes,
|
|
37
|
-
blockquote = _state$schema$nodes2.blockquote,
|
|
38
|
-
paragraph = _state$schema$nodes2.paragraph;
|
|
39
|
-
var content;
|
|
40
|
-
var depth;
|
|
41
|
-
if (nodeType === blockquote) {
|
|
42
|
-
depth = 3;
|
|
43
|
-
content = [paragraph.create({}, currentNode.content)];
|
|
44
|
-
} else {
|
|
45
|
-
depth = 2;
|
|
46
|
-
content = currentNode.content;
|
|
47
|
-
}
|
|
48
|
-
var newNode = nodeType.create(attrs, content);
|
|
49
|
-
|
|
50
|
-
// Add new node.
|
|
51
|
-
tr = tr.setSelection(new NodeSelection(tr.doc.resolve(start + 1))).replaceSelectionWith(newNode).setSelection(new TextSelection(tr.doc.resolve(start + depth)));
|
|
52
|
-
return tr;
|
|
53
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export declare const insertBlock: (state: EditorState, nodeType: NodeType, nodeName: string, start: number, end: number, attrs?: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
} | undefined) => Transaction | null;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
export declare const insertBlock: (state: EditorState, nodeType: NodeType, nodeName: string, start: number, end: number, attrs?: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
} | undefined) => Transaction | null;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types-ts4.5/plugins/{block-type/commands → code-block}/transform-to-code-block.d.ts
RENAMED
|
File without changes
|