@atlaskit/editor-core 185.16.3 → 185.16.6
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 +14 -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/expand/commands.js +15 -12
- package/dist/cjs/plugins/expand/nodeviews/index.js +4 -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/expand/commands.js +13 -14
- package/dist/es2019/plugins/expand/nodeviews/index.js +4 -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/expand/commands.js +16 -13
- package/dist/esm/plugins/expand/nodeviews/index.js +4 -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/expand/commands.d.ts +1 -1
- 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/expand/commands.d.ts +1 -1
- 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,208 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
3
|
-
import rafSchedule from 'raf-schd';
|
|
4
|
-
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
5
|
-
import { BlockCard } from '../nodeviews/blockCard';
|
|
6
|
-
import { EmbedCard } from '../nodeviews/embedCard';
|
|
7
|
-
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
8
|
-
import { pluginKey } from './plugin-key';
|
|
9
|
-
import reducer from './reducers';
|
|
10
|
-
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
11
|
-
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
12
|
-
import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
|
|
13
|
-
import { Datasource } from '../nodeviews/datasource';
|
|
14
|
-
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
15
|
-
import { setDatasourceTableRef, setCardLayoutAndDatasourceTableRef } from './actions';
|
|
16
|
-
import { findDomRefAtPos } from 'prosemirror-utils';
|
|
17
|
-
export { pluginKey } from './plugin-key';
|
|
18
|
-
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
19
|
-
export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryParams => {
|
|
20
|
-
const {
|
|
21
|
-
lpAnalyticsEventsNext
|
|
22
|
-
} = pmPluginFactoryParams.featureFlags;
|
|
23
|
-
const analyticsQueue = createAnalyticsQueue(!!lpAnalyticsEventsNext);
|
|
24
|
-
const {
|
|
25
|
-
editorAppearance,
|
|
26
|
-
platform,
|
|
27
|
-
allowResizing,
|
|
28
|
-
useAlternativePreloader,
|
|
29
|
-
fullWidthMode,
|
|
30
|
-
showServerActions
|
|
31
|
-
} = options;
|
|
32
|
-
const inlineCardViewProducer = getInlineNodeViewProducer({
|
|
33
|
-
pmPluginFactoryParams,
|
|
34
|
-
Component: InlineCardNodeView,
|
|
35
|
-
extraComponentProps: {
|
|
36
|
-
useAlternativePreloader,
|
|
37
|
-
showServerActions
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return new SafePlugin({
|
|
41
|
-
state: {
|
|
42
|
-
init() {
|
|
43
|
-
return {
|
|
44
|
-
requests: [],
|
|
45
|
-
provider: null,
|
|
46
|
-
cards: [],
|
|
47
|
-
showLinkingToolbar: false,
|
|
48
|
-
smartLinkEvents: undefined,
|
|
49
|
-
smartLinkEventsNext: undefined,
|
|
50
|
-
editorAppearance,
|
|
51
|
-
showDatasourceModal: false,
|
|
52
|
-
datasourceModalType: undefined,
|
|
53
|
-
datasourceTableRef: undefined,
|
|
54
|
-
layout: undefined
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
apply(tr, pluginState, prevEditorState) {
|
|
58
|
-
// Update all the positions of outstanding requests and
|
|
59
|
-
// cards in the plugin state.
|
|
60
|
-
const pluginStateWithUpdatedPos = getPluginStateWithUpdatedPos(pluginState, tr);
|
|
61
|
-
|
|
62
|
-
// apply any actions
|
|
63
|
-
const meta = tr.getMeta(pluginKey);
|
|
64
|
-
const events = eventsFromTransaction(tr, prevEditorState);
|
|
65
|
-
analyticsQueue.push(...events);
|
|
66
|
-
if (meta) {
|
|
67
|
-
const nextState = reducer(pluginStateWithUpdatedPos, meta);
|
|
68
|
-
if (!pluginState.smartLinkEventsNext && nextState.smartLinkEventsNext) {
|
|
69
|
-
analyticsQueue.setCallbacks(nextState.smartLinkEventsNext);
|
|
70
|
-
}
|
|
71
|
-
return nextState;
|
|
72
|
-
}
|
|
73
|
-
return pluginStateWithUpdatedPos;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
view(view) {
|
|
77
|
-
const subscriptionHandler = (name, provider) => handleProvider(name, provider, view);
|
|
78
|
-
const domAtPos = view.domAtPos.bind(view);
|
|
79
|
-
const rafCancellationCallbacks = [];
|
|
80
|
-
pmPluginFactoryParams.providerFactory.subscribe('cardProvider', subscriptionHandler);
|
|
81
|
-
return {
|
|
82
|
-
update(view, prevState) {
|
|
83
|
-
var _selection$node;
|
|
84
|
-
const currentState = getPluginState(view.state);
|
|
85
|
-
const oldState = getPluginState(prevState);
|
|
86
|
-
const {
|
|
87
|
-
state,
|
|
88
|
-
dispatch
|
|
89
|
-
} = view;
|
|
90
|
-
const {
|
|
91
|
-
selection,
|
|
92
|
-
tr,
|
|
93
|
-
schema
|
|
94
|
-
} = state;
|
|
95
|
-
const isBlockCardSelected = selection instanceof NodeSelection && ((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type) === schema.nodes.blockCard;
|
|
96
|
-
if (isBlockCardSelected) {
|
|
97
|
-
var _findDomRefAtPos, _node$attrs;
|
|
98
|
-
const datasourceTableRef = (_findDomRefAtPos = findDomRefAtPos(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(`.${DATASOURCE_INNER_CONTAINER_CLASSNAME}`);
|
|
99
|
-
const {
|
|
100
|
-
node
|
|
101
|
-
} = selection;
|
|
102
|
-
const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource);
|
|
103
|
-
const shouldUpdateTableRef = datasourceTableRef && (currentState === null || currentState === void 0 ? void 0 : currentState.datasourceTableRef) !== datasourceTableRef;
|
|
104
|
-
if (isDatasource && shouldUpdateTableRef) {
|
|
105
|
-
var _node$attrs2;
|
|
106
|
-
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
107
|
-
const layout = (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
|
|
108
|
-
|
|
109
|
-
// we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
|
|
110
|
-
dispatch(setCardLayoutAndDatasourceTableRef({
|
|
111
|
-
datasourceTableRef,
|
|
112
|
-
layout
|
|
113
|
-
})(tr));
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
if (currentState !== null && currentState !== void 0 && currentState.datasourceTableRef) {
|
|
117
|
-
dispatch(setDatasourceTableRef(undefined)(tr));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (currentState && currentState.provider) {
|
|
121
|
-
// Find requests in this state that weren't in the old one.
|
|
122
|
-
const newRequests = getNewRequests(oldState, currentState);
|
|
123
|
-
// Ask the CardProvider to resolve all new requests.
|
|
124
|
-
const {
|
|
125
|
-
provider
|
|
126
|
-
} = currentState;
|
|
127
|
-
newRequests.forEach(request => {
|
|
128
|
-
/**
|
|
129
|
-
* Queue each asynchronous resolve request on separate frames.
|
|
130
|
-
* ---
|
|
131
|
-
* NB: The promise for each request is queued to take place on separate animation frames. This avoids
|
|
132
|
-
* the scenario debugged and discovered in EDM-668, wherein the queuing of too many promises in quick succession
|
|
133
|
-
* leads to the browser's macrotask queue being overwhelmed, locking interactivity of the browser tab.
|
|
134
|
-
* By using this approach, the browser is free to schedule the resolution of the promises below in between rendering/network/
|
|
135
|
-
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
136
|
-
*/
|
|
137
|
-
const invoke = rafSchedule(() => {
|
|
138
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
139
|
-
return resolveWithProvider(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.sharedState.currentState()) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.createAnalyticsEvent) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : undefined);
|
|
140
|
-
});
|
|
141
|
-
rafCancellationCallbacks.push(invoke.cancel);
|
|
142
|
-
invoke();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
analyticsQueue.flush();
|
|
146
|
-
},
|
|
147
|
-
destroy() {
|
|
148
|
-
// Cancel any outstanding raf callbacks.
|
|
149
|
-
rafCancellationCallbacks.forEach(cancellationCallback => cancellationCallback());
|
|
150
|
-
pmPluginFactoryParams.providerFactory.unsubscribe('cardProvider', subscriptionHandler);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
},
|
|
154
|
-
props: {
|
|
155
|
-
nodeViews: {
|
|
156
|
-
inlineCard: inlineCardViewProducer,
|
|
157
|
-
blockCard: (node, view, getPos, decorations) => {
|
|
158
|
-
var _node$attrs3;
|
|
159
|
-
const {
|
|
160
|
-
portalProviderAPI,
|
|
161
|
-
eventDispatcher
|
|
162
|
-
} = pmPluginFactoryParams;
|
|
163
|
-
const reactComponentProps = {
|
|
164
|
-
platform,
|
|
165
|
-
showServerActions
|
|
166
|
-
};
|
|
167
|
-
const hasIntlContext = true;
|
|
168
|
-
const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
169
|
-
if (isDatasource) {
|
|
170
|
-
var _node$attrs4, _node$attrs4$datasour;
|
|
171
|
-
if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
|
|
172
|
-
return new Datasource({
|
|
173
|
-
node,
|
|
174
|
-
view,
|
|
175
|
-
getPos,
|
|
176
|
-
portalProviderAPI,
|
|
177
|
-
eventDispatcher,
|
|
178
|
-
hasIntlContext,
|
|
179
|
-
pluginInjectionApi
|
|
180
|
-
}).init();
|
|
181
|
-
} else {
|
|
182
|
-
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
186
|
-
},
|
|
187
|
-
embedCard: (node, view, getPos) => {
|
|
188
|
-
const {
|
|
189
|
-
portalProviderAPI,
|
|
190
|
-
eventDispatcher,
|
|
191
|
-
dispatchAnalyticsEvent
|
|
192
|
-
} = pmPluginFactoryParams;
|
|
193
|
-
const reactComponentProps = {
|
|
194
|
-
eventDispatcher,
|
|
195
|
-
allowResizing,
|
|
196
|
-
platform,
|
|
197
|
-
fullWidthMode,
|
|
198
|
-
dispatchAnalyticsEvent,
|
|
199
|
-
pluginInjectionApi
|
|
200
|
-
};
|
|
201
|
-
const hasIntlContext = true;
|
|
202
|
-
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
key: pluginKey
|
|
207
|
-
});
|
|
208
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { HyperlinkToolbarAppearance } from '../ui/HyperlinkToolbarAppearance';
|
|
4
|
-
export const mountHyperlinkPlugin = (pluginInjectionApi, options) => {
|
|
5
|
-
return new SafePlugin({
|
|
6
|
-
view(editorView) {
|
|
7
|
-
requestAnimationFrame(() => {
|
|
8
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2;
|
|
9
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.hyperlink) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.actions) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.prependToolbarButtons({
|
|
10
|
-
items: (state, intl, providerFactory, link) => [{
|
|
11
|
-
type: 'custom',
|
|
12
|
-
fallback: [],
|
|
13
|
-
render: editorView => {
|
|
14
|
-
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
15
|
-
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearance, {
|
|
16
|
-
key: "link-appearance",
|
|
17
|
-
url: link,
|
|
18
|
-
intl: intl,
|
|
19
|
-
editorView: editorView,
|
|
20
|
-
editorState: state,
|
|
21
|
-
cardOptions: options,
|
|
22
|
-
providerFactory: providerFactory,
|
|
23
|
-
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
24
|
-
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d3 = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.actions,
|
|
25
|
-
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies.card) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}],
|
|
29
|
-
onEscapeCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions.hideLinkToolbar,
|
|
30
|
-
onInsertLinkCallback: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions.queueCardsFromChangedTr,
|
|
31
|
-
view: editorView
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
return {};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
const queue = (state, action) => {
|
|
2
|
-
return {
|
|
3
|
-
...state,
|
|
4
|
-
requests: state.requests.concat(action.requests)
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
const resolve = (state, action) => {
|
|
8
|
-
const requests = state.requests.reduce((requests, request) => {
|
|
9
|
-
if (request.url !== action.url) {
|
|
10
|
-
requests.push(request);
|
|
11
|
-
}
|
|
12
|
-
return requests;
|
|
13
|
-
}, []);
|
|
14
|
-
return {
|
|
15
|
-
...state,
|
|
16
|
-
requests
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
const register = (state, action) => {
|
|
20
|
-
return {
|
|
21
|
-
...state,
|
|
22
|
-
cards: state.cards.filter(card => card.pos !== action.info.pos).concat(action.info)
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const setProvider = (state, action) => {
|
|
26
|
-
return {
|
|
27
|
-
...state,
|
|
28
|
-
provider: action.provider
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
const setCardLayout = (state, action) => {
|
|
32
|
-
return {
|
|
33
|
-
...state,
|
|
34
|
-
layout: action.layout
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const setDatasourceTableRef = (state, action) => {
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
40
|
-
datasourceTableRef: action.datasourceTableRef
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const setCardLayoutDatasourceTableRef = (state, action) => {
|
|
44
|
-
return {
|
|
45
|
-
...state,
|
|
46
|
-
datasourceTableRef: action.datasourceTableRef,
|
|
47
|
-
layout: action.layout
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const registerEvents = (state, action) => {
|
|
51
|
-
return {
|
|
52
|
-
...state,
|
|
53
|
-
smartLinkEvents: action.smartLinkEvents
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
const registerEventsNext = (state, action) => {
|
|
57
|
-
return {
|
|
58
|
-
...state,
|
|
59
|
-
smartLinkEventsNext: action.smartLinkEvents
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
const setLinkToolbar = (state, action) => {
|
|
63
|
-
return {
|
|
64
|
-
...state,
|
|
65
|
-
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
const showDatasourceModal = (state, action) => {
|
|
69
|
-
return {
|
|
70
|
-
...state,
|
|
71
|
-
showDatasourceModal: true,
|
|
72
|
-
datasourceModalType: action.type === 'SHOW_DATASOURCE_MODAL' ? action.modalType : undefined
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const hideDatasourceModal = state => {
|
|
76
|
-
return {
|
|
77
|
-
...state,
|
|
78
|
-
showDatasourceModal: false,
|
|
79
|
-
datasourceModalType: undefined
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
export default ((state, action) => {
|
|
83
|
-
switch (action.type) {
|
|
84
|
-
case 'QUEUE':
|
|
85
|
-
return queue(state, action);
|
|
86
|
-
case 'SET_PROVIDER':
|
|
87
|
-
return setProvider(state, action);
|
|
88
|
-
case 'RESOLVE':
|
|
89
|
-
return resolve(state, action);
|
|
90
|
-
case 'REGISTER':
|
|
91
|
-
return register(state, action);
|
|
92
|
-
case 'REGISTER_EVENTS':
|
|
93
|
-
return registerEvents(state, action);
|
|
94
|
-
case 'REGISTER_EVENTS_NEXT':
|
|
95
|
-
return registerEventsNext(state, action);
|
|
96
|
-
case 'SET_DATASOURCE_TABLE_REF':
|
|
97
|
-
return setDatasourceTableRef(state, action);
|
|
98
|
-
case 'SET_CARD_LAYOUT':
|
|
99
|
-
return setCardLayout(state, action);
|
|
100
|
-
case 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF':
|
|
101
|
-
return setCardLayoutDatasourceTableRef(state, action);
|
|
102
|
-
case 'SHOW_LINK_TOOLBAR':
|
|
103
|
-
case 'HIDE_LINK_TOOLBAR':
|
|
104
|
-
return setLinkToolbar(state, action);
|
|
105
|
-
case 'SHOW_DATASOURCE_MODAL':
|
|
106
|
-
return showDatasourceModal(state, action);
|
|
107
|
-
case 'HIDE_DATASOURCE_MODAL':
|
|
108
|
-
return hideDatasourceModal(state);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { normalizeUrl } from '@atlaskit/adf-schema';
|
|
2
|
-
import { md } from '@atlaskit/editor-common/paste';
|
|
3
|
-
export function shouldReplaceLink(node, compareLinkText = true, compareToUrl) {
|
|
4
|
-
const linkMark = node.marks.find(mark => mark.type.name === 'link');
|
|
5
|
-
if (!linkMark) {
|
|
6
|
-
// not a link anymore
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// ED-6041: compare normalised link text after linkfy from Markdown transformer
|
|
11
|
-
// instead, since it always decodes URL ('%20' -> ' ') on the link text
|
|
12
|
-
|
|
13
|
-
const normalisedHref = normalizeUrl(md.normalizeLinkText(linkMark.attrs.href));
|
|
14
|
-
const normalizedLinkText = normalizeUrl(md.normalizeLinkText(node.text || ''));
|
|
15
|
-
if (compareLinkText && normalisedHref !== normalizedLinkText) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (compareToUrl) {
|
|
19
|
-
const normalizedUrl = normalizeUrl(md.normalizeLinkText(compareToUrl));
|
|
20
|
-
if (normalizedUrl !== normalisedHref) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { setProvider } from '../actions';
|
|
2
|
-
import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
|
|
3
|
-
// ============================================================================ //
|
|
4
|
-
// ============================== PROVIDER UTILS ============================== //
|
|
5
|
-
// ============================================================================ //
|
|
6
|
-
// Used for all interactions with the EditorCardProvider.
|
|
7
|
-
// ============================================================================ //
|
|
8
|
-
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) => {
|
|
9
|
-
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
10
|
-
let shouldForceAppearance =
|
|
11
|
-
// This flag is set to true only in one place atm:
|
|
12
|
-
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
13
|
-
// Which is used when user switching from URL to smart link appearance.
|
|
14
|
-
!!request.shouldReplaceLink;
|
|
15
|
-
const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
16
|
-
return handleResolve;
|
|
17
|
-
};
|
|
18
|
-
const updateCardType = (resolvedCard, options) => {
|
|
19
|
-
if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
|
|
20
|
-
// clean out the 'layout' attr from an embedCard type that should be transformed into the inlineCard type.
|
|
21
|
-
if (resolvedCard.type === 'embedCard') {
|
|
22
|
-
delete resolvedCard.attrs.layout;
|
|
23
|
-
}
|
|
24
|
-
resolvedCard.type = 'inlineCard';
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const handleResolved = (view, request, editorAnalyticsApi, createAnalyticsEvent, options) => resolvedCard => {
|
|
28
|
-
updateCardType(resolvedCard, options);
|
|
29
|
-
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
|
|
30
|
-
return resolvedCard;
|
|
31
|
-
};
|
|
32
|
-
const handleRejected = (view, request, editorAnalyticsApi) => () => {
|
|
33
|
-
handleFallbackWithAnalytics(request, editorAnalyticsApi)(view.state, view.dispatch);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// listen for card provider changes
|
|
37
|
-
export const handleProvider = (_, provider, view) => {
|
|
38
|
-
if (!provider) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
provider.then(cardProvider => {
|
|
42
|
-
const {
|
|
43
|
-
state,
|
|
44
|
-
dispatch
|
|
45
|
-
} = view;
|
|
46
|
-
dispatch(setProvider(cardProvider)(state.tr));
|
|
47
|
-
});
|
|
48
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { pluginKey } from '../plugin-key';
|
|
2
|
-
|
|
3
|
-
// ============================================================================ //
|
|
4
|
-
// ============================== PLUGIN STATE ================================ //
|
|
5
|
-
// ============================================================================ //
|
|
6
|
-
// Used for interactions with the Card Plugin's state.
|
|
7
|
-
// ============================================================================ //
|
|
8
|
-
export const getPluginState = editorState => pluginKey.getState(editorState);
|
|
9
|
-
export const getPluginStateWithUpdatedPos = (pluginState, tr) => ({
|
|
10
|
-
...pluginState,
|
|
11
|
-
requests: pluginState.requests.map(request => ({
|
|
12
|
-
...request,
|
|
13
|
-
pos: tr.mapping.map(request.pos)
|
|
14
|
-
})),
|
|
15
|
-
cards: pluginState.cards.map(card => ({
|
|
16
|
-
...card,
|
|
17
|
-
pos: tr.mapping.map(card.pos)
|
|
18
|
-
}))
|
|
19
|
-
});
|
|
20
|
-
export const getNewRequests = (oldState, currentState) => {
|
|
21
|
-
if (oldState) {
|
|
22
|
-
return currentState.requests.filter(req => !oldState.requests.find(oldReq => isSameRequest(oldReq, req)));
|
|
23
|
-
}
|
|
24
|
-
return currentState.requests;
|
|
25
|
-
};
|
|
26
|
-
const isSameRequest = (requestA, requestB) => requestA.url === requestB.url && requestA.pos === requestB.pos;
|