@atlaskit/editor-core 185.2.0 → 185.2.2
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 +7 -0
- package/dist/cjs/actions/index.js +2 -2
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -2
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/cjs/messages.js +6 -56
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +2 -2
- package/dist/cjs/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +2 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/card/pm-plugins/doc.js +9 -11
- package/dist/cjs/plugins/card/pm-plugins/keymap.js +3 -6
- package/dist/cjs/plugins/card/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/card/toolbar.js +12 -15
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -6
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +7 -10
- package/dist/cjs/plugins/card/utils.js +3 -4
- package/dist/cjs/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/cjs/plugins/custom-autoformat/doc.js +1 -1
- package/dist/cjs/plugins/date/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/emoji/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -1
- package/dist/cjs/plugins/hyperlink/Toolbar.js +8 -8
- package/dist/cjs/plugins/hyperlink/commands.js +2 -3
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/cjs/plugins/layout/actions.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -2
- package/dist/cjs/plugins/media/toolbar/index.js +9 -8
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +4 -3
- package/dist/cjs/plugins/media/toolbar/linking.js +3 -3
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +6 -8
- package/dist/cjs/plugins/media/utils/media-files.js +8 -7
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/placeholder/index.js +2 -3
- package/dist/cjs/plugins/status/plugin.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +3 -3
- package/dist/cjs/ui/LinkSearch/ToolbarComponents.js +4 -11
- package/dist/cjs/utils/document.js +7 -249
- package/dist/cjs/utils/index.js +1 -23
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +2 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/es2019/messages.js +2 -54
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/es2019/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/card/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/card/toolbar.js +7 -9
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/es2019/plugins/card/utils.js +1 -2
- package/dist/es2019/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/es2019/plugins/custom-autoformat/doc.js +1 -1
- package/dist/es2019/plugins/date/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/emoji/index.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
- package/dist/es2019/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/es2019/plugins/hyperlink/commands.js +1 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/es2019/plugins/layout/actions.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/toolbar/index.js +9 -8
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/es2019/plugins/media/toolbar/linking.js +1 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/es2019/plugins/media/utils/media-files.js +4 -3
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/placeholder/index.js +1 -1
- package/dist/es2019/plugins/status/plugin.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/es2019/utils/document.js +3 -244
- package/dist/es2019/utils/index.js +1 -4
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +2 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/internal/hooks/use-editor/create-editor.js +1 -1
- package/dist/esm/messages.js +2 -54
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/scroll-gutter.js +1 -1
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +2 -3
- package/dist/esm/plugins/card/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/card/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/card/toolbar.js +7 -9
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +3 -4
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +1 -4
- package/dist/esm/plugins/card/utils.js +1 -2
- package/dist/esm/plugins/clear-marks-on-change-to-empty-document/index.js +1 -1
- package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
- package/dist/esm/plugins/date/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/emoji/index.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -1
- package/dist/esm/plugins/hyperlink/Toolbar.js +3 -3
- package/dist/esm/plugins/hyperlink/commands.js +1 -2
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +1 -1
- package/dist/esm/plugins/layout/actions.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/toolbar/index.js +9 -8
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +2 -1
- package/dist/esm/plugins/media/toolbar/linking.js +1 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -4
- package/dist/esm/plugins/media/utils/media-files.js +4 -3
- package/dist/esm/plugins/mentions/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/placeholder/index.js +1 -1
- package/dist/esm/plugins/status/plugin.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/ui/LinkSearch/ToolbarComponents.js +1 -4
- package/dist/esm/utils/document.js +6 -240
- package/dist/esm/utils/index.js +1 -4
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types/labs/next/presets/default.d.ts +1 -1
- package/dist/types/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types/messages.d.ts +2 -53
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/plugins/card/toolbar.d.ts +1 -1
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types/utils/document.d.ts +0 -12
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +3 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +3 -3
- package/dist/types-ts4.5/messages.d.ts +2 -53
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +3 -3
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types-ts4.5/plugins/date/nodeviews/date.d.ts +1 -1
- package/dist/types-ts4.5/plugins/emoji/nodeviews/emoji.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +2 -3
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +0 -15
- package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +1 -1
- package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +1 -1
- package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types-ts4.5/plugins/unsupported-content/unsupported-inline-node-view.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/LinkSearch/ToolbarComponents.d.ts +0 -4
- package/dist/types-ts4.5/utils/document.d.ts +0 -12
- package/dist/types-ts4.5/utils/index.d.ts +1 -2
- package/package.json +4 -5
- package/report.api.md +9 -34
- package/tmp/api-report-tmp.d.ts +7 -33
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.js +0 -227
- package/dist/cjs/plugins/hyperlink/types.js +0 -5
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +0 -152
- package/dist/cjs/ui/Resizer/index.js +0 -210
- package/dist/cjs/ui/Resizer/styled.js +0 -15
- package/dist/cjs/ui/Resizer/types.js +0 -5
- package/dist/cjs/ui/Resizer/utils.js +0 -21
- package/dist/cjs/utils/filter/privacy-filter.js +0 -55
- package/dist/cjs/utils/linking-utils.js +0 -84
- package/dist/cjs/utils/rich-media-utils.js +0 -130
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.js +0 -221
- package/dist/es2019/plugins/hyperlink/types.js +0 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +0 -159
- package/dist/es2019/ui/Resizer/index.js +0 -191
- package/dist/es2019/ui/Resizer/styled.js +0 -15
- package/dist/es2019/ui/Resizer/types.js +0 -1
- package/dist/es2019/ui/Resizer/utils.js +0 -12
- package/dist/es2019/utils/filter/privacy-filter.js +0 -47
- package/dist/es2019/utils/linking-utils.js +0 -74
- package/dist/es2019/utils/rich-media-utils.js +0 -108
- package/dist/esm/nodeviews/getInlineNodeViewProducer.js +0 -217
- package/dist/esm/plugins/hyperlink/types.js +0 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +0 -144
- package/dist/esm/ui/Resizer/index.js +0 -203
- package/dist/esm/ui/Resizer/styled.js +0 -7
- package/dist/esm/ui/Resizer/types.js +0 -1
- package/dist/esm/ui/Resizer/utils.js +0 -12
- package/dist/esm/utils/filter/privacy-filter.js +0 -48
- package/dist/esm/utils/linking-utils.js +0 -74
- package/dist/esm/utils/rich-media-utils.js +0 -117
- package/dist/types/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types/ui/Resizer/index.d.ts +0 -41
- package/dist/types/ui/Resizer/styled.d.ts +0 -2
- package/dist/types/ui/Resizer/types.d.ts +0 -26
- package/dist/types/ui/Resizer/utils.d.ts +0 -6
- package/dist/types/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types/utils/linking-utils.d.ts +0 -14
- package/dist/types/utils/rich-media-utils.d.ts +0 -8
- package/dist/types-ts4.5/nodeviews/getInlineNodeViewProducer.d.ts +0 -24
- package/dist/types-ts4.5/plugins/hyperlink/types.d.ts +0 -35
- package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/Resizer/index.d.ts +0 -41
- package/dist/types-ts4.5/ui/Resizer/styled.d.ts +0 -2
- package/dist/types-ts4.5/ui/Resizer/types.d.ts +0 -26
- package/dist/types-ts4.5/ui/Resizer/utils.d.ts +0 -6
- package/dist/types-ts4.5/utils/filter/privacy-filter.d.ts +0 -9
- package/dist/types-ts4.5/utils/linking-utils.d.ts +0 -14
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +0 -8
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NodeSelection } from 'prosemirror-state';
|
|
2
2
|
import { Slice, Fragment } from 'prosemirror-model';
|
|
3
3
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
4
|
-
import { mapChildren } from '
|
|
5
|
-
import { isSupportedInParent } from '../../utils/nodes';
|
|
4
|
+
import { isSupportedInParent, mapChildren } from '@atlaskit/editor-common/utils';
|
|
6
5
|
export const appearanceForNodeType = spec => {
|
|
7
6
|
if (spec.name === 'inlineCard') {
|
|
8
7
|
return 'inline';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { isEmptyDocument } from '
|
|
3
|
+
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
4
4
|
export const pluginKey = new PluginKey('clearMarksOnChangeToEmptyDocumentPlugin');
|
|
5
5
|
export function createPlugin() {
|
|
6
6
|
return new SafePlugin({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeHistory } from 'prosemirror-history';
|
|
2
|
-
import { processRawValue } from '
|
|
2
|
+
import { processRawValue } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { autoformatAction } from './utils';
|
|
4
4
|
export const buildHandler = (_regex, handler) => {
|
|
5
5
|
return async (view, match, start, end) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { DateNodeView } from '../nodeviews/date';
|
|
3
|
-
import { getInlineNodeViewProducer } from '
|
|
3
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
5
5
|
import { reducer, mapping, onSelectionChanged } from './utils';
|
|
6
6
|
import { pluginKey } from './plugin-key';
|
|
@@ -5,7 +5,7 @@ import { emoji } from '@atlaskit/adf-schema';
|
|
|
5
5
|
import { Fragment } from 'prosemirror-model';
|
|
6
6
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
7
7
|
import { EmojiTypeAheadItem, SearchSort, recordSelectionSucceededSli, recordSelectionFailedSli } from '@atlaskit/emoji';
|
|
8
|
-
import { getInlineNodeViewProducer } from '
|
|
8
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
9
9
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
11
11
|
import { IconEmoji } from '../quick-insert/assets';
|
|
@@ -8,7 +8,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
8
8
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
9
9
|
import WithPluginState from '../../ui/WithPluginState';
|
|
10
10
|
import { CONTENT_COMPONENT } from '../analytics/types';
|
|
11
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '
|
|
11
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { pluginKey as extensionsPluginKey } from '../extension/plugin-key';
|
|
13
13
|
import { pluginKey as editorDisabledPluginKey } from '../editor-disabled';
|
|
14
14
|
import { pluginKey as dataPluginKey } from './pm-plugins/toolbar-data/plugin-key';
|
|
@@ -9,10 +9,10 @@ import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
|
9
9
|
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { linkToolbarMessages as linkToolbarCommonMessages, linkMessages } from '../../messages';
|
|
11
11
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
12
|
-
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '
|
|
12
|
+
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
13
13
|
import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { ACTION_SUBJECT_ID, ACTION, INPUT_METHOD, buildVisitedLinkPayload, buildOpenedSettingsPayload } from '@atlaskit/editor-common/analytics';
|
|
15
|
+
import { addAnalytics } from '../analytics';
|
|
16
16
|
/* type guard for edit links */
|
|
17
17
|
function isEditLink(linkMark) {
|
|
18
18
|
return linkMark.pos !== undefined;
|
|
@@ -4,9 +4,8 @@ import { stateKey, LinkAction } from './pm-plugins/main';
|
|
|
4
4
|
import { Selection } from 'prosemirror-state';
|
|
5
5
|
import { filter } from '../../utils/commands';
|
|
6
6
|
import { addAnalytics, withAnalytics } from '../analytics';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID, buildEditLinkPayload, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { queueCardsFromChangedTr } from '../card/pm-plugins/doc';
|
|
9
|
-
import { buildEditLinkPayload, unlinkPayload } from '../../utils/linking-utils';
|
|
10
9
|
export function isTextAtPos(pos) {
|
|
11
10
|
return state => {
|
|
12
11
|
const node = state.doc.nodeAt(pos);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import HyperlinkAddToolbarComp from './HyperlinkAddToolbar';
|
|
5
|
-
import { INPUT_METHOD } from '
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { stateKey as pluginKey } from '../../pm-plugins/main';
|
|
7
7
|
import WithPluginState from '../../../../ui/WithPluginState';
|
|
8
8
|
import { EditorLinkPicker } from '../EditorLinkPicker';
|
|
@@ -2,7 +2,7 @@ import { safeInsert } from 'prosemirror-utils';
|
|
|
2
2
|
import { Fragment, Slice } from 'prosemirror-model';
|
|
3
3
|
import { TextSelection, NodeSelection } from 'prosemirror-state';
|
|
4
4
|
import { flatmap, mapChildren } from '../../utils/slice';
|
|
5
|
-
import { getStepRange, isEmptyDocument } from '
|
|
5
|
+
import { getStepRange, isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics/types/enums';
|
|
7
7
|
import { addAnalytics, withAnalytics } from '../analytics/utils';
|
|
8
8
|
import { LAYOUT_TYPE } from '../analytics/types/node-events';
|
|
@@ -14,7 +14,7 @@ import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
|
14
14
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
15
15
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
16
16
|
import { figureWrapper, MediaSingleNodeSelector } from './styles';
|
|
17
|
-
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '
|
|
17
|
+
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
18
18
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
19
19
|
import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
|
|
20
20
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -14,7 +14,7 @@ import { ToolTipContent } from '../../../../../keymaps';
|
|
|
14
14
|
import { closeMediaAltTextMenu, updateAltText } from '../commands';
|
|
15
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
16
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, fireAnalyticsEvent, ACTION } from '@atlaskit/editor-common/analytics';
|
|
17
|
-
import { RECENT_SEARCH_WIDTH_IN_PX } from '
|
|
17
|
+
import { RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
18
18
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { ErrorMessage } from '@atlaskit/editor-common/ui';
|
|
20
20
|
export const CONTAINER_WIDTH_IN_PX = RECENT_SEARCH_WIDTH_IN_PX;
|
|
@@ -7,7 +7,7 @@ import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
|
7
7
|
import commonMessages from '../../../messages';
|
|
8
8
|
import { stateKey } from '../pm-plugins/plugin-key';
|
|
9
9
|
import { getLinkingToolbar, shouldShowMediaLinkToolbar } from './linking';
|
|
10
|
-
import buildLayoutButtons from '
|
|
10
|
+
import { buildLayoutButtons } from '@atlaskit/editor-common/card';
|
|
11
11
|
import { getMediaLinkingState } from '../pm-plugins/linking';
|
|
12
12
|
import { getPluginState as getMediaAltTextPluginState } from '../pm-plugins/alt-text';
|
|
13
13
|
import { altTextButton, getAltTextToolbar } from './alt-text';
|
|
@@ -187,7 +187,7 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState, hover
|
|
|
187
187
|
return items;
|
|
188
188
|
};
|
|
189
189
|
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) => {
|
|
190
|
-
var _pluginInjectionApi$
|
|
190
|
+
var _pluginInjectionApi$d3;
|
|
191
191
|
const {
|
|
192
192
|
mediaSingle
|
|
193
193
|
} = state.schema.nodes;
|
|
@@ -230,7 +230,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
if (allowAdvancedToolBarOptions) {
|
|
233
|
-
|
|
233
|
+
var _pluginInjectionApi$d;
|
|
234
|
+
toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, allowResizing, allowResizingInTables)];
|
|
234
235
|
if (toolbarButtons.length) {
|
|
235
236
|
toolbarButtons.push({
|
|
236
237
|
type: 'separator'
|
|
@@ -253,14 +254,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
253
254
|
};
|
|
254
255
|
const openLink = () => {
|
|
255
256
|
if (editorView) {
|
|
256
|
-
var _pluginInjectionApi$
|
|
257
|
+
var _pluginInjectionApi$d2;
|
|
257
258
|
const {
|
|
258
259
|
state: {
|
|
259
260
|
tr
|
|
260
261
|
},
|
|
261
262
|
dispatch
|
|
262
263
|
} = editorView;
|
|
263
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
264
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.attachAnalyticsEvent({
|
|
264
265
|
eventType: EVENT_TYPE.TRACK,
|
|
265
266
|
action: ACTION.VISITED,
|
|
266
267
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
@@ -292,7 +293,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
292
293
|
}
|
|
293
294
|
const {
|
|
294
295
|
hoverDecoration
|
|
295
|
-
} = (_pluginInjectionApi$
|
|
296
|
+
} = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {};
|
|
296
297
|
const removeButton = {
|
|
297
298
|
id: 'editor.media.delete',
|
|
298
299
|
type: 'button',
|
|
@@ -320,7 +321,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
320
321
|
return items;
|
|
321
322
|
};
|
|
322
323
|
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
323
|
-
var _pluginInjectionApi$
|
|
324
|
+
var _pluginInjectionApi$d4;
|
|
324
325
|
const {
|
|
325
326
|
media,
|
|
326
327
|
mediaInline,
|
|
@@ -339,7 +340,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
339
340
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
340
341
|
const {
|
|
341
342
|
hoverDecoration
|
|
342
|
-
} = (_pluginInjectionApi$
|
|
343
|
+
} = (_pluginInjectionApi$d4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d4 !== void 0 ? _pluginInjectionApi$d4 : {};
|
|
343
344
|
if (!mediaPluginState) {
|
|
344
345
|
return;
|
|
345
346
|
}
|
|
@@ -7,7 +7,8 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
|
7
7
|
import { checkMediaType } from '../utils/check-media-type';
|
|
8
8
|
import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import Separator from '../../floating-toolbar/ui/Separator';
|
|
10
|
-
import {
|
|
10
|
+
import { linkMessages } from '../../../messages';
|
|
11
|
+
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
11
12
|
import { ToolTipContent, addLink } from '../../../keymaps';
|
|
12
13
|
import { stateKey } from '../pm-plugins/plugin-key';
|
|
13
14
|
import { currentMediaNode } from '../utils/current-media-node';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { hideLinkingToolbar, setUrlToMedia, unlink } from '../commands/linking';
|
|
3
3
|
import { getMediaLinkingState } from '../pm-plugins/linking';
|
|
4
4
|
import MediaLinkingToolbar from '../ui/MediaLinkingToolbar';
|
|
5
|
-
import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '
|
|
5
|
+
import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
7
7
|
const FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
|
|
8
8
|
export function shouldShowMediaLinkToolbar(editorState) {
|
|
@@ -12,7 +12,7 @@ import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
|
12
12
|
import Separator from '../../floating-toolbar/ui/Separator';
|
|
13
13
|
import { container, containerWithProvider, inputWrapper } from '../../../ui/LinkSearch/ToolbarComponents';
|
|
14
14
|
import RecentSearch from '../../../ui/LinkSearch';
|
|
15
|
-
import { linkToolbarMessages } from '
|
|
15
|
+
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
16
16
|
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
17
17
|
import { R400 } from '@atlaskit/theme/colors';
|
|
18
18
|
import { INPUT_METHOD } from '../../analytics/types/enums';
|
|
@@ -8,10 +8,8 @@ import { getMediaClient } from '@atlaskit/media-client';
|
|
|
8
8
|
import { calcPctFromPx, calcColumnsFromPx, wrappedLayouts } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { wrapperStyle } from './styled';
|
|
11
|
-
import Resizer from '
|
|
12
|
-
import {
|
|
13
|
-
import { calcMediaPxWidth } from '@atlaskit/editor-common/ui';
|
|
14
|
-
import { calculateSnapPoints } from '../../../../utils/rich-media-utils';
|
|
11
|
+
import { Resizer, calcMediaPxWidth, snapTo, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
12
|
+
import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
|
|
15
13
|
export default class ResizableMediaSingle extends React.Component {
|
|
16
14
|
constructor(...args) {
|
|
17
15
|
super(...args);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Fragment } from 'prosemirror-model';
|
|
2
|
-
import { setNodeSelection, setTextSelection, insideTableCell, isInListItem, findFarthestParentNode
|
|
2
|
+
import { setNodeSelection, setTextSelection, insideTableCell, isInListItem, findFarthestParentNode } from '../../../utils';
|
|
3
|
+
import { isInLayoutColumn, isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { posOfPrecedingMediaGroup, posOfMediaGroupNearby, posOfParentMediaGroup, isSelectionNonMediaBlockNode, isInsidePotentialEmptyParagraph, copyOptionalAttrsFromMediaState } from './media-common';
|
|
4
5
|
import { canInsert, safeInsert, hasParentNode } from 'prosemirror-utils';
|
|
5
6
|
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '../../../utils/prosemirror/position';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { addAnalytics } from '../../analytics';
|
|
8
9
|
export const canInsertMediaInline = state => {
|
|
9
10
|
const node = state.schema.nodes.mediaInline.create({});
|
|
10
11
|
return canInsert(state.selection.$to, Fragment.from(node));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { SLI_EVENT_TYPE, SMART_EVENT_TYPE, buildSliPayload } from '@atlaskit/mention/resource';
|
|
3
|
-
import { getInlineNodeViewProducer } from '
|
|
3
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import { MentionNodeView } from '../nodeviews/mention';
|
|
5
5
|
import { mentionPluginKey } from './key';
|
|
6
6
|
const ACTIONS = {
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { PluginKey } from 'prosemirror-state';
|
|
4
4
|
import { DecorationSet, Decoration } from 'prosemirror-view';
|
|
5
|
-
import { isEmptyDocument, bracketTyped } from '
|
|
5
|
+
import { isEmptyDocument, bracketTyped } from '@atlaskit/editor-common/utils';
|
|
6
6
|
export const pluginKey = new PluginKey('placeholderPlugin');
|
|
7
7
|
import { focusStateKey } from '../base/pm-plugins/focus-handler';
|
|
8
8
|
import { isTypeAheadOpen } from '../type-ahead/utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { getInlineNodeViewProducer } from '
|
|
4
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import { StatusNodeView } from './nodeviews/status';
|
|
6
6
|
import { pluginKey } from './plugin-key';
|
|
7
7
|
import { isEmptyStatus, mayGetStatusAtSelection } from './utils';
|
|
@@ -4,7 +4,7 @@ import { confluenceUnsupportedBlock, confluenceUnsupportedInline, unsupportedBlo
|
|
|
4
4
|
import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { UnsupportedInlineNodeView } from './unsupported-inline-node-view';
|
|
6
6
|
import { ReactNodeView } from '../../nodeviews';
|
|
7
|
-
import { getInlineNodeViewProducer } from '
|
|
7
|
+
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
export const pluginKey = new PluginKey('unsupportedContentPlugin');
|
|
9
9
|
const createPlugin = pmPluginFactoryParams => {
|
|
10
10
|
const hasIntlContext = true;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
export const RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX = 360;
|
|
4
|
-
export const RECENT_SEARCH_HEIGHT_IN_PX = 360;
|
|
5
|
-
export const LINKPICKER_HEIGHT_IN_PX = 570;
|
|
2
|
+
import { RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
6
3
|
export const inputWrapper = css`
|
|
7
4
|
display: flex;
|
|
8
5
|
line-height: 0;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { sanitizeNodeForPrivacy } from '../utils/filter/privacy-filter';
|
|
4
|
-
import { isEmptyParagraph, validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { Fragment } from 'prosemirror-model';
|
|
2
|
+
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
3
|
import { getBreakoutMode } from './node-width';
|
|
6
|
-
import {
|
|
4
|
+
import { processRawValue, hasDocAsParent, getStepRange } from '@atlaskit/editor-common/utils';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
@@ -46,25 +44,6 @@ export function isNodeEmpty(node) {
|
|
|
46
44
|
});
|
|
47
45
|
return !nonBlock.length && !block.filter(childNode => !!childNode.childCount && !(childNode.childCount === 1 && isEmptyParagraph(childNode.firstChild)) || childNode.isAtom).length;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Checks if a node looks like an empty document
|
|
52
|
-
*/
|
|
53
|
-
export function isEmptyDocument(node) {
|
|
54
|
-
const nodeChild = node.content.firstChild;
|
|
55
|
-
if (node.childCount !== 1 || !nodeChild) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return isEmptyParagraph(nodeChild);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Checks to see if the parent node is the document, ie not contained within another entity
|
|
62
|
-
export function hasDocAsParent($anchor) {
|
|
63
|
-
return $anchor.depth === 1;
|
|
64
|
-
}
|
|
65
|
-
export function isProseMirrorSchemaCheckError(error) {
|
|
66
|
-
return error instanceof RangeError && (!!error.message.match(/^Invalid collection of marks for node/) || !!error.message.match(/^Invalid content for node/));
|
|
67
|
-
}
|
|
68
47
|
export function isInEmptyLine(state) {
|
|
69
48
|
const {
|
|
70
49
|
selection
|
|
@@ -82,27 +61,6 @@ export function isInEmptyLine(state) {
|
|
|
82
61
|
}
|
|
83
62
|
return isEmptyParagraph(node) && hasDocAsParent($anchor);
|
|
84
63
|
}
|
|
85
|
-
export function bracketTyped(state) {
|
|
86
|
-
const {
|
|
87
|
-
selection
|
|
88
|
-
} = state;
|
|
89
|
-
const {
|
|
90
|
-
$cursor,
|
|
91
|
-
$anchor
|
|
92
|
-
} = selection;
|
|
93
|
-
if (!$cursor) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
const node = $cursor.nodeBefore;
|
|
97
|
-
if (!node) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (node.type.name === 'text' && node.text === '{') {
|
|
101
|
-
const paragraphNode = $anchor.node();
|
|
102
|
-
return paragraphNode.marks.length === 0 && hasDocAsParent($anchor);
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
64
|
export function processRawFragmentValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
107
65
|
if (!value) {
|
|
108
66
|
return;
|
|
@@ -113,205 +71,6 @@ export function processRawFragmentValue(schema, value, providerFactory, sanitize
|
|
|
113
71
|
}
|
|
114
72
|
return Fragment.from(adfEntities);
|
|
115
73
|
}
|
|
116
|
-
export function processRawValue(schema, value, providerFactory, sanitizePrivateContent, contentTransformer, dispatchAnalyticsEvent) {
|
|
117
|
-
if (!value) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
let node;
|
|
121
|
-
if (typeof value === 'string') {
|
|
122
|
-
try {
|
|
123
|
-
if (contentTransformer) {
|
|
124
|
-
const doc = contentTransformer.parse(value);
|
|
125
|
-
node = doc.toJSON();
|
|
126
|
-
} else {
|
|
127
|
-
node = JSON.parse(value);
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
130
|
-
// eslint-disable-next-line no-console
|
|
131
|
-
console.error(`Error processing value: ${value} isn't a valid JSON`);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
} else {
|
|
135
|
-
node = value;
|
|
136
|
-
}
|
|
137
|
-
if (Array.isArray(node)) {
|
|
138
|
-
// eslint-disable-next-line no-console
|
|
139
|
-
console.error(`Error processing value: ${node} is an array, but it must be an object.`);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
// ProseMirror always require a child under doc
|
|
144
|
-
if (node.type === 'doc') {
|
|
145
|
-
if (Array.isArray(node.content) && node.content.length === 0) {
|
|
146
|
-
node.content.push({
|
|
147
|
-
type: 'paragraph',
|
|
148
|
-
content: []
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
// Just making sure doc is always valid
|
|
152
|
-
if (!node.version) {
|
|
153
|
-
node.version = 1;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (contentTransformer) {
|
|
157
|
-
return Node.fromJSON(schema, node);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
161
|
-
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
162
|
-
let {
|
|
163
|
-
transformedAdf,
|
|
164
|
-
isTransformed
|
|
165
|
-
} = transformMediaLinkMarks(node);
|
|
166
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
167
|
-
dispatchAnalyticsEvent({
|
|
168
|
-
action: ACTION.MEDIA_LINK_TRANSFORMED,
|
|
169
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
170
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
|
|
175
|
-
// We declared in code mark spec that links and marks should not co-exist on
|
|
176
|
-
// text nodes. This util strips code marks from bad text nodes and preserves links.
|
|
177
|
-
// Otherwise, prosemirror will try to repair the invalid document by stripping links
|
|
178
|
-
// and preserving code marks during content changes.
|
|
179
|
-
({
|
|
180
|
-
transformedAdf,
|
|
181
|
-
isTransformed
|
|
182
|
-
} = transformTextLinkCodeMarks(transformedAdf));
|
|
183
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
184
|
-
dispatchAnalyticsEvent({
|
|
185
|
-
action: ACTION.TEXT_LINK_MARK_TRANSFORMED,
|
|
186
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
187
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
let discardedMarks = [];
|
|
191
|
-
({
|
|
192
|
-
transformedAdf,
|
|
193
|
-
isTransformed,
|
|
194
|
-
discardedMarks
|
|
195
|
-
} = transformDedupeMarks(transformedAdf));
|
|
196
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
197
|
-
dispatchAnalyticsEvent({
|
|
198
|
-
action: ACTION.DEDUPE_MARKS_TRANSFORMED_V2,
|
|
199
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
200
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
201
|
-
attributes: {
|
|
202
|
-
/** UGC WARNING
|
|
203
|
-
*
|
|
204
|
-
* DO NOT include the `mark` attributes inside, we map here to only
|
|
205
|
-
* extract the mark type as that is the only non-UGC safe information
|
|
206
|
-
* that we can add to event-attributes
|
|
207
|
-
*
|
|
208
|
-
*/
|
|
209
|
-
discardedMarkTypes: discardedMarks.map(mark => mark.type)
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
({
|
|
214
|
-
transformedAdf,
|
|
215
|
-
isTransformed
|
|
216
|
-
} = transformNodesMissingContent(transformedAdf));
|
|
217
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
218
|
-
dispatchAnalyticsEvent({
|
|
219
|
-
action: ACTION.NODES_MISSING_CONTENT_TRANSFORMED,
|
|
220
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
221
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
({
|
|
225
|
-
transformedAdf,
|
|
226
|
-
isTransformed
|
|
227
|
-
} = transformIndentationMarks(transformedAdf));
|
|
228
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
229
|
-
dispatchAnalyticsEvent({
|
|
230
|
-
action: ACTION.INDENTATION_MARKS_TRANSFORMED,
|
|
231
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
232
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
({
|
|
236
|
-
transformedAdf,
|
|
237
|
-
isTransformed
|
|
238
|
-
} = transformInvalidMediaContent(transformedAdf));
|
|
239
|
-
if (isTransformed && dispatchAnalyticsEvent) {
|
|
240
|
-
dispatchAnalyticsEvent({
|
|
241
|
-
action: ACTION.INVALID_MEDIA_CONTENT_TRANSFORMED,
|
|
242
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
243
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
const entity = validateADFEntity(schema, transformedAdf || node, dispatchAnalyticsEvent);
|
|
247
|
-
let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
|
|
248
|
-
const parsedDoc = Node.fromJSON(schema, newEntity);
|
|
249
|
-
|
|
250
|
-
// throws an error if the document is invalid
|
|
251
|
-
try {
|
|
252
|
-
parsedDoc.check();
|
|
253
|
-
} catch (err) {
|
|
254
|
-
if (dispatchAnalyticsEvent) {
|
|
255
|
-
dispatchAnalyticsEvent({
|
|
256
|
-
action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
|
|
257
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
258
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
259
|
-
attributes: {
|
|
260
|
-
errorStack: err instanceof Error ? err.stack : String(err)
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
throw err;
|
|
265
|
-
}
|
|
266
|
-
if (dispatchAnalyticsEvent) {
|
|
267
|
-
findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
|
|
268
|
-
}
|
|
269
|
-
return parsedDoc;
|
|
270
|
-
} catch (e) {
|
|
271
|
-
if (dispatchAnalyticsEvent) {
|
|
272
|
-
dispatchAnalyticsEvent({
|
|
273
|
-
action: ACTION.DOCUMENT_PROCESSING_ERROR,
|
|
274
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
275
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
276
|
-
nonPrivacySafeAttributes: {
|
|
277
|
-
errorStack: e instanceof Error ? e.stack : String(e)
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// eslint-disable-next-line no-console
|
|
283
|
-
console.error(`Error processing document:\n${e instanceof Error ? e.message : String(e)}\n\n`, JSON.stringify(node));
|
|
284
|
-
if (isProseMirrorSchemaCheckError(e)) {
|
|
285
|
-
throw e;
|
|
286
|
-
}
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
const maySanitizePrivateContent = (entity, providerFactory, sanitizePrivateContent) => {
|
|
291
|
-
if (sanitizePrivateContent && providerFactory) {
|
|
292
|
-
return sanitizeNodeForPrivacy(entity, providerFactory);
|
|
293
|
-
}
|
|
294
|
-
return entity;
|
|
295
|
-
};
|
|
296
|
-
export const getStepRange = transaction => {
|
|
297
|
-
let from = -1;
|
|
298
|
-
let to = -1;
|
|
299
|
-
transaction.mapping.maps.forEach((stepMap, index) => {
|
|
300
|
-
stepMap.forEach((oldStart, oldEnd) => {
|
|
301
|
-
const newStart = transaction.mapping.slice(index).map(oldStart, -1);
|
|
302
|
-
const newEnd = transaction.mapping.slice(index).map(oldEnd);
|
|
303
|
-
from = newStart < from || from === -1 ? newStart : from;
|
|
304
|
-
to = newEnd > to || to === -1 ? newEnd : to;
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
if (from !== -1) {
|
|
308
|
-
return {
|
|
309
|
-
from,
|
|
310
|
-
to
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
return null;
|
|
314
|
-
};
|
|
315
74
|
|
|
316
75
|
/**
|
|
317
76
|
* Find the farthest node given a condition
|
|
@@ -7,7 +7,7 @@ import { isNodeEmpty } from './document';
|
|
|
7
7
|
import { atTheBeginningOfDoc, atTheEndOfDoc } from './prosemirror/position';
|
|
8
8
|
import { isMediaNode } from '@atlaskit/editor-common/utils';
|
|
9
9
|
export { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
-
export { hasVisibleContent, isNodeEmpty,
|
|
10
|
+
export { hasVisibleContent, isNodeEmpty, findFarthestParentNode, isSelectionEndOfParagraph, nodesBetweenChanged, getNodesCount } from './document';
|
|
11
11
|
export { sanitiseMarksInSelection } from './mark';
|
|
12
12
|
export { isParagraph, isText, isLinkMark } from './nodes';
|
|
13
13
|
export { setNodeSelection, setGapCursorSelection, setTextSelection } from './selection';
|
|
@@ -282,9 +282,6 @@ export const insideTableCell = state => {
|
|
|
282
282
|
} = state.schema.nodes;
|
|
283
283
|
return hasParentNodeOfType([tableCell, tableHeader])(state.selection);
|
|
284
284
|
};
|
|
285
|
-
export const isInLayoutColumn = state => {
|
|
286
|
-
return hasParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
287
|
-
};
|
|
288
285
|
export const isInListItem = state => {
|
|
289
286
|
return hasParentNodeOfType(state.schema.nodes.listItem)(state.selection);
|
|
290
287
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -13,7 +13,8 @@ import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
|
13
13
|
import { toJSON } from '../utils';
|
|
14
14
|
import { getEditorValueWithMedia, __temporaryFixForConfigPanel as _temporaryFixForConfigPanel } from '../utils/action';
|
|
15
15
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
16
|
-
import { isEmptyDocument,
|
|
16
|
+
import { isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
|
|
17
|
+
import { processRawFragmentValue } from '../utils/document';
|
|
17
18
|
import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
|
|
18
19
|
var EditorActions = /*#__PURE__*/function () {
|
|
19
20
|
function EditorActions() {
|