@atlaskit/editor-core 185.16.3 → 185.16.5
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/.eslintrc.js +1 -0
- package/CHANGELOG.md +8 -0
- package/dist/cjs/i18n/cs.js +0 -35
- package/dist/cjs/i18n/da.js +0 -35
- package/dist/cjs/i18n/de.js +0 -35
- package/dist/cjs/i18n/en.js +0 -35
- package/dist/cjs/i18n/en_GB.js +0 -35
- package/dist/cjs/i18n/en_ZZ.js +0 -35
- package/dist/cjs/i18n/es.js +1 -35
- package/dist/cjs/i18n/fi.js +0 -35
- package/dist/cjs/i18n/fr.js +1 -35
- package/dist/cjs/i18n/hu.js +1 -35
- package/dist/cjs/i18n/it.js +1 -35
- package/dist/cjs/i18n/ja.js +1 -35
- package/dist/cjs/i18n/ko.js +0 -35
- package/dist/cjs/i18n/nb.js +1 -35
- package/dist/cjs/i18n/nl.js +1 -35
- package/dist/cjs/i18n/pl.js +1 -35
- package/dist/cjs/i18n/pt_BR.js +1 -35
- package/dist/cjs/i18n/ru.js +1 -35
- package/dist/cjs/i18n/sv.js +0 -35
- package/dist/cjs/i18n/th.js +0 -35
- package/dist/cjs/i18n/tr.js +1 -35
- package/dist/cjs/i18n/uk.js +1 -35
- package/dist/cjs/i18n/vi.js +0 -35
- package/dist/cjs/i18n/zh.js +1 -35
- package/dist/cjs/i18n/zh_TW.js +1 -35
- package/dist/cjs/labs/next/presets/mobile.js +1 -1
- package/dist/cjs/labs/next/presets/universal.js +2 -2
- package/dist/cjs/plugins/deprecated-card/doc.js +111 -0
- package/dist/cjs/plugins/deprecated-hyperlink/commands.js +1 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +14 -25
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/cs.js +0 -35
- package/dist/es2019/i18n/da.js +0 -35
- package/dist/es2019/i18n/de.js +0 -35
- package/dist/es2019/i18n/en.js +0 -35
- package/dist/es2019/i18n/en_GB.js +0 -35
- package/dist/es2019/i18n/en_ZZ.js +0 -35
- package/dist/es2019/i18n/es.js +1 -35
- package/dist/es2019/i18n/fi.js +0 -35
- package/dist/es2019/i18n/fr.js +1 -35
- package/dist/es2019/i18n/hu.js +1 -35
- package/dist/es2019/i18n/it.js +1 -35
- package/dist/es2019/i18n/ja.js +1 -35
- package/dist/es2019/i18n/ko.js +0 -35
- package/dist/es2019/i18n/nb.js +1 -35
- package/dist/es2019/i18n/nl.js +1 -35
- package/dist/es2019/i18n/pl.js +1 -35
- package/dist/es2019/i18n/pt_BR.js +1 -35
- package/dist/es2019/i18n/ru.js +1 -35
- package/dist/es2019/i18n/sv.js +0 -35
- package/dist/es2019/i18n/th.js +0 -35
- package/dist/es2019/i18n/tr.js +1 -35
- package/dist/es2019/i18n/uk.js +1 -35
- package/dist/es2019/i18n/vi.js +0 -35
- package/dist/es2019/i18n/zh.js +1 -35
- package/dist/es2019/i18n/zh_TW.js +1 -35
- package/dist/es2019/labs/next/presets/mobile.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +1 -1
- package/dist/es2019/plugins/deprecated-card/doc.js +97 -0
- package/dist/es2019/plugins/deprecated-hyperlink/commands.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -14
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/cs.js +0 -35
- package/dist/esm/i18n/da.js +0 -35
- package/dist/esm/i18n/de.js +0 -35
- package/dist/esm/i18n/en.js +0 -35
- package/dist/esm/i18n/en_GB.js +0 -35
- package/dist/esm/i18n/en_ZZ.js +0 -35
- package/dist/esm/i18n/es.js +1 -35
- package/dist/esm/i18n/fi.js +0 -35
- package/dist/esm/i18n/fr.js +1 -35
- package/dist/esm/i18n/hu.js +1 -35
- package/dist/esm/i18n/it.js +1 -35
- package/dist/esm/i18n/ja.js +1 -35
- package/dist/esm/i18n/ko.js +0 -35
- package/dist/esm/i18n/nb.js +1 -35
- package/dist/esm/i18n/nl.js +1 -35
- package/dist/esm/i18n/pl.js +1 -35
- package/dist/esm/i18n/pt_BR.js +1 -35
- package/dist/esm/i18n/ru.js +1 -35
- package/dist/esm/i18n/sv.js +0 -35
- package/dist/esm/i18n/th.js +0 -35
- package/dist/esm/i18n/tr.js +1 -35
- package/dist/esm/i18n/uk.js +1 -35
- package/dist/esm/i18n/vi.js +0 -35
- package/dist/esm/i18n/zh.js +1 -35
- package/dist/esm/i18n/zh_TW.js +1 -35
- package/dist/esm/labs/next/presets/mobile.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +1 -1
- package/dist/esm/plugins/deprecated-card/doc.js +105 -0
- package/dist/esm/plugins/deprecated-hyperlink/commands.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +14 -25
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +39 -27
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/i18n/cs.d.ts +0 -35
- package/dist/types/i18n/da.d.ts +0 -35
- package/dist/types/i18n/de.d.ts +0 -35
- package/dist/types/i18n/en.d.ts +0 -35
- package/dist/types/i18n/en_GB.d.ts +0 -35
- package/dist/types/i18n/en_ZZ.d.ts +0 -35
- package/dist/types/i18n/es.d.ts +1 -35
- package/dist/types/i18n/fi.d.ts +0 -35
- package/dist/types/i18n/fr.d.ts +1 -35
- package/dist/types/i18n/hu.d.ts +1 -35
- package/dist/types/i18n/it.d.ts +1 -35
- package/dist/types/i18n/ja.d.ts +1 -35
- package/dist/types/i18n/ko.d.ts +0 -35
- package/dist/types/i18n/nb.d.ts +1 -35
- package/dist/types/i18n/nl.d.ts +1 -35
- package/dist/types/i18n/pl.d.ts +1 -35
- package/dist/types/i18n/pt_BR.d.ts +1 -35
- package/dist/types/i18n/ru.d.ts +1 -35
- package/dist/types/i18n/sv.d.ts +0 -35
- package/dist/types/i18n/th.d.ts +0 -35
- package/dist/types/i18n/tr.d.ts +1 -35
- package/dist/types/i18n/uk.d.ts +1 -35
- package/dist/types/i18n/vi.d.ts +0 -35
- package/dist/types/i18n/zh.d.ts +1 -35
- package/dist/types/i18n/zh_TW.d.ts +1 -35
- package/dist/types/plugins/deprecated-card/doc.d.ts +20 -0
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
- package/dist/types/plugins/paste/index.d.ts +1 -1
- package/dist/types-ts4.5/i18n/cs.d.ts +0 -35
- package/dist/types-ts4.5/i18n/da.d.ts +0 -35
- package/dist/types-ts4.5/i18n/de.d.ts +0 -35
- package/dist/types-ts4.5/i18n/en.d.ts +0 -35
- package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -35
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -35
- package/dist/types-ts4.5/i18n/es.d.ts +1 -35
- package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
- package/dist/types-ts4.5/i18n/fr.d.ts +1 -35
- package/dist/types-ts4.5/i18n/hu.d.ts +1 -35
- package/dist/types-ts4.5/i18n/it.d.ts +1 -35
- package/dist/types-ts4.5/i18n/ja.d.ts +1 -35
- package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
- package/dist/types-ts4.5/i18n/nb.d.ts +1 -35
- package/dist/types-ts4.5/i18n/nl.d.ts +1 -35
- package/dist/types-ts4.5/i18n/pl.d.ts +1 -35
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +1 -35
- package/dist/types-ts4.5/i18n/ru.d.ts +1 -35
- package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
- package/dist/types-ts4.5/i18n/th.d.ts +0 -35
- package/dist/types-ts4.5/i18n/tr.d.ts +1 -35
- package/dist/types-ts4.5/i18n/uk.d.ts +1 -35
- package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
- package/dist/types-ts4.5/i18n/zh.d.ts +1 -35
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +1 -35
- package/dist/types-ts4.5/plugins/deprecated-card/doc.d.ts +20 -0
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +3 -2
- package/dist/types-ts4.5/plugins/paste/index.d.ts +1 -1
- package/package.json +6 -5
- package/tmp/api-report-tmp.d.ts +2307 -0
- package/dist/cjs/plugins/card/index.js +0 -139
- package/dist/cjs/plugins/card/messages.js +0 -20
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +0 -163
- package/dist/cjs/plugins/card/nodeviews/datasource.js +0 -172
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +0 -396
- package/dist/cjs/plugins/card/nodeviews/genericCard.js +0 -118
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +0 -131
- package/dist/cjs/plugins/card/pm-plugins/actions.js +0 -122
- package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -48
- package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -353
- package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +0 -19
- package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +0 -5
- package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +0 -178
- package/dist/cjs/plugins/card/pm-plugins/doc.js +0 -478
- package/dist/cjs/plugins/card/pm-plugins/keymap.js +0 -64
- package/dist/cjs/plugins/card/pm-plugins/main.js +0 -212
- package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +0 -47
- package/dist/cjs/plugins/card/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/card/pm-plugins/reducers.js +0 -111
- package/dist/cjs/plugins/card/pm-plugins/shouldReplaceLink.js +0 -35
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +0 -58
- package/dist/cjs/plugins/card/pm-plugins/util/state.js +0 -49
- package/dist/cjs/plugins/card/toolbar.js +0 -364
- package/dist/cjs/plugins/card/types.js +0 -5
- package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -25
- package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +0 -60
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +0 -256
- package/dist/cjs/plugins/card/ui/EditorSmartCardEvents.js +0 -21
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +0 -213
- package/dist/cjs/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -173
- package/dist/cjs/plugins/card/ui/LayoutButton/index.js +0 -113
- package/dist/cjs/plugins/card/ui/LayoutButton/styled.js +0 -17
- package/dist/cjs/plugins/card/ui/LayoutButton/types.js +0 -5
- package/dist/cjs/plugins/card/ui/LayoutButton/utils.js +0 -19
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +0 -151
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +0 -360
- package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +0 -20
- package/dist/cjs/plugins/card/utils.js +0 -60
- package/dist/es2019/plugins/card/index.js +0 -131
- package/dist/es2019/plugins/card/messages.js +0 -13
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +0 -130
- package/dist/es2019/plugins/card/nodeviews/datasource.js +0 -136
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +0 -368
- package/dist/es2019/plugins/card/nodeviews/genericCard.js +0 -92
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +0 -112
- package/dist/es2019/plugins/card/pm-plugins/actions.js +0 -57
- package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -38
- package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -333
- package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +0 -2
- package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +0 -1
- package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +0 -160
- package/dist/es2019/plugins/card/pm-plugins/doc.js +0 -451
- package/dist/es2019/plugins/card/pm-plugins/keymap.js +0 -59
- package/dist/es2019/plugins/card/pm-plugins/main.js +0 -208
- package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +0 -37
- package/dist/es2019/plugins/card/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/card/pm-plugins/reducers.js +0 -110
- package/dist/es2019/plugins/card/pm-plugins/shouldReplaceLink.js +0 -25
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +0 -48
- package/dist/es2019/plugins/card/pm-plugins/util/state.js +0 -26
- package/dist/es2019/plugins/card/toolbar.js +0 -362
- package/dist/es2019/plugins/card/types.js +0 -1
- package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -19
- package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +0 -48
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +0 -225
- package/dist/es2019/plugins/card/ui/EditorSmartCardEvents.js +0 -15
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +0 -198
- package/dist/es2019/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -86
- package/dist/es2019/plugins/card/ui/LayoutButton/index.js +0 -106
- package/dist/es2019/plugins/card/ui/LayoutButton/styled.js +0 -10
- package/dist/es2019/plugins/card/ui/LayoutButton/types.js +0 -1
- package/dist/es2019/plugins/card/ui/LayoutButton/utils.js +0 -15
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +0 -117
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +0 -332
- package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +0 -11
- package/dist/es2019/plugins/card/utils.js +0 -46
- package/dist/esm/plugins/card/index.js +0 -132
- package/dist/esm/plugins/card/messages.js +0 -13
- package/dist/esm/plugins/card/nodeviews/blockCard.js +0 -155
- package/dist/esm/plugins/card/nodeviews/datasource.js +0 -164
- package/dist/esm/plugins/card/nodeviews/embedCard.js +0 -387
- package/dist/esm/plugins/card/nodeviews/genericCard.js +0 -111
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +0 -123
- package/dist/esm/plugins/card/pm-plugins/actions.js +0 -102
- package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +0 -41
- package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +0 -344
- package/dist/esm/plugins/card/pm-plugins/analytics/index.js +0 -2
- package/dist/esm/plugins/card/pm-plugins/analytics/types.js +0 -1
- package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +0 -160
- package/dist/esm/plugins/card/pm-plugins/doc.js +0 -460
- package/dist/esm/plugins/card/pm-plugins/keymap.js +0 -58
- package/dist/esm/plugins/card/pm-plugins/main.js +0 -199
- package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +0 -39
- package/dist/esm/plugins/card/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/card/pm-plugins/reducers.js +0 -103
- package/dist/esm/plugins/card/pm-plugins/shouldReplaceLink.js +0 -29
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +0 -50
- package/dist/esm/plugins/card/pm-plugins/util/state.js +0 -40
- package/dist/esm/plugins/card/toolbar.js +0 -353
- package/dist/esm/plugins/card/types.js +0 -1
- package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +0 -17
- package/dist/esm/plugins/card/ui/DatasourceModal/index.js +0 -49
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +0 -243
- package/dist/esm/plugins/card/ui/EditorSmartCardEvents.js +0 -14
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +0 -202
- package/dist/esm/plugins/card/ui/HyperlinkToolbarAppearance.js +0 -163
- package/dist/esm/plugins/card/ui/LayoutButton/index.js +0 -102
- package/dist/esm/plugins/card/ui/LayoutButton/styled.js +0 -10
- package/dist/esm/plugins/card/ui/LayoutButton/types.js +0 -1
- package/dist/esm/plugins/card/ui/LayoutButton/utils.js +0 -12
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +0 -140
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +0 -355
- package/dist/esm/plugins/card/ui/SmallerEditIcon.js +0 -11
- package/dist/esm/plugins/card/utils.js +0 -48
- package/dist/types/plugins/card/index.d.ts +0 -26
- package/dist/types/plugins/card/messages.d.ts +0 -12
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +0 -26
- package/dist/types/plugins/card/nodeviews/datasource.d.ts +0 -42
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +0 -46
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +0 -37
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +0 -23
- package/dist/types/plugins/card/pm-plugins/actions.d.ts +0 -23
- package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
- package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
- package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
- package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
- package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +0 -23
- package/dist/types/plugins/card/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/card/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
- package/dist/types/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types/plugins/card/pm-plugins/reducers.d.ts +0 -3
- package/dist/types/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +0 -31
- package/dist/types/plugins/card/toolbar.d.ts +0 -12
- package/dist/types/plugins/card/types.d.ts +0 -165
- package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
- package/dist/types/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
- package/dist/types/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
- package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
- package/dist/types/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
- package/dist/types/plugins/card/ui/LayoutButton/index.d.ts +0 -9
- package/dist/types/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
- package/dist/types/plugins/card/ui/LayoutButton/types.d.ts +0 -19
- package/dist/types/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
- package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
- package/dist/types/plugins/card/utils.d.ts +0 -19
- package/dist/types-ts4.5/plugins/card/index.d.ts +0 -26
- package/dist/types-ts4.5/plugins/card/messages.d.ts +0 -12
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +0 -26
- package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +0 -42
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +0 -46
- package/dist/types-ts4.5/plugins/card/nodeviews/genericCard.d.ts +0 -37
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +0 -23
- package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +0 -23
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +0 -10
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +0 -17
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/types.d.ts +0 -12
- package/dist/types-ts4.5/plugins/card/pm-plugins/analytics/utils.d.ts +0 -32
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +0 -23
- package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/plugins/card/pm-plugins/mountHyperlink.d.ts +0 -5
- package/dist/types-ts4.5/plugins/card/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/pm-plugins/reducers.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/pm-plugins/shouldReplaceLink.d.ts +0 -2
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/resolve.d.ts +0 -8
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +0 -31
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +0 -12
- package/dist/types-ts4.5/plugins/card/types.d.ts +0 -165
- package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +0 -9
- package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +0 -47
- package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEvents.d.ts +0 -5
- package/dist/types-ts4.5/plugins/card/ui/EditorSmartCardEventsNext.d.ts +0 -18
- package/dist/types-ts4.5/plugins/card/ui/HyperlinkToolbarAppearance.d.ts +0 -32
- package/dist/types-ts4.5/plugins/card/ui/LayoutButton/index.d.ts +0 -9
- package/dist/types-ts4.5/plugins/card/ui/LayoutButton/styled.d.ts +0 -1
- package/dist/types-ts4.5/plugins/card/ui/LayoutButton/types.d.ts +0 -19
- package/dist/types-ts4.5/plugins/card/ui/LayoutButton/utils.d.ts +0 -5
- package/dist/types-ts4.5/plugins/card/ui/LinkToolbarAppearance.d.ts +0 -29
- package/dist/types-ts4.5/plugins/card/ui/ResizableEmbedCard.d.ts +0 -61
- package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +0 -3
- package/dist/types-ts4.5/plugins/card/utils.d.ts +0 -19
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { isLinkMark } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import { appearanceForNodeType } from '../../utils';
|
|
3
|
-
/**
|
|
4
|
-
* Whether a node is a "link" node, ie inline card, block card, embed card
|
|
5
|
-
* (but not a text node with a link mark)
|
|
6
|
-
*/
|
|
7
|
-
export function isLinkNode(node) {
|
|
8
|
-
return !!appearanceForNodeType(node.type);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Analytics appearance for link object
|
|
13
|
-
*/
|
|
14
|
-
export function appearanceForLink(link) {
|
|
15
|
-
if (link.type === 'node') {
|
|
16
|
-
const appearance = appearanceForNodeType(link.node.type);
|
|
17
|
-
if (appearance) {
|
|
18
|
-
return appearance;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return 'url';
|
|
22
|
-
}
|
|
23
|
-
const nodeHasLinkMark = (schema, node) => {
|
|
24
|
-
if (node.marks) {
|
|
25
|
-
for (let i = 0; i < node.marks.length; i++) {
|
|
26
|
-
const mark = node.marks[i];
|
|
27
|
-
if (isLinkMark(mark, schema)) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Determine if a node is considered to be a link
|
|
37
|
-
*/
|
|
38
|
-
export const isLink = (schema, node) => {
|
|
39
|
-
if (isLinkNode(node)) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return nodeHasLinkMark(schema, node);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Given a node, find all nodes and marks that are considered "links"
|
|
47
|
-
* @param state EditorState
|
|
48
|
-
* @param fragment Fragment to search
|
|
49
|
-
* @returns Array of nodes and marks found in the fragment that are "links"
|
|
50
|
-
*/
|
|
51
|
-
export function findLinksInNode(doc, schema, node, offset) {
|
|
52
|
-
const links = [];
|
|
53
|
-
node.descendants((node, pos) => {
|
|
54
|
-
const nodeContext = getLinkNodeContext(doc, pos);
|
|
55
|
-
|
|
56
|
-
// Nodes
|
|
57
|
-
if (isLinkNode(node)) {
|
|
58
|
-
links.push({
|
|
59
|
-
type: 'node',
|
|
60
|
-
pos: pos + offset,
|
|
61
|
-
node,
|
|
62
|
-
nodeContext
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Marks
|
|
67
|
-
if (node.marks) {
|
|
68
|
-
for (let i = 0; i < node.marks.length; i++) {
|
|
69
|
-
const mark = node.marks[i];
|
|
70
|
-
if (isLinkMark(mark, schema)) {
|
|
71
|
-
links.push({
|
|
72
|
-
type: 'mark',
|
|
73
|
-
pos: pos + offset,
|
|
74
|
-
mark,
|
|
75
|
-
nodeContext
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
return links;
|
|
82
|
-
}
|
|
83
|
-
export function getLinkUrl(link) {
|
|
84
|
-
var _link$mark$attrs;
|
|
85
|
-
if (link.type === 'node') {
|
|
86
|
-
var _link$node$attrs;
|
|
87
|
-
return (_link$node$attrs = link.node.attrs) === null || _link$node$attrs === void 0 ? void 0 : _link$node$attrs.url;
|
|
88
|
-
}
|
|
89
|
-
return (_link$mark$attrs = link.mark.attrs) === null || _link$mark$attrs === void 0 ? void 0 : _link$mark$attrs.href;
|
|
90
|
-
}
|
|
91
|
-
export const getLinkNodeContext = (doc, pos) => {
|
|
92
|
-
const $pos = doc.resolve(pos);
|
|
93
|
-
const maxDepth = 3;
|
|
94
|
-
for (let i = 0; i <= maxDepth; i++) {
|
|
95
|
-
const node = $pos.node($pos.depth - i);
|
|
96
|
-
if (node && node.type.name !== 'paragraph') {
|
|
97
|
-
return node.type.name;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return 'unknown';
|
|
101
|
-
};
|
|
102
|
-
export const linkObjectFromNode = (doc, schema, node, pos) => {
|
|
103
|
-
const nodeContext = getLinkNodeContext(doc, pos);
|
|
104
|
-
if (isLinkNode(node)) {
|
|
105
|
-
return {
|
|
106
|
-
type: 'node',
|
|
107
|
-
pos,
|
|
108
|
-
node,
|
|
109
|
-
nodeContext
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (node.marks) {
|
|
113
|
-
for (let i = 0; i < node.marks.length; i++) {
|
|
114
|
-
const mark = node.marks[i];
|
|
115
|
-
if (isLinkMark(mark, schema)) {
|
|
116
|
-
return {
|
|
117
|
-
type: 'mark',
|
|
118
|
-
pos,
|
|
119
|
-
mark,
|
|
120
|
-
nodeContext
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
export const findLinksAtPositions = (tr, positions) => {
|
|
127
|
-
const schema = tr.doc.type.schema;
|
|
128
|
-
const links = [];
|
|
129
|
-
for (let i = 0; i < positions.length; i++) {
|
|
130
|
-
const pos = positions[i];
|
|
131
|
-
const node = tr.doc.nodeAt(pos);
|
|
132
|
-
if (!node) {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
const link = linkObjectFromNode(tr.doc, schema, node, pos);
|
|
136
|
-
if (!link) {
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
links.push(link);
|
|
140
|
-
}
|
|
141
|
-
return links;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Returns whether or not two sets of links appear to likely be the same set of links
|
|
146
|
-
* That they are in the same order and that both their hrefs and appearances match
|
|
147
|
-
*/
|
|
148
|
-
export const areSameLinks = (linksA, linksB) => {
|
|
149
|
-
if (linksA.length !== linksB.length) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
for (let i = 0; i < linksA.length; i++) {
|
|
153
|
-
const linkA = linksA[i];
|
|
154
|
-
const linkB = linksB[i];
|
|
155
|
-
if (getLinkUrl(linkA) !== getLinkUrl(linkB) || appearanceForLink(linkA) !== appearanceForLink(linkB)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return true;
|
|
160
|
-
};
|
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
import isEqual from 'lodash/isEqual';
|
|
2
|
-
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
3
|
-
import { closeHistory } from 'prosemirror-history';
|
|
4
|
-
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
5
|
-
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
6
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
10
|
-
import { queueCards, resolveCard, hideDatasourceModal } from './actions';
|
|
11
|
-
import { pluginKey } from './plugin-key';
|
|
12
|
-
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
13
|
-
/**
|
|
14
|
-
* Attempt to replace the link into the respective card.
|
|
15
|
-
*/
|
|
16
|
-
function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
17
|
-
const {
|
|
18
|
-
inlineCard
|
|
19
|
-
} = schema.nodes;
|
|
20
|
-
const {
|
|
21
|
-
url
|
|
22
|
-
} = request;
|
|
23
|
-
if (!isSafeUrl(url)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// replace all the outstanding links with their cards
|
|
28
|
-
const pos = tr.mapping.map(request.pos);
|
|
29
|
-
const $pos = tr.doc.resolve(pos);
|
|
30
|
-
const node = tr.doc.nodeAt(pos);
|
|
31
|
-
if (!node || !node.type.isText) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const replaceLink = request.shouldReplaceLink || shouldReplaceLink(node, request.compareLinkText, url);
|
|
35
|
-
if (!replaceLink) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
40
|
-
const nodes = [cardAdf];
|
|
41
|
-
if (cardAdf.type === inlineCard) {
|
|
42
|
-
nodes.push(schema.text(' '));
|
|
43
|
-
}
|
|
44
|
-
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
45
|
-
return $pos.node($pos.depth - 1).type.name;
|
|
46
|
-
}
|
|
47
|
-
export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) => (editorState, dispatch) => {
|
|
48
|
-
const state = pluginKey.getState(editorState);
|
|
49
|
-
if (!state) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// find the requests for this URL
|
|
54
|
-
const requests = state.requests.filter(req => req.url === url);
|
|
55
|
-
|
|
56
|
-
// try to transform response to ADF
|
|
57
|
-
const schema = editorState.schema;
|
|
58
|
-
const cardAdf = processRawValue(schema, cardData);
|
|
59
|
-
let tr = editorState.tr;
|
|
60
|
-
if (cardAdf) {
|
|
61
|
-
// Should prevent any other node than cards? [inlineCard, blockCard].includes(cardAdf.type)
|
|
62
|
-
const nodeContexts = requests.map(request => replaceLinksToCards(tr, cardAdf, schema, request)).filter(context => !!context); // context exist
|
|
63
|
-
|
|
64
|
-
// Send analytics information
|
|
65
|
-
if (nodeContexts.length) {
|
|
66
|
-
const nodeContext = nodeContexts.every(context => context === nodeContexts[0]) ? nodeContexts[0] : 'mixed';
|
|
67
|
-
|
|
68
|
-
/** For block links v1, default to inline links */
|
|
69
|
-
const nodeType = 'inlineCard';
|
|
70
|
-
const [,, domainName] = url.split('/');
|
|
71
|
-
if (state.smartLinkEvents) {
|
|
72
|
-
state.smartLinkEvents.insertSmartLink(domainName, 'inline', createAnalyticsEvent);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* TODO:
|
|
77
|
-
* What if each request has a different source?
|
|
78
|
-
* Unlikely, but need to define behaviour.
|
|
79
|
-
* Ignore analytics event? take first? provide 'mixed' as well?
|
|
80
|
-
*/
|
|
81
|
-
const inputMethod = requests[0].source;
|
|
82
|
-
const sourceEvent = requests[0].sourceEvent;
|
|
83
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
84
|
-
action: analyticsAction || ACTION.INSERTED,
|
|
85
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
86
|
-
actionSubjectId: ACTION_SUBJECT_ID.SMART_LINK,
|
|
87
|
-
eventType: EVENT_TYPE.TRACK,
|
|
88
|
-
attributes: {
|
|
89
|
-
inputMethod,
|
|
90
|
-
nodeType,
|
|
91
|
-
nodeContext: nodeContext,
|
|
92
|
-
fromCurrentDomain: isFromCurrentDomain(url)
|
|
93
|
-
},
|
|
94
|
-
nonPrivacySafeAttributes: {
|
|
95
|
-
domainName
|
|
96
|
-
}
|
|
97
|
-
})(tr);
|
|
98
|
-
addLinkMetadata(editorState.selection, tr, {
|
|
99
|
-
action: analyticsAction,
|
|
100
|
-
inputMethod,
|
|
101
|
-
cardAction: 'RESOLVE',
|
|
102
|
-
sourceEvent
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (dispatch) {
|
|
107
|
-
dispatch(resolveCard(url)(closeHistory(tr)));
|
|
108
|
-
}
|
|
109
|
-
return true;
|
|
110
|
-
};
|
|
111
|
-
export const handleFallbackWithAnalytics = (request, editorAnalyticsApi) => (state, dispatch) => {
|
|
112
|
-
const cardState = pluginKey.getState(state);
|
|
113
|
-
if (!cardState) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
const tr = state.tr;
|
|
117
|
-
if (request.source !== INPUT_METHOD.FLOATING_TB) {
|
|
118
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(request.source, request.url))(tr);
|
|
119
|
-
}
|
|
120
|
-
addLinkMetadata(state.selection, tr, {
|
|
121
|
-
action: request.analyticsAction,
|
|
122
|
-
inputMethod: request.source
|
|
123
|
-
});
|
|
124
|
-
if (dispatch) {
|
|
125
|
-
dispatch(resolveCard(request.url)(tr));
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
};
|
|
129
|
-
export const queueCardsFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined) => {
|
|
130
|
-
const {
|
|
131
|
-
schema
|
|
132
|
-
} = state;
|
|
133
|
-
const {
|
|
134
|
-
link
|
|
135
|
-
} = schema.marks;
|
|
136
|
-
const requests = [];
|
|
137
|
-
nodesBetweenChanged(tr, (node, pos) => {
|
|
138
|
-
if (!node.isText) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
const linkMark = node.marks.find(mark => mark.type === link);
|
|
142
|
-
if (linkMark) {
|
|
143
|
-
if (!shouldReplaceLink(node, normalizeLinkText)) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
requests.push({
|
|
147
|
-
url: linkMark.attrs.href,
|
|
148
|
-
pos,
|
|
149
|
-
appearance: 'inline',
|
|
150
|
-
compareLinkText: normalizeLinkText,
|
|
151
|
-
source,
|
|
152
|
-
analyticsAction,
|
|
153
|
-
sourceEvent
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
});
|
|
158
|
-
if (analyticsAction) {
|
|
159
|
-
addLinkMetadata(state.selection, tr, {
|
|
160
|
-
action: analyticsAction
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return queueCards(requests)(tr);
|
|
164
|
-
};
|
|
165
|
-
export const queueCardFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined, previousAppearance) => {
|
|
166
|
-
const {
|
|
167
|
-
schema
|
|
168
|
-
} = state;
|
|
169
|
-
const {
|
|
170
|
-
link
|
|
171
|
-
} = schema.marks;
|
|
172
|
-
let requests = [];
|
|
173
|
-
nodesBetweenChanged(tr, (node, pos) => {
|
|
174
|
-
if (!node.isText) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
const linkMark = node.marks.find(mark => mark.type === link);
|
|
178
|
-
if (linkMark) {
|
|
179
|
-
if (!shouldReplaceLink(node, normalizeLinkText)) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
requests.push({
|
|
183
|
-
url: linkMark.attrs.href,
|
|
184
|
-
pos,
|
|
185
|
-
appearance: 'inline',
|
|
186
|
-
previousAppearance: previousAppearance,
|
|
187
|
-
compareLinkText: normalizeLinkText,
|
|
188
|
-
source,
|
|
189
|
-
analyticsAction,
|
|
190
|
-
sourceEvent
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
return false;
|
|
194
|
-
});
|
|
195
|
-
addLinkMetadata(state.selection, tr, {
|
|
196
|
-
action: analyticsAction
|
|
197
|
-
});
|
|
198
|
-
return queueCards(requests)(tr);
|
|
199
|
-
};
|
|
200
|
-
export const convertHyperlinkToSmartCard = (state, source, appearance, normalizeLinkText = true) => {
|
|
201
|
-
const {
|
|
202
|
-
schema
|
|
203
|
-
} = state;
|
|
204
|
-
const {
|
|
205
|
-
link
|
|
206
|
-
} = schema.marks;
|
|
207
|
-
const requests = [];
|
|
208
|
-
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
209
|
-
const linkMark = node.marks.find(mark => mark.type === link);
|
|
210
|
-
if (linkMark) {
|
|
211
|
-
requests.push({
|
|
212
|
-
url: linkMark.attrs.href,
|
|
213
|
-
pos,
|
|
214
|
-
appearance,
|
|
215
|
-
previousAppearance: 'url',
|
|
216
|
-
compareLinkText: normalizeLinkText,
|
|
217
|
-
source,
|
|
218
|
-
analyticsAction: ACTION.CHANGED_TYPE,
|
|
219
|
-
shouldReplaceLink: true
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
addLinkMetadata(state.selection, state.tr, {
|
|
224
|
-
action: ACTION.CHANGED_TYPE
|
|
225
|
-
});
|
|
226
|
-
return queueCards(requests)(state.tr);
|
|
227
|
-
};
|
|
228
|
-
export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos, editorAnalyticsApi) => (state, dispatch) => {
|
|
229
|
-
let tr;
|
|
230
|
-
if (node && pos) {
|
|
231
|
-
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
232
|
-
} else {
|
|
233
|
-
tr = cardToLinkWithTransaction(state, text, href);
|
|
234
|
-
}
|
|
235
|
-
const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
236
|
-
if (sendAnalytics) {
|
|
237
|
-
if (selectedNode) {
|
|
238
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
239
|
-
action: ACTION.CHANGED_TYPE,
|
|
240
|
-
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
241
|
-
eventType: EVENT_TYPE.TRACK,
|
|
242
|
-
attributes: {
|
|
243
|
-
newType: SMART_LINK_TYPE.URL,
|
|
244
|
-
previousType: appearanceForNodeType(selectedNode.type)
|
|
245
|
-
}
|
|
246
|
-
})(tr);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (dispatch) {
|
|
250
|
-
dispatch(tr.scrollIntoView());
|
|
251
|
-
}
|
|
252
|
-
return true;
|
|
253
|
-
};
|
|
254
|
-
export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node, pos, editorAnalyticsApi) => (state, dispatch) => {
|
|
255
|
-
let tr;
|
|
256
|
-
if (node && pos) {
|
|
257
|
-
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
258
|
-
} else {
|
|
259
|
-
tr = cardToLinkWithTransaction(state, text, href);
|
|
260
|
-
}
|
|
261
|
-
if (sendAnalytics) {
|
|
262
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
263
|
-
action: ACTION.ERRORED,
|
|
264
|
-
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
265
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
266
|
-
attributes: {
|
|
267
|
-
error: 'Smart card falling back to link.'
|
|
268
|
-
}
|
|
269
|
-
})(tr);
|
|
270
|
-
}
|
|
271
|
-
if (dispatch) {
|
|
272
|
-
dispatch(tr.scrollIntoView());
|
|
273
|
-
}
|
|
274
|
-
return true;
|
|
275
|
-
};
|
|
276
|
-
export const updateCard = (href, sourceEvent) => (state, dispatch) => {
|
|
277
|
-
const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
278
|
-
if (!selectedNode) {
|
|
279
|
-
return false;
|
|
280
|
-
}
|
|
281
|
-
const cardAppearance = selectedCardAppearance(state);
|
|
282
|
-
const tr = cardToLinkWithTransaction(state, href, href);
|
|
283
|
-
queueCardFromChangedTr(state, tr, INPUT_METHOD.MANUAL, ACTION.UPDATED, undefined, sourceEvent, cardAppearance);
|
|
284
|
-
if (dispatch) {
|
|
285
|
-
dispatch(tr.scrollIntoView());
|
|
286
|
-
}
|
|
287
|
-
return true;
|
|
288
|
-
};
|
|
289
|
-
function cardToLinkWithTransaction(state, text, href) {
|
|
290
|
-
const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
291
|
-
if (!selectedNode) {
|
|
292
|
-
return state.tr;
|
|
293
|
-
}
|
|
294
|
-
const {
|
|
295
|
-
link
|
|
296
|
-
} = state.schema.marks;
|
|
297
|
-
const url = selectedNode.attrs.url || selectedNode.attrs.data.url;
|
|
298
|
-
const tr = state.tr.replaceSelectionWith(state.schema.text(text || url, [link.create({
|
|
299
|
-
href: href || url
|
|
300
|
-
})]), false);
|
|
301
|
-
return tr;
|
|
302
|
-
}
|
|
303
|
-
function cardNodeToLinkWithTransaction(state, text, href, node, pos) {
|
|
304
|
-
const {
|
|
305
|
-
link
|
|
306
|
-
} = state.schema.marks;
|
|
307
|
-
const url = node.attrs.url || node.attrs.data.url;
|
|
308
|
-
return state.tr.replaceWith(pos, pos + node.nodeSize, state.schema.text(text || url, [link.create({
|
|
309
|
-
href: href || url
|
|
310
|
-
})]));
|
|
311
|
-
}
|
|
312
|
-
export const changeSelectedCardToText = (text, editorAnalyticsApi) => (state, dispatch) => {
|
|
313
|
-
const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
314
|
-
if (!selectedNode) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
const tr = state.tr.replaceSelectionWith(state.schema.text(text), false);
|
|
318
|
-
if (dispatch) {
|
|
319
|
-
addLinkMetadata(state.selection, tr, {
|
|
320
|
-
action: ACTION.UNLINK
|
|
321
|
-
});
|
|
322
|
-
tr.scrollIntoView();
|
|
323
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(unlinkPayload(ACTION_SUBJECT_ID.CARD_INLINE))(tr);
|
|
324
|
-
dispatch(tr);
|
|
325
|
-
}
|
|
326
|
-
return true;
|
|
327
|
-
};
|
|
328
|
-
export const setSelectedCardAppearance = (appearance, editorAnalyticsApi) => (state, dispatch) => {
|
|
329
|
-
var _previousNode$type;
|
|
330
|
-
const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
331
|
-
if (!selectedNode) {
|
|
332
|
-
// When there is no selected node, we insert a new one
|
|
333
|
-
// and replace the existing blue link
|
|
334
|
-
const tr = convertHyperlinkToSmartCard(state, INPUT_METHOD.FLOATING_TB, appearance);
|
|
335
|
-
if (dispatch) {
|
|
336
|
-
addLinkMetadata(state.selection, tr, {
|
|
337
|
-
action: ACTION.CHANGED_TYPE
|
|
338
|
-
});
|
|
339
|
-
dispatch(tr.scrollIntoView());
|
|
340
|
-
}
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
if (appearanceForNodeType(selectedNode.type) === appearance) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
const isEmbed = appearance === 'embed';
|
|
347
|
-
const attrs = isEmbed ? {
|
|
348
|
-
...selectedNode.attrs,
|
|
349
|
-
layout: 'center'
|
|
350
|
-
} : selectedNode.attrs;
|
|
351
|
-
const {
|
|
352
|
-
from,
|
|
353
|
-
to
|
|
354
|
-
} = state.selection;
|
|
355
|
-
const nodeType = getLinkNodeType(appearance, state.schema.nodes);
|
|
356
|
-
const tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
|
|
357
|
-
|
|
358
|
-
// When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
|
|
359
|
-
if (tr.doc.nodeSize - 2 === to) {
|
|
360
|
-
tr.insertText(' ', to);
|
|
361
|
-
}
|
|
362
|
-
tr.setSelection(TextSelection.create(tr.doc, to + 1));
|
|
363
|
-
const previousNodePos = from - 1 > 0 ? from - 1 : 0;
|
|
364
|
-
const previousNode = tr.doc.nodeAt(previousNodePos);
|
|
365
|
-
if ((previousNode === null || previousNode === void 0 ? void 0 : (_previousNode$type = previousNode.type) === null || _previousNode$type === void 0 ? void 0 : _previousNode$type.name) === 'paragraph') {
|
|
366
|
-
tr.delete(previousNodePos, from);
|
|
367
|
-
}
|
|
368
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
369
|
-
action: ACTION.CHANGED_TYPE,
|
|
370
|
-
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
371
|
-
eventType: EVENT_TYPE.TRACK,
|
|
372
|
-
attributes: {
|
|
373
|
-
newType: appearance,
|
|
374
|
-
previousType: appearanceForNodeType(selectedNode.type)
|
|
375
|
-
}
|
|
376
|
-
})(tr);
|
|
377
|
-
addLinkMetadata(state.selection, tr, {
|
|
378
|
-
action: ACTION.CHANGED_TYPE
|
|
379
|
-
});
|
|
380
|
-
if (dispatch) {
|
|
381
|
-
dispatch(tr.scrollIntoView());
|
|
382
|
-
}
|
|
383
|
-
return true;
|
|
384
|
-
};
|
|
385
|
-
const getLinkNodeType = (appearance, linkNodes) => {
|
|
386
|
-
switch (appearance) {
|
|
387
|
-
case 'inline':
|
|
388
|
-
return linkNodes.inlineCard;
|
|
389
|
-
case 'block':
|
|
390
|
-
return linkNodes.blockCard;
|
|
391
|
-
case 'embed':
|
|
392
|
-
return linkNodes.embedCard;
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
// Apply an update to a datasource (aka blockCard) node
|
|
397
|
-
export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
398
|
-
const {
|
|
399
|
-
tr,
|
|
400
|
-
selection: {
|
|
401
|
-
from
|
|
402
|
-
},
|
|
403
|
-
schema: {
|
|
404
|
-
nodes: schemaNodes
|
|
405
|
-
}
|
|
406
|
-
} = state;
|
|
407
|
-
|
|
408
|
-
// datasource to datasource
|
|
409
|
-
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
410
|
-
var _ref, _ref2, _newViews$properties, _oldViews$properties, _newAdf$attrs, _node$attrs;
|
|
411
|
-
const [newViews] = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
412
|
-
const [oldViews] = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
413
|
-
const newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(column => column.key);
|
|
414
|
-
const oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(column => column.key);
|
|
415
|
-
const isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
|
|
416
|
-
const isUrlChange = ((_newAdf$attrs = newAdf.attrs) === null || _newAdf$attrs === void 0 ? void 0 : _newAdf$attrs.url) !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url);
|
|
417
|
-
if (isColumnChange || isUrlChange) {
|
|
418
|
-
tr.setNodeMarkup(from, schemaNodes.blockCard, {
|
|
419
|
-
...node.attrs,
|
|
420
|
-
...newAdf.attrs
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
} else if (newAdf.type === 'inlineCard') {
|
|
424
|
-
// datasource to inline
|
|
425
|
-
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
426
|
-
}
|
|
427
|
-
hideDatasourceModal(tr);
|
|
428
|
-
view.dispatch(tr.scrollIntoView());
|
|
429
|
-
};
|
|
430
|
-
export const insertDatasource = (state, adf, view) => {
|
|
431
|
-
const {
|
|
432
|
-
tr,
|
|
433
|
-
selection: {
|
|
434
|
-
from
|
|
435
|
-
},
|
|
436
|
-
schema: {
|
|
437
|
-
nodes: schemaNodes
|
|
438
|
-
}
|
|
439
|
-
} = state;
|
|
440
|
-
const {
|
|
441
|
-
attrs,
|
|
442
|
-
type
|
|
443
|
-
} = adf;
|
|
444
|
-
const schemaNode = type === 'inlineCard' ? schemaNodes.inlineCard : schemaNodes.blockCard;
|
|
445
|
-
const newNode = schemaNode.createChecked(attrs);
|
|
446
|
-
// in future, if we decide to do datasource insertion from the main toolbar, we should probably consider editor-plugin-content-insertion instead of tr.insert
|
|
447
|
-
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
448
|
-
newNode && tr.insert(from, newNode);
|
|
449
|
-
hideDatasourceModal(tr);
|
|
450
|
-
view.dispatch(tr.scrollIntoView());
|
|
451
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { keymap } from 'prosemirror-keymap';
|
|
2
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
3
|
-
import { bindKeymapWithCommand, moveDown, moveUp } from '@atlaskit/editor-common/keymaps';
|
|
4
|
-
import { findChildren, flatten } from 'prosemirror-utils';
|
|
5
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
6
|
-
const lookupPixel = 10;
|
|
7
|
-
const getClosestInlineCardPos = (state, editorView, direction) => {
|
|
8
|
-
var _editorView$posAtCoor;
|
|
9
|
-
const {
|
|
10
|
-
selection
|
|
11
|
-
} = state;
|
|
12
|
-
const {
|
|
13
|
-
parent
|
|
14
|
-
} = selection.$from;
|
|
15
|
-
const inlineCardType = state.schema.nodes.inlineCard;
|
|
16
|
-
if (!flatten(parent, false).some(({
|
|
17
|
-
node
|
|
18
|
-
}) => node.type === inlineCardType)) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
const coord = editorView.coordsAtPos(selection.$anchor.pos);
|
|
22
|
-
const nearPos = (_editorView$posAtCoor = editorView.posAtCoords({
|
|
23
|
-
left: coord.left,
|
|
24
|
-
top: direction === 'up' ? coord.top - lookupPixel : coord.bottom + lookupPixel
|
|
25
|
-
})) === null || _editorView$posAtCoor === void 0 ? void 0 : _editorView$posAtCoor.pos;
|
|
26
|
-
if (nearPos) {
|
|
27
|
-
const newNode = state.doc.nodeAt(nearPos);
|
|
28
|
-
if (newNode) {
|
|
29
|
-
if (newNode.type !== inlineCardType || findChildren(parent, node => node === newNode, false).length === 0 || newNode === selection.node) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return nearPos;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
};
|
|
37
|
-
const selectAboveBelowInlineCard = direction => {
|
|
38
|
-
return (state, dispatch, editorView) => {
|
|
39
|
-
if (!editorView || !dispatch) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const pos = getClosestInlineCardPos(state, editorView, direction);
|
|
43
|
-
if (pos) {
|
|
44
|
-
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export function cardKeymap(featureFlags) {
|
|
51
|
-
const list = {};
|
|
52
|
-
|
|
53
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
|
|
54
|
-
if (browser.chrome && browser.chrome_version > 90 && featureFlags.chromeCursorHandlerFixedVersion && browser.chrome_version < featureFlags.chromeCursorHandlerFixedVersion) {
|
|
55
|
-
bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
|
|
56
|
-
bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
|
|
57
|
-
}
|
|
58
|
-
return keymap(list);
|
|
59
|
-
}
|