@atlaskit/editor-core 188.12.1 → 188.12.3
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 +13 -0
- package/dist/cjs/create-editor/sort-by-order.js +13 -20
- package/dist/cjs/plugins/annotation/utils.js +23 -43
- package/dist/cjs/plugins/code-block/utils.js +18 -43
- package/dist/cjs/plugins/paste/handlers.js +36 -18
- package/dist/cjs/plugins/paste/plugins/media.js +50 -24
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +6 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +53 -51
- package/dist/cjs/plugins/paste/util/index.js +2 -2
- package/dist/cjs/plugins/rank.js +2 -27
- package/dist/cjs/plugins/tasks-and-decisions/utils.js +8 -12
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/sort-by-order.js +1 -17
- package/dist/es2019/plugins/annotation/utils.js +6 -43
- package/dist/es2019/plugins/code-block/utils.js +1 -44
- package/dist/es2019/plugins/paste/handlers.js +18 -3
- package/dist/es2019/plugins/paste/plugins/media.js +53 -25
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +3 -3
- package/dist/es2019/plugins/paste/pm-plugins/main.js +11 -13
- package/dist/es2019/plugins/paste/util/index.js +1 -1
- package/dist/es2019/plugins/rank.js +2 -27
- package/dist/es2019/plugins/tasks-and-decisions/utils.js +2 -12
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/sort-by-order.js +1 -17
- package/dist/esm/plugins/annotation/utils.js +8 -37
- package/dist/esm/plugins/code-block/utils.js +1 -42
- package/dist/esm/plugins/paste/handlers.js +23 -3
- package/dist/esm/plugins/paste/plugins/media.js +50 -23
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +3 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +11 -13
- package/dist/esm/plugins/paste/util/index.js +1 -1
- package/dist/esm/plugins/rank.js +2 -27
- package/dist/esm/plugins/tasks-and-decisions/utils.js +2 -12
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/sort-by-order.d.ts +1 -14
- package/dist/types/plugins/annotation/utils.d.ts +3 -3
- package/dist/types/plugins/code-block/utils.d.ts +1 -6
- package/dist/types/plugins/paste/handlers.d.ts +2 -2
- package/dist/types/plugins/paste/plugins/media.d.ts +11 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -2
- package/dist/types/plugins/rank.d.ts +2 -6
- package/dist/types/plugins/tasks-and-decisions/utils.d.ts +2 -3
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/create-editor/sort-by-order.d.ts +1 -14
- package/dist/types-ts4.5/plugins/annotation/utils.d.ts +3 -3
- package/dist/types-ts4.5/plugins/code-block/utils.d.ts +1 -6
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -2
- package/dist/types-ts4.5/plugins/paste/plugins/media.d.ts +11 -0
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +1 -1
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/plugins/rank.d.ts +2 -6
- package/dist/types-ts4.5/plugins/tasks-and-decisions/utils.d.ts +2 -3
- 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/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
1
|
+
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, PasteTypes, PasteContents } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { addAnalytics } from '../../analytics';
|
|
2
3
|
import { getPasteSource } from '../util';
|
|
3
4
|
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
4
5
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { mapSlice } from '
|
|
6
|
-
import { getLinkDomain } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
7
7
|
const contentToPasteContent = {
|
|
8
8
|
url: PasteContents.url,
|
|
9
9
|
paragraph: PasteContents.text,
|
|
@@ -3,27 +3,24 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
5
5
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
6
|
-
import { mapChildren } from '
|
|
6
|
+
import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren, measureRender } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
7
8
|
import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
9
|
+
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { md, isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
|
|
11
|
+
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
|
|
10
12
|
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
11
|
-
import {
|
|
12
|
-
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
13
|
+
import { transformSliceNestedExpandToExpand, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
13
14
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
14
|
-
import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
|
|
15
15
|
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
16
|
-
|
|
16
|
+
// TODO: ED-20519 It requires full analytics extraction to use the plugin injection API
|
|
17
|
+
import { analyticsPluginKey } from '../../analytics';
|
|
17
18
|
import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
|
|
18
|
-
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { upgradeTextToLists, splitParagraphs } from '../commands';
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
import { containsAnyAnnotations, stripNonExistingAnnotations } from '../../annotation/utils';
|
|
20
|
+
// TODO: ED-20519 It requires annotation extraction to use the plugin injection API
|
|
21
|
+
import { stripNonExistingAnnotations } from '../../annotation/utils';
|
|
23
22
|
import { clipboardTextSerializer } from './clipboard-text-serializer';
|
|
24
23
|
import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMCEConfluence } from '../util/tinyMCE';
|
|
25
|
-
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
26
|
-
import { extractSliceFromStep } from '../../../utils/step';
|
|
27
24
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
28
25
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
29
26
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -365,6 +362,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
365
362
|
}
|
|
366
363
|
slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
|
|
367
364
|
slice = transformSliceToCorrectMediaWrapper(slice, schema);
|
|
365
|
+
slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
|
|
368
366
|
slice = transformSliceToDecisionList(slice, schema);
|
|
369
367
|
|
|
370
368
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -4,7 +4,7 @@ import { ACTION_SUBJECT, addAnalytics, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION }
|
|
|
4
4
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { sortByOrderWithTypeName } from '
|
|
7
|
+
import { sortByOrderWithTypeName } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
8
8
|
import { isSupportedInParent, mapChildren } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export function isPastedFromWord(html) {
|
|
10
10
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Needs to be before indentation to handle tab into input field
|
|
4
|
-
'dateKeymap',
|
|
5
|
-
// This should be always after `typeAheadKeymap` & `emojiKeymap`
|
|
6
|
-
'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap',
|
|
7
|
-
// task/decisions keymap needs to be above table keymap so can indent actions in a table
|
|
8
|
-
'tasksAndDecisionsKeyMap',
|
|
9
|
-
// expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
|
|
10
|
-
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
|
|
11
|
-
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap',
|
|
12
|
-
// media keymap above selection keymap to allow navigating past the mediaSingle node
|
|
13
|
-
'mediaKeymap',
|
|
14
|
-
// selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
15
|
-
// left/right arrows
|
|
16
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
17
|
-
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
18
|
-
marks: [
|
|
19
|
-
// Fragment mark is both for inline and block elements
|
|
20
|
-
'fragment',
|
|
21
|
-
// Inline marks
|
|
22
|
-
'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
|
|
23
|
-
// Block marks
|
|
24
|
-
'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
|
|
25
|
-
// Unsupported mark
|
|
26
|
-
'unsupportedMark', 'unsupportedNodeAttribute']
|
|
27
|
-
};
|
|
1
|
+
import { rankEditorPlugins } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
2
|
+
export default rankEditorPlugins;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// additional newline from being pasted along with the selected decision item.
|
|
6
|
-
export const transformSliceToDecisionList = (slice, schema) => {
|
|
7
|
-
const node = slice.content.firstChild;
|
|
8
|
-
if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
|
|
9
|
-
const decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
|
|
10
|
-
return new Slice(Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
|
|
11
|
-
}
|
|
12
|
-
return slice;
|
|
13
|
-
};
|
|
2
|
+
import { transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
3
|
+
export { transformSliceToDecisionList };
|
|
14
4
|
function isTaskListNode(node) {
|
|
15
5
|
return Boolean(node && node.type && 'taskList' === node.type.name);
|
|
16
6
|
}
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export function sortByOrder(item) {
|
|
3
|
-
return function (a, b) {
|
|
4
|
-
return Ranks[item].indexOf(a.name) - Ranks[item].indexOf(b.name);
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// while functionally the same, in order to avoid potentially rewriting the ~10
|
|
9
|
-
// existing implementations of the above function I decided creating a separate
|
|
10
|
-
// function avoided that whole mess. If someone can think of a better way to implement
|
|
11
|
-
// the above and below into a single function please do so
|
|
12
|
-
|
|
13
|
-
export function sortByOrderWithTypeName(item) {
|
|
14
|
-
return function (a, b) {
|
|
15
|
-
return Ranks[item].indexOf(a.type.name) - Ranks[item].indexOf(b.type.name);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
1
|
+
export { sortByOrder, sortByOrderWithTypeName } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { PluginKey, TextSelection, AllSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
4
|
-
import { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { canApplyAnnotationOnRange, getAnnotationIdsFromRange, isText, isParagraph, hasAnnotationMark, containsAnyAnnotations } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
6
6
|
import { AnnotationSelectionType } from './types';
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
export { hasAnnotationMark, containsAnyAnnotations };
|
|
9
|
+
function sum(arr, f) {
|
|
10
|
+
return arr.reduce(function (val, x) {
|
|
11
|
+
return val + f(x);
|
|
12
|
+
}, 0);
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* Finds the marks in the nodes to the left and right.
|
|
11
16
|
* @param $pos Position to center search around
|
|
@@ -285,14 +290,6 @@ export function hasInvalidWhitespaceNode(selection, schema) {
|
|
|
285
290
|
return foundInvalidWhitespace;
|
|
286
291
|
}
|
|
287
292
|
|
|
288
|
-
/*
|
|
289
|
-
* verifies if node contains annotation mark
|
|
290
|
-
*/
|
|
291
|
-
export function hasAnnotationMark(node, state) {
|
|
292
|
-
var annotationMark = state.schema.marks.annotation;
|
|
293
|
-
return !!(annotationMark && node && node.marks.length && annotationMark.isInSet(node.marks));
|
|
294
|
-
}
|
|
295
|
-
|
|
296
293
|
/*
|
|
297
294
|
* verifies that the annotation exists by the given id
|
|
298
295
|
*/
|
|
@@ -301,32 +298,6 @@ export function annotationExists(annotationId, state) {
|
|
|
301
298
|
return !!(commentsPluginState !== null && commentsPluginState !== void 0 && commentsPluginState.annotations) && Object.keys(commentsPluginState.annotations).includes(annotationId);
|
|
302
299
|
}
|
|
303
300
|
|
|
304
|
-
/*
|
|
305
|
-
* verifies that slice contains any annotations
|
|
306
|
-
*/
|
|
307
|
-
export function containsAnyAnnotations(slice, state) {
|
|
308
|
-
if (!slice.content.size) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
var hasAnnotation = false;
|
|
312
|
-
slice.content.forEach(function (node) {
|
|
313
|
-
hasAnnotation = hasAnnotation || hasAnnotationMark(node, state);
|
|
314
|
-
// return early if annotation found already
|
|
315
|
-
if (hasAnnotation) {
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
|
-
// check annotations in descendants
|
|
319
|
-
node.descendants(function (node) {
|
|
320
|
-
if (hasAnnotationMark(node, state)) {
|
|
321
|
-
hasAnnotation = true;
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
return true;
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
return hasAnnotation;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
301
|
/*
|
|
331
302
|
* remove annotations that dont exsist in plugin state from slice
|
|
332
303
|
*/
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { mapSlice } from '../../utils/slice';
|
|
3
|
-
import { findSelectedNodeOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
function joinCodeBlocks(left, right) {
|
|
5
|
-
var textContext = "".concat(left.textContent, "\n").concat(right.textContent);
|
|
6
|
-
return left.type.create(left.attrs, left.type.schema.text(textContext));
|
|
7
|
-
}
|
|
8
|
-
function mergeAdjacentCodeBlocks(fragment) {
|
|
9
|
-
var children = [];
|
|
10
|
-
fragment.forEach(function (maybeCodeBlock) {
|
|
11
|
-
if (maybeCodeBlock.type === maybeCodeBlock.type.schema.nodes.codeBlock) {
|
|
12
|
-
var peekAtPrevious = children[children.length - 1];
|
|
13
|
-
if (peekAtPrevious && peekAtPrevious.type === maybeCodeBlock.type) {
|
|
14
|
-
return children.push(joinCodeBlocks(children.pop(), maybeCodeBlock));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return children.push(maybeCodeBlock);
|
|
18
|
-
});
|
|
19
|
-
return Fragment.from(children);
|
|
20
|
-
}
|
|
21
|
-
export function transformSliceToJoinAdjacentCodeBlocks(slice) {
|
|
22
|
-
slice = mapSlice(slice, function (node) {
|
|
23
|
-
return node.isBlock && !node.isTextblock ? node.copy(mergeAdjacentCodeBlocks(node.content)) : node;
|
|
24
|
-
});
|
|
25
|
-
// mapSlice won't be able to merge adjacent top-level code-blocks
|
|
26
|
-
return new Slice(mergeAdjacentCodeBlocks(slice.content), slice.openStart, slice.openEnd);
|
|
27
|
-
}
|
|
28
|
-
export var transformSingleLineCodeBlockToCodeMark = function transformSingleLineCodeBlockToCodeMark(slice, schema) {
|
|
29
|
-
if (slice.content.childCount === 1 && (slice.openStart || slice.openEnd)) {
|
|
30
|
-
var maybeCodeBlock = slice.content.firstChild;
|
|
31
|
-
if (maybeCodeBlock && maybeCodeBlock.type === schema.nodes.codeBlock) {
|
|
32
|
-
if (maybeCodeBlock.textContent && maybeCodeBlock.textContent.indexOf('\n') === -1) {
|
|
33
|
-
return new Slice(Fragment.from(schema.text(maybeCodeBlock.textContent, [schema.marks.code.create()])), 0, 0);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return slice;
|
|
38
|
-
};
|
|
39
|
-
export var findCodeBlock = function findCodeBlock(state, selection) {
|
|
40
|
-
var codeBlock = state.schema.nodes.codeBlock;
|
|
41
|
-
return findSelectedNodeOfType(codeBlock)(selection || state.selection) || findParentNodeOfType(codeBlock)(selection || state.selection);
|
|
42
|
-
};
|
|
1
|
+
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
|
|
@@ -12,17 +12,37 @@ import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state
|
|
|
12
12
|
import { canInsert, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import uuid from 'uuid/v4';
|
|
14
14
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
|
|
16
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
17
17
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
18
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
19
|
+
// TODO: ED-20519 Needs Macro extraction
|
|
19
20
|
import { runMacroAutoConvert } from '../macro';
|
|
20
21
|
import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
|
|
21
|
-
import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
22
22
|
import { insertSliceForLists } from './edge-cases';
|
|
23
23
|
import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
|
|
24
24
|
import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
|
|
25
25
|
import { anyMarkActive } from '@atlaskit/editor-common/mark';
|
|
26
|
+
|
|
27
|
+
/** Helper type for single arg function */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Compose 1 to n functions.
|
|
31
|
+
* @param func first function
|
|
32
|
+
* @param funcs additional functions
|
|
33
|
+
*/
|
|
34
|
+
function compose(func) {
|
|
35
|
+
for (var _len = arguments.length, funcs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
36
|
+
funcs[_key - 1] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
var allFuncs = [func].concat(funcs);
|
|
39
|
+
return function composed(raw) {
|
|
40
|
+
return allFuncs.reduceRight(function (memo, func) {
|
|
41
|
+
return func(memo);
|
|
42
|
+
}, raw);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
26
46
|
// remove text attribute from mention for copy/paste (GDPR)
|
|
27
47
|
export function handleMention(slice, schema) {
|
|
28
48
|
return mapSlice(slice, function (node) {
|
|
@@ -5,6 +5,13 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { mapSlice, unwrap, removeNestedEmptyEls, walkUpTreeUntil } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
8
|
+
import { DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Ensure correct layout in nested mode
|
|
12
|
+
*
|
|
13
|
+
* TODO: this func is only used in handlePaste, so layout update won't work for drop event
|
|
14
|
+
*/
|
|
8
15
|
export function transformSliceForMedia(slice, schema) {
|
|
9
16
|
var _schema$nodes = schema.nodes,
|
|
10
17
|
mediaSingle = _schema$nodes.mediaSingle,
|
|
@@ -12,8 +19,6 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
12
19
|
table = _schema$nodes.table,
|
|
13
20
|
bulletList = _schema$nodes.bulletList,
|
|
14
21
|
orderedList = _schema$nodes.orderedList,
|
|
15
|
-
media = _schema$nodes.media,
|
|
16
|
-
mediaInline = _schema$nodes.mediaInline,
|
|
17
22
|
expand = _schema$nodes.expand,
|
|
18
23
|
nestedExpand = _schema$nodes.nestedExpand;
|
|
19
24
|
return function (selection) {
|
|
@@ -40,27 +45,6 @@ export function transformSliceForMedia(slice, schema) {
|
|
|
40
45
|
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
|
-
var __mediaTraceId = getRandomHex(8);
|
|
44
|
-
newSlice = mapSlice(newSlice, function (node) {
|
|
45
|
-
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
46
|
-
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
47
|
-
// sharing dependencies with editor-core to support products using it with various versions
|
|
48
|
-
// of editor packages.
|
|
49
|
-
// The duplication is in the following file:
|
|
50
|
-
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
51
|
-
if (node.type.name === 'media') {
|
|
52
|
-
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
53
|
-
__external: node.attrs.type === 'external',
|
|
54
|
-
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
55
|
-
}), node.content, node.marks);
|
|
56
|
-
}
|
|
57
|
-
if (node.type.name === 'mediaInline') {
|
|
58
|
-
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
59
|
-
__mediaTraceId: __mediaTraceId
|
|
60
|
-
}), node.content, node.marks);
|
|
61
|
-
}
|
|
62
|
-
return node;
|
|
63
|
-
});
|
|
64
48
|
return newSlice;
|
|
65
49
|
};
|
|
66
50
|
}
|
|
@@ -86,6 +70,49 @@ export var transformSliceToCorrectMediaWrapper = function transformSliceToCorrec
|
|
|
86
70
|
});
|
|
87
71
|
};
|
|
88
72
|
|
|
73
|
+
/**
|
|
74
|
+
* This func will be called when copy & paste, drag & drop external html with media, media files, and slices from editor
|
|
75
|
+
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export var transformSliceToMediaSingleWithNewExperience = function transformSliceToMediaSingleWithNewExperience(slice, schema) {
|
|
79
|
+
var _schema$nodes3 = schema.nodes,
|
|
80
|
+
mediaInline = _schema$nodes3.mediaInline,
|
|
81
|
+
mediaSingle = _schema$nodes3.mediaSingle,
|
|
82
|
+
media = _schema$nodes3.media;
|
|
83
|
+
var newSlice = mapSlice(slice, function (node) {
|
|
84
|
+
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
85
|
+
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
86
|
+
// sharing dependencies with editor-core to support products using it with various versions
|
|
87
|
+
// of editor packages.
|
|
88
|
+
// The duplication is in the following file:
|
|
89
|
+
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
90
|
+
if (node.type === mediaSingle) {
|
|
91
|
+
return getBooleanFF('platform.editor.media.extended-resize-experience') ? mediaSingle.createChecked({
|
|
92
|
+
width: node.attrs.width || DEFAULT_IMAGE_WIDTH,
|
|
93
|
+
widthType: node.attrs.widthType || 'pixel',
|
|
94
|
+
layout: node.attrs.layout
|
|
95
|
+
}, node.content, node.marks) : node;
|
|
96
|
+
}
|
|
97
|
+
return node;
|
|
98
|
+
});
|
|
99
|
+
return mapSlice(newSlice, function (node) {
|
|
100
|
+
var __mediaTraceId = getRandomHex(8);
|
|
101
|
+
if (node.type === media) {
|
|
102
|
+
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
103
|
+
__external: node.attrs.type === 'external',
|
|
104
|
+
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
105
|
+
}), node.content, node.marks);
|
|
106
|
+
}
|
|
107
|
+
if (node.type.name === 'mediaInline') {
|
|
108
|
+
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
109
|
+
__mediaTraceId: __mediaTraceId
|
|
110
|
+
}), node.content, node.marks);
|
|
111
|
+
}
|
|
112
|
+
return node;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
89
116
|
/**
|
|
90
117
|
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
91
118
|
* @param element
|
|
@@ -2,12 +2,12 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
5
|
+
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, PasteTypes, PasteContents } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { addAnalytics } from '../../analytics';
|
|
6
7
|
import { getPasteSource } from '../util';
|
|
7
8
|
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
8
9
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import { mapSlice } from '
|
|
10
|
-
import { getLinkDomain } from '@atlaskit/editor-common/utils';
|
|
10
|
+
import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
|
|
11
11
|
var contentToPasteContent = {
|
|
12
12
|
url: PasteContents.url,
|
|
13
13
|
paragraph: PasteContents.text,
|
|
@@ -5,27 +5,24 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
5
5
|
import uuid from 'uuid';
|
|
6
6
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
7
7
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
8
|
-
import { mapChildren } from '
|
|
8
|
+
import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren, measureRender } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
9
10
|
import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { ACTION, INPUT_METHOD, PasteTypes } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { md, isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
|
|
13
|
+
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
|
|
12
14
|
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
13
|
-
import {
|
|
14
|
-
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
15
|
+
import { transformSliceNestedExpandToExpand, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
15
16
|
import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from '../handlers';
|
|
16
|
-
import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
|
|
17
17
|
import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics } from './analytics';
|
|
18
|
-
|
|
18
|
+
// TODO: ED-20519 It requires full analytics extraction to use the plugin injection API
|
|
19
|
+
import { analyticsPluginKey } from '../../analytics';
|
|
19
20
|
import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
|
|
20
|
-
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
21
21
|
import { upgradeTextToLists, splitParagraphs } from '../commands';
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
import { containsAnyAnnotations, stripNonExistingAnnotations } from '../../annotation/utils';
|
|
22
|
+
// TODO: ED-20519 It requires annotation extraction to use the plugin injection API
|
|
23
|
+
import { stripNonExistingAnnotations } from '../../annotation/utils';
|
|
25
24
|
import { clipboardTextSerializer } from './clipboard-text-serializer';
|
|
26
25
|
import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMCEConfluence } from '../util/tinyMCE';
|
|
27
|
-
import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
|
|
28
|
-
import { extractSliceFromStep } from '../../../utils/step';
|
|
29
26
|
import { pluginKey as stateKey, createPluginState } from './plugin-factory';
|
|
30
27
|
export { pluginKey as stateKey } from './plugin-factory';
|
|
31
28
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -385,6 +382,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
385
382
|
}
|
|
386
383
|
slice = transformSingleLineCodeBlockToCodeMark(slice, schema);
|
|
387
384
|
slice = transformSliceToCorrectMediaWrapper(slice, schema);
|
|
385
|
+
slice = transformSliceToMediaSingleWithNewExperience(slice, schema);
|
|
388
386
|
slice = transformSliceToDecisionList(slice, schema);
|
|
389
387
|
|
|
390
388
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -5,7 +5,7 @@ import { ACTION_SUBJECT, addAnalytics, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION }
|
|
|
5
5
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { sortByOrderWithTypeName } from '
|
|
8
|
+
import { sortByOrderWithTypeName } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
9
9
|
import { isSupportedInParent, mapChildren } from '@atlaskit/editor-common/utils';
|
|
10
10
|
export function isPastedFromWord(html) {
|
|
11
11
|
return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
|
package/dist/esm/plugins/rank.js
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Needs to be before indentation to handle tab into input field
|
|
4
|
-
'dateKeymap',
|
|
5
|
-
// This should be always after `typeAheadKeymap` & `emojiKeymap`
|
|
6
|
-
'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap',
|
|
7
|
-
// task/decisions keymap needs to be above table keymap so can indent actions in a table
|
|
8
|
-
'tasksAndDecisionsKeyMap',
|
|
9
|
-
// expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
|
|
10
|
-
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
|
|
11
|
-
'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap',
|
|
12
|
-
// media keymap above selection keymap to allow navigating past the mediaSingle node
|
|
13
|
-
'mediaKeymap',
|
|
14
|
-
// selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
15
|
-
// left/right arrows
|
|
16
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
17
|
-
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
18
|
-
marks: [
|
|
19
|
-
// Fragment mark is both for inline and block elements
|
|
20
|
-
'fragment',
|
|
21
|
-
// Inline marks
|
|
22
|
-
'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
|
|
23
|
-
// Block marks
|
|
24
|
-
'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
|
|
25
|
-
// Unsupported mark
|
|
26
|
-
'unsupportedMark', 'unsupportedNodeAttribute']
|
|
27
|
-
};
|
|
1
|
+
import { rankEditorPlugins } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
2
|
+
export default rankEditorPlugins;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// additional newline from being pasted along with the selected decision item.
|
|
6
|
-
export var transformSliceToDecisionList = function transformSliceToDecisionList(slice, schema) {
|
|
7
|
-
var node = slice.content.firstChild;
|
|
8
|
-
if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
|
|
9
|
-
var decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
|
|
10
|
-
return new Slice(Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
|
|
11
|
-
}
|
|
12
|
-
return slice;
|
|
13
|
-
};
|
|
2
|
+
import { transformSliceToDecisionList } from '@atlaskit/editor-common/transforms';
|
|
3
|
+
export { transformSliceToDecisionList };
|
|
14
4
|
function isTaskListNode(node) {
|
|
15
5
|
return Boolean(node && node.type && 'taskList' === node.type.name);
|
|
16
6
|
}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: string;
|
|
3
|
-
}, b: {
|
|
4
|
-
name: string;
|
|
5
|
-
}) => number;
|
|
6
|
-
export declare function sortByOrderWithTypeName(item: 'plugins' | 'nodes' | 'marks'): (a: {
|
|
7
|
-
type: {
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
10
|
-
}, b: {
|
|
11
|
-
type: {
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
}) => number;
|
|
1
|
+
export { sortByOrder, sortByOrderWithTypeName, } from '@atlaskit/editor-common/legacy-rank-plugins';
|
|
@@ -2,11 +2,13 @@ import type { ResolvedPos, Mark, Node, Slice, Schema } from '@atlaskit/editor-pr
|
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { PluginKey, TextSelection, AllSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import { hasAnnotationMark, containsAnyAnnotations } from '@atlaskit/editor-common/utils';
|
|
5
6
|
import type { AnnotationInfo } from './types';
|
|
6
7
|
import { AnnotationSelectionType } from './types';
|
|
7
8
|
import type { InlineCommentPluginState } from './pm-plugins/types';
|
|
8
|
-
import type { INPUT_METHOD } from '../analytics';
|
|
9
9
|
import type { AnalyticsEventPayloadCallback } from '../analytics/utils';
|
|
10
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
+
export { hasAnnotationMark, containsAnyAnnotations };
|
|
10
12
|
/**
|
|
11
13
|
* Finds the marks in the nodes to the left and right.
|
|
12
14
|
* @param $pos Position to center search around
|
|
@@ -34,7 +36,5 @@ export declare const hasInvalidNodes: (state: EditorState) => boolean;
|
|
|
34
36
|
* This is to conform to Confluence annotation specifications
|
|
35
37
|
*/
|
|
36
38
|
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
37
|
-
export declare function hasAnnotationMark(node: Node, state: EditorState): boolean;
|
|
38
39
|
export declare function annotationExists(annotationId: string, state: EditorState): boolean;
|
|
39
|
-
export declare function containsAnyAnnotations(slice: Slice, state: EditorState): boolean;
|
|
40
40
|
export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
export declare function transformSliceToJoinAdjacentCodeBlocks(slice: Slice): Slice;
|
|
5
|
-
export declare const transformSingleLineCodeBlockToCodeMark: (slice: Slice, schema: Schema) => Slice;
|
|
6
|
-
export declare const findCodeBlock: (state: EditorState, selection?: Selection | null) => import("prosemirror-utils/dist/types").FindResult;
|
|
1
|
+
export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, } from '@atlaskit/editor-common/transforms';
|
|
@@ -2,8 +2,8 @@ import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { ExtensionAutoConvertHandler } from '@atlaskit/editor-common/extensions';
|
|
5
|
-
import type { Command } from '
|
|
6
|
-
import type { InputMethodInsertMedia } from '
|
|
5
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
|
+
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { InsertMediaAsMediaSingle } from '@atlaskit/editor-plugin-media/types';
|
|
8
8
|
import type { QueueCardsFromTransactionAction, CardOptions } from '@atlaskit/editor-common/card';
|
|
9
9
|
import type { FindRootParentListNode } from '@atlaskit/editor-plugin-list';
|