@atlaskit/editor-core 187.19.0 → 187.20.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 +20 -0
- package/dist/cjs/plugins/emoji/commands/insert-emoji.js +21 -20
- package/dist/cjs/plugins/emoji/index.js +16 -5
- package/dist/cjs/plugins/index.js +2 -2
- package/dist/cjs/plugins/insert-block/index.js +3 -7
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
- package/dist/cjs/plugins/media/index.js +4 -3
- package/dist/cjs/plugins/media/pm-plugins/alt-text/commands.js +10 -7
- package/dist/cjs/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +22 -10
- package/dist/cjs/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/cjs/plugins/media/toolbar/index.js +33 -19
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +15 -3
- package/dist/cjs/plugins/media/utils/media-single.js +13 -13
- package/dist/cjs/plugins/paste/handlers.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/cjs/plugins/selection/gap-cursor/utils/place-gap-cursor.js +3 -3
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +6 -3
- package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +3 -3
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +3 -2
- package/dist/cjs/utils/document.js +6 -24
- package/dist/cjs/utils/index.js +33 -105
- package/dist/cjs/utils/prosemirror/position.js +33 -41
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/emoji/commands/insert-emoji.js +24 -20
- package/dist/es2019/plugins/emoji/index.js +14 -4
- package/dist/es2019/plugins/index.js +1 -1
- package/dist/es2019/plugins/insert-block/index.js +3 -7
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +6 -3
- package/dist/es2019/plugins/media/index.js +6 -3
- package/dist/es2019/plugins/media/pm-plugins/alt-text/commands.js +3 -2
- package/dist/es2019/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/main.js +16 -7
- package/dist/es2019/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/es2019/plugins/media/toolbar/index.js +34 -21
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +17 -4
- package/dist/es2019/plugins/media/utils/media-single.js +7 -8
- package/dist/es2019/plugins/paste/handlers.js +2 -3
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/selection/gap-cursor/styles.js +2 -1
- package/dist/es2019/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +5 -2
- package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +3 -2
- package/dist/es2019/utils/document.js +1 -20
- package/dist/es2019/utils/index.js +1 -99
- package/dist/es2019/utils/prosemirror/position.js +1 -51
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/emoji/commands/insert-emoji.js +21 -20
- package/dist/esm/plugins/emoji/index.js +14 -4
- package/dist/esm/plugins/index.js +1 -1
- package/dist/esm/plugins/insert-block/index.js +3 -7
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
- package/dist/esm/plugins/media/index.js +4 -3
- package/dist/esm/plugins/media/pm-plugins/alt-text/commands.js +10 -7
- package/dist/esm/plugins/media/pm-plugins/alt-text/keymap.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/main.js +18 -7
- package/dist/esm/plugins/media/toolbar/alt-text.js +2 -2
- package/dist/esm/plugins/media/toolbar/index.js +35 -21
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +16 -4
- package/dist/esm/plugins/media/utils/media-single.js +7 -7
- package/dist/esm/plugins/paste/handlers.js +2 -3
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/selection/gap-cursor/styles.js +1 -1
- package/dist/esm/plugins/selection/gap-cursor/utils/place-gap-cursor.js +4 -4
- package/dist/esm/plugins/selection/gap-cursor/utils.js +5 -2
- package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +4 -4
- package/dist/esm/plugins/text-color/commands/toggle-color.js +3 -2
- package/dist/esm/utils/document.js +1 -22
- package/dist/esm/utils/index.js +1 -97
- package/dist/esm/utils/prosemirror/position.js +1 -39
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +32 -32
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types/plugins/emoji/index.d.ts +9 -4
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/insert-block/index.d.ts +3 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/media/pm-plugins/types.d.ts +2 -0
- package/dist/types/plugins/media/toolbar/alt-text.d.ts +2 -1
- package/dist/types/plugins/media/toolbar/index.d.ts +1 -2
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -0
- package/dist/types/plugins/media/utils/media-single.d.ts +3 -3
- package/dist/types/plugins/paste/handlers.d.ts +2 -1
- package/dist/types/plugins/paste/index.d.ts +3 -1
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types/plugins/selection/gap-cursor/utils.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/document.d.ts +2 -7
- package/dist/types/utils/index.d.ts +2 -6
- package/dist/types/utils/prosemirror/position.d.ts +1 -8
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +32 -32
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +9 -4
- package/dist/types-ts4.5/plugins/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +3 -0
- package/dist/types-ts4.5/plugins/media/pm-plugins/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +1 -2
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +3 -3
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -1
- package/dist/types-ts4.5/plugins/paste/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -1
- package/dist/types-ts4.5/plugins/selection/gap-cursor/utils.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/document.d.ts +2 -7
- package/dist/types-ts4.5/utils/index.d.ts +2 -6
- package/dist/types-ts4.5/utils/prosemirror/position.d.ts +1 -8
- package/package.json +4 -4
- package/report.api.md +5 -0
- package/tmp/api-report-tmp.d.ts +5 -1
|
@@ -16,8 +16,7 @@ var _utils3 = require("@atlaskit/editor-common/utils");
|
|
|
16
16
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
17
17
|
var _mediaCommon = require("../utils/media-common");
|
|
18
18
|
var _slice = require("../../../utils/slice");
|
|
19
|
-
var _analytics = require("
|
|
20
|
-
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
19
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
20
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
22
21
|
var _isImage = require("./is-image");
|
|
23
22
|
var _position = require("../../../utils/prosemirror/position");
|
|
@@ -27,15 +26,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
27
26
|
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) { (0, _defineProperty2.default)(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; }
|
|
28
27
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
29
28
|
return {
|
|
30
|
-
action:
|
|
31
|
-
actionSubject:
|
|
32
|
-
actionSubjectId:
|
|
29
|
+
action: _analytics.ACTION.INSERTED,
|
|
30
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
31
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
|
|
33
32
|
attributes: {
|
|
34
33
|
inputMethod: inputMethod,
|
|
35
34
|
fileExtension: fileExtension,
|
|
36
|
-
type:
|
|
35
|
+
type: _analytics.ACTION_SUBJECT_ID.MEDIA_SINGLE
|
|
37
36
|
},
|
|
38
|
-
eventType:
|
|
37
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
function shouldAddParagraph(state) {
|
|
@@ -43,6 +42,7 @@ function shouldAddParagraph(state) {
|
|
|
43
42
|
}
|
|
44
43
|
function insertNodesWithOptionalParagraph(nodes) {
|
|
45
44
|
var analyticsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
45
|
+
var editorAnalyticsAPI = arguments.length > 2 ? arguments[2] : undefined;
|
|
46
46
|
return function (state, dispatch) {
|
|
47
47
|
var tr = state.tr,
|
|
48
48
|
schema = state.schema;
|
|
@@ -56,7 +56,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
56
56
|
}
|
|
57
57
|
tr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
|
|
58
58
|
if (inputMethod) {
|
|
59
|
-
|
|
59
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
60
60
|
}
|
|
61
61
|
if (dispatch) {
|
|
62
62
|
dispatch(tr);
|
|
@@ -68,7 +68,7 @@ var isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
|
68
68
|
return !!schema.nodes.mediaSingle && (0, _isImage.isImage)(fileMimeType);
|
|
69
69
|
};
|
|
70
70
|
exports.isMediaSingle = isMediaSingle;
|
|
71
|
-
var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod) {
|
|
71
|
+
var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI) {
|
|
72
72
|
var state = view.state,
|
|
73
73
|
dispatch = view.dispatch;
|
|
74
74
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -88,10 +88,10 @@ var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inp
|
|
|
88
88
|
inputMethod: inputMethod,
|
|
89
89
|
fileExtension: node.attrs.__fileMimeType
|
|
90
90
|
};
|
|
91
|
-
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes)(state, dispatch);
|
|
91
|
+
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI)(state, dispatch);
|
|
92
92
|
};
|
|
93
93
|
exports.insertMediaAsMediaSingle = insertMediaAsMediaSingle;
|
|
94
|
-
var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, newInsertionBehaviour, widthPluginState) {
|
|
94
|
+
var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, newInsertionBehaviour, widthPluginState, editorAnalyticsAPI) {
|
|
95
95
|
var _state$selection$$fro;
|
|
96
96
|
if (collection === undefined) {
|
|
97
97
|
return false;
|
|
@@ -122,7 +122,7 @@ var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inp
|
|
|
122
122
|
insertNodesWithOptionalParagraph([node], {
|
|
123
123
|
fileExtension: fileExtension,
|
|
124
124
|
inputMethod: inputMethod
|
|
125
|
-
})(state, dispatch);
|
|
125
|
+
}, editorAnalyticsAPI)(state, dispatch);
|
|
126
126
|
} else {
|
|
127
127
|
var tr = null;
|
|
128
128
|
if (newInsertionBehaviour) {
|
|
@@ -133,7 +133,7 @@ var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inp
|
|
|
133
133
|
tr = (0, _utils.safeInsert)(content, undefined, true)(state.tr);
|
|
134
134
|
}
|
|
135
135
|
if (inputMethod) {
|
|
136
|
-
|
|
136
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
137
137
|
}
|
|
138
138
|
dispatch(tr);
|
|
139
139
|
}
|
|
@@ -544,12 +544,12 @@ function isOnlyMediaSingle(state, slice) {
|
|
|
544
544
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
545
545
|
return mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle;
|
|
546
546
|
}
|
|
547
|
-
function handleMediaSingle(inputMethod) {
|
|
547
|
+
function handleMediaSingle(inputMethod, editorAnalyticsAPI) {
|
|
548
548
|
return function (slice) {
|
|
549
549
|
return function (state, dispatch, view) {
|
|
550
550
|
if (view) {
|
|
551
551
|
if (isOnlyMedia(state, slice)) {
|
|
552
|
-
return (0, _mediaSingle.insertMediaAsMediaSingle)(view, slice.content.firstChild, inputMethod);
|
|
552
|
+
return (0, _mediaSingle.insertMediaAsMediaSingle)(view, slice.content.firstChild, inputMethod, editorAnalyticsAPI);
|
|
553
553
|
}
|
|
554
554
|
if ((0, _utils3.insideTable)(state) && isOnlyMediaSingle(state, slice)) {
|
|
555
555
|
var tr = state.tr.replaceSelection(slice);
|
|
@@ -257,10 +257,10 @@ var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(view, e
|
|
|
257
257
|
}))((0, _handlers.handleCodeBlock)(text));
|
|
258
258
|
};
|
|
259
259
|
exports.handleCodeBlockWithAnalytics = handleCodeBlockWithAnalytics;
|
|
260
|
-
var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type) {
|
|
260
|
+
var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type, editorAnalyticsAPI) {
|
|
261
261
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
262
262
|
type: type
|
|
263
|
-
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD)(slice));
|
|
263
|
+
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI)(slice));
|
|
264
264
|
};
|
|
265
265
|
exports.handleMediaSingleWithAnalytics = handleMediaSingleWithAnalytics;
|
|
266
266
|
var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
@@ -112,7 +112,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
115
|
-
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3;
|
|
115
|
+
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
|
|
116
116
|
var event = rawEvent;
|
|
117
117
|
if (!event.clipboardData) {
|
|
118
118
|
return false;
|
|
@@ -276,7 +276,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
276
276
|
if ((0, _analytics.handleCodeBlockWithAnalytics)(view, event, slice, text)(state, dispatch)) {
|
|
277
277
|
return true;
|
|
278
278
|
}
|
|
279
|
-
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText)(state, dispatch, view)) {
|
|
279
|
+
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.analytics) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions)(state, dispatch, view)) {
|
|
280
280
|
return true;
|
|
281
281
|
}
|
|
282
282
|
if ((0, _analytics.handleSelectedTableWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
@@ -309,7 +309,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
309
309
|
|
|
310
310
|
// finally, handle rich-text copy-paste
|
|
311
311
|
if (isRichText) {
|
|
312
|
-
var _pluginInjectionApi$
|
|
312
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7;
|
|
313
313
|
// linkify the text where possible
|
|
314
314
|
slice = (0, _utils.linkifyContent)(state.schema)(slice);
|
|
315
315
|
if ((0, _analytics.handlePasteLinkOnSelectedTextWithAnalytics)(view, event, slice, _analytics2.PasteTypes.richText)(state, dispatch)) {
|
|
@@ -317,7 +317,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// run macro autoconvert prior to other conversions
|
|
320
|
-
if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
320
|
+
if ((0, _handlers.handleMacroAutoConvert)(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : (_pluginInjectionApi$d7 = _pluginInjectionApi$d6.actions) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : _pluginInjectionApi$d7.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
321
321
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
322
322
|
(0, _analytics.sendPasteAnalyticsEvent)(view, event, slice, {
|
|
323
323
|
type: _analytics2.PasteTypes.richText
|
|
@@ -15,5 +15,5 @@ var gapCursor = '.ProseMirror-gapcursor';
|
|
|
15
15
|
var prosemirrorwidget = '.ProseMirror-widget';
|
|
16
16
|
var wrapLeft = '[layout="wrap-left"]';
|
|
17
17
|
var wrapRight = '[layout="wrap-right"]';
|
|
18
|
-
var gapCursorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /* =============== GAP CURSOR ================== */\n .ProseMirror {\n &.", " {\n caret-color: transparent;\n }\n\n ", " {\n display: none;\n pointer-events: none;\n position: relative;\n\n & span {\n caret-color: transparent;\n position: absolute;\n height: 100%;\n width: 100%;\n display: block;\n }\n\n & span::after {\n animation: 1s ", " step-end infinite;\n border-left: 1px solid;\n content: '';\n display: block;\n position: absolute;\n top: 0;\n height: 100%;\n }\n &.-left span::after {\n left: -3px;\n }\n &.-right span::after {\n right: -3px;\n }\n & span[layout='full-width'],\n & span[layout='wide'] {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n &", " {\n float: right;\n }\n\n /* fix vertical alignment of gap cursor */\n &:first-of-type + ul,\n &:first-of-type + span + ul,\n &:first-of-type + ol,\n &:first-of-type + span + ol,\n &:first-of-type + pre,\n &:first-of-type + span + pre,\n &:first-of-type + blockquote,\n &:first-of-type + span + blockquote {\n margin-top: 0;\n }\n }\n &.ProseMirror-focused ", " {\n display: block;\n border-color: transparent;\n }\n }\n\n /* This hack below is for two images aligned side by side */\n ", "", " + span + ", ",\n ", "", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " {\n clear: none;\n }\n\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div {\n margin-right: 0;\n margin-left: 0;\n margin-bottom: 0;\n }\n\n ", " + ", ",\n ", " + ", " {\n float: left;\n }\n\n ", " + ", " + span + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after {\n visibility: hidden;\n display: block;\n font-size: 0;\n content: ' ';\n clear: both;\n height: 0;\n }\n\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + *,\n ", " + ", " + span + * {\n margin-top: 0;\n }\n"])), hideCaretModifier, gapCursor, gapCursorBlink, wrapRight, gapCursor, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, wrapLeft, gapCursor, wrapRight, gapCursor, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, prosemirrorwidget, gapCursor, prosemirrorwidget, gapCursor);
|
|
18
|
+
var gapCursorStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /* =============== GAP CURSOR ================== */\n .ProseMirror {\n &.", " {\n caret-color: transparent;\n }\n\n ", " {\n display: none;\n pointer-events: none;\n position: relative;\n\n & span {\n caret-color: transparent;\n position: absolute;\n height: 100%;\n width: 100%;\n display: block;\n }\n\n & span::after {\n animation: 1s ", " step-end infinite;\n border-left: 1px solid;\n content: '';\n display: block;\n position: absolute;\n top: 0;\n height: 100%;\n }\n &.-left span::after {\n left: -3px;\n }\n &.-right span::after {\n right: -3px;\n }\n & span[layout='full-width'],\n & span[layout='wide'],\n & span[layout='fixed-width'] {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n &", " {\n float: right;\n }\n\n /* fix vertical alignment of gap cursor */\n &:first-of-type + ul,\n &:first-of-type + span + ul,\n &:first-of-type + ol,\n &:first-of-type + span + ol,\n &:first-of-type + pre,\n &:first-of-type + span + pre,\n &:first-of-type + blockquote,\n &:first-of-type + span + blockquote {\n margin-top: 0;\n }\n }\n &.ProseMirror-focused ", " {\n display: block;\n border-color: transparent;\n }\n }\n\n /* This hack below is for two images aligned side by side */\n ", "", " + span + ", ",\n ", "", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " + ", ",\n ", " + ", " + span ", ",\n ", " + ", " + ", ",\n ", " + ", " + span + ", ",\n ", " + ", " {\n clear: none;\n }\n\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div,\n ", " + ", " + ", " > div,\n ", " + ", " + span + ", " > div {\n margin-right: 0;\n margin-left: 0;\n margin-bottom: 0;\n }\n\n ", " + ", ",\n ", " + ", " {\n float: left;\n }\n\n ", " + ", " + span + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after,\n ", " + ", " + ", "::after,\n ", " + ", " + span + ", "::after {\n visibility: hidden;\n display: block;\n font-size: 0;\n content: ' ';\n clear: both;\n height: 0;\n }\n\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + ", " + *,\n ", " + ", " + ", " + span + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + span + ", " + *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + ", " + * > *,\n ", " + ", " + ", " + span + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + span + ", " + * > *,\n ", " + ", " + *,\n ", " + ", " + span + * {\n margin-top: 0;\n }\n"])), hideCaretModifier, gapCursor, gapCursorBlink, wrapRight, gapCursor, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapRight, wrapLeft, gapCursor, wrapRight, gapCursor, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, wrapRight, gapCursor, wrapLeft, wrapLeft, gapCursor, wrapRight, wrapRight, gapCursor, wrapLeft, gapCursor, wrapLeft, wrapRight, gapCursor, wrapRight, wrapLeft, prosemirrorwidget, gapCursor, prosemirrorwidget, gapCursor);
|
|
19
19
|
exports.gapCursorStyles = gapCursorStyles;
|
|
@@ -85,9 +85,9 @@ var toDOM = function toDOM(view, getPos) {
|
|
|
85
85
|
if (nodeStart !== 0 || node && node.type.name === 'table') {
|
|
86
86
|
gapCursor.style.marginTop = style.getPropertyValue('margin-top');
|
|
87
87
|
}
|
|
88
|
-
var
|
|
89
|
-
if (
|
|
90
|
-
gapCursor.setAttribute('layout',
|
|
88
|
+
var layoutMode = node && (0, _utils.getLayoutModeFromTargetNode)(node);
|
|
89
|
+
if (layoutMode) {
|
|
90
|
+
gapCursor.setAttribute('layout', layoutMode);
|
|
91
91
|
gapCursor.style.width = "".concat(measureWidth(style), "px");
|
|
92
92
|
} else {
|
|
93
93
|
mutateElementStyle(gapCursor, style, selection.side);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLayoutModeFromTargetNode = getLayoutModeFromTargetNode;
|
|
7
7
|
exports.getMediaNearPos = getMediaNearPos;
|
|
8
8
|
exports.isTextBlockNearPos = exports.isLeftCursor = exports.isIgnoredClick = void 0;
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
@@ -68,7 +68,7 @@ var isTextBlockNearPos = function isTextBlockNearPos(doc, schema, $pos, dir) {
|
|
|
68
68
|
return false;
|
|
69
69
|
};
|
|
70
70
|
exports.isTextBlockNearPos = isTextBlockNearPos;
|
|
71
|
-
function
|
|
71
|
+
function getLayoutModeFromTargetNode(node) {
|
|
72
72
|
var layout;
|
|
73
73
|
if (node.attrs.layout) {
|
|
74
74
|
layout = node.attrs.layout;
|
|
@@ -82,7 +82,10 @@ function getBreakoutModeFromTargetNode(node) {
|
|
|
82
82
|
}
|
|
83
83
|
}).attrs.mode;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
85
|
+
if (node.type.name === 'table' && node.attrs.width) {
|
|
86
|
+
layout = 'fixed-width';
|
|
87
|
+
}
|
|
88
|
+
if (['wide', 'full-width', 'fixed-width'].indexOf(layout) === -1) {
|
|
86
89
|
return '';
|
|
87
90
|
}
|
|
88
91
|
return layout;
|
|
@@ -75,10 +75,10 @@ var plugin = new _safePlugin.SafePlugin({
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
var node = isRightCursor ? $from.nodeBefore : $from.nodeAfter;
|
|
78
|
-
var
|
|
78
|
+
var layoutMode = node && (0, _utils2.getLayoutModeFromTargetNode)(node);
|
|
79
79
|
return _view2.DecorationSet.create(doc, [_view2.Decoration.widget(position, _placeGapCursor.toDOM, {
|
|
80
|
-
key: "".concat(_selection.JSON_ID, "-").concat(side, "-").concat(
|
|
81
|
-
side:
|
|
80
|
+
key: "".concat(_selection.JSON_ID, "-").concat(side, "-").concat(layoutMode),
|
|
81
|
+
side: layoutMode ? -1 : 0
|
|
82
82
|
})]);
|
|
83
83
|
}
|
|
84
84
|
return null;
|
|
@@ -7,6 +7,7 @@ exports.toggleColor = void 0;
|
|
|
7
7
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
8
|
var _main = require("../pm-plugins/main");
|
|
9
9
|
var _disabled = require("../utils/disabled");
|
|
10
|
+
var _preset = require("@atlaskit/editor-common/preset");
|
|
10
11
|
var toggleColor = function toggleColor(color) {
|
|
11
12
|
return function (state, dispatch) {
|
|
12
13
|
var textColor = state.schema.marks.textColor;
|
|
@@ -26,9 +27,9 @@ var toggleColor = function toggleColor(color) {
|
|
|
26
27
|
color: color
|
|
27
28
|
});
|
|
28
29
|
state.tr.scrollIntoView();
|
|
29
|
-
(0, _mark.toggleMark)(textColor, {
|
|
30
|
+
(0, _preset.pluginCommandToPMCommand)((0, _mark.toggleMark)(textColor, {
|
|
30
31
|
color: color
|
|
31
|
-
})(state, dispatch);
|
|
32
|
+
}))(state, dispatch);
|
|
32
33
|
}
|
|
33
34
|
return true;
|
|
34
35
|
};
|
|
@@ -4,7 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "findFarthestParentNode", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _utils.findFarthestParentNode;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
8
13
|
exports.getChangedNodes = getChangedNodes;
|
|
9
14
|
exports.getChangedNodesIn = getChangedNodesIn;
|
|
10
15
|
exports.getChildBreakoutModes = getChildBreakoutModes;
|
|
@@ -65,29 +70,6 @@ function processRawFragmentValue(schema, value, providerFactory, sanitizePrivate
|
|
|
65
70
|
}
|
|
66
71
|
return _model.Fragment.from(adfEntities);
|
|
67
72
|
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Find the farthest node given a condition
|
|
71
|
-
* @param predicate Function to check the node
|
|
72
|
-
*/
|
|
73
|
-
var findFarthestParentNode = function findFarthestParentNode(predicate) {
|
|
74
|
-
return function ($pos) {
|
|
75
|
-
var candidate = null;
|
|
76
|
-
for (var i = $pos.depth; i > 0; i--) {
|
|
77
|
-
var _node = $pos.node(i);
|
|
78
|
-
if (predicate(_node)) {
|
|
79
|
-
candidate = {
|
|
80
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
81
|
-
start: $pos.start(i),
|
|
82
|
-
depth: i,
|
|
83
|
-
node: _node
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return candidate;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
exports.findFarthestParentNode = findFarthestParentNode;
|
|
91
73
|
var isSelectionEndOfParagraph = function isSelectionEndOfParagraph(state) {
|
|
92
74
|
return state.selection.$to.parent.type === state.schema.nodes.paragraph && state.selection.$to.pos === state.doc.resolve(state.selection.$to.pos).end();
|
|
93
75
|
};
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -10,7 +10,12 @@ Object.defineProperty(exports, "SetAttrsStep", {
|
|
|
10
10
|
return _steps.SetAttrsStep;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "checkNodeDown", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _utils2.checkNodeDown;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
14
19
|
exports.compose = compose;
|
|
15
20
|
exports.dedupe = dedupe;
|
|
16
21
|
Object.defineProperty(exports, "findFarthestParentNode", {
|
|
@@ -33,14 +38,31 @@ Object.defineProperty(exports, "insideTable", {
|
|
|
33
38
|
return _coreUtils.insideTable;
|
|
34
39
|
}
|
|
35
40
|
});
|
|
36
|
-
exports
|
|
41
|
+
Object.defineProperty(exports, "insideTableCell", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function get() {
|
|
44
|
+
return _utils2.insideTableCell;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
37
47
|
Object.defineProperty(exports, "isElementInTableCell", {
|
|
38
48
|
enumerable: true,
|
|
39
49
|
get: function get() {
|
|
40
50
|
return _utils2.isElementInTableCell;
|
|
41
51
|
}
|
|
42
52
|
});
|
|
43
|
-
|
|
53
|
+
Object.defineProperty(exports, "isEmptyNode", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function get() {
|
|
56
|
+
return _utils2.isEmptyNode;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "isInListItem", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _utils2.isInListItem;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
exports.isInsideBlockQuote = void 0;
|
|
44
66
|
Object.defineProperty(exports, "isLastItemMediaGroup", {
|
|
45
67
|
enumerable: true,
|
|
46
68
|
get: function get() {
|
|
@@ -72,7 +94,12 @@ Object.defineProperty(exports, "isSelectionEndOfParagraph", {
|
|
|
72
94
|
return _document.isSelectionEndOfParagraph;
|
|
73
95
|
}
|
|
74
96
|
});
|
|
75
|
-
exports
|
|
97
|
+
Object.defineProperty(exports, "isSelectionInsideLastNodeInDocument", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function get() {
|
|
100
|
+
return _utils2.isSelectionInsideLastNodeInDocument;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
76
103
|
exports.isTemporary = void 0;
|
|
77
104
|
Object.defineProperty(exports, "isText", {
|
|
78
105
|
enumerable: true,
|
|
@@ -138,13 +165,13 @@ var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
|
138
165
|
var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
|
|
139
166
|
var _cursor = require("../plugins/fake-text-cursor/cursor");
|
|
140
167
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
141
|
-
var
|
|
168
|
+
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
142
169
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
170
|
+
var _document = require("./document");
|
|
143
171
|
var _mark = require("./mark");
|
|
144
172
|
var _nodes = require("./nodes");
|
|
145
173
|
var _selection = require("./selection");
|
|
146
174
|
var _measureEnum = _interopRequireDefault(require("./performance/measure-enum"));
|
|
147
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
148
175
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
149
176
|
function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
150
177
|
return !mark.type.excludes(markType) && !markType.excludes(mark.type);
|
|
@@ -152,11 +179,6 @@ function isMarkTypeCompatibleWithMark(markType, mark) {
|
|
|
152
179
|
function isMarkTypeAllowedInNode(markType, state) {
|
|
153
180
|
return (0, _commands.toggleMark)(markType)(state);
|
|
154
181
|
}
|
|
155
|
-
function isSelectionInsideLastNodeInDocument(selection) {
|
|
156
|
-
var docNode = selection.$anchor.node(0);
|
|
157
|
-
var rootNode = selection.$anchor.node(1);
|
|
158
|
-
return docNode.lastChild === rootNode;
|
|
159
|
-
}
|
|
160
182
|
function getCursor(selection) {
|
|
161
183
|
return selection.$cursor || undefined;
|
|
162
184
|
}
|
|
@@ -204,36 +226,6 @@ function isMarkTypeAllowedInCurrentSelection(markType, state) {
|
|
|
204
226
|
return allowedInActiveMarks;
|
|
205
227
|
});
|
|
206
228
|
}
|
|
207
|
-
function checkNodeDown(selection, doc, filter) {
|
|
208
|
-
var ancestorDepth = findAncestorPosition(doc, selection.$to).depth;
|
|
209
|
-
|
|
210
|
-
// Top level node
|
|
211
|
-
if (ancestorDepth === 0) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
var res = doc.resolve(selection.$to.after(ancestorDepth));
|
|
215
|
-
return res.nodeAfter ? filter(res.nodeAfter) : false;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Traverse the document until an "ancestor" is found. Any nestable block can be an ancestor.
|
|
220
|
-
*/
|
|
221
|
-
function findAncestorPosition(doc, pos) {
|
|
222
|
-
var nestableBlocks = ['blockquote', 'bulletList', 'orderedList'];
|
|
223
|
-
if (pos.depth === 1) {
|
|
224
|
-
return pos;
|
|
225
|
-
}
|
|
226
|
-
var node = pos.node(pos.depth);
|
|
227
|
-
var newPos = pos;
|
|
228
|
-
while (pos.depth >= 1) {
|
|
229
|
-
pos = doc.resolve(pos.before(pos.depth));
|
|
230
|
-
node = pos.node(pos.depth);
|
|
231
|
-
if (node && nestableBlocks.indexOf(node.type.name) !== -1) {
|
|
232
|
-
newPos = pos;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return newPos;
|
|
236
|
-
}
|
|
237
229
|
var transformer = new _editorJsonTransformer.JSONTransformer();
|
|
238
230
|
function toJSON(node) {
|
|
239
231
|
return transformer.encode(node);
|
|
@@ -280,70 +272,6 @@ var isTemporary = function isTemporary(id) {
|
|
|
280
272
|
return id.indexOf('temporary:') === 0;
|
|
281
273
|
};
|
|
282
274
|
exports.isTemporary = isTemporary;
|
|
283
|
-
var isEmptyNode = function isEmptyNode(schema) {
|
|
284
|
-
var _schema$nodes = schema.nodes,
|
|
285
|
-
doc = _schema$nodes.doc,
|
|
286
|
-
paragraph = _schema$nodes.paragraph,
|
|
287
|
-
codeBlock = _schema$nodes.codeBlock,
|
|
288
|
-
blockquote = _schema$nodes.blockquote,
|
|
289
|
-
panel = _schema$nodes.panel,
|
|
290
|
-
heading = _schema$nodes.heading,
|
|
291
|
-
listItem = _schema$nodes.listItem,
|
|
292
|
-
bulletList = _schema$nodes.bulletList,
|
|
293
|
-
orderedList = _schema$nodes.orderedList,
|
|
294
|
-
taskList = _schema$nodes.taskList,
|
|
295
|
-
taskItem = _schema$nodes.taskItem,
|
|
296
|
-
decisionList = _schema$nodes.decisionList,
|
|
297
|
-
decisionItem = _schema$nodes.decisionItem,
|
|
298
|
-
media = _schema$nodes.media,
|
|
299
|
-
mediaGroup = _schema$nodes.mediaGroup,
|
|
300
|
-
mediaSingle = _schema$nodes.mediaSingle;
|
|
301
|
-
var innerIsEmptyNode = function innerIsEmptyNode(node) {
|
|
302
|
-
switch (node.type) {
|
|
303
|
-
case media:
|
|
304
|
-
case mediaGroup:
|
|
305
|
-
case mediaSingle:
|
|
306
|
-
return false;
|
|
307
|
-
case paragraph:
|
|
308
|
-
case codeBlock:
|
|
309
|
-
case heading:
|
|
310
|
-
case taskItem:
|
|
311
|
-
case decisionItem:
|
|
312
|
-
return node.content.size === 0;
|
|
313
|
-
case blockquote:
|
|
314
|
-
case panel:
|
|
315
|
-
case listItem:
|
|
316
|
-
return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
|
|
317
|
-
case bulletList:
|
|
318
|
-
case orderedList:
|
|
319
|
-
return node.content.size === 4 && innerIsEmptyNode(node.content.firstChild);
|
|
320
|
-
case taskList:
|
|
321
|
-
case decisionList:
|
|
322
|
-
return node.content.size === 2 && innerIsEmptyNode(node.content.firstChild);
|
|
323
|
-
case doc:
|
|
324
|
-
var isEmpty = true;
|
|
325
|
-
node.content.forEach(function (child) {
|
|
326
|
-
isEmpty = isEmpty && innerIsEmptyNode(child);
|
|
327
|
-
});
|
|
328
|
-
return isEmpty;
|
|
329
|
-
default:
|
|
330
|
-
return (0, _document.isNodeEmpty)(node);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
return innerIsEmptyNode;
|
|
334
|
-
};
|
|
335
|
-
exports.isEmptyNode = isEmptyNode;
|
|
336
|
-
var insideTableCell = function insideTableCell(state) {
|
|
337
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
338
|
-
tableCell = _state$schema$nodes.tableCell,
|
|
339
|
-
tableHeader = _state$schema$nodes.tableHeader;
|
|
340
|
-
return (0, _utils.hasParentNodeOfType)([tableCell, tableHeader])(state.selection);
|
|
341
|
-
};
|
|
342
|
-
exports.insideTableCell = insideTableCell;
|
|
343
|
-
var isInListItem = function isInListItem(state) {
|
|
344
|
-
return (0, _utils.hasParentNodeOfType)(state.schema.nodes.listItem)(state.selection);
|
|
345
|
-
};
|
|
346
|
-
exports.isInListItem = isInListItem;
|
|
347
275
|
var hasOpenEnd = function hasOpenEnd(slice) {
|
|
348
276
|
return slice.openStart > 0 || slice.openEnd > 0;
|
|
349
277
|
};
|
|
@@ -3,48 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.endPositionOfParent = endPositionOfParent;
|
|
11
|
-
exports.startPositionOfParent = startPositionOfParent;
|
|
12
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
-
var _selection = require("../../plugins/selection/gap-cursor/selection");
|
|
14
|
-
function atTheEndOfDoc(state) {
|
|
15
|
-
var selection = state.selection,
|
|
16
|
-
doc = state.doc;
|
|
17
|
-
return doc.nodeSize - selection.$to.pos - 2 === selection.$to.depth;
|
|
18
|
-
}
|
|
19
|
-
function atTheBeginningOfDoc(state) {
|
|
20
|
-
var selection = state.selection;
|
|
21
|
-
return selection.$from.pos === selection.$from.depth;
|
|
22
|
-
}
|
|
23
|
-
function atTheEndOfBlock(state) {
|
|
24
|
-
var selection = state.selection;
|
|
25
|
-
var $to = selection.$to;
|
|
26
|
-
if (selection instanceof _selection.GapCursorSelection) {
|
|
27
|
-
return false;
|
|
6
|
+
Object.defineProperty(exports, "atTheBeginningOfBlock", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _selection.atTheBeginningOfBlock;
|
|
28
10
|
}
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "atTheBeginningOfDoc", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _selection.atTheBeginningOfDoc;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "atTheEndOfBlock", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _selection.atTheEndOfBlock;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "atTheEndOfDoc", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _selection.atTheEndOfDoc;
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (selection instanceof _selection.GapCursorSelection) {
|
|
38
|
-
return false;
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "endPositionOfParent", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _selection.endPositionOfParent;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "startPositionOfParent", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _selection.startPositionOfParent;
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
function startPositionOfParent(resolvedPos) {
|
|
46
|
-
return resolvedPos.start(resolvedPos.depth);
|
|
47
|
-
}
|
|
48
|
-
function endPositionOfParent(resolvedPos) {
|
|
49
|
-
return resolvedPos.end(resolvedPos.depth) + 1;
|
|
50
|
-
}
|
|
41
|
+
});
|
|
42
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.20.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED