@atlaskit/editor-common 74.32.1 → 74.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +23 -7
- package/dist/cjs/guideline/index.js +13 -0
- package/dist/cjs/keymaps/index.js +8 -1
- package/dist/cjs/keymaps/keymap.js +38 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/media-single.js +2 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/index.js +2 -7
- package/dist/cjs/ui/MediaSingle/styled.js +24 -2
- package/dist/cjs/ui/index.js +0 -6
- package/dist/cjs/utils/commands.js +180 -15
- package/dist/cjs/utils/editor-core-utils.js +53 -3
- package/dist/cjs/utils/index.js +54 -0
- package/dist/cjs/utils/input-rules.js +48 -2
- package/dist/cjs/utils/rich-media-utils.js +6 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +23 -8
- package/dist/es2019/guideline/index.js +1 -0
- package/dist/es2019/keymaps/index.js +3 -2
- package/dist/es2019/keymaps/keymap.js +33 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/media-single.js +6 -5
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +1 -4
- package/dist/es2019/ui/MediaSingle/styled.js +45 -2
- package/dist/es2019/ui/index.js +1 -1
- package/dist/es2019/utils/commands.js +173 -2
- package/dist/es2019/utils/editor-core-utils.js +46 -1
- package/dist/es2019/utils/index.js +4 -4
- package/dist/es2019/utils/input-rules.js +45 -0
- package/dist/es2019/utils/rich-media-utils.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +24 -8
- package/dist/esm/guideline/index.js +1 -0
- package/dist/esm/keymaps/index.js +3 -2
- package/dist/esm/keymaps/keymap.js +33 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/media-single.js +2 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/index.js +1 -4
- package/dist/esm/ui/MediaSingle/styled.js +25 -3
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/utils/commands.js +170 -14
- package/dist/esm/utils/editor-core-utils.js +47 -0
- package/dist/esm/utils/index.js +4 -4
- package/dist/esm/utils/input-rules.js +44 -0
- package/dist/esm/utils/rich-media-utils.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types/guideline/index.d.ts +1 -0
- package/dist/types/keymaps/index.d.ts +1 -0
- package/dist/types/keymaps/keymap.d.ts +11 -0
- package/dist/types/types/block-type.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types/utils/commands.d.ts +11 -5
- package/dist/types/utils/editor-core-utils.d.ts +7 -2
- package/dist/types/utils/index.d.ts +4 -4
- package/dist/types/utils/input-rules.d.ts +12 -4
- package/dist/types/utils/rich-media-utils.d.ts +1 -0
- package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/guideline/index.d.ts +1 -0
- package/dist/types-ts4.5/keymaps/index.d.ts +1 -0
- package/dist/types-ts4.5/keymaps/keymap.d.ts +11 -0
- package/dist/types-ts4.5/types/block-type.d.ts +1 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +8 -0
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types-ts4.5/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/commands.d.ts +11 -5
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +7 -2
- package/dist/types-ts4.5/utils/index.d.ts +4 -4
- package/dist/types-ts4.5/utils/input-rules.d.ts +12 -4
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +1 -0
- package/package.json +7 -3
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
5
|
+
import { withAnalytics } from '../editor-analytics';
|
|
3
6
|
import { GapCursorSelection } from '../selection';
|
|
4
7
|
import { isEmptyParagraph } from './editor-core-utils';
|
|
5
|
-
|
|
8
|
+
import { isMediaNode } from './nodes';
|
|
9
|
+
export var filter = function filter(predicates, cmd) {
|
|
6
10
|
return function (state, dispatch, view) {
|
|
7
11
|
if (!Array.isArray(predicates)) {
|
|
8
12
|
predicates = [predicates];
|
|
@@ -54,6 +58,158 @@ export var walkPrevNode = function walkPrevNode($startPos) {
|
|
|
54
58
|
foundNode: $pos.pos > 0
|
|
55
59
|
};
|
|
56
60
|
};
|
|
61
|
+
export function insertNewLine() {
|
|
62
|
+
return function (state, dispatch) {
|
|
63
|
+
var $from = state.selection.$from;
|
|
64
|
+
var parent = $from.parent;
|
|
65
|
+
var hardBreak = state.schema.nodes.hardBreak;
|
|
66
|
+
if (hardBreak) {
|
|
67
|
+
var hardBreakNode = hardBreak.createChecked();
|
|
68
|
+
if (parent && parent.type.validContent(Fragment.from(hardBreakNode))) {
|
|
69
|
+
if (dispatch) {
|
|
70
|
+
dispatch(state.tr.replaceSelectionWith(hardBreakNode, false));
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (state.selection instanceof TextSelection) {
|
|
76
|
+
if (dispatch) {
|
|
77
|
+
dispatch(state.tr.insertText('\n'));
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export var insertNewLineWithAnalytics = function insertNewLineWithAnalytics(editorAnalyticsAPI) {
|
|
85
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
86
|
+
action: ACTION.INSERTED,
|
|
87
|
+
actionSubject: ACTION_SUBJECT.TEXT,
|
|
88
|
+
actionSubjectId: ACTION_SUBJECT_ID.LINE_BREAK,
|
|
89
|
+
eventType: EVENT_TYPE.TRACK
|
|
90
|
+
})(insertNewLine());
|
|
91
|
+
};
|
|
92
|
+
export var createNewParagraphAbove = function createNewParagraphAbove(state, dispatch) {
|
|
93
|
+
var append = false;
|
|
94
|
+
if (!canMoveUp(state) && canCreateParagraphNear(state)) {
|
|
95
|
+
createParagraphNear(append)(state, dispatch);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
};
|
|
100
|
+
export var createNewParagraphBelow = function createNewParagraphBelow(state, dispatch) {
|
|
101
|
+
var append = true;
|
|
102
|
+
if (!canMoveDown(state) && canCreateParagraphNear(state)) {
|
|
103
|
+
createParagraphNear(append)(state, dispatch);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
};
|
|
108
|
+
function canCreateParagraphNear(state) {
|
|
109
|
+
var $from = state.selection.$from;
|
|
110
|
+
var node = $from.node($from.depth);
|
|
111
|
+
var insideCodeBlock = !!node && node.type === state.schema.nodes.codeBlock;
|
|
112
|
+
var isNodeSelection = state.selection instanceof NodeSelection;
|
|
113
|
+
return $from.depth > 1 || isNodeSelection || insideCodeBlock;
|
|
114
|
+
}
|
|
115
|
+
export function createParagraphNear() {
|
|
116
|
+
var append = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
117
|
+
return function (state, dispatch) {
|
|
118
|
+
var paragraph = state.schema.nodes.paragraph;
|
|
119
|
+
if (!paragraph) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
var insertPos;
|
|
123
|
+
if (state.selection instanceof TextSelection) {
|
|
124
|
+
if (topLevelNodeIsEmptyTextBlock(state)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
insertPos = getInsertPosFromTextBlock(state, append);
|
|
128
|
+
} else {
|
|
129
|
+
insertPos = getInsertPosFromNonTextBlock(state, append);
|
|
130
|
+
}
|
|
131
|
+
var tr = state.tr.insert(insertPos, paragraph.createAndFill());
|
|
132
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
133
|
+
if (dispatch) {
|
|
134
|
+
dispatch(tr);
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function getInsertPosFromTextBlock(state, append) {
|
|
140
|
+
var _state$selection = state.selection,
|
|
141
|
+
$from = _state$selection.$from,
|
|
142
|
+
$to = _state$selection.$to;
|
|
143
|
+
var pos;
|
|
144
|
+
if (!append) {
|
|
145
|
+
pos = $from.start(0);
|
|
146
|
+
} else {
|
|
147
|
+
pos = $to.end(0);
|
|
148
|
+
}
|
|
149
|
+
return pos;
|
|
150
|
+
}
|
|
151
|
+
function getInsertPosFromNonTextBlock(state, append) {
|
|
152
|
+
var _state$selection2 = state.selection,
|
|
153
|
+
$from = _state$selection2.$from,
|
|
154
|
+
$to = _state$selection2.$to;
|
|
155
|
+
var nodeAtSelection = state.selection instanceof NodeSelection && state.doc.nodeAt(state.selection.$anchor.pos);
|
|
156
|
+
var isMediaSelection = nodeAtSelection && nodeAtSelection.type.name === 'mediaGroup';
|
|
157
|
+
var pos;
|
|
158
|
+
if (!append) {
|
|
159
|
+
// The start position is different with text block because it starts from 0
|
|
160
|
+
pos = $from.start($from.depth);
|
|
161
|
+
// The depth is different with text block because it starts from 0
|
|
162
|
+
pos = $from.depth > 0 && !isMediaSelection ? pos - 1 : pos;
|
|
163
|
+
} else {
|
|
164
|
+
pos = $to.end($to.depth);
|
|
165
|
+
pos = $to.depth > 0 && !isMediaSelection ? pos + 1 : pos;
|
|
166
|
+
}
|
|
167
|
+
return pos;
|
|
168
|
+
}
|
|
169
|
+
function topLevelNodeIsEmptyTextBlock(state) {
|
|
170
|
+
var topLevelNode = state.selection.$from.node(1);
|
|
171
|
+
return topLevelNode.isTextblock && topLevelNode.type !== state.schema.nodes.codeBlock && topLevelNode.nodeSize === 2;
|
|
172
|
+
}
|
|
173
|
+
function canMoveUp(state) {
|
|
174
|
+
var selection = state.selection;
|
|
175
|
+
/**
|
|
176
|
+
* If there's a media element on the selection it will use a gap cursor to move
|
|
177
|
+
*/
|
|
178
|
+
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
if (selection instanceof TextSelection) {
|
|
182
|
+
if (!selection.empty) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return !atTheBeginningOfDoc(state);
|
|
187
|
+
}
|
|
188
|
+
function canMoveDown(state) {
|
|
189
|
+
var selection = state.selection;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* If there's a media element on the selection it will use a gap cursor to move
|
|
193
|
+
*/
|
|
194
|
+
if (selection instanceof NodeSelection && isMediaNode(selection.node)) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
if (selection instanceof TextSelection) {
|
|
198
|
+
if (!selection.empty) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return !atTheEndOfDoc(state);
|
|
203
|
+
}
|
|
204
|
+
export function atTheEndOfDoc(state) {
|
|
205
|
+
var selection = state.selection,
|
|
206
|
+
doc = state.doc;
|
|
207
|
+
return doc.nodeSize - selection.$to.pos - 2 === selection.$to.depth;
|
|
208
|
+
}
|
|
209
|
+
export function atTheBeginningOfDoc(state) {
|
|
210
|
+
var selection = state.selection;
|
|
211
|
+
return selection.$from.pos === selection.$from.depth;
|
|
212
|
+
}
|
|
57
213
|
|
|
58
214
|
/**
|
|
59
215
|
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
@@ -64,12 +220,12 @@ export var walkPrevNode = function walkPrevNode($startPos) {
|
|
|
64
220
|
*/
|
|
65
221
|
export var deleteEmptyParagraphAndMoveBlockUp = function deleteEmptyParagraphAndMoveBlockUp(canNextNodeMoveUp) {
|
|
66
222
|
return function (state, dispatch, view) {
|
|
67
|
-
var _state$
|
|
68
|
-
_state$
|
|
69
|
-
pos = _state$
|
|
70
|
-
parent = _state$
|
|
71
|
-
$head = _state$
|
|
72
|
-
empty = _state$
|
|
223
|
+
var _state$selection3 = state.selection,
|
|
224
|
+
_state$selection3$$fr = _state$selection3.$from,
|
|
225
|
+
pos = _state$selection3$$fr.pos,
|
|
226
|
+
parent = _state$selection3$$fr.parent,
|
|
227
|
+
$head = _state$selection3.$head,
|
|
228
|
+
empty = _state$selection3.empty,
|
|
73
229
|
tr = state.tr,
|
|
74
230
|
doc = state.doc;
|
|
75
231
|
var _walkNextNode = walkNextNode($head),
|
|
@@ -101,15 +257,15 @@ export var insertContentDeleteRange = function insertContentDeleteRange(tr, getS
|
|
|
101
257
|
tr.setSelection(new TextSelection(getSelectionResolvedPos(tr)));
|
|
102
258
|
};
|
|
103
259
|
export var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
|
|
104
|
-
var _state$
|
|
105
|
-
empty = _state$
|
|
106
|
-
$from = _state$
|
|
260
|
+
var _state$selection4 = state.selection,
|
|
261
|
+
empty = _state$selection4.empty,
|
|
262
|
+
$from = _state$selection4.$from;
|
|
107
263
|
return empty && ($from.parentOffset === 0 || state.selection instanceof GapCursorSelection);
|
|
108
264
|
};
|
|
109
265
|
export var isEmptySelectionAtEnd = function isEmptySelectionAtEnd(state) {
|
|
110
|
-
var _state$
|
|
111
|
-
empty = _state$
|
|
112
|
-
$from = _state$
|
|
266
|
+
var _state$selection5 = state.selection,
|
|
267
|
+
empty = _state$selection5.empty,
|
|
268
|
+
$from = _state$selection5.$from;
|
|
113
269
|
return empty && ($from.end() === $from.pos || state.selection instanceof GapCursorSelection);
|
|
114
270
|
};
|
|
115
271
|
export { filter as filterCommand };
|
|
@@ -83,4 +83,51 @@ export var isValidPosition = function isValidPosition(pos, state) {
|
|
|
83
83
|
};
|
|
84
84
|
export var isInLayoutColumn = function isInLayoutColumn(state) {
|
|
85
85
|
return hasParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
86
|
+
};
|
|
87
|
+
export function filterChildrenBetween(doc, from, to, predicate) {
|
|
88
|
+
var results = [];
|
|
89
|
+
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
90
|
+
if (predicate(node, pos, parent)) {
|
|
91
|
+
results.push({
|
|
92
|
+
node: node,
|
|
93
|
+
pos: pos
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return results;
|
|
98
|
+
}
|
|
99
|
+
export var removeBlockMarks = function removeBlockMarks(state, marks) {
|
|
100
|
+
var selection = state.selection,
|
|
101
|
+
schema = state.schema;
|
|
102
|
+
var tr = state.tr;
|
|
103
|
+
|
|
104
|
+
// Marks might not exist in Schema
|
|
105
|
+
var marksToRemove = marks.filter(Boolean);
|
|
106
|
+
if (marksToRemove.length === 0) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Saves an extra dispatch */
|
|
111
|
+
var blockMarksExists = false;
|
|
112
|
+
var hasMark = function hasMark(mark) {
|
|
113
|
+
return marksToRemove.indexOf(mark.type) > -1;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* When you need to toggle the selection
|
|
117
|
+
* when another type which does not allow alignment is applied
|
|
118
|
+
*/
|
|
119
|
+
state.doc.nodesBetween(selection.from, selection.to, function (node, pos) {
|
|
120
|
+
if (node.type === schema.nodes.paragraph && node.marks.some(hasMark)) {
|
|
121
|
+
blockMarksExists = true;
|
|
122
|
+
var resolvedPos = state.doc.resolve(pos);
|
|
123
|
+
var withoutBlockMarks = node.marks.filter(not(hasMark));
|
|
124
|
+
tr = tr.setNodeMarkup(resolvedPos.pos, undefined, node.attrs, withoutBlockMarks);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return blockMarksExists ? tr : undefined;
|
|
128
|
+
};
|
|
129
|
+
var not = function not(fn) {
|
|
130
|
+
return function (arg) {
|
|
131
|
+
return !fn(arg);
|
|
132
|
+
};
|
|
86
133
|
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { getExtensionLozengeData } from './macro';
|
|
|
3
3
|
export { default as browser } from './browser';
|
|
4
4
|
export { default as ErrorReporter } from './error-reporter';
|
|
5
5
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
6
|
-
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn } from './editor-core-utils';
|
|
6
|
+
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, removeBlockMarks, filterChildrenBetween } from './editor-core-utils';
|
|
7
7
|
export { withImageLoader } from './imageLoader';
|
|
8
8
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, getNextBreakoutMode, getTitle } from './breakout';
|
|
9
9
|
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent, isMediaNode, isNodeBeforeMediaNode } from './nodes';
|
|
@@ -42,10 +42,10 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
42
42
|
export var pmHistoryPluginKey = 'history$';
|
|
43
43
|
export { gridTypeForLayout } from './grid';
|
|
44
44
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent } from './document';
|
|
45
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes } from './rich-media-utils';
|
|
45
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts } from './rich-media-utils';
|
|
46
46
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
47
47
|
export { canRenderDatasource } from './datasource';
|
|
48
|
-
export { filterCommand,
|
|
48
|
+
export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode } from './commands';
|
|
49
49
|
export function shallowEqual() {
|
|
50
50
|
var obj1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
51
|
var obj2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -55,4 +55,4 @@ export function shallowEqual() {
|
|
|
55
55
|
return acc && obj1[key] === obj2[key];
|
|
56
56
|
}, true);
|
|
57
57
|
}
|
|
58
|
-
export { inputRuleWithAnalytics } from './input-rules';
|
|
58
|
+
export { inputRuleWithAnalytics, createWrappingJoinRule, createRule } from './input-rules';
|
|
@@ -1,6 +1,9 @@
|
|
|
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 { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
5
|
+
import { canJoin, findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
+
import { JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
|
|
4
7
|
// Roughly based on atlassian-frontend/packages/editor/editor-core/src/utils/input-rules.ts but with the Editor Analytics API that's injected in plugins
|
|
5
8
|
export var inputRuleWithAnalytics = function inputRuleWithAnalytics(getPayload, analyticsApi) {
|
|
6
9
|
return function (originalRule) {
|
|
@@ -15,4 +18,45 @@ export var inputRuleWithAnalytics = function inputRuleWithAnalytics(getPayload,
|
|
|
15
18
|
onHandlerApply: onHandlerApply
|
|
16
19
|
});
|
|
17
20
|
};
|
|
21
|
+
};
|
|
22
|
+
export var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
|
|
23
|
+
var match = _ref.match,
|
|
24
|
+
nodeType = _ref.nodeType,
|
|
25
|
+
getAttrs = _ref.getAttrs,
|
|
26
|
+
joinPredicate = _ref.joinPredicate;
|
|
27
|
+
var handler = function handler(state, match, start, end) {
|
|
28
|
+
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
29
|
+
var tr = state.tr;
|
|
30
|
+
var fixedStart = Math.max(start, 1);
|
|
31
|
+
tr.delete(fixedStart, end);
|
|
32
|
+
var $start = tr.doc.resolve(fixedStart);
|
|
33
|
+
var range = $start.blockRange();
|
|
34
|
+
var wrapping = range && findWrapping(range, nodeType, attrs);
|
|
35
|
+
if (!wrapping || !range) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
var parentNodePosMapped = tr.mapping.map(range.start);
|
|
39
|
+
var parentNode = tr.doc.nodeAt(parentNodePosMapped);
|
|
40
|
+
var lastWrap = wrapping[wrapping.length - 1];
|
|
41
|
+
if (parentNode && lastWrap) {
|
|
42
|
+
var allowedMarks = lastWrap.type.allowedMarks(parentNode.marks) || [];
|
|
43
|
+
tr.setNodeMarkup(parentNodePosMapped, parentNode.type, parentNode.attrs, allowedMarks);
|
|
44
|
+
}
|
|
45
|
+
tr.wrap(range, wrapping);
|
|
46
|
+
var before = tr.doc.resolve(fixedStart - 1).nodeBefore;
|
|
47
|
+
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))) {
|
|
48
|
+
tr.join(fixedStart - 1);
|
|
49
|
+
}
|
|
50
|
+
return tr;
|
|
51
|
+
};
|
|
52
|
+
return createRule(match, handler);
|
|
53
|
+
};
|
|
54
|
+
export var createRule = function createRule(match, handler) {
|
|
55
|
+
return {
|
|
56
|
+
match: match,
|
|
57
|
+
handler: handler,
|
|
58
|
+
onHandlerApply: function onHandlerApply(_state, tr) {
|
|
59
|
+
closeHistory(tr);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
18
62
|
};
|
|
@@ -3,8 +3,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
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
4
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { shouldAddDefaultWrappedWidth } from '../ui/MediaSingle';
|
|
7
6
|
import { calcPxFromColumns, wrappedLayouts } from '../ui/MediaSingle/grid';
|
|
7
|
+
export var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
|
|
8
|
+
return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
9
|
+
};
|
|
8
10
|
export var nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
9
11
|
export var floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
10
12
|
export var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos) {
|
package/dist/esm/version.json
CHANGED
|
@@ -7,5 +7,5 @@ type WidthPluginType = NextEditorPlugin<'width', {
|
|
|
7
7
|
sharedState: EditorContainerWidth | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
|
|
10
|
-
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
|
|
10
|
+
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean, isChangingLayoutDisabled?: boolean) => FloatingToolbarItem<Command>[];
|
|
11
11
|
export default buildLayoutButtons;
|
|
@@ -4,4 +4,5 @@ export { generateDefaultGuidelines } from './defaultGuideline';
|
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
6
|
export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
|
|
7
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
7
8
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
|
|
@@ -89,3 +89,4 @@ export declare function bindKeymapWithCommand(shortcut: string, cmd: Command, ke
|
|
|
89
89
|
}): void;
|
|
90
90
|
export declare function findKeyMapForBrowser(keyMap: Keymap): string | undefined;
|
|
91
91
|
export { DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from './consts';
|
|
92
|
+
export { keymap } from './keymap';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SafePlugin } from '../safe-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* A workaround for mostly Cyrillic but should have a positive affect
|
|
4
|
+
* on other languages / layouts. Attempts a similar approach to OS X.
|
|
5
|
+
* @see ED-7310
|
|
6
|
+
* @see https://github.com/ProseMirror/prosemirror/issues/957
|
|
7
|
+
* @param bindings
|
|
8
|
+
*/
|
|
9
|
+
export declare function keymap(bindings: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}): SafePlugin<any>;
|
|
@@ -416,6 +416,14 @@ export type FeatureFlags = {
|
|
|
416
416
|
* @default false
|
|
417
417
|
*/
|
|
418
418
|
useFragmentMarkBreakoutWidthStylingFix?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* @description
|
|
421
|
+
* Enable the new editor media resize experience.
|
|
422
|
+
*
|
|
423
|
+
* @see https://product-fabric.atlassian.net/browse/ED-18316
|
|
424
|
+
* @default false
|
|
425
|
+
*/
|
|
426
|
+
extendedMediaResizeExperience?: boolean | undefined;
|
|
419
427
|
};
|
|
420
428
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
421
429
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -39,6 +39,6 @@ export type { SnapPointsProps } from './resizable-media-single';
|
|
|
39
39
|
export type { BreakoutMode } from './breakout';
|
|
40
40
|
export type { DatasourceModalType } from './datasource';
|
|
41
41
|
export type { ImageUploadPluginReferenceEventBase, ImageUploadPluginReferenceEventDragEvent, ImageUploadPluginReferenceEventClipboardEvent, ImageUploadPluginReferenceEvent, } from './image-upload-reference-event';
|
|
42
|
-
export type { HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
|
|
42
|
+
export type { AllowedBlockTypes, HeadingLevels, NormalTextLevel, HeadingLevelsAndNormalText, } from './block-type';
|
|
43
43
|
export type { ColumnResizingPluginState } from './tables';
|
|
44
44
|
export type { InputRuleHandler, OnHandlerApply, InputRuleWrapper, } from './input-rules';
|
|
@@ -16,5 +16,5 @@ export type OpenChangedEvent = {
|
|
|
16
16
|
isOpen: boolean;
|
|
17
17
|
event: MouseEvent | KeyboardEvent;
|
|
18
18
|
};
|
|
19
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "
|
|
19
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "testId" | "position" | "analyticsContext" | "shouldFitContainer" | "trigger" | "isOpen" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
|
|
20
20
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { RichMediaLayout as MediaSingleLayout
|
|
4
|
+
import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
5
|
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
6
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
7
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -27,6 +27,5 @@ export interface Props {
|
|
|
27
27
|
hasFallbackContainer?: boolean;
|
|
28
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
29
29
|
}
|
|
30
|
-
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
31
30
|
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
31
|
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -31,12 +31,14 @@ export interface MediaSingleWrapperProps {
|
|
|
31
31
|
mediaSingleWidth?: number;
|
|
32
32
|
width?: number;
|
|
33
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
34
|
+
isExtendedResizeExperienceOn?: boolean;
|
|
35
|
+
isNestedNode?: boolean;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
37
39
|
* supporting `styled-components` v1.
|
|
38
40
|
*/
|
|
39
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
41
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
40
42
|
export interface MediaWrapperProps {
|
|
41
43
|
paddingBottom?: string;
|
|
42
44
|
height?: number;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT,
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, } from './MediaSingle';
|
|
3
3
|
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fragment, Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import {
|
|
4
|
-
import type { Command } from '../types';
|
|
3
|
+
import { EditorAnalyticsAPI } from '../analytics';
|
|
4
|
+
import type { Command, Predicate } from '../types';
|
|
5
5
|
export type WalkNode = {
|
|
6
6
|
$pos: ResolvedPos;
|
|
7
7
|
foundNode: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
|
|
9
|
+
export declare const filter: (predicates: Predicate[] | Predicate, cmd: Command) => Command;
|
|
11
10
|
/**
|
|
12
11
|
* Walk forwards from a position until we encounter the (inside) start of
|
|
13
12
|
* the next node, or reach the end of the document.
|
|
@@ -22,6 +21,13 @@ export declare const walkNextNode: ($startPos: ResolvedPos) => WalkNode;
|
|
|
22
21
|
* @param $startPos Position to start walking from.
|
|
23
22
|
*/
|
|
24
23
|
export declare const walkPrevNode: ($startPos: ResolvedPos) => WalkNode;
|
|
24
|
+
export declare function insertNewLine(): Command;
|
|
25
|
+
export declare const insertNewLineWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
26
|
+
export declare const createNewParagraphAbove: Command;
|
|
27
|
+
export declare const createNewParagraphBelow: Command;
|
|
28
|
+
export declare function createParagraphNear(append?: boolean): Command;
|
|
29
|
+
export declare function atTheEndOfDoc(state: EditorState): boolean;
|
|
30
|
+
export declare function atTheBeginningOfDoc(state: EditorState): boolean;
|
|
25
31
|
/**
|
|
26
32
|
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
27
33
|
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node, NodeType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import { MarkType, Node, NodeType, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { EditorState, Selection, TextSelection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
/**
|
|
@@ -27,3 +27,8 @@ export declare function setTextSelection(view: EditorView, anchor: number, head?
|
|
|
27
27
|
export declare function nonNullable<T>(value: T): value is NonNullable<T>;
|
|
28
28
|
export declare const isValidPosition: (pos: number | undefined, state: EditorState) => boolean;
|
|
29
29
|
export declare const isInLayoutColumn: (state: EditorState) => boolean;
|
|
30
|
+
export declare function filterChildrenBetween(doc: Node, from: number, to: number, predicate: (node: Node, pos: number, parent: Node | null) => boolean | undefined): {
|
|
31
|
+
node: Node;
|
|
32
|
+
pos: number;
|
|
33
|
+
}[];
|
|
34
|
+
export declare const removeBlockMarks: (state: EditorState, marks: Array<MarkType | undefined>) => Transaction | undefined;
|
|
@@ -6,7 +6,7 @@ export { default as ErrorReporter } from './error-reporter';
|
|
|
6
6
|
export type { ErrorReportingHandler } from './error-reporter';
|
|
7
7
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC, } from './date';
|
|
8
8
|
export type { Date } from './date';
|
|
9
|
-
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, } from './editor-core-utils';
|
|
9
|
+
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition, isEmptyParagraph, isInLayoutColumn, removeBlockMarks, filterChildrenBetween, } from './editor-core-utils';
|
|
10
10
|
export { withImageLoader } from './imageLoader';
|
|
11
11
|
export type { ImageLoaderProps, ImageLoaderState, ImageStatus, } from './imageLoader';
|
|
12
12
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx, getNextBreakoutMode, getTitle, } from './breakout';
|
|
@@ -52,10 +52,10 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
52
52
|
export declare const pmHistoryPluginKey = "history$";
|
|
53
53
|
export { gridTypeForLayout } from './grid';
|
|
54
54
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, } from './document';
|
|
55
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
|
|
55
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
|
|
56
56
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
57
57
|
export { canRenderDatasource } from './datasource';
|
|
58
|
-
export { filterCommand,
|
|
58
|
+
export { filterCommand, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, createParagraphNear, walkNextNode, walkPrevNode, } from './commands';
|
|
59
59
|
export type { WalkNode } from './commands';
|
|
60
60
|
export declare function shallowEqual(obj1?: any, obj2?: any): boolean;
|
|
61
|
-
export { inputRuleWithAnalytics } from './input-rules';
|
|
61
|
+
export { inputRuleWithAnalytics, createWrappingJoinRule, createRule, } from './input-rules';
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
1
|
+
import type { NodeType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type AnalyticsEventPayload, type EditorAnalyticsAPI, JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST } from '../analytics';
|
|
4
|
+
import { InputRuleHandler, InputRuleWrapper } from '../types';
|
|
5
5
|
type GetPayload = AnalyticsEventPayload | ((state: EditorState, matchResult: RegExpExecArray) => AnalyticsEventPayload);
|
|
6
6
|
export declare const inputRuleWithAnalytics: (getPayload: GetPayload, analyticsApi: EditorAnalyticsAPI | undefined) => (originalRule: InputRuleWrapper) => InputRuleWrapper;
|
|
7
|
+
type WrappingRuleProps = {
|
|
8
|
+
match: RegExp;
|
|
9
|
+
nodeType: NodeType;
|
|
10
|
+
getAttrs?: Record<string, any> | ((matchResult: RegExpExecArray) => Record<string, any>);
|
|
11
|
+
joinPredicate?: (matchResult: RegExpExecArray, node: PMNode, joinScenario: JOIN_SCENARIOS_WHEN_TYPING_TO_INSERT_LIST) => boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const createWrappingJoinRule: ({ match, nodeType, getAttrs, joinPredicate, }: WrappingRuleProps) => InputRuleWrapper;
|
|
14
|
+
export declare const createRule: (match: RegExp, handler: InputRuleHandler) => InputRuleWrapper;
|
|
7
15
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { SnapPointsProps } from '../types';
|
|
4
|
+
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
4
5
|
export declare const nonWrappedLayouts: RichMediaLayout[];
|
|
5
6
|
export declare const floatingLayouts: string[];
|
|
6
7
|
export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
|
|
@@ -7,5 +7,5 @@ type WidthPluginType = NextEditorPlugin<'width', {
|
|
|
7
7
|
sharedState: EditorContainerWidth | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
|
|
10
|
-
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
|
|
10
|
+
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean, isChangingLayoutDisabled?: boolean) => FloatingToolbarItem<Command>[];
|
|
11
11
|
export default buildLayoutButtons;
|
|
@@ -4,4 +4,5 @@ export { generateDefaultGuidelines } from './defaultGuideline';
|
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
6
|
export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
|
|
7
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
7
8
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
|
|
@@ -89,3 +89,4 @@ export declare function bindKeymapWithCommand(shortcut: string, cmd: Command, ke
|
|
|
89
89
|
}): void;
|
|
90
90
|
export declare function findKeyMapForBrowser(keyMap: Keymap): string | undefined;
|
|
91
91
|
export { DOWN, HEADING_KEYS, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, LEFT, RIGHT, UP, } from './consts';
|
|
92
|
+
export { keymap } from './keymap';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SafePlugin } from '../safe-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* A workaround for mostly Cyrillic but should have a positive affect
|
|
4
|
+
* on other languages / layouts. Attempts a similar approach to OS X.
|
|
5
|
+
* @see ED-7310
|
|
6
|
+
* @see https://github.com/ProseMirror/prosemirror/issues/957
|
|
7
|
+
* @param bindings
|
|
8
|
+
*/
|
|
9
|
+
export declare function keymap(bindings: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}): SafePlugin<any>;
|