@atlaskit/editor-core 185.14.3 → 185.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/annotation/commands/transform.js +1 -1
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +3 -3
- package/dist/cjs/plugins/block-type/index.js +3 -3
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +6 -6
- package/dist/cjs/plugins/block-type/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/card/pm-plugins/mountHyperlink.js +1 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +72 -14
- package/dist/cjs/plugins/code-block/index.js +2 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +9 -9
- package/dist/cjs/plugins/date/index.js +2 -2
- package/dist/cjs/plugins/{hyperlink → deprecated-hyperlink}/commands.js +60 -119
- package/dist/cjs/plugins/emoji/index.js +2 -2
- package/dist/cjs/plugins/emoji/pm-plugins/ascii-input-rules.js +2 -3
- package/dist/cjs/plugins/expand/index.js +2 -2
- package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Input.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -2
- package/dist/cjs/plugins/image-upload/pm-plugins/input-rule.js +3 -3
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/index.js +98 -48
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +40 -36
- package/dist/cjs/plugins/layout/index.js +2 -2
- package/dist/cjs/plugins/layout/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/list/actions/conversions.js +3 -3
- package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +3 -3
- package/dist/cjs/plugins/list/commands/index.js +5 -4
- package/dist/cjs/plugins/list/index.js +3 -3
- package/dist/cjs/plugins/list/pm-plugins/input-rules/index.js +2 -2
- package/dist/cjs/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +2 -2
- package/dist/cjs/plugins/list/utils/selection.js +4 -4
- package/dist/cjs/plugins/media/index.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -2
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +5 -7
- package/dist/cjs/plugins/mentions/index.js +2 -2
- package/dist/cjs/plugins/panel/index.js +7 -8
- package/dist/cjs/plugins/paste/handlers.js +1 -2
- package/dist/cjs/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +2 -2
- package/dist/cjs/plugins/rule/index.js +2 -2
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +3 -4
- package/dist/cjs/plugins/status/index.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/index.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/input-rules.js +2 -3
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +11 -10
- package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +3 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +1 -1
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +8 -8
- package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +1 -1
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +5 -4
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +2 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +3 -4
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +12 -11
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +9 -9
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +2 -2
- package/dist/cjs/utils/array.js +0 -8
- package/dist/cjs/utils/commands.js +5 -19
- package/dist/cjs/utils/index.js +0 -10
- package/dist/cjs/utils/input-rules.js +13 -73
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +14 -3
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/annotation/commands/transform.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/index.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -2
- package/dist/es2019/plugins/block-type/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/card/pm-plugins/mountHyperlink.js +1 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +64 -3
- package/dist/es2019/plugins/code-block/index.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/date/index.js +1 -1
- package/dist/es2019/plugins/{hyperlink → deprecated-hyperlink}/commands.js +48 -100
- package/dist/es2019/plugins/emoji/index.js +1 -1
- package/dist/es2019/plugins/emoji/pm-plugins/ascii-input-rules.js +1 -1
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Input.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
- package/dist/es2019/plugins/image-upload/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +102 -52
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -6
- package/dist/es2019/plugins/layout/index.js +1 -1
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/actions/conversions.js +1 -1
- package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +1 -1
- package/dist/es2019/plugins/list/commands/index.js +2 -1
- package/dist/es2019/plugins/list/index.js +1 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/index.js +1 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +1 -1
- package/dist/es2019/plugins/list/utils/selection.js +1 -1
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +2 -3
- package/dist/es2019/plugins/mentions/index.js +1 -1
- package/dist/es2019/plugins/panel/index.js +2 -2
- package/dist/es2019/plugins/paste/handlers.js +1 -2
- package/dist/es2019/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +1 -1
- package/dist/es2019/plugins/rule/index.js +1 -1
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/status/index.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +2 -1
- package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +2 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +3 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +3 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +2 -2
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +1 -1
- package/dist/es2019/ui/ContentStyles/index.js +6 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/es2019/utils/array.js +0 -5
- package/dist/es2019/utils/commands.js +2 -13
- package/dist/es2019/utils/index.js +0 -5
- package/dist/es2019/utils/input-rules.js +1 -59
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +14 -3
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/annotation/commands/transform.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/index.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -2
- package/dist/esm/plugins/block-type/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/card/pm-plugins/mountHyperlink.js +1 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +69 -13
- package/dist/esm/plugins/code-block/index.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/date/index.js +1 -1
- package/dist/esm/plugins/{hyperlink → deprecated-hyperlink}/commands.js +48 -100
- package/dist/esm/plugins/emoji/index.js +1 -1
- package/dist/esm/plugins/emoji/pm-plugins/ascii-input-rules.js +1 -1
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Input.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
- package/dist/esm/plugins/image-upload/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +94 -44
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +38 -34
- package/dist/esm/plugins/layout/index.js +1 -1
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/actions/conversions.js +1 -1
- package/dist/esm/plugins/list/actions/indent-list-items-selected.js +1 -1
- package/dist/esm/plugins/list/commands/index.js +2 -1
- package/dist/esm/plugins/list/index.js +1 -1
- package/dist/esm/plugins/list/pm-plugins/input-rules/index.js +1 -1
- package/dist/esm/plugins/list/pm-plugins/input-rules/wrapping-join-rule.js +1 -1
- package/dist/esm/plugins/list/utils/selection.js +1 -1
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -3
- package/dist/esm/plugins/mentions/index.js +1 -1
- package/dist/esm/plugins/panel/index.js +2 -2
- package/dist/esm/plugins/paste/handlers.js +1 -2
- package/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js +1 -1
- package/dist/esm/plugins/rule/index.js +1 -1
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/status/index.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +2 -1
- package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +2 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +3 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +3 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +2 -2
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +4 -3
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -1
- package/dist/esm/utils/array.js +0 -7
- package/dist/esm/utils/commands.js +2 -15
- package/dist/esm/utils/index.js +0 -9
- package/dist/esm/utils/input-rules.js +10 -68
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +16 -5
- package/dist/types/labs/next/presets/cxhtml.d.ts +8 -2
- package/dist/types/labs/next/presets/default.d.ts +16 -4
- package/dist/types/labs/next/presets/mobile.d.ts +8 -2
- package/dist/types/plugins/annotation/commands/transform.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -1
- package/dist/types/plugins/block-type/types.d.ts +1 -3
- package/dist/types/plugins/card/index.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +5 -0
- package/dist/types/plugins/deprecated-hyperlink/commands.d.ts +38 -0
- package/dist/types/plugins/find-replace/commands.d.ts +4 -4
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +4 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +2 -4
- package/dist/types/plugins/list/pm-plugins/input-rules/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/MediaLinkingToolbar.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +2 -3
- package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +1 -1
- package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +1 -0
- package/dist/types/utils/array.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +2 -5
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/input-rules.d.ts +1 -8
- package/dist/types-ts4.5/index.d.ts +16 -5
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +8 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +16 -4
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +8 -2
- package/dist/types-ts4.5/plugins/annotation/commands/transform.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/types.d.ts +1 -3
- package/dist/types-ts4.5/plugins/card/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +5 -0
- package/dist/types-ts4.5/plugins/deprecated-hyperlink/commands.d.ts +38 -0
- package/dist/types-ts4.5/plugins/find-replace/commands.d.ts +4 -4
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +2 -4
- package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/MediaLinkingToolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +2 -3
- package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +1 -0
- package/dist/types-ts4.5/utils/array.d.ts +0 -1
- package/dist/types-ts4.5/utils/commands.d.ts +2 -5
- package/dist/types-ts4.5/utils/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/input-rules.d.ts +1 -8
- package/package.json +6 -6
- package/report.api.md +15 -72
- package/dist/cjs/plugins/hyperlink/Toolbar.js +0 -242
- package/dist/cjs/plugins/hyperlink/index.js +0 -107
- package/dist/cjs/plugins/hyperlink/pm-plugins/fake-curor-for-toolbar-plugin-key.js +0 -9
- package/dist/cjs/plugins/hyperlink/pm-plugins/fake-cursor-for-toolbar.js +0 -67
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +0 -92
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +0 -76
- package/dist/cjs/plugins/hyperlink/pm-plugins/main.js +0 -295
- package/dist/cjs/plugins/hyperlink/pm-plugins/toolbar-buttons.js +0 -41
- package/dist/cjs/plugins/hyperlink/styles.js +0 -20
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +0 -86
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +0 -32
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -932
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +0 -104
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/messages.js +0 -40
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/utils.js +0 -76
- package/dist/cjs/plugins/quick-insert/assets/action.js +0 -43
- package/dist/cjs/plugins/quick-insert/assets/code.js +0 -115
- package/dist/cjs/plugins/quick-insert/assets/custom-panel.js +0 -55
- package/dist/cjs/plugins/quick-insert/assets/date.js +0 -93
- package/dist/cjs/plugins/quick-insert/assets/decision.js +0 -34
- package/dist/cjs/plugins/quick-insert/assets/divider.js +0 -74
- package/dist/cjs/plugins/quick-insert/assets/emoji.js +0 -37
- package/dist/cjs/plugins/quick-insert/assets/expand.js +0 -47
- package/dist/cjs/plugins/quick-insert/assets/fallback.js +0 -55
- package/dist/cjs/plugins/quick-insert/assets/feedback.js +0 -70
- package/dist/cjs/plugins/quick-insert/assets/heading1.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/heading2.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/heading3.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/heading4.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/heading5.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/heading6.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/images.js +0 -92
- package/dist/cjs/plugins/quick-insert/assets/index.js +0 -356
- package/dist/cjs/plugins/quick-insert/assets/layout.js +0 -71
- package/dist/cjs/plugins/quick-insert/assets/link.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/list-number.js +0 -51
- package/dist/cjs/plugins/quick-insert/assets/list.js +0 -65
- package/dist/cjs/plugins/quick-insert/assets/mention.js +0 -56
- package/dist/cjs/plugins/quick-insert/assets/panel-error.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/panel-note.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/panel-success.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/panel-warning.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/panel.js +0 -50
- package/dist/cjs/plugins/quick-insert/assets/quote.js +0 -35
- package/dist/cjs/plugins/quick-insert/assets/status.js +0 -109
- package/dist/cjs/ui/LinkSearch/LinkSearchList.js +0 -83
- package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +0 -146
- package/dist/cjs/ui/LinkSearch/ToolbarComponents.js +0 -17
- package/dist/cjs/ui/LinkSearch/index.js +0 -328
- package/dist/cjs/ui/LinkSearch/listItemAlts.js +0 -70
- package/dist/cjs/ui/LinkSearch/transformTimeStamp.js +0 -42
- package/dist/cjs/ui/LinkSearch/types.js +0 -5
- package/dist/cjs/ui/LinkSearch/withActivityProvider.js +0 -57
- package/dist/cjs/ui/PanelTextInput/index.js +0 -174
- package/dist/cjs/ui/PanelTextInput/styles.js +0 -19
- package/dist/cjs/utils/announcer/announcer.js +0 -62
- package/dist/es2019/plugins/hyperlink/Toolbar.js +0 -223
- package/dist/es2019/plugins/hyperlink/index.js +0 -88
- package/dist/es2019/plugins/hyperlink/pm-plugins/fake-curor-for-toolbar-plugin-key.js +0 -2
- package/dist/es2019/plugins/hyperlink/pm-plugins/fake-cursor-for-toolbar.js +0 -62
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +0 -79
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +0 -64
- package/dist/es2019/plugins/hyperlink/pm-plugins/main.js +0 -292
- package/dist/es2019/plugins/hyperlink/pm-plugins/toolbar-buttons.js +0 -37
- package/dist/es2019/plugins/hyperlink/styles.js +0 -22
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +0 -74
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +0 -25
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -777
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +0 -80
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/messages.js +0 -33
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/utils.js +0 -78
- package/dist/es2019/plugins/quick-insert/assets/action.js +0 -35
- package/dist/es2019/plugins/quick-insert/assets/code.js +0 -107
- package/dist/es2019/plugins/quick-insert/assets/custom-panel.js +0 -47
- package/dist/es2019/plugins/quick-insert/assets/date.js +0 -85
- package/dist/es2019/plugins/quick-insert/assets/decision.js +0 -26
- package/dist/es2019/plugins/quick-insert/assets/divider.js +0 -66
- package/dist/es2019/plugins/quick-insert/assets/emoji.js +0 -29
- package/dist/es2019/plugins/quick-insert/assets/expand.js +0 -39
- package/dist/es2019/plugins/quick-insert/assets/fallback.js +0 -47
- package/dist/es2019/plugins/quick-insert/assets/feedback.js +0 -62
- package/dist/es2019/plugins/quick-insert/assets/heading1.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/heading2.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/heading3.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/heading4.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/heading5.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/heading6.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/images.js +0 -84
- package/dist/es2019/plugins/quick-insert/assets/index.js +0 -113
- package/dist/es2019/plugins/quick-insert/assets/layout.js +0 -63
- package/dist/es2019/plugins/quick-insert/assets/link.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/list-number.js +0 -43
- package/dist/es2019/plugins/quick-insert/assets/list.js +0 -57
- package/dist/es2019/plugins/quick-insert/assets/mention.js +0 -48
- package/dist/es2019/plugins/quick-insert/assets/panel-error.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/panel-note.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/panel-success.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/panel-warning.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/panel.js +0 -42
- package/dist/es2019/plugins/quick-insert/assets/quote.js +0 -27
- package/dist/es2019/plugins/quick-insert/assets/status.js +0 -101
- package/dist/es2019/ui/LinkSearch/LinkSearchList.js +0 -63
- package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +0 -141
- package/dist/es2019/ui/LinkSearch/ToolbarComponents.js +0 -20
- package/dist/es2019/ui/LinkSearch/index.js +0 -213
- package/dist/es2019/ui/LinkSearch/listItemAlts.js +0 -63
- package/dist/es2019/ui/LinkSearch/transformTimeStamp.js +0 -34
- package/dist/es2019/ui/LinkSearch/types.js +0 -1
- package/dist/es2019/ui/LinkSearch/withActivityProvider.js +0 -33
- package/dist/es2019/ui/PanelTextInput/index.js +0 -149
- package/dist/es2019/ui/PanelTextInput/styles.js +0 -36
- package/dist/es2019/utils/announcer/announcer.js +0 -41
- package/dist/esm/plugins/hyperlink/Toolbar.js +0 -235
- package/dist/esm/plugins/hyperlink/index.js +0 -99
- package/dist/esm/plugins/hyperlink/pm-plugins/fake-curor-for-toolbar-plugin-key.js +0 -2
- package/dist/esm/plugins/hyperlink/pm-plugins/fake-cursor-for-toolbar.js +0 -60
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +0 -82
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +0 -65
- package/dist/esm/plugins/hyperlink/pm-plugins/main.js +0 -283
- package/dist/esm/plugins/hyperlink/pm-plugins/toolbar-buttons.js +0 -32
- package/dist/esm/plugins/hyperlink/styles.js +0 -11
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +0 -76
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +0 -25
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +0 -919
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +0 -97
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/messages.js +0 -33
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/utils.js +0 -66
- package/dist/esm/plugins/quick-insert/assets/action.js +0 -35
- package/dist/esm/plugins/quick-insert/assets/code.js +0 -107
- package/dist/esm/plugins/quick-insert/assets/custom-panel.js +0 -47
- package/dist/esm/plugins/quick-insert/assets/date.js +0 -85
- package/dist/esm/plugins/quick-insert/assets/decision.js +0 -26
- package/dist/esm/plugins/quick-insert/assets/divider.js +0 -66
- package/dist/esm/plugins/quick-insert/assets/emoji.js +0 -29
- package/dist/esm/plugins/quick-insert/assets/expand.js +0 -39
- package/dist/esm/plugins/quick-insert/assets/fallback.js +0 -47
- package/dist/esm/plugins/quick-insert/assets/feedback.js +0 -62
- package/dist/esm/plugins/quick-insert/assets/heading1.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/heading2.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/heading3.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/heading4.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/heading5.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/heading6.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/images.js +0 -84
- package/dist/esm/plugins/quick-insert/assets/index.js +0 -246
- package/dist/esm/plugins/quick-insert/assets/layout.js +0 -63
- package/dist/esm/plugins/quick-insert/assets/link.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/list-number.js +0 -43
- package/dist/esm/plugins/quick-insert/assets/list.js +0 -57
- package/dist/esm/plugins/quick-insert/assets/mention.js +0 -48
- package/dist/esm/plugins/quick-insert/assets/panel-error.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/panel-note.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/panel-success.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/panel-warning.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/panel.js +0 -42
- package/dist/esm/plugins/quick-insert/assets/quote.js +0 -27
- package/dist/esm/plugins/quick-insert/assets/status.js +0 -101
- package/dist/esm/ui/LinkSearch/LinkSearchList.js +0 -75
- package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +0 -131
- package/dist/esm/ui/LinkSearch/ToolbarComponents.js +0 -7
- package/dist/esm/ui/LinkSearch/index.js +0 -320
- package/dist/esm/ui/LinkSearch/listItemAlts.js +0 -63
- package/dist/esm/ui/LinkSearch/transformTimeStamp.js +0 -34
- package/dist/esm/ui/LinkSearch/types.js +0 -1
- package/dist/esm/ui/LinkSearch/withActivityProvider.js +0 -50
- package/dist/esm/ui/PanelTextInput/index.js +0 -168
- package/dist/esm/ui/PanelTextInput/styles.js +0 -10
- package/dist/esm/utils/announcer/announcer.js +0 -52
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +0 -6
- package/dist/types/plugins/hyperlink/commands.d.ts +0 -17
- package/dist/types/plugins/hyperlink/index.d.ts +0 -24
- package/dist/types/plugins/hyperlink/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +0 -2
- package/dist/types/plugins/hyperlink/pm-plugins/fake-cursor-for-toolbar.d.ts +0 -3
- package/dist/types/plugins/hyperlink/pm-plugins/input-rule.d.ts +0 -7
- package/dist/types/plugins/hyperlink/pm-plugins/keymap.d.ts +0 -3
- package/dist/types/plugins/hyperlink/pm-plugins/main.d.ts +0 -46
- package/dist/types/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +0 -19
- package/dist/types/plugins/hyperlink/styles.d.ts +0 -6
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +0 -21
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +0 -2
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +0 -109
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +0 -19
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/messages.d.ts +0 -32
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/utils.d.ts +0 -7
- package/dist/types/plugins/quick-insert/assets/action.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/code.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/custom-panel.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/date.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/decision.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/divider.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/emoji.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/expand.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/fallback.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/feedback.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading1.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading2.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading3.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading4.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading5.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/heading6.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/images.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/index.d.ts +0 -30
- package/dist/types/plugins/quick-insert/assets/layout.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/link.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/list-number.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/list.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/mention.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/panel-error.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/panel-note.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/panel-success.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/panel-warning.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/panel.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/quote.d.ts +0 -2
- package/dist/types/plugins/quick-insert/assets/status.d.ts +0 -2
- package/dist/types/ui/LinkSearch/LinkSearchList.d.ts +0 -20
- package/dist/types/ui/LinkSearch/LinkSearchListItem.d.ts +0 -22
- package/dist/types/ui/LinkSearch/ToolbarComponents.d.ts +0 -3
- package/dist/types/ui/LinkSearch/index.d.ts +0 -59
- package/dist/types/ui/LinkSearch/listItemAlts.d.ts +0 -2
- package/dist/types/ui/LinkSearch/transformTimeStamp.d.ts +0 -10
- package/dist/types/ui/LinkSearch/types.d.ts +0 -49
- package/dist/types/ui/LinkSearch/withActivityProvider.d.ts +0 -66
- package/dist/types/ui/PanelTextInput/index.d.ts +0 -46
- package/dist/types/ui/PanelTextInput/styles.d.ts +0 -2
- package/dist/types/utils/announcer/announcer.d.ts +0 -22
- package/dist/types-ts4.5/plugins/hyperlink/Toolbar.d.ts +0 -6
- package/dist/types-ts4.5/plugins/hyperlink/commands.d.ts +0 -17
- package/dist/types-ts4.5/plugins/hyperlink/index.d.ts +0 -24
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/fake-cursor-for-toolbar.d.ts +0 -3
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/input-rule.d.ts +0 -7
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/main.d.ts +0 -46
- package/dist/types-ts4.5/plugins/hyperlink/pm-plugins/toolbar-buttons.d.ts +0 -19
- package/dist/types-ts4.5/plugins/hyperlink/styles.d.ts +0 -6
- package/dist/types-ts4.5/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +0 -21
- package/dist/types-ts4.5/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +0 -2
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +0 -109
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/messages.d.ts +0 -32
- package/dist/types-ts4.5/plugins/hyperlink/ui/HyperlinkAddToolbar/utils.d.ts +0 -7
- package/dist/types-ts4.5/plugins/quick-insert/assets/action.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/code.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/custom-panel.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/date.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/decision.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/divider.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/emoji.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/expand.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/fallback.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/feedback.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading1.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading2.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading3.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading4.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading5.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/heading6.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/images.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/index.d.ts +0 -30
- package/dist/types-ts4.5/plugins/quick-insert/assets/layout.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/link.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/list-number.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/list.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/mention.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/panel-error.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/panel-note.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/panel-success.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/panel-warning.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/panel.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/quote.d.ts +0 -2
- package/dist/types-ts4.5/plugins/quick-insert/assets/status.d.ts +0 -2
- package/dist/types-ts4.5/ui/LinkSearch/LinkSearchList.d.ts +0 -20
- package/dist/types-ts4.5/ui/LinkSearch/LinkSearchListItem.d.ts +0 -22
- package/dist/types-ts4.5/ui/LinkSearch/ToolbarComponents.d.ts +0 -3
- package/dist/types-ts4.5/ui/LinkSearch/index.d.ts +0 -59
- package/dist/types-ts4.5/ui/LinkSearch/listItemAlts.d.ts +0 -2
- package/dist/types-ts4.5/ui/LinkSearch/transformTimeStamp.d.ts +0 -10
- package/dist/types-ts4.5/ui/LinkSearch/types.d.ts +0 -49
- package/dist/types-ts4.5/ui/LinkSearch/withActivityProvider.d.ts +0 -66
- package/dist/types-ts4.5/ui/PanelTextInput/index.d.ts +0 -46
- package/dist/types-ts4.5/ui/PanelTextInput/styles.d.ts +0 -2
- package/dist/types-ts4.5/utils/announcer/announcer.d.ts +0 -22
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
-
var _prosemirrorView = require("prosemirror-view");
|
|
9
|
-
var _fakeCurorForToolbarPluginKey = require("./fake-curor-for-toolbar-plugin-key");
|
|
10
|
-
var _main = require("./main");
|
|
11
|
-
var createTextCursor = function createTextCursor(pos) {
|
|
12
|
-
var node = document.createElement('div');
|
|
13
|
-
node.className = 'ProseMirror-fake-text-cursor';
|
|
14
|
-
return _prosemirrorView.Decoration.widget(pos, node, {
|
|
15
|
-
key: 'hyperlink-text-cursor'
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var createTextSelection = function createTextSelection(from, to) {
|
|
19
|
-
return _prosemirrorView.Decoration.inline(from, to, {
|
|
20
|
-
class: 'ProseMirror-fake-text-selection'
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var getInsertLinkToolbarState = function getInsertLinkToolbarState(editorState) {
|
|
24
|
-
var state = _main.stateKey.getState(editorState);
|
|
25
|
-
if (state && state.activeLinkMark) {
|
|
26
|
-
if (state.activeLinkMark.type === _main.InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
27
|
-
return state.activeLinkMark;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
};
|
|
32
|
-
var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
|
|
33
|
-
key: _fakeCurorForToolbarPluginKey.fakeCursorForToolbarPluginKey,
|
|
34
|
-
state: {
|
|
35
|
-
init: function init() {
|
|
36
|
-
return _prosemirrorView.DecorationSet.empty;
|
|
37
|
-
},
|
|
38
|
-
apply: function apply(tr, pluginState, oldState, newState) {
|
|
39
|
-
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
40
|
-
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
41
|
-
// Map DecorationSet if it still refers to the same position in the document
|
|
42
|
-
if (oldInsertToolbarState && insertToolbarState) {
|
|
43
|
-
var from = insertToolbarState.from,
|
|
44
|
-
to = insertToolbarState.to;
|
|
45
|
-
var oldFrom = tr.mapping.map(oldInsertToolbarState.from);
|
|
46
|
-
var oldTo = tr.mapping.map(oldInsertToolbarState.to);
|
|
47
|
-
if (oldFrom === from && oldTo === to) {
|
|
48
|
-
return pluginState.map(tr.mapping, tr.doc);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// Update DecorationSet if new insert toolbar, or if we have moved to a different position in the doc
|
|
52
|
-
if (insertToolbarState) {
|
|
53
|
-
var _from = insertToolbarState.from,
|
|
54
|
-
_to = insertToolbarState.to;
|
|
55
|
-
return _prosemirrorView.DecorationSet.create(tr.doc, [_from === _to ? createTextCursor(_from) : createTextSelection(_from, _to)]);
|
|
56
|
-
}
|
|
57
|
-
return _prosemirrorView.DecorationSet.empty;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
props: {
|
|
61
|
-
decorations: function decorations(state) {
|
|
62
|
-
return _fakeCurorForToolbarPluginKey.fakeCursorForToolbarPluginKey.getState(state);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
var _default = fakeCursorToolbarPlugin;
|
|
67
|
-
exports.default = _default;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createInputRulePlugin = createInputRulePlugin;
|
|
8
|
-
exports.createLinkInputRule = createLinkInputRule;
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _card = require("@atlaskit/editor-common/card");
|
|
12
|
-
var _inputRules = require("../../../utils/input-rules");
|
|
13
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
|
-
var _analytics2 = require("../../analytics");
|
|
16
|
-
function createLinkInputRule(regexp) {
|
|
17
|
-
var skipAnalytics = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
|
-
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
19
|
-
return (0, _inputRules.createRule)(regexp, function (state, match, start, end) {
|
|
20
|
-
var schema = state.schema;
|
|
21
|
-
if (state.doc.rangeHasMark(start, end, schema.marks.link)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
var link = match;
|
|
25
|
-
var url = (0, _utils.normalizeUrl)(link.url);
|
|
26
|
-
var markType = schema.mark('link', {
|
|
27
|
-
href: url
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Need access to complete text to check if last URL is part of a filepath before linkifying
|
|
31
|
-
var nodeBefore = state.selection.$from.nodeBefore;
|
|
32
|
-
if (!nodeBefore || !nodeBefore.isText || !nodeBefore.text) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
var filepaths = (0, _utils.findFilepaths)(nodeBefore.text,
|
|
36
|
-
// The position referenced by 'start' is relative to the start of the document, findFilepaths deals with index in a node only.
|
|
37
|
-
start - (nodeBefore.text.length - link.text.length) // (start of link match) - (whole node text length - link length) gets start of text node, which is used as offset
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
if ((0, _utils.isLinkInMatches)(start, filepaths)) {
|
|
41
|
-
var _tr = state.tr;
|
|
42
|
-
return _tr;
|
|
43
|
-
}
|
|
44
|
-
var from = start;
|
|
45
|
-
var to = Math.min(start + link.text.length, state.doc.content.size);
|
|
46
|
-
var tr = state.tr.addMark(from, to, markType);
|
|
47
|
-
|
|
48
|
-
// Keep old behavior that will delete the space after the link
|
|
49
|
-
if (to === end) {
|
|
50
|
-
tr.insertText(' ');
|
|
51
|
-
}
|
|
52
|
-
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
53
|
-
inputMethod: _analytics.INPUT_METHOD.AUTO_DETECT
|
|
54
|
-
});
|
|
55
|
-
if (skipAnalytics) {
|
|
56
|
-
return tr;
|
|
57
|
-
}
|
|
58
|
-
return (0, _analytics2.addAnalytics)(state, tr, (0, _utils.getLinkCreationAnalyticsEvent)(_analytics.INPUT_METHOD.AUTO_DETECT, url));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function createInputRulePlugin(schema) {
|
|
62
|
-
var skipAnalytics = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
63
|
-
var featureFlags = arguments.length > 2 ? arguments[2] : undefined;
|
|
64
|
-
if (!schema.marks.link) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
var urlWithASpaceRule = createLinkInputRule(_utils.LinkMatcher.create(), skipAnalytics);
|
|
68
|
-
|
|
69
|
-
// [something](link) should convert to a hyperlink
|
|
70
|
-
var markdownLinkRule = (0, _inputRules.createRule)(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
71
|
-
var schema = state.schema;
|
|
72
|
-
var _match = (0, _slicedToArray2.default)(match, 4),
|
|
73
|
-
prefix = _match[1],
|
|
74
|
-
linkText = _match[2],
|
|
75
|
-
linkUrl = _match[3];
|
|
76
|
-
var url = (0, _utils.normalizeUrl)(linkUrl).trim();
|
|
77
|
-
var markType = schema.mark('link', {
|
|
78
|
-
href: url
|
|
79
|
-
});
|
|
80
|
-
var tr = state.tr.replaceWith(start + prefix.length, end, schema.text((linkText || '').trim(), [markType]));
|
|
81
|
-
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
82
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
83
|
-
});
|
|
84
|
-
if (skipAnalytics) {
|
|
85
|
-
return tr;
|
|
86
|
-
}
|
|
87
|
-
return (0, _analytics2.addAnalytics)(state, tr, (0, _utils.getLinkCreationAnalyticsEvent)(_analytics.INPUT_METHOD.FORMATTING, url));
|
|
88
|
-
});
|
|
89
|
-
return (0, _inputRules.createPlugin)('hyperlink', [urlWithASpaceRule, markdownLinkRule]);
|
|
90
|
-
}
|
|
91
|
-
var _default = createInputRulePlugin;
|
|
92
|
-
exports.default = _default;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createKeymapPlugin = createKeymapPlugin;
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _prosemirrorKeymap = require("prosemirror-keymap");
|
|
10
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
-
var keymaps = _interopRequireWildcard(require("../../../keymaps"));
|
|
12
|
-
var _main = require("../pm-plugins/main");
|
|
13
|
-
var _commands = require("../commands");
|
|
14
|
-
var _analytics = require("../../analytics");
|
|
15
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
-
function createKeymapPlugin() {
|
|
19
|
-
var skipAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
20
|
-
var list = {};
|
|
21
|
-
keymaps.bindKeymapWithCommand(keymaps.addLink.common, (0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
22
|
-
keymaps.bindKeymapWithCommand(keymaps.enter.common, mayConvertLastWordToHyperlink(skipAnalytics), list);
|
|
23
|
-
keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, mayConvertLastWordToHyperlink(skipAnalytics), list);
|
|
24
|
-
keymaps.bindKeymapWithCommand(keymaps.escape.common, function (state, dispatch, view) {
|
|
25
|
-
var hyperlinkPlugin = _main.stateKey.getState(state);
|
|
26
|
-
if (hyperlinkPlugin.activeLinkMark) {
|
|
27
|
-
(0, _commands.hideLinkToolbar)()(state, dispatch);
|
|
28
|
-
if (view) {
|
|
29
|
-
view.focus();
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
}, list);
|
|
35
|
-
return (0, _prosemirrorKeymap.keymap)(list);
|
|
36
|
-
}
|
|
37
|
-
var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(skipAnalytics) {
|
|
38
|
-
return function (state, dispatch) {
|
|
39
|
-
var nodeBefore = state.selection.$from.nodeBefore;
|
|
40
|
-
if (!nodeBefore || !nodeBefore.isText || !nodeBefore.text) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
var words = nodeBefore.text.split(' ');
|
|
44
|
-
var lastWord = words[words.length - 1];
|
|
45
|
-
var match = (0, _adfSchema.getLinkMatch)(lastWord);
|
|
46
|
-
if (match) {
|
|
47
|
-
var hyperlinkedText = match.raw;
|
|
48
|
-
var start = state.selection.$from.pos - hyperlinkedText.length;
|
|
49
|
-
var end = state.selection.$from.pos;
|
|
50
|
-
if (state.doc.rangeHasMark(start, end, state.schema.marks.link)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
var url = match.url;
|
|
54
|
-
var markType = state.schema.mark('link', {
|
|
55
|
-
href: url
|
|
56
|
-
});
|
|
57
|
-
var filepaths = (0, _utils.findFilepaths)(nodeBefore.text, start - (nodeBefore.text.length - hyperlinkedText.length) // The position referenced by 'start' is relative to the start of the document, findFilepaths deals with index in a node only.
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
if ((0, _utils.isLinkInMatches)(start, filepaths)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
var tr = state.tr.addMark(start, end, markType);
|
|
64
|
-
if (dispatch) {
|
|
65
|
-
if (skipAnalytics) {
|
|
66
|
-
dispatch(tr);
|
|
67
|
-
} else {
|
|
68
|
-
dispatch((0, _analytics.addAnalytics)(state, tr, (0, _utils.getLinkCreationAnalyticsEvent)(_analytics.INPUT_METHOD.AUTO_DETECT, url)));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return false;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
var _default = createKeymapPlugin;
|
|
76
|
-
exports.default = _default;
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.stateKey = exports.plugin = exports.canLinkBeCreatedInRange = exports.LinkAction = exports.InsertStatus = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
12
|
-
var _utils = require("../../../utils");
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
var LinkAction = /*#__PURE__*/function (LinkAction) {
|
|
16
|
-
LinkAction["SHOW_INSERT_TOOLBAR"] = "SHOW_INSERT_TOOLBAR";
|
|
17
|
-
LinkAction["HIDE_TOOLBAR"] = "HIDE_TOOLBAR";
|
|
18
|
-
LinkAction["SELECTION_CHANGE"] = "SELECTION_CHANGE";
|
|
19
|
-
LinkAction["INSERT_LINK_TOOLBAR"] = "INSERT";
|
|
20
|
-
LinkAction["EDIT_INSERTED_TOOLBAR"] = "EDIT_INSERTED_TOOLBAR";
|
|
21
|
-
return LinkAction;
|
|
22
|
-
}({});
|
|
23
|
-
exports.LinkAction = LinkAction;
|
|
24
|
-
var InsertStatus = /*#__PURE__*/function (InsertStatus) {
|
|
25
|
-
InsertStatus["EDIT_LINK_TOOLBAR"] = "EDIT";
|
|
26
|
-
InsertStatus["INSERT_LINK_TOOLBAR"] = "INSERT";
|
|
27
|
-
InsertStatus["EDIT_INSERTED_TOOLBAR"] = "EDIT_INSERTED";
|
|
28
|
-
return InsertStatus;
|
|
29
|
-
}({});
|
|
30
|
-
exports.InsertStatus = InsertStatus;
|
|
31
|
-
var canLinkBeCreatedInRange = function canLinkBeCreatedInRange(from, to) {
|
|
32
|
-
return function (state) {
|
|
33
|
-
if (!state.doc.rangeHasMark(from, to, state.schema.marks.link)) {
|
|
34
|
-
var $from = state.doc.resolve(from);
|
|
35
|
-
var $to = state.doc.resolve(to);
|
|
36
|
-
var link = state.schema.marks.link;
|
|
37
|
-
if ($from.parent === $to.parent && $from.parent.isTextblock) {
|
|
38
|
-
if ($from.parent.type.allowsMarkType(link)) {
|
|
39
|
-
var allowed = true;
|
|
40
|
-
state.doc.nodesBetween(from, to, function (node) {
|
|
41
|
-
allowed = allowed && !node.marks.some(function (m) {
|
|
42
|
-
return m.type.excludes(link);
|
|
43
|
-
});
|
|
44
|
-
return allowed;
|
|
45
|
-
});
|
|
46
|
-
return allowed;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
exports.canLinkBeCreatedInRange = canLinkBeCreatedInRange;
|
|
54
|
-
var isSelectionInsideLink = function isSelectionInsideLink(state) {
|
|
55
|
-
return !!state.doc.type.schema.marks.link.isInSet(state.selection.$from.marks());
|
|
56
|
-
};
|
|
57
|
-
var isSelectionAroundLink = function isSelectionAroundLink(state) {
|
|
58
|
-
var _state$selection = state.selection,
|
|
59
|
-
$from = _state$selection.$from,
|
|
60
|
-
$to = _state$selection.$to;
|
|
61
|
-
var node = $from.nodeAfter;
|
|
62
|
-
return !!node && $from.textOffset === 0 && $to.pos - $from.pos === node.nodeSize && !!state.doc.type.schema.marks.link.isInSet(node.marks);
|
|
63
|
-
};
|
|
64
|
-
var mapTransactionToState = function mapTransactionToState(state, tr) {
|
|
65
|
-
if (!state) {
|
|
66
|
-
return undefined;
|
|
67
|
-
} else if (state.type === InsertStatus.EDIT_LINK_TOOLBAR || state.type === InsertStatus.EDIT_INSERTED_TOOLBAR) {
|
|
68
|
-
var _tr$mapping$mapResult = tr.mapping.mapResult(state.pos, 1),
|
|
69
|
-
pos = _tr$mapping$mapResult.pos,
|
|
70
|
-
deleted = _tr$mapping$mapResult.deleted;
|
|
71
|
-
var node = tr.doc.nodeAt(pos);
|
|
72
|
-
// If the position was not deleted & it is still a link
|
|
73
|
-
if (!deleted && !!node.type.schema.marks.link.isInSet(node.marks)) {
|
|
74
|
-
if (node === state.node && pos === state.pos) {
|
|
75
|
-
return state;
|
|
76
|
-
}
|
|
77
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
78
|
-
pos: pos,
|
|
79
|
-
node: node
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
// If the position has been deleted, then require a navigation to show the toolbar again
|
|
83
|
-
return;
|
|
84
|
-
} else if (state.type === InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
85
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
86
|
-
from: tr.mapping.map(state.from),
|
|
87
|
-
to: tr.mapping.map(state.to)
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return;
|
|
91
|
-
};
|
|
92
|
-
var toState = function toState(state, action, editorState) {
|
|
93
|
-
// Show insert or edit toolbar
|
|
94
|
-
if (!state) {
|
|
95
|
-
switch (action) {
|
|
96
|
-
case LinkAction.SHOW_INSERT_TOOLBAR:
|
|
97
|
-
{
|
|
98
|
-
var _editorState$selectio = editorState.selection,
|
|
99
|
-
from = _editorState$selectio.from,
|
|
100
|
-
to = _editorState$selectio.to;
|
|
101
|
-
if (canLinkBeCreatedInRange(from, to)(editorState)) {
|
|
102
|
-
return {
|
|
103
|
-
type: InsertStatus.INSERT_LINK_TOOLBAR,
|
|
104
|
-
from: from,
|
|
105
|
-
to: to
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
case LinkAction.SELECTION_CHANGE:
|
|
111
|
-
// If the user has moved their cursor, see if they're in a link
|
|
112
|
-
var link = getActiveLinkMark(editorState);
|
|
113
|
-
if (link) {
|
|
114
|
-
return _objectSpread(_objectSpread({}, link), {}, {
|
|
115
|
-
type: InsertStatus.EDIT_LINK_TOOLBAR
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
return undefined;
|
|
119
|
-
default:
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Update toolbar state if selection changes, or if toolbar is hidden
|
|
124
|
-
if (state.type === InsertStatus.EDIT_LINK_TOOLBAR) {
|
|
125
|
-
switch (action) {
|
|
126
|
-
case LinkAction.EDIT_INSERTED_TOOLBAR:
|
|
127
|
-
{
|
|
128
|
-
var _link = getActiveLinkMark(editorState);
|
|
129
|
-
if (_link) {
|
|
130
|
-
if (_link.pos === state.pos && _link.node === state.node) {
|
|
131
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
132
|
-
type: InsertStatus.EDIT_INSERTED_TOOLBAR
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return _objectSpread(_objectSpread({}, _link), {}, {
|
|
136
|
-
type: InsertStatus.EDIT_INSERTED_TOOLBAR
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
case LinkAction.SELECTION_CHANGE:
|
|
142
|
-
var _link2 = getActiveLinkMark(editorState);
|
|
143
|
-
if (_link2) {
|
|
144
|
-
if (_link2.pos === state.pos && _link2.node === state.node) {
|
|
145
|
-
// Make sure we return the same object, if it's the same link
|
|
146
|
-
return state;
|
|
147
|
-
}
|
|
148
|
-
return _objectSpread(_objectSpread({}, _link2), {}, {
|
|
149
|
-
type: InsertStatus.EDIT_LINK_TOOLBAR
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
return undefined;
|
|
153
|
-
case LinkAction.HIDE_TOOLBAR:
|
|
154
|
-
return undefined;
|
|
155
|
-
default:
|
|
156
|
-
return state;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Remove toolbar if user changes selection or toolbar is hidden
|
|
161
|
-
if (state.type === InsertStatus.INSERT_LINK_TOOLBAR) {
|
|
162
|
-
switch (action) {
|
|
163
|
-
case LinkAction.SELECTION_CHANGE:
|
|
164
|
-
case LinkAction.HIDE_TOOLBAR:
|
|
165
|
-
return undefined;
|
|
166
|
-
default:
|
|
167
|
-
return state;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return;
|
|
171
|
-
};
|
|
172
|
-
var getActiveLinkMark = function getActiveLinkMark(state) {
|
|
173
|
-
var $from = state.selection.$from;
|
|
174
|
-
if (isSelectionInsideLink(state) || isSelectionAroundLink(state)) {
|
|
175
|
-
var pos = $from.pos - $from.textOffset;
|
|
176
|
-
var node = state.doc.nodeAt(pos);
|
|
177
|
-
return node && node.isText ? {
|
|
178
|
-
node: node,
|
|
179
|
-
pos: pos
|
|
180
|
-
} : undefined;
|
|
181
|
-
}
|
|
182
|
-
return undefined;
|
|
183
|
-
};
|
|
184
|
-
var getActiveText = function getActiveText(selection) {
|
|
185
|
-
var currentSlice = selection.content();
|
|
186
|
-
if (currentSlice.size === 0) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (currentSlice.content.childCount === 1 && currentSlice.content.firstChild && selection instanceof _prosemirrorState.TextSelection) {
|
|
190
|
-
return currentSlice.content.firstChild.textContent;
|
|
191
|
-
}
|
|
192
|
-
return;
|
|
193
|
-
};
|
|
194
|
-
var stateKey = new _prosemirrorState.PluginKey('hyperlinkPlugin');
|
|
195
|
-
exports.stateKey = stateKey;
|
|
196
|
-
var plugin = function plugin(dispatch, editorAppearance) {
|
|
197
|
-
return new _safePlugin.SafePlugin({
|
|
198
|
-
state: {
|
|
199
|
-
init: function init(_, state) {
|
|
200
|
-
var canInsertLink = canLinkBeCreatedInRange(state.selection.from, state.selection.to)(state);
|
|
201
|
-
return {
|
|
202
|
-
activeText: getActiveText(state.selection),
|
|
203
|
-
canInsertLink: canInsertLink,
|
|
204
|
-
timesViewed: 0,
|
|
205
|
-
activeLinkMark: toState(undefined, LinkAction.SELECTION_CHANGE, state),
|
|
206
|
-
editorAppearance: editorAppearance
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
apply: function apply(tr, pluginState, oldState, newState) {
|
|
210
|
-
var state = pluginState;
|
|
211
|
-
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
212
|
-
var inputMethod = tr.getMeta(stateKey) && tr.getMeta(stateKey).inputMethod;
|
|
213
|
-
if (tr.docChanged) {
|
|
214
|
-
state = {
|
|
215
|
-
activeText: state.activeText,
|
|
216
|
-
canInsertLink: canLinkBeCreatedInRange(newState.selection.from, newState.selection.to)(newState),
|
|
217
|
-
timesViewed: state.timesViewed,
|
|
218
|
-
inputMethod: inputMethod,
|
|
219
|
-
activeLinkMark: mapTransactionToState(state.activeLinkMark, tr),
|
|
220
|
-
editorAppearance: editorAppearance
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (action) {
|
|
224
|
-
var stateForAnalytics = [LinkAction.SHOW_INSERT_TOOLBAR, LinkAction.EDIT_INSERTED_TOOLBAR].includes(action) ? {
|
|
225
|
-
timesViewed: ++state.timesViewed,
|
|
226
|
-
searchSessionId: (0, _uuid.default)()
|
|
227
|
-
} : {
|
|
228
|
-
timesViewed: state.timesViewed,
|
|
229
|
-
searchSessionId: state.searchSessionId
|
|
230
|
-
};
|
|
231
|
-
state = _objectSpread({
|
|
232
|
-
activeText: state.activeText,
|
|
233
|
-
canInsertLink: state.canInsertLink,
|
|
234
|
-
inputMethod: inputMethod,
|
|
235
|
-
activeLinkMark: toState(state.activeLinkMark, action, newState),
|
|
236
|
-
editorAppearance: editorAppearance
|
|
237
|
-
}, stateForAnalytics);
|
|
238
|
-
}
|
|
239
|
-
var hasPositionChanged = oldState.selection.from !== newState.selection.from || oldState.selection.to !== newState.selection.to;
|
|
240
|
-
if (tr.selectionSet && hasPositionChanged) {
|
|
241
|
-
state = {
|
|
242
|
-
activeText: getActiveText(newState.selection),
|
|
243
|
-
canInsertLink: canLinkBeCreatedInRange(newState.selection.from, newState.selection.to)(newState),
|
|
244
|
-
activeLinkMark: toState(state.activeLinkMark, LinkAction.SELECTION_CHANGE, newState),
|
|
245
|
-
timesViewed: state.timesViewed,
|
|
246
|
-
searchSessionId: state.searchSessionId,
|
|
247
|
-
inputMethod: inputMethod,
|
|
248
|
-
editorAppearance: editorAppearance
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
if (!(0, _utils.shallowEqual)(state, pluginState)) {
|
|
252
|
-
dispatch(stateKey, state);
|
|
253
|
-
}
|
|
254
|
-
return state;
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
key: stateKey,
|
|
258
|
-
props: {
|
|
259
|
-
handleDOMEvents: {
|
|
260
|
-
mouseup: function mouseup(_, event) {
|
|
261
|
-
// this prevents redundant selection transaction when clicking on link
|
|
262
|
-
// link state will be update on slection change which happens on mousedown
|
|
263
|
-
if (isLinkDirectTarget(event)) {
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
return false;
|
|
268
|
-
},
|
|
269
|
-
mousedown: function mousedown(view, event) {
|
|
270
|
-
// since link clicks are disallowed by browsers inside contenteditable
|
|
271
|
-
// so we need to handle shift+click selection ourselves in this case
|
|
272
|
-
if (!event.shiftKey || !isLinkDirectTarget(event)) {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
var state = view.state;
|
|
276
|
-
var $anchor = state.selection.$anchor;
|
|
277
|
-
var newPosition = view.posAtCoords({
|
|
278
|
-
left: event.clientX,
|
|
279
|
-
top: event.clientY
|
|
280
|
-
});
|
|
281
|
-
if ((newPosition === null || newPosition === void 0 ? void 0 : newPosition.pos) != null && newPosition.pos !== $anchor.pos) {
|
|
282
|
-
var tr = state.tr.setSelection(_prosemirrorState.TextSelection.create(state.doc, $anchor.pos, newPosition.pos));
|
|
283
|
-
view.dispatch(tr);
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
};
|
|
292
|
-
exports.plugin = plugin;
|
|
293
|
-
function isLinkDirectTarget(event) {
|
|
294
|
-
return (event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement && event.target.tagName === 'A';
|
|
295
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toolbarKey = exports.toolbarButtonsPlugin = exports.prependToolbarButtons = void 0;
|
|
7
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
8
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
-
var toolbarKey = new _prosemirrorState.PluginKey('hyperlinkToolbarItems');
|
|
10
|
-
exports.toolbarKey = toolbarKey;
|
|
11
|
-
var prependToolbarButtons = function prependToolbarButtons(_ref) {
|
|
12
|
-
var items = _ref.items,
|
|
13
|
-
onEscapeCallback = _ref.onEscapeCallback,
|
|
14
|
-
view = _ref.view;
|
|
15
|
-
var tr = view.state.tr,
|
|
16
|
-
dispatch = view.dispatch;
|
|
17
|
-
tr.setMeta(toolbarKey, {
|
|
18
|
-
items: items,
|
|
19
|
-
onEscapeCallback: onEscapeCallback
|
|
20
|
-
});
|
|
21
|
-
dispatch(tr);
|
|
22
|
-
};
|
|
23
|
-
exports.prependToolbarButtons = prependToolbarButtons;
|
|
24
|
-
var toolbarButtonsPlugin = function toolbarButtonsPlugin() {
|
|
25
|
-
return new _safePlugin.SafePlugin({
|
|
26
|
-
key: toolbarKey,
|
|
27
|
-
state: {
|
|
28
|
-
init: function init(_, state) {
|
|
29
|
-
return undefined;
|
|
30
|
-
},
|
|
31
|
-
apply: function apply(tr, pluginState) {
|
|
32
|
-
var metaState = tr.getMeta(toolbarKey);
|
|
33
|
-
if (metaState) {
|
|
34
|
-
return metaState;
|
|
35
|
-
}
|
|
36
|
-
return pluginState;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
exports.toolbarButtonsPlugin = toolbarButtonsPlugin;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.visuallyHiddenStyles = exports.linkStyles = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _react = require("@emotion/react");
|
|
10
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
|
-
var _templateObject, _templateObject2;
|
|
12
|
-
var linkStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n"])), _styles.linkSharedStyle);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Visible only to screenreaders. Use when there is a need
|
|
16
|
-
* to provide more context to a non-sighted user.
|
|
17
|
-
*/
|
|
18
|
-
exports.linkStyles = linkStyles;
|
|
19
|
-
var visuallyHiddenStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n clip: rect(1px, 1px, 1px, 1px);\n clip-path: inset(50%);\n height: 1px;\n width: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n"])));
|
|
20
|
-
exports.visuallyHiddenStyles = visuallyHiddenStyles;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.EditorLinkPicker = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _linkPicker = require("@atlaskit/link-picker");
|
|
13
|
-
var _commands = require("../../commands");
|
|
14
|
-
var _toolbarButtons = require("../../pm-plugins/toolbar-buttons");
|
|
15
|
-
var _useEscapeClickaway = require("./useEscapeClickaway");
|
|
16
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
18
|
-
var _excluded = ["view", "onCancel", "invokeMethod", "editorAppearance", "onClose"];
|
|
19
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
/**
|
|
22
|
-
* Returns a type that matches T but where keys (K) are now optional
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
26
|
-
var view = _ref.view,
|
|
27
|
-
onCancel = _ref.onCancel,
|
|
28
|
-
_ref$invokeMethod = _ref.invokeMethod,
|
|
29
|
-
invokeMethod = _ref$invokeMethod === void 0 ? '_unknown' : _ref$invokeMethod,
|
|
30
|
-
editorAppearance = _ref.editorAppearance,
|
|
31
|
-
onClose = _ref.onClose,
|
|
32
|
-
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
|
-
/**
|
|
34
|
-
* Track onClose handler in a
|
|
35
|
-
* ref so that we void needing it in the dependency array
|
|
36
|
-
* below
|
|
37
|
-
*/
|
|
38
|
-
var onCloseRef = (0, _react.useRef)(onClose);
|
|
39
|
-
(0, _react.useEffect)(function () {
|
|
40
|
-
onCloseRef.current = onClose;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Call onClose on mount, usefull to provide
|
|
45
|
-
* a handler for performing an action after the component has been
|
|
46
|
-
* unmounted (e.g. return focus to the editors)
|
|
47
|
-
*/
|
|
48
|
-
(0, _react.useEffect)(function () {
|
|
49
|
-
return function () {
|
|
50
|
-
var _onCloseRef$current;
|
|
51
|
-
return (_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef);
|
|
52
|
-
};
|
|
53
|
-
}, []);
|
|
54
|
-
var onEscape = (0, _react.useCallback)(function () {
|
|
55
|
-
var _toolbarKey$getState, _toolbarKey$getState$;
|
|
56
|
-
var tr = view.state.tr;
|
|
57
|
-
(0, _commands.hideLinkToolbarSetMeta)(tr);
|
|
58
|
-
(_toolbarKey$getState = _toolbarButtons.toolbarKey.getState(view.state)) === null || _toolbarKey$getState === void 0 ? void 0 : (_toolbarKey$getState$ = _toolbarKey$getState.onEscapeCallback) === null || _toolbarKey$getState$ === void 0 ? void 0 : _toolbarKey$getState$.call(_toolbarKey$getState, tr);
|
|
59
|
-
view.dispatch(tr);
|
|
60
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
61
|
-
}, [view, onCancel]);
|
|
62
|
-
var onClickAway = (0, _react.useCallback)(function () {
|
|
63
|
-
(0, _commands.hideLinkToolbar)()(view.state, view.dispatch);
|
|
64
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
65
|
-
}, [view, onCancel]);
|
|
66
|
-
var ref = (0, _useEscapeClickaway.useEscapeClickaway)(onEscape, onClickAway);
|
|
67
|
-
var analyticsEditorAppearance = (0, _utils.getAnalyticsEditorAppearance)(editorAppearance);
|
|
68
|
-
var analyticsData = (0, _react.useMemo)(function () {
|
|
69
|
-
return {
|
|
70
|
-
attributes: {
|
|
71
|
-
invokeMethod: invokeMethod,
|
|
72
|
-
location: analyticsEditorAppearance
|
|
73
|
-
},
|
|
74
|
-
// Below is added for the future implementation of Linking Platform namespaced analytic context
|
|
75
|
-
location: analyticsEditorAppearance
|
|
76
|
-
};
|
|
77
|
-
}, [invokeMethod, analyticsEditorAppearance]);
|
|
78
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
-
ref: ref
|
|
80
|
-
}, /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
81
|
-
data: analyticsData
|
|
82
|
-
}, /*#__PURE__*/_react.default.createElement(_linkPicker.LinkPicker, (0, _extends2.default)({}, restProps, {
|
|
83
|
-
onCancel: onEscape
|
|
84
|
-
}))));
|
|
85
|
-
};
|
|
86
|
-
exports.EditorLinkPicker = EditorLinkPicker;
|