@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,777 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/** @jsx jsx */
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
6
|
-
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
7
|
-
import EditorAlignLeftIcon from '@atlaskit/icon/glyph/editor/align-left';
|
|
8
|
-
import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
9
|
-
import { N90, N80, N30 } from '@atlaskit/theme/colors';
|
|
10
|
-
import Page16Icon from '@atlaskit/icon-object/glyph/page/16';
|
|
11
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
-
import { PureComponent } from 'react';
|
|
13
|
-
import { defineMessages, injectIntl } from 'react-intl-next';
|
|
14
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
15
|
-
import { linkToolbarMessages as linkToolbarCommonMessages } from '@atlaskit/editor-common/messages';
|
|
16
|
-
import PanelTextInput from '../../../../ui/PanelTextInput';
|
|
17
|
-
import LinkSearchList from '../../../../ui/LinkSearch/LinkSearchList';
|
|
18
|
-
import { container, containerWithProvider, inputWrapper } from '../../../../ui/LinkSearch/ToolbarComponents';
|
|
19
|
-
import { INPUT_METHOD, fireAnalyticsEvent, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
20
|
-
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
21
|
-
import { filterUniqueItems } from '../../../../utils/array';
|
|
22
|
-
import debounce from 'lodash/debounce';
|
|
23
|
-
import { mapContentTypeToIcon, sha1, wordCount } from './utils';
|
|
24
|
-
import { hideLinkToolbar, hideLinkToolbarSetMeta } from '../../commands';
|
|
25
|
-
import { visuallyHiddenStyles } from '../../styles';
|
|
26
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
27
|
-
import { transformTimeStamp } from '../../../../ui/LinkSearch/transformTimeStamp';
|
|
28
|
-
import Announcer from '../../../../utils/announcer/announcer';
|
|
29
|
-
import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
|
|
30
|
-
export const RECENT_SEARCH_LIST_SIZE = 5;
|
|
31
|
-
const clearText = css`
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
padding: 0;
|
|
34
|
-
margin-right: 8px;
|
|
35
|
-
color: ${`var(--ds-icon-subtle, ${N90})`};
|
|
36
|
-
background: transparent;
|
|
37
|
-
border: none;
|
|
38
|
-
`;
|
|
39
|
-
const textInputWrapper = css`
|
|
40
|
-
${inputWrapper};
|
|
41
|
-
border-top: 1px solid ${`var(--ds-border, ${N30})`};
|
|
42
|
-
border-bottom: 1px solid ${`var(--ds-border, ${N30})`};
|
|
43
|
-
`;
|
|
44
|
-
const iconWrapper = css`
|
|
45
|
-
color: ${`var(--ds-icon-subtle, ${N80})`};
|
|
46
|
-
padding: 4px 8px;
|
|
47
|
-
width: 18px;
|
|
48
|
-
`;
|
|
49
|
-
export const messages = defineMessages({
|
|
50
|
-
displayText: {
|
|
51
|
-
id: 'fabric.editor.displayText',
|
|
52
|
-
defaultMessage: 'Text to display',
|
|
53
|
-
description: 'Text to display'
|
|
54
|
-
},
|
|
55
|
-
clearText: {
|
|
56
|
-
id: 'fabric.editor.clearLinkText',
|
|
57
|
-
defaultMessage: 'Clear text',
|
|
58
|
-
description: 'Clears text on the link toolbar'
|
|
59
|
-
},
|
|
60
|
-
clearLink: {
|
|
61
|
-
id: 'fabric.editor.clearLink',
|
|
62
|
-
defaultMessage: 'Clear link',
|
|
63
|
-
description: 'Clears link in the link toolbar'
|
|
64
|
-
},
|
|
65
|
-
searchLinkAriaDescription: {
|
|
66
|
-
id: 'fabric.editor.hyperlink.searchLinkAriaDescription',
|
|
67
|
-
defaultMessage: 'Suggestions will appear below as you type into the field',
|
|
68
|
-
description: 'Describes what the search field does for screen reader users.'
|
|
69
|
-
},
|
|
70
|
-
searchLinkResults: {
|
|
71
|
-
id: 'fabric.editor.hyperlink.searchLinkResults',
|
|
72
|
-
defaultMessage: '{count, plural, =0 {no results} one {# result} other {# results}} found',
|
|
73
|
-
description: 'Announce search results for screen-reader users.'
|
|
74
|
-
},
|
|
75
|
-
linkAriaLabel: {
|
|
76
|
-
id: 'fabric.editor.hyperlink.linkAriaLabel',
|
|
77
|
-
defaultMessage: 'Link label',
|
|
78
|
-
description: 'aria label for a link'
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
const defaultIcon = jsx(Page16Icon, {
|
|
82
|
-
label: 'page'
|
|
83
|
-
});
|
|
84
|
-
const mapActivityProviderResultToLinkSearchItemData = ({
|
|
85
|
-
name,
|
|
86
|
-
container,
|
|
87
|
-
iconUrl,
|
|
88
|
-
objectId,
|
|
89
|
-
url,
|
|
90
|
-
viewedTimestamp
|
|
91
|
-
}) => ({
|
|
92
|
-
objectId,
|
|
93
|
-
name,
|
|
94
|
-
container,
|
|
95
|
-
iconUrl,
|
|
96
|
-
url,
|
|
97
|
-
lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined,
|
|
98
|
-
prefetch: true
|
|
99
|
-
});
|
|
100
|
-
const mapSearchProviderResultToLinkSearchItemData = ({
|
|
101
|
-
objectId,
|
|
102
|
-
container,
|
|
103
|
-
title,
|
|
104
|
-
contentType,
|
|
105
|
-
url,
|
|
106
|
-
updatedTimestamp
|
|
107
|
-
}) => ({
|
|
108
|
-
objectId,
|
|
109
|
-
container,
|
|
110
|
-
name: title,
|
|
111
|
-
url,
|
|
112
|
-
lastUpdatedDate: updatedTimestamp ? new Date(updatedTimestamp) : undefined,
|
|
113
|
-
icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon,
|
|
114
|
-
prefetch: false
|
|
115
|
-
});
|
|
116
|
-
export class HyperlinkLinkAddToolbar extends PureComponent {
|
|
117
|
-
constructor(props) {
|
|
118
|
-
super(props);
|
|
119
|
-
/* To prevent double submit */
|
|
120
|
-
_defineProperty(this, "submitted", false);
|
|
121
|
-
_defineProperty(this, "urlInputContainer", null);
|
|
122
|
-
_defineProperty(this, "displayTextInputContainer", null);
|
|
123
|
-
_defineProperty(this, "wrapperRef", /*#__PURE__*/React.createRef());
|
|
124
|
-
_defineProperty(this, "quickSearchQueryVersion", 0);
|
|
125
|
-
_defineProperty(this, "analyticSource", 'createLinkInlineDialog');
|
|
126
|
-
_defineProperty(this, "quickSearch", async (input, items, quickSearchLimit) => {
|
|
127
|
-
var _pluginState$searchSe;
|
|
128
|
-
const {
|
|
129
|
-
searchProvider,
|
|
130
|
-
displayUrl
|
|
131
|
-
} = this.state;
|
|
132
|
-
const {
|
|
133
|
-
pluginState
|
|
134
|
-
} = this.props;
|
|
135
|
-
if (!searchProvider) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const queryVersion = ++this.quickSearchQueryVersion;
|
|
139
|
-
this.fireAnalytics({
|
|
140
|
-
action: ACTION.ENTERED,
|
|
141
|
-
actionSubject: ACTION_SUBJECT.TEXT,
|
|
142
|
-
actionSubjectId: ACTION_SUBJECT_ID.LINK_SEARCH_INPUT,
|
|
143
|
-
attributes: {
|
|
144
|
-
queryLength: input.length,
|
|
145
|
-
queryVersion,
|
|
146
|
-
queryHash: sha1(input),
|
|
147
|
-
searchSessionId: (_pluginState$searchSe = pluginState.searchSessionId) !== null && _pluginState$searchSe !== void 0 ? _pluginState$searchSe : '',
|
|
148
|
-
wordCount: wordCount(input),
|
|
149
|
-
source: this.analyticSource
|
|
150
|
-
},
|
|
151
|
-
nonPrivacySafeAttributes: {
|
|
152
|
-
query: input
|
|
153
|
-
},
|
|
154
|
-
eventType: EVENT_TYPE.UI
|
|
155
|
-
});
|
|
156
|
-
const perfStart = performance.now();
|
|
157
|
-
try {
|
|
158
|
-
var _pluginState$searchSe2;
|
|
159
|
-
const searchProviderResultItems = await searchProvider.quickSearch(input, quickSearchLimit);
|
|
160
|
-
const searchItems = limit(filterUniqueItems([...items, ...searchProviderResultItems.map(mapSearchProviderResultToLinkSearchItemData)], (firstItem, secondItem) => firstItem.objectId === secondItem.objectId));
|
|
161
|
-
if (displayUrl === input && queryVersion === this.quickSearchQueryVersion) {
|
|
162
|
-
this.setState({
|
|
163
|
-
items: searchItems,
|
|
164
|
-
isLoading: false
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
const perfStop = performance.now();
|
|
168
|
-
const duration = perfStop - perfStart;
|
|
169
|
-
this.fireAnalytics({
|
|
170
|
-
action: ACTION.INVOKED,
|
|
171
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
172
|
-
actionSubjectId: ACTION_SUBJECT_ID.QUICK_SEARCH,
|
|
173
|
-
attributes: {
|
|
174
|
-
duration,
|
|
175
|
-
count: searchProviderResultItems.length
|
|
176
|
-
},
|
|
177
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
178
|
-
});
|
|
179
|
-
this.fireAnalytics({
|
|
180
|
-
action: ACTION.SHOWN,
|
|
181
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
182
|
-
actionSubjectId: ACTION_SUBJECT_ID.POST_QUERY_SEARCH_RESULTS,
|
|
183
|
-
attributes: {
|
|
184
|
-
source: this.analyticSource,
|
|
185
|
-
postQueryRequestDurationMs: duration,
|
|
186
|
-
searchSessionId: (_pluginState$searchSe2 = pluginState.searchSessionId) !== null && _pluginState$searchSe2 !== void 0 ? _pluginState$searchSe2 : '',
|
|
187
|
-
resultCount: searchProviderResultItems.length,
|
|
188
|
-
results: searchProviderResultItems.map(item => ({
|
|
189
|
-
resultContentId: item.objectId,
|
|
190
|
-
resultType: item.contentType
|
|
191
|
-
}))
|
|
192
|
-
},
|
|
193
|
-
eventType: EVENT_TYPE.UI
|
|
194
|
-
});
|
|
195
|
-
} catch (err) {
|
|
196
|
-
const perfStop = performance.now();
|
|
197
|
-
const duration = perfStop - perfStart;
|
|
198
|
-
this.fireAnalytics({
|
|
199
|
-
action: ACTION.INVOKED,
|
|
200
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
201
|
-
actionSubjectId: ACTION_SUBJECT_ID.QUICK_SEARCH,
|
|
202
|
-
attributes: {
|
|
203
|
-
duration,
|
|
204
|
-
count: -1,
|
|
205
|
-
errorCode: err.status
|
|
206
|
-
},
|
|
207
|
-
nonPrivacySafeAttributes: {
|
|
208
|
-
error: err.message
|
|
209
|
-
},
|
|
210
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
_defineProperty(this, "updateInput", async input => {
|
|
215
|
-
const {
|
|
216
|
-
activityProvider,
|
|
217
|
-
searchProvider
|
|
218
|
-
} = this.state;
|
|
219
|
-
this.setState({
|
|
220
|
-
displayUrl: input
|
|
221
|
-
});
|
|
222
|
-
if (activityProvider) {
|
|
223
|
-
if (input.length === 0) {
|
|
224
|
-
this.setState({
|
|
225
|
-
items: await this.getRecentItems(activityProvider),
|
|
226
|
-
selectedIndex: -1
|
|
227
|
-
});
|
|
228
|
-
} else if (isSafeUrl(input)) {
|
|
229
|
-
this.setState({
|
|
230
|
-
items: [],
|
|
231
|
-
selectedIndex: -1,
|
|
232
|
-
isLoading: false
|
|
233
|
-
});
|
|
234
|
-
} else {
|
|
235
|
-
const items = await this.getRecentItems(activityProvider, input);
|
|
236
|
-
const shouldQuerySearchProvider = items.length < RECENT_SEARCH_LIST_SIZE && !!searchProvider;
|
|
237
|
-
this.setState({
|
|
238
|
-
items,
|
|
239
|
-
isLoading: shouldQuerySearchProvider
|
|
240
|
-
});
|
|
241
|
-
if (shouldQuerySearchProvider) {
|
|
242
|
-
this.debouncedQuickSearch(input, items, RECENT_SEARCH_LIST_SIZE);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
_defineProperty(this, "createClearHandler", field => {
|
|
248
|
-
return async () => {
|
|
249
|
-
const {
|
|
250
|
-
activityProvider
|
|
251
|
-
} = this.state;
|
|
252
|
-
switch (field) {
|
|
253
|
-
case 'displayUrl':
|
|
254
|
-
{
|
|
255
|
-
this.setState({
|
|
256
|
-
[field]: '',
|
|
257
|
-
items: !!activityProvider ? limit(await activityProvider.getRecentItems()) : []
|
|
258
|
-
});
|
|
259
|
-
if (this.urlInputContainer) {
|
|
260
|
-
this.urlInputContainer.focus();
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
case 'displayText':
|
|
265
|
-
{
|
|
266
|
-
this.setState({
|
|
267
|
-
[field]: ''
|
|
268
|
-
});
|
|
269
|
-
if (this.displayTextInputContainer) {
|
|
270
|
-
this.displayTextInputContainer.focus();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
});
|
|
276
|
-
_defineProperty(this, "handleClickOutside", event => {
|
|
277
|
-
if (event.target instanceof Element && this.wrapperRef.current && !this.wrapperRef.current.contains(event.target)) {
|
|
278
|
-
const {
|
|
279
|
-
view
|
|
280
|
-
} = this.props;
|
|
281
|
-
hideLinkToolbar()(view.state, view.dispatch);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
_defineProperty(this, "getScreenReaderText", () => {
|
|
285
|
-
const {
|
|
286
|
-
intl
|
|
287
|
-
} = this.props;
|
|
288
|
-
const {
|
|
289
|
-
items,
|
|
290
|
-
selectedIndex
|
|
291
|
-
} = this.state;
|
|
292
|
-
if (items.length && selectedIndex > -1) {
|
|
293
|
-
const {
|
|
294
|
-
name,
|
|
295
|
-
container,
|
|
296
|
-
lastUpdatedDate,
|
|
297
|
-
lastViewedDate
|
|
298
|
-
} = items[selectedIndex];
|
|
299
|
-
const date = transformTimeStamp(intl, lastViewedDate, lastUpdatedDate);
|
|
300
|
-
return `${name}, ${container}, ${date === null || date === void 0 ? void 0 : date.pageAction} ${date === null || date === void 0 ? void 0 : date.dateString} ${(date === null || date === void 0 ? void 0 : date.timeSince) || ''}`;
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
_defineProperty(this, "isUrlPopulatedWithSelectedItem", () => {
|
|
304
|
-
/**
|
|
305
|
-
* When we use ArrowKey to navigate through result items,
|
|
306
|
-
* the URL field will be populated with the content of
|
|
307
|
-
* selected item.
|
|
308
|
-
* This function will check if the URL field is populated
|
|
309
|
-
* with selected item.
|
|
310
|
-
* It can be useful to detect whether we want to insert a
|
|
311
|
-
* smartlink or a hyperlink with customized title
|
|
312
|
-
*/
|
|
313
|
-
const {
|
|
314
|
-
items,
|
|
315
|
-
selectedIndex,
|
|
316
|
-
displayUrl
|
|
317
|
-
} = this.state;
|
|
318
|
-
const selectedItem = items[selectedIndex];
|
|
319
|
-
if (selectedItem && selectedItem.url === displayUrl) {
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
return false;
|
|
323
|
-
});
|
|
324
|
-
_defineProperty(this, "handleSelected", (href, text) => {
|
|
325
|
-
this.handleInsert(href, text, INPUT_METHOD.TYPEAHEAD, 'click');
|
|
326
|
-
});
|
|
327
|
-
_defineProperty(this, "handleInsert", (href, title, inputType, interaction) => {
|
|
328
|
-
const {
|
|
329
|
-
pluginState,
|
|
330
|
-
onSubmit
|
|
331
|
-
} = this.props;
|
|
332
|
-
const {
|
|
333
|
-
items,
|
|
334
|
-
selectedIndex,
|
|
335
|
-
displayText
|
|
336
|
-
} = this.state;
|
|
337
|
-
if (onSubmit) {
|
|
338
|
-
this.submitted = true;
|
|
339
|
-
onSubmit(href, title, displayText, inputType);
|
|
340
|
-
}
|
|
341
|
-
if (interaction === 'click' || this.isUrlPopulatedWithSelectedItem()) {
|
|
342
|
-
var _pluginState$searchSe3, _selectedItem$prefetc;
|
|
343
|
-
/**
|
|
344
|
-
* When it's a mouse click even or the selectedItem.url matches displayUrl, we think
|
|
345
|
-
* it's selected from the result list and fire the
|
|
346
|
-
* analytic
|
|
347
|
-
*/
|
|
348
|
-
const selectedItem = items[selectedIndex];
|
|
349
|
-
this.fireAnalytics({
|
|
350
|
-
action: ACTION.SELECTED,
|
|
351
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
352
|
-
attributes: {
|
|
353
|
-
source: this.analyticSource,
|
|
354
|
-
searchSessionId: (_pluginState$searchSe3 = pluginState.searchSessionId) !== null && _pluginState$searchSe3 !== void 0 ? _pluginState$searchSe3 : '',
|
|
355
|
-
trigger: interaction,
|
|
356
|
-
resultCount: items.length,
|
|
357
|
-
selectedResultId: selectedItem.objectId,
|
|
358
|
-
selectedRelativePosition: selectedIndex,
|
|
359
|
-
prefetch: (_selectedItem$prefetc = selectedItem.prefetch) !== null && _selectedItem$prefetc !== void 0 ? _selectedItem$prefetc : false
|
|
360
|
-
},
|
|
361
|
-
eventType: EVENT_TYPE.UI
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
_defineProperty(this, "handleMouseEnterResultItem", objectId => {
|
|
366
|
-
const {
|
|
367
|
-
items
|
|
368
|
-
} = this.state;
|
|
369
|
-
const index = findIndex(items, item => item.objectId === objectId);
|
|
370
|
-
this.setState({
|
|
371
|
-
selectedIndex: index
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
_defineProperty(this, "handleMouseLeaveResultItem", objectId => {
|
|
375
|
-
const {
|
|
376
|
-
items,
|
|
377
|
-
selectedIndex
|
|
378
|
-
} = this.state;
|
|
379
|
-
const index = findIndex(items, item => item.objectId === objectId);
|
|
380
|
-
// This is to avoid updating index that was set by other mouseenter event
|
|
381
|
-
if (selectedIndex === index) {
|
|
382
|
-
this.setState({
|
|
383
|
-
selectedIndex: -1
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
_defineProperty(this, "handleSubmit", () => {
|
|
388
|
-
const {
|
|
389
|
-
displayUrl,
|
|
390
|
-
selectedIndex,
|
|
391
|
-
items
|
|
392
|
-
} = this.state;
|
|
393
|
-
const selectedItem = items[selectedIndex];
|
|
394
|
-
if (this.isUrlPopulatedWithSelectedItem()) {
|
|
395
|
-
this.handleInsert(normalizeUrl(selectedItem.url), selectedItem.name, INPUT_METHOD.TYPEAHEAD, 'keyboard');
|
|
396
|
-
} else if (displayUrl && displayUrl.length > 0) {
|
|
397
|
-
const url = normalizeUrl(displayUrl);
|
|
398
|
-
if (url) {
|
|
399
|
-
this.handleInsert(url, displayUrl, INPUT_METHOD.MANUAL, 'notselected');
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
_defineProperty(this, "handleClearTextKeyDown", event => {
|
|
404
|
-
const KEY_CODE_TAB = 9;
|
|
405
|
-
const {
|
|
406
|
-
keyCode
|
|
407
|
-
} = event;
|
|
408
|
-
if (keyCode === KEY_CODE_TAB) {
|
|
409
|
-
if (!this.submitted) {
|
|
410
|
-
const {
|
|
411
|
-
displayUrl,
|
|
412
|
-
displayText
|
|
413
|
-
} = this.state;
|
|
414
|
-
const url = normalizeUrl(displayUrl);
|
|
415
|
-
this.handleInsert(url, displayText || displayUrl, INPUT_METHOD.MANUAL, 'notselected');
|
|
416
|
-
}
|
|
417
|
-
event.preventDefault();
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
_defineProperty(this, "handleKeyDown", event => {
|
|
422
|
-
const {
|
|
423
|
-
items,
|
|
424
|
-
selectedIndex
|
|
425
|
-
} = this.state;
|
|
426
|
-
const {
|
|
427
|
-
pluginState,
|
|
428
|
-
view
|
|
429
|
-
} = this.props;
|
|
430
|
-
const {
|
|
431
|
-
keyCode
|
|
432
|
-
} = event;
|
|
433
|
-
const KEY_CODE_ESCAPE = 27;
|
|
434
|
-
const KEY_CODE_ARROW_DOWN = 40;
|
|
435
|
-
const KEY_CODE_ARROW_UP = 38;
|
|
436
|
-
if (keyCode === KEY_CODE_ESCAPE) {
|
|
437
|
-
var _toolbarKey$getState, _toolbarKey$getState$;
|
|
438
|
-
// escape
|
|
439
|
-
event.preventDefault();
|
|
440
|
-
const {
|
|
441
|
-
state: {
|
|
442
|
-
tr
|
|
443
|
-
},
|
|
444
|
-
dispatch
|
|
445
|
-
} = view;
|
|
446
|
-
hideLinkToolbarSetMeta(tr);
|
|
447
|
-
(_toolbarKey$getState = 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);
|
|
448
|
-
dispatch(tr);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (!items || !items.length) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
let updatedIndex = selectedIndex;
|
|
455
|
-
if (keyCode === KEY_CODE_ARROW_DOWN) {
|
|
456
|
-
// down
|
|
457
|
-
event.preventDefault();
|
|
458
|
-
updatedIndex = (selectedIndex + 1) % items.length;
|
|
459
|
-
} else if (keyCode === KEY_CODE_ARROW_UP) {
|
|
460
|
-
// up
|
|
461
|
-
event.preventDefault();
|
|
462
|
-
updatedIndex = selectedIndex > 0 ? selectedIndex - 1 : items.length - 1;
|
|
463
|
-
}
|
|
464
|
-
if ([KEY_CODE_ARROW_DOWN, KEY_CODE_ARROW_UP].includes(keyCode) && items[updatedIndex]) {
|
|
465
|
-
var _pluginState$searchSe4;
|
|
466
|
-
this.setState({
|
|
467
|
-
selectedIndex: updatedIndex,
|
|
468
|
-
displayUrl: items[updatedIndex].url
|
|
469
|
-
});
|
|
470
|
-
this.fireAnalytics({
|
|
471
|
-
action: ACTION.HIGHLIGHTED,
|
|
472
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
473
|
-
attributes: {
|
|
474
|
-
source: this.analyticSource,
|
|
475
|
-
searchSessionId: (_pluginState$searchSe4 = pluginState.searchSessionId) !== null && _pluginState$searchSe4 !== void 0 ? _pluginState$searchSe4 : '',
|
|
476
|
-
selectedResultId: items[updatedIndex].objectId,
|
|
477
|
-
selectedRelativePosition: updatedIndex
|
|
478
|
-
},
|
|
479
|
-
eventType: EVENT_TYPE.UI
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
_defineProperty(this, "updateTextInput", displayText => {
|
|
484
|
-
this.setState({
|
|
485
|
-
displayText
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
_defineProperty(this, "handleCancel", e => {
|
|
489
|
-
const {
|
|
490
|
-
view
|
|
491
|
-
} = this.props;
|
|
492
|
-
e.preventDefault();
|
|
493
|
-
hideLinkToolbar()(view.state, view.dispatch);
|
|
494
|
-
});
|
|
495
|
-
this.state = {
|
|
496
|
-
selectedIndex: -1,
|
|
497
|
-
isLoading: false,
|
|
498
|
-
displayUrl: normalizeUrl(props.displayUrl),
|
|
499
|
-
displayText: props.displayText,
|
|
500
|
-
items: []
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
/* Cache functions */
|
|
504
|
-
this.handleClearText = this.createClearHandler('displayUrl');
|
|
505
|
-
this.handleClearDisplayText = this.createClearHandler('displayText');
|
|
506
|
-
this.debouncedQuickSearch = debounce(this.quickSearch, 400);
|
|
507
|
-
this.fireCustomAnalytics = fireAnalyticsEvent(props.createAnalyticsEvent);
|
|
508
|
-
}
|
|
509
|
-
async componentDidMount() {
|
|
510
|
-
var _pluginState$searchSe5, _pluginState$inputMet;
|
|
511
|
-
const {
|
|
512
|
-
pluginState
|
|
513
|
-
} = this.props;
|
|
514
|
-
document.addEventListener('mousedown', this.handleClickOutside);
|
|
515
|
-
this.fireAnalytics({
|
|
516
|
-
action: ACTION.VIEWED,
|
|
517
|
-
actionSubject: ACTION_SUBJECT.CREATE_LINK_INLINE_DIALOG,
|
|
518
|
-
attributes: {
|
|
519
|
-
timesViewed: pluginState.timesViewed,
|
|
520
|
-
searchSessionId: (_pluginState$searchSe5 = pluginState.searchSessionId) !== null && _pluginState$searchSe5 !== void 0 ? _pluginState$searchSe5 : '',
|
|
521
|
-
trigger: (_pluginState$inputMet = pluginState.inputMethod) !== null && _pluginState$inputMet !== void 0 ? _pluginState$inputMet : ''
|
|
522
|
-
},
|
|
523
|
-
eventType: EVENT_TYPE.SCREEN
|
|
524
|
-
});
|
|
525
|
-
const [activityProvider, searchProvider] = await Promise.all([this.props.activityProvider, this.props.searchProvider]);
|
|
526
|
-
this.setState({
|
|
527
|
-
activityProvider,
|
|
528
|
-
searchProvider
|
|
529
|
-
});
|
|
530
|
-
await this.loadInitialLinkSearchResult();
|
|
531
|
-
}
|
|
532
|
-
componentWillUnmount() {
|
|
533
|
-
const {
|
|
534
|
-
pluginState
|
|
535
|
-
} = this.props;
|
|
536
|
-
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
537
|
-
if (!this.submitted) {
|
|
538
|
-
var _pluginState$searchSe6;
|
|
539
|
-
this.fireAnalytics({
|
|
540
|
-
action: ACTION.DISMISSED,
|
|
541
|
-
actionSubject: ACTION_SUBJECT.CREATE_LINK_INLINE_DIALOG,
|
|
542
|
-
attributes: {
|
|
543
|
-
source: this.analyticSource,
|
|
544
|
-
searchSessionId: (_pluginState$searchSe6 = pluginState.searchSessionId) !== null && _pluginState$searchSe6 !== void 0 ? _pluginState$searchSe6 : '',
|
|
545
|
-
trigger: 'blur'
|
|
546
|
-
},
|
|
547
|
-
eventType: EVENT_TYPE.UI
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
async getRecentItems(activityProvider, query) {
|
|
552
|
-
const {
|
|
553
|
-
pluginState
|
|
554
|
-
} = this.props;
|
|
555
|
-
const perfStart = performance.now();
|
|
556
|
-
try {
|
|
557
|
-
var _pluginState$searchSe7;
|
|
558
|
-
const activityRecentItems = limit(query ? await activityProvider.searchRecent(query) : await activityProvider.getRecentItems());
|
|
559
|
-
const items = activityRecentItems.map(mapActivityProviderResultToLinkSearchItemData);
|
|
560
|
-
const perfStop = performance.now();
|
|
561
|
-
const duration = perfStop - perfStart;
|
|
562
|
-
this.fireAnalytics({
|
|
563
|
-
action: ACTION.INVOKED,
|
|
564
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
565
|
-
actionSubjectId: ACTION_SUBJECT_ID.RECENT_ACTIVITIES,
|
|
566
|
-
attributes: {
|
|
567
|
-
duration,
|
|
568
|
-
count: items.length
|
|
569
|
-
},
|
|
570
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
571
|
-
});
|
|
572
|
-
this.fireAnalytics({
|
|
573
|
-
action: ACTION.SHOWN,
|
|
574
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
575
|
-
actionSubjectId: ACTION_SUBJECT_ID.PRE_QUERY_SEARCH_RESULTS,
|
|
576
|
-
attributes: {
|
|
577
|
-
source: this.analyticSource,
|
|
578
|
-
preQueryRequestDurationMs: duration,
|
|
579
|
-
searchSessionId: (_pluginState$searchSe7 = pluginState.searchSessionId) !== null && _pluginState$searchSe7 !== void 0 ? _pluginState$searchSe7 : '',
|
|
580
|
-
resultCount: items.length,
|
|
581
|
-
results: activityRecentItems.map(item => {
|
|
582
|
-
var _item$type;
|
|
583
|
-
return {
|
|
584
|
-
resultContentId: item.objectId,
|
|
585
|
-
resultType: (_item$type = item.type) !== null && _item$type !== void 0 ? _item$type : ''
|
|
586
|
-
};
|
|
587
|
-
})
|
|
588
|
-
},
|
|
589
|
-
eventType: EVENT_TYPE.UI
|
|
590
|
-
});
|
|
591
|
-
return items;
|
|
592
|
-
} catch (err) {
|
|
593
|
-
const perfStop = performance.now();
|
|
594
|
-
const duration = perfStop - perfStart;
|
|
595
|
-
this.fireAnalytics({
|
|
596
|
-
action: ACTION.INVOKED,
|
|
597
|
-
actionSubject: ACTION_SUBJECT.SEARCH_RESULT,
|
|
598
|
-
actionSubjectId: ACTION_SUBJECT_ID.RECENT_ACTIVITIES,
|
|
599
|
-
attributes: {
|
|
600
|
-
duration,
|
|
601
|
-
count: -1,
|
|
602
|
-
errorCode: err.status
|
|
603
|
-
},
|
|
604
|
-
nonPrivacySafeAttributes: {
|
|
605
|
-
error: err.message
|
|
606
|
-
},
|
|
607
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
608
|
-
});
|
|
609
|
-
return [];
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
fireAnalytics(payload) {
|
|
613
|
-
if (this.props.createAnalyticsEvent && this.fireCustomAnalytics) {
|
|
614
|
-
this.fireCustomAnalytics({
|
|
615
|
-
payload
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
async loadInitialLinkSearchResult() {
|
|
620
|
-
const {
|
|
621
|
-
displayUrl,
|
|
622
|
-
activityProvider
|
|
623
|
-
} = this.state;
|
|
624
|
-
try {
|
|
625
|
-
if (!displayUrl && activityProvider) {
|
|
626
|
-
this.setState({
|
|
627
|
-
isLoading: true
|
|
628
|
-
});
|
|
629
|
-
const items = await this.getRecentItems(activityProvider);
|
|
630
|
-
this.setState({
|
|
631
|
-
items
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
} finally {
|
|
635
|
-
this.setState({
|
|
636
|
-
isLoading: false
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
render() {
|
|
641
|
-
const {
|
|
642
|
-
items,
|
|
643
|
-
isLoading,
|
|
644
|
-
selectedIndex,
|
|
645
|
-
displayUrl,
|
|
646
|
-
displayText
|
|
647
|
-
} = this.state;
|
|
648
|
-
const {
|
|
649
|
-
intl: {
|
|
650
|
-
formatMessage
|
|
651
|
-
},
|
|
652
|
-
activityProvider
|
|
653
|
-
} = this.props;
|
|
654
|
-
const placeholder = formatMessage(activityProvider ? linkToolbarCommonMessages.placeholder : linkToolbarCommonMessages.linkPlaceholder);
|
|
655
|
-
const formatLinkAddressText = formatMessage(linkToolbarCommonMessages.linkAddress);
|
|
656
|
-
const formatClearLinkText = formatMessage(messages.clearLink);
|
|
657
|
-
const formatDisplayText = formatMessage(messages.displayText);
|
|
658
|
-
const screenReaderDescriptionId = 'search-recent-links-field-description';
|
|
659
|
-
const linkSearchListId = 'hyperlink-search-list';
|
|
660
|
-
const ariaActiveDescendant = selectedIndex > -1 ? `link-search-list-item-${selectedIndex}` : '';
|
|
661
|
-
|
|
662
|
-
// Added workaround with a screen reader Announcer specifically for VoiceOver + Safari
|
|
663
|
-
// as the Aria design pattern for combobox does not work in this case
|
|
664
|
-
// for details: https://a11y-internal.atlassian.net/browse/AK-740
|
|
665
|
-
const screenReaderText = browser.safari && this.getScreenReaderText();
|
|
666
|
-
return jsx("div", {
|
|
667
|
-
"aria-label": "Hyperlink Edit",
|
|
668
|
-
className: "recent-list"
|
|
669
|
-
}, jsx("div", {
|
|
670
|
-
css: [container, !!activityProvider && containerWithProvider],
|
|
671
|
-
ref: this.wrapperRef
|
|
672
|
-
}, jsx("div", {
|
|
673
|
-
css: inputWrapper
|
|
674
|
-
}, jsx("span", {
|
|
675
|
-
css: iconWrapper
|
|
676
|
-
}, jsx(Tooltip, {
|
|
677
|
-
content: formatLinkAddressText
|
|
678
|
-
}, jsx(LinkIcon, {
|
|
679
|
-
label: formatLinkAddressText
|
|
680
|
-
}))), screenReaderText && jsx(Announcer, {
|
|
681
|
-
ariaLive: "assertive",
|
|
682
|
-
text: screenReaderText,
|
|
683
|
-
ariaRelevant: "additions",
|
|
684
|
-
delay: 250
|
|
685
|
-
}), jsx("div", {
|
|
686
|
-
css: visuallyHiddenStyles,
|
|
687
|
-
"aria-hidden": "true",
|
|
688
|
-
id: screenReaderDescriptionId
|
|
689
|
-
}, formatMessage(messages.searchLinkAriaDescription)), jsx(PanelTextInput, {
|
|
690
|
-
role: "combobox",
|
|
691
|
-
ariaExpanded: true,
|
|
692
|
-
ariaActiveDescendant: ariaActiveDescendant,
|
|
693
|
-
ariaControls: linkSearchListId,
|
|
694
|
-
ariaAutoComplete: true,
|
|
695
|
-
describedById: screenReaderDescriptionId,
|
|
696
|
-
ref: ele => this.urlInputContainer = ele,
|
|
697
|
-
placeholder: placeholder,
|
|
698
|
-
testId: 'link-url',
|
|
699
|
-
onSubmit: this.handleSubmit,
|
|
700
|
-
onChange: this.updateInput,
|
|
701
|
-
autoFocus: {
|
|
702
|
-
preventScroll: true
|
|
703
|
-
},
|
|
704
|
-
onCancel: this.handleCancel,
|
|
705
|
-
defaultValue: displayUrl,
|
|
706
|
-
onKeyDown: this.handleKeyDown
|
|
707
|
-
}), displayUrl && jsx(Tooltip, {
|
|
708
|
-
content: formatClearLinkText
|
|
709
|
-
}, jsx("button", {
|
|
710
|
-
type: "button",
|
|
711
|
-
css: clearText,
|
|
712
|
-
onClick: this.handleClearText
|
|
713
|
-
}, jsx(CrossCircleIcon, {
|
|
714
|
-
label: formatClearLinkText
|
|
715
|
-
})))), jsx("div", {
|
|
716
|
-
css: textInputWrapper
|
|
717
|
-
}, jsx("span", {
|
|
718
|
-
css: iconWrapper
|
|
719
|
-
}, jsx(Tooltip, {
|
|
720
|
-
content: formatDisplayText
|
|
721
|
-
}, jsx(EditorAlignLeftIcon, {
|
|
722
|
-
label: formatDisplayText
|
|
723
|
-
}))), jsx(PanelTextInput, {
|
|
724
|
-
ref: ele => this.displayTextInputContainer = ele,
|
|
725
|
-
placeholder: formatDisplayText,
|
|
726
|
-
ariaLabel: formatMessage(messages.linkAriaLabel),
|
|
727
|
-
testId: 'link-label',
|
|
728
|
-
onChange: this.updateTextInput,
|
|
729
|
-
onCancel: this.handleCancel,
|
|
730
|
-
defaultValue: displayText,
|
|
731
|
-
onSubmit: this.handleSubmit,
|
|
732
|
-
onKeyDown: this.handleKeyDown
|
|
733
|
-
}), displayText && jsx(Tooltip, {
|
|
734
|
-
content: formatMessage(messages.clearText)
|
|
735
|
-
}, jsx("button", {
|
|
736
|
-
type: "button",
|
|
737
|
-
css: clearText,
|
|
738
|
-
onClick: this.handleClearDisplayText,
|
|
739
|
-
onKeyDown: this.handleClearTextKeyDown
|
|
740
|
-
}, jsx(CrossCircleIcon, {
|
|
741
|
-
label: formatMessage(messages.clearText)
|
|
742
|
-
})))), jsx("div", {
|
|
743
|
-
css: visuallyHiddenStyles,
|
|
744
|
-
"aria-live": "polite",
|
|
745
|
-
"aria-atomic": "true",
|
|
746
|
-
id: "fabric.editor.hyperlink.suggested.results"
|
|
747
|
-
}, displayUrl && formatMessage(messages.searchLinkResults, {
|
|
748
|
-
count: items.length
|
|
749
|
-
})), jsx(LinkSearchList, {
|
|
750
|
-
ariaControls: "fabric.editor.hyperlink.suggested.results",
|
|
751
|
-
id: linkSearchListId,
|
|
752
|
-
role: "listbox",
|
|
753
|
-
items: items,
|
|
754
|
-
isLoading: isLoading,
|
|
755
|
-
selectedIndex: selectedIndex,
|
|
756
|
-
onSelect: this.handleSelected,
|
|
757
|
-
onMouseEnter: this.handleMouseEnterResultItem,
|
|
758
|
-
onMouseLeave: this.handleMouseLeaveResultItem
|
|
759
|
-
})));
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
function findIndex(array, predicate) {
|
|
763
|
-
let index = -1;
|
|
764
|
-
array.some((item, i) => {
|
|
765
|
-
if (predicate(item)) {
|
|
766
|
-
index = i;
|
|
767
|
-
return true;
|
|
768
|
-
}
|
|
769
|
-
return false;
|
|
770
|
-
});
|
|
771
|
-
return index;
|
|
772
|
-
}
|
|
773
|
-
function limit(items) {
|
|
774
|
-
return items.slice(0, RECENT_SEARCH_LIST_SIZE);
|
|
775
|
-
}
|
|
776
|
-
export const HyperlinkLinkAddToolbarWithIntl = injectIntl(HyperlinkLinkAddToolbar);
|
|
777
|
-
export default withAnalyticsEvents()(HyperlinkLinkAddToolbarWithIntl);
|