@atlaskit/editor-core 188.8.0 → 188.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/composable-editor/editor-internal.js +2 -2
- package/dist/cjs/create-editor/ReactEditorView.js +796 -8
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +7 -4
- package/dist/cjs/plugins/index.js +0 -28
- package/dist/cjs/plugins/insert-block/index.js +4 -6
- package/dist/cjs/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -13
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +15 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/editor-internal.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +753 -2
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +4 -1
- package/dist/es2019/plugins/index.js +0 -4
- package/dist/es2019/plugins/insert-block/index.js +4 -6
- package/dist/es2019/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +43 -10
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +13 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/editor-internal.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +797 -8
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +4 -1
- package/dist/esm/plugins/index.js +0 -4
- package/dist/esm/plugins/insert-block/index.js +4 -6
- package/dist/esm/plugins/tasks-and-decisions/index.js +4 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +26 -6
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +45 -12
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +14 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +119 -5
- package/dist/types/labs/next/presets/default.d.ts +43 -43
- package/dist/types/plugins/index.d.ts +0 -4
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/tasks-and-decisions/index.d.ts +2 -5
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +6 -1
- package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +119 -5
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +43 -43
- package/dist/types-ts4.5/plugins/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/index.d.ts +2 -5
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +9 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +9 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +4 -2
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +8 -1
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +0 -812
- package/dist/cjs/create-editor/ReactEditorViewNext.js +0 -15
- package/dist/cjs/plugins/save-on-enter/index.js +0 -70
- package/dist/cjs/plugins/scroll-into-view/index.js +0 -55
- package/dist/cjs/plugins/status/actions.js +0 -158
- package/dist/cjs/plugins/status/analytics.js +0 -31
- package/dist/cjs/plugins/status/index.js +0 -143
- package/dist/cjs/plugins/status/keymap.js +0 -22
- package/dist/cjs/plugins/status/nodeviews/status.js +0 -58
- package/dist/cjs/plugins/status/plugin-key.js +0 -9
- package/dist/cjs/plugins/status/plugin.js +0 -133
- package/dist/cjs/plugins/status/types.js +0 -5
- package/dist/cjs/plugins/status/ui/statusPicker.js +0 -314
- package/dist/cjs/plugins/status/utils.js +0 -22
- package/dist/cjs/plugins/type-ahead/api.js +0 -215
- package/dist/cjs/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -205
- package/dist/cjs/plugins/type-ahead/commands/update-list-items.js +0 -23
- package/dist/cjs/plugins/type-ahead/commands/update-query.js +0 -27
- package/dist/cjs/plugins/type-ahead/commands/update-selected-index.js +0 -27
- package/dist/cjs/plugins/type-ahead/constants.js +0 -15
- package/dist/cjs/plugins/type-ahead/index.js +0 -14
- package/dist/cjs/plugins/type-ahead/insert-utils.js +0 -107
- package/dist/cjs/plugins/type-ahead/messages.js +0 -79
- package/dist/cjs/plugins/type-ahead/plugin.js +0 -382
- package/dist/cjs/plugins/type-ahead/pm-plugins/actions.js +0 -16
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +0 -148
- package/dist/cjs/plugins/type-ahead/pm-plugins/input-rules.js +0 -36
- package/dist/cjs/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -22
- package/dist/cjs/plugins/type-ahead/pm-plugins/key.js +0 -8
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +0 -110
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +0 -158
- package/dist/cjs/plugins/type-ahead/pm-plugins/utils.js +0 -18
- package/dist/cjs/plugins/type-ahead/stats-modifier.js +0 -42
- package/dist/cjs/plugins/type-ahead/transforms/close-type-ahead.js +0 -13
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -75
- package/dist/cjs/plugins/type-ahead/transforms/set-selection-before-query.js +0 -18
- package/dist/cjs/plugins/type-ahead/types.js +0 -5
- package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +0 -120
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +0 -400
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +0 -285
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +0 -179
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +0 -230
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -127
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -109
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-load-items.js +0 -50
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -41
- package/dist/cjs/plugins/type-ahead/utils.js +0 -130
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +0 -753
- package/dist/es2019/create-editor/ReactEditorViewNext.js +0 -7
- package/dist/es2019/plugins/save-on-enter/index.js +0 -63
- package/dist/es2019/plugins/scroll-into-view/index.js +0 -44
- package/dist/es2019/plugins/status/actions.js +0 -144
- package/dist/es2019/plugins/status/analytics.js +0 -18
- package/dist/es2019/plugins/status/index.js +0 -135
- package/dist/es2019/plugins/status/keymap.js +0 -13
- package/dist/es2019/plugins/status/nodeviews/status.js +0 -60
- package/dist/es2019/plugins/status/plugin-key.js +0 -3
- package/dist/es2019/plugins/status/plugin.js +0 -113
- package/dist/es2019/plugins/status/types.js +0 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +0 -293
- package/dist/es2019/plugins/status/utils.js +0 -12
- package/dist/es2019/plugins/type-ahead/api.js +0 -205
- package/dist/es2019/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -204
- package/dist/es2019/plugins/type-ahead/commands/update-list-items.js +0 -17
- package/dist/es2019/plugins/type-ahead/commands/update-query.js +0 -21
- package/dist/es2019/plugins/type-ahead/commands/update-selected-index.js +0 -21
- package/dist/es2019/plugins/type-ahead/constants.js +0 -9
- package/dist/es2019/plugins/type-ahead/index.js +0 -3
- package/dist/es2019/plugins/type-ahead/insert-utils.js +0 -106
- package/dist/es2019/plugins/type-ahead/messages.js +0 -73
- package/dist/es2019/plugins/type-ahead/plugin.js +0 -381
- package/dist/es2019/plugins/type-ahead/pm-plugins/actions.js +0 -10
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -148
- package/dist/es2019/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
- package/dist/es2019/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
- package/dist/es2019/plugins/type-ahead/pm-plugins/key.js +0 -2
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +0 -106
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +0 -160
- package/dist/es2019/plugins/type-ahead/pm-plugins/utils.js +0 -12
- package/dist/es2019/plugins/type-ahead/stats-modifier.js +0 -33
- package/dist/es2019/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -71
- package/dist/es2019/plugins/type-ahead/transforms/set-selection-before-query.js +0 -10
- package/dist/es2019/plugins/type-ahead/types.js +0 -1
- package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +0 -88
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +0 -393
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +0 -273
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +0 -214
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +0 -233
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -109
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -112
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-load-items.js +0 -41
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -38
- package/dist/es2019/plugins/type-ahead/utils.js +0 -126
- package/dist/esm/create-editor/ReactEditorViewInternal.js +0 -806
- package/dist/esm/create-editor/ReactEditorViewNext.js +0 -7
- package/dist/esm/plugins/save-on-enter/index.js +0 -63
- package/dist/esm/plugins/scroll-into-view/index.js +0 -50
- package/dist/esm/plugins/status/actions.js +0 -151
- package/dist/esm/plugins/status/analytics.js +0 -24
- package/dist/esm/plugins/status/index.js +0 -136
- package/dist/esm/plugins/status/keymap.js +0 -15
- package/dist/esm/plugins/status/nodeviews/status.js +0 -51
- package/dist/esm/plugins/status/plugin-key.js +0 -3
- package/dist/esm/plugins/status/plugin.js +0 -115
- package/dist/esm/plugins/status/types.js +0 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +0 -308
- package/dist/esm/plugins/status/utils.js +0 -16
- package/dist/esm/plugins/type-ahead/api.js +0 -209
- package/dist/esm/plugins/type-ahead/commands/insert-type-ahead-item.js +0 -198
- package/dist/esm/plugins/type-ahead/commands/update-list-items.js +0 -17
- package/dist/esm/plugins/type-ahead/commands/update-query.js +0 -21
- package/dist/esm/plugins/type-ahead/commands/update-selected-index.js +0 -21
- package/dist/esm/plugins/type-ahead/constants.js +0 -9
- package/dist/esm/plugins/type-ahead/index.js +0 -3
- package/dist/esm/plugins/type-ahead/insert-utils.js +0 -101
- package/dist/esm/plugins/type-ahead/messages.js +0 -73
- package/dist/esm/plugins/type-ahead/plugin.js +0 -374
- package/dist/esm/plugins/type-ahead/pm-plugins/actions.js +0 -10
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -141
- package/dist/esm/plugins/type-ahead/pm-plugins/input-rules.js +0 -29
- package/dist/esm/plugins/type-ahead/pm-plugins/insert-item-plugin.js +0 -16
- package/dist/esm/plugins/type-ahead/pm-plugins/key.js +0 -2
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +0 -104
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +0 -151
- package/dist/esm/plugins/type-ahead/pm-plugins/utils.js +0 -12
- package/dist/esm/plugins/type-ahead/stats-modifier.js +0 -35
- package/dist/esm/plugins/type-ahead/transforms/close-type-ahead.js +0 -7
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +0 -69
- package/dist/esm/plugins/type-ahead/transforms/set-selection-before-query.js +0 -12
- package/dist/esm/plugins/type-ahead/types.js +0 -1
- package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +0 -115
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +0 -390
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +0 -276
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +0 -169
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +0 -220
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +0 -117
- package/dist/esm/plugins/type-ahead/ui/hooks/use-item-insert.js +0 -103
- package/dist/esm/plugins/type-ahead/ui/hooks/use-load-items.js +0 -43
- package/dist/esm/plugins/type-ahead/ui/hooks/use-on-force-select.js +0 -35
- package/dist/esm/plugins/type-ahead/utils.js +0 -124
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -119
- package/dist/types/create-editor/ReactEditorViewNext.d.ts +0 -8
- package/dist/types/plugins/save-on-enter/index.d.ts +0 -10
- package/dist/types/plugins/scroll-into-view/index.d.ts +0 -14
- package/dist/types/plugins/status/actions.d.ts +0 -16
- package/dist/types/plugins/status/analytics.d.ts +0 -4
- package/dist/types/plugins/status/index.d.ts +0 -15
- package/dist/types/plugins/status/keymap.d.ts +0 -3
- package/dist/types/plugins/status/nodeviews/status.d.ts +0 -25
- package/dist/types/plugins/status/plugin-key.d.ts +0 -4
- package/dist/types/plugins/status/plugin.d.ts +0 -7
- package/dist/types/plugins/status/types.d.ts +0 -18
- package/dist/types/plugins/status/ui/statusPicker.d.ts +0 -63
- package/dist/types/plugins/status/utils.d.ts +0 -5
- package/dist/types/plugins/type-ahead/api.d.ts +0 -61
- package/dist/types/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
- package/dist/types/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
- package/dist/types/plugins/type-ahead/commands/update-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
- package/dist/types/plugins/type-ahead/constants.d.ts +0 -8
- package/dist/types/plugins/type-ahead/index.d.ts +0 -4
- package/dist/types/plugins/type-ahead/insert-utils.d.ts +0 -18
- package/dist/types/plugins/type-ahead/messages.d.ts +0 -72
- package/dist/types/plugins/type-ahead/plugin.d.ts +0 -10
- package/dist/types/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
- package/dist/types/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
- package/dist/types/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
- package/dist/types/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
- package/dist/types/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
- package/dist/types/plugins/type-ahead/stats-modifier.d.ts +0 -20
- package/dist/types/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
- package/dist/types/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
- package/dist/types/plugins/type-ahead/types.d.ts +0 -109
- package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
- package/dist/types/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
- package/dist/types/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
- package/dist/types/plugins/type-ahead/utils.d.ts +0 -27
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -119
- package/dist/types-ts4.5/create-editor/ReactEditorViewNext.d.ts +0 -8
- package/dist/types-ts4.5/plugins/save-on-enter/index.d.ts +0 -10
- package/dist/types-ts4.5/plugins/scroll-into-view/index.d.ts +0 -14
- package/dist/types-ts4.5/plugins/status/actions.d.ts +0 -16
- package/dist/types-ts4.5/plugins/status/analytics.d.ts +0 -4
- package/dist/types-ts4.5/plugins/status/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/status/keymap.d.ts +0 -3
- package/dist/types-ts4.5/plugins/status/nodeviews/status.d.ts +0 -25
- package/dist/types-ts4.5/plugins/status/plugin-key.d.ts +0 -4
- package/dist/types-ts4.5/plugins/status/plugin.d.ts +0 -7
- package/dist/types-ts4.5/plugins/status/types.d.ts +0 -18
- package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +0 -63
- package/dist/types-ts4.5/plugins/status/utils.d.ts +0 -5
- package/dist/types-ts4.5/plugins/type-ahead/api.d.ts +0 -61
- package/dist/types-ts4.5/plugins/type-ahead/commands/insert-type-ahead-item.d.ts +0 -12
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-list-items.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-query.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/commands/update-selected-index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/constants.d.ts +0 -8
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/type-ahead/insert-utils.d.ts +0 -18
- package/dist/types-ts4.5/plugins/type-ahead/messages.d.ts +0 -72
- package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +0 -10
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/actions.d.ts +0 -9
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -14
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/input-rules.d.ts +0 -6
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/insert-item-plugin.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +0 -14
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/reducer.d.ts +0 -10
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/type-ahead/stats-modifier.d.ts +0 -20
- package/dist/types-ts4.5/plugins/type-ahead/transforms/close-type-ahead.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +0 -11
- package/dist/types-ts4.5/plugins/type-ahead/transforms/set-selection-before-query.d.ts +0 -2
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +0 -111
- package/dist/types-ts4.5/plugins/type-ahead/ui/AssistiveText.d.ts +0 -33
- package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -26
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadList.d.ts +0 -25
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -18
- package/dist/types-ts4.5/plugins/type-ahead/ui/TypeAheadPopup.d.ts +0 -29
- package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -20
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-item-insert.d.ts +0 -7
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-load-items.d.ts +0 -3
- package/dist/types-ts4.5/plugins/type-ahead/ui/hooks/use-on-force-select.d.ts +0 -11
- package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +0 -27
|
@@ -1,806 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
|
-
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
|
-
import { editorMessages } from './messages';
|
|
18
|
-
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking, processRawValue, analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
19
|
-
import { ExperienceStore, EditorExperience, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
20
|
-
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
21
|
-
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
22
|
-
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
23
|
-
import { findChangedNodesFromTransaction, validateNodes, validNode } from '../utils/nodes';
|
|
24
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, PLATFORMS, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
25
|
-
import { createFeatureFlagsFromProps } from './feature-flags-from-props';
|
|
26
|
-
import { getEnabledFeatureFlagKeys } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
27
|
-
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
28
|
-
import { getDocStructure } from '../utils/document-logger';
|
|
29
|
-
import { isFullPage } from '../utils/is-full-page';
|
|
30
|
-
import measurements from '../utils/performance/measure-enum';
|
|
31
|
-
import { getNodesCount } from '../utils/document';
|
|
32
|
-
import { createSchema } from './create-schema';
|
|
33
|
-
import { PluginPerformanceObserver } from '../utils/performance/plugin-performance-observer';
|
|
34
|
-
import { getParticipantsCount } from '../plugins/collab-edit/get-participants-count';
|
|
35
|
-
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, EVENT_NAME_ON_CHANGE, TransactionTracker } from '../utils/performance/track-transactions';
|
|
36
|
-
import { countNodes as _countNodes } from '@atlaskit/editor-common/utils';
|
|
37
|
-
import createPluginsList from './create-plugins-list';
|
|
38
|
-
import { PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS } from './consts';
|
|
39
|
-
import ReactEditorViewContext from './ReactEditorViewContext';
|
|
40
|
-
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
41
|
-
import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
|
|
42
|
-
function handleEditorFocus(view) {
|
|
43
|
-
if (view.hasFocus()) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
return window.setTimeout(function () {
|
|
47
|
-
if (view.hasFocus()) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (!window.getSelection) {
|
|
51
|
-
view.focus();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
var domSelection = window.getSelection();
|
|
55
|
-
if (!domSelection || domSelection.rangeCount === 0) {
|
|
56
|
-
view.focus();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
var range = domSelection.getRangeAt(0);
|
|
60
|
-
// if selection is outside editor focus and exit
|
|
61
|
-
if (range.startContainer.contains(view.dom)) {
|
|
62
|
-
view.focus();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
// set cursor/selection and focus
|
|
66
|
-
var anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
67
|
-
var head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
68
|
-
// if anchor or head < 0 focus and exit
|
|
69
|
-
if (anchor < 0 || head < 0) {
|
|
70
|
-
view.focus();
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
var selection = TextSelection.create(view.state.doc, anchor, head);
|
|
74
|
-
var tr = view.state.tr.setSelection(selection);
|
|
75
|
-
view.dispatch(tr);
|
|
76
|
-
view.focus();
|
|
77
|
-
}, 0);
|
|
78
|
-
}
|
|
79
|
-
export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
80
|
-
_inherits(ReactEditorView, _React$Component);
|
|
81
|
-
var _super = _createSuper(ReactEditorView);
|
|
82
|
-
function ReactEditorView(props, context) {
|
|
83
|
-
var _props$setEditorApi, _props$editorProps;
|
|
84
|
-
var _this;
|
|
85
|
-
_classCallCheck(this, ReactEditorView);
|
|
86
|
-
_this = _super.call(this, props, context);
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "editorRef", /*#__PURE__*/React.createRef());
|
|
88
|
-
// ProseMirror is instantiated prior to the initial React render cycle,
|
|
89
|
-
// so we allow transactions by default, to avoid discarding the initial one.
|
|
90
|
-
_defineProperty(_assertThisInitialized(_this), "canDispatchTransactions", true);
|
|
91
|
-
_defineProperty(_assertThisInitialized(_this), "onPluginObservation", function (report, editorState) {
|
|
92
|
-
_this.dispatchAnalyticsEvent({
|
|
93
|
-
action: ACTION.TRANSACTION_DISPATCHED,
|
|
94
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
95
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
96
|
-
attributes: {
|
|
97
|
-
report: report,
|
|
98
|
-
participants: getParticipantsCount(editorState)
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
_defineProperty(_assertThisInitialized(_this), "getEditorState", function () {
|
|
103
|
-
var _this$view;
|
|
104
|
-
return (_this$view = _this.view) === null || _this$view === void 0 ? void 0 : _this$view.state;
|
|
105
|
-
});
|
|
106
|
-
_defineProperty(_assertThisInitialized(_this), "getEditorView", function () {
|
|
107
|
-
return _this.view;
|
|
108
|
-
});
|
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "formatFullWidthAppearance", function (appearance) {
|
|
110
|
-
if (appearance === 'full-width') {
|
|
111
|
-
return FULL_WIDTH_MODE.FULL_WIDTH;
|
|
112
|
-
}
|
|
113
|
-
return FULL_WIDTH_MODE.FIXED_WIDTH;
|
|
114
|
-
});
|
|
115
|
-
_defineProperty(_assertThisInitialized(_this), "resetEditorState", function (_ref) {
|
|
116
|
-
var _this$props$editorPro, _this$props$editorPro2;
|
|
117
|
-
var doc = _ref.doc,
|
|
118
|
-
shouldScrollToBottom = _ref.shouldScrollToBottom;
|
|
119
|
-
if (!_this.view) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
124
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
125
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
126
|
-
_this.blur();
|
|
127
|
-
_this.featureFlags = createFeatureFlagsFromProps(_this.props.editorProps);
|
|
128
|
-
_this.editorState = _this.createEditorState({
|
|
129
|
-
props: _this.props,
|
|
130
|
-
context: _this.context,
|
|
131
|
-
doc: doc,
|
|
132
|
-
resetting: true,
|
|
133
|
-
selectionAtStart: !shouldScrollToBottom
|
|
134
|
-
});
|
|
135
|
-
_this.view.updateState(_this.editorState);
|
|
136
|
-
(_this$props$editorPro = (_this$props$editorPro2 = _this.props.editorProps).onChange) === null || _this$props$editorPro === void 0 || _this$props$editorPro.call(_this$props$editorPro2, _this.view, {
|
|
137
|
-
source: 'local'
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
_defineProperty(_assertThisInitialized(_this), "blur", function () {
|
|
141
|
-
if (!_this.view) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (_this.view.dom instanceof HTMLElement && _this.view.hasFocus()) {
|
|
145
|
-
_this.view.dom.blur();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// The selectionToDOM method uses the document selection to determine currently selected node
|
|
149
|
-
// We need to mimic blurring this as it seems doing the above is not enough.
|
|
150
|
-
// @ts-expect-error
|
|
151
|
-
var sel = _this.view.root.getSelection();
|
|
152
|
-
if (sel) {
|
|
153
|
-
sel.removeAllRanges();
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
_defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (payload) {
|
|
157
|
-
fireAnalyticsEvent(_this.props.createAnalyticsEvent)(payload);
|
|
158
|
-
});
|
|
159
|
-
_defineProperty(_assertThisInitialized(_this), "editorPlugins", []);
|
|
160
|
-
_defineProperty(_assertThisInitialized(_this), "createEditorState", function (options) {
|
|
161
|
-
var schema;
|
|
162
|
-
if (_this.view) {
|
|
163
|
-
if (options.resetting) {
|
|
164
|
-
/**
|
|
165
|
-
* ReactEditorView currently does NOT handle dynamic schema,
|
|
166
|
-
* We are reusing the existing schema, and rely on #reconfigureState
|
|
167
|
-
* to update `this.config`
|
|
168
|
-
*/
|
|
169
|
-
schema = _this.view.state.schema;
|
|
170
|
-
} else {
|
|
171
|
-
/**
|
|
172
|
-
* There's presently a number of issues with changing the schema of a
|
|
173
|
-
* editor inflight. A significant issue is that we lose the ability
|
|
174
|
-
* to keep track of a user's history as the internal plugin state
|
|
175
|
-
* keeps a list of Steps to undo/redo (which are tied to the schema).
|
|
176
|
-
* Without a good way to do work around this, we prevent this for now.
|
|
177
|
-
*/
|
|
178
|
-
// eslint-disable-next-line no-console
|
|
179
|
-
console.warn('The editor does not support changing the schema dynamically.');
|
|
180
|
-
return _this.editorState;
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
_this.config = processPluginsList(_this.getPlugins(options.props.preset));
|
|
184
|
-
schema = createSchema(_this.config);
|
|
185
|
-
}
|
|
186
|
-
var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
|
|
187
|
-
var plugins = createPMPlugins({
|
|
188
|
-
schema: schema,
|
|
189
|
-
dispatch: _this.dispatch,
|
|
190
|
-
errorReporter: _this.errorReporter,
|
|
191
|
-
editorConfig: _this.config,
|
|
192
|
-
eventDispatcher: _this.eventDispatcher,
|
|
193
|
-
providerFactory: options.props.providerFactory,
|
|
194
|
-
portalProviderAPI: _this.props.portalProviderAPI,
|
|
195
|
-
reactContext: function reactContext() {
|
|
196
|
-
return options.context;
|
|
197
|
-
},
|
|
198
|
-
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
199
|
-
performanceTracking: _this.props.editorProps.performanceTracking,
|
|
200
|
-
transactionTracker: _this.transactionTracker,
|
|
201
|
-
featureFlags: _this.featureFlags,
|
|
202
|
-
getIntl: function getIntl() {
|
|
203
|
-
return _this.props.intl;
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
_this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
207
|
-
var doc;
|
|
208
|
-
if (options.doc) {
|
|
209
|
-
doc = processRawValue(schema, options.doc, options.props.providerFactory, options.props.editorProps.sanitizePrivateContent, _this.contentTransformer, _this.dispatchAnalyticsEvent);
|
|
210
|
-
}
|
|
211
|
-
var selection;
|
|
212
|
-
if (doc) {
|
|
213
|
-
selection = options.selectionAtStart ? Selection.atStart(doc) : Selection.atEnd(doc);
|
|
214
|
-
}
|
|
215
|
-
// Workaround for ED-3507: When media node is the last element, scrollIntoView throws an error
|
|
216
|
-
var patchedSelection = selection ? Selection.findFrom(selection.$head, -1, true) || undefined : undefined;
|
|
217
|
-
return EditorState.create({
|
|
218
|
-
schema: schema,
|
|
219
|
-
plugins: plugins,
|
|
220
|
-
doc: doc,
|
|
221
|
-
selection: patchedSelection
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
_defineProperty(_assertThisInitialized(_this), "onEditorViewStateUpdated", function (_ref2) {
|
|
225
|
-
var originalTransaction = _ref2.originalTransaction,
|
|
226
|
-
transactions = _ref2.transactions,
|
|
227
|
-
oldEditorState = _ref2.oldEditorState,
|
|
228
|
-
newEditorState = _ref2.newEditorState;
|
|
229
|
-
var trackinEnabled = _this.transactionTracking.enabled;
|
|
230
|
-
_this.config.onEditorViewStateUpdatedCallbacks.forEach(function (entry) {
|
|
231
|
-
trackinEnabled && startMeasure("\uD83E\uDD89 ".concat(entry.pluginName, "::onEditorViewStateUpdated"));
|
|
232
|
-
entry.callback({
|
|
233
|
-
originalTransaction: originalTransaction,
|
|
234
|
-
transactions: transactions,
|
|
235
|
-
oldEditorState: oldEditorState,
|
|
236
|
-
newEditorState: newEditorState
|
|
237
|
-
});
|
|
238
|
-
trackinEnabled && stopMeasure("\uD83E\uDD89 ".concat(entry.pluginName, "::onEditorViewStateUpdated"));
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
_defineProperty(_assertThisInitialized(_this), "trackValidTransactions", function () {
|
|
242
|
-
var editorProps = _this.props.editorProps;
|
|
243
|
-
if (!_this.isTransactionTrackingExplicitlyDisabled() && editorProps !== null && editorProps !== void 0 && editorProps.trackValidTransactions) {
|
|
244
|
-
_this.validTransactionCount++;
|
|
245
|
-
var samplingRate = _typeof(editorProps.trackValidTransactions) === 'object' && editorProps.trackValidTransactions.samplingRate || DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS;
|
|
246
|
-
if (_this.validTransactionCount >= samplingRate) {
|
|
247
|
-
_this.dispatchAnalyticsEvent({
|
|
248
|
-
action: ACTION.DISPATCHED_VALID_TRANSACTION,
|
|
249
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
250
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
251
|
-
});
|
|
252
|
-
_this.validTransactionCount = 0;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
_defineProperty(_assertThisInitialized(_this), "dispatchTransaction", function (unsafeTransaction) {
|
|
257
|
-
if (!_this.view) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
_this.transactionTracker.bumpDispatchCounter(_this.transactionTracking);
|
|
261
|
-
var _this$transactionTrac = _this.transactionTracker.getMeasureHelpers(_this.transactionTracking),
|
|
262
|
-
startMeasure = _this$transactionTrac.startMeasure,
|
|
263
|
-
stopMeasure = _this$transactionTrac.stopMeasure;
|
|
264
|
-
startMeasure(EVENT_NAME_DISPATCH_TRANSACTION);
|
|
265
|
-
if (_this.transactionTracker.shouldTrackTransaction(_this.transactionTracking)) {
|
|
266
|
-
var _this$experienceStore;
|
|
267
|
-
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 || _this$experienceStore.start(EditorExperience.interaction);
|
|
268
|
-
}
|
|
269
|
-
var nodes = findChangedNodesFromTransaction(unsafeTransaction);
|
|
270
|
-
var changedNodesValid = validateNodes(nodes);
|
|
271
|
-
var transaction = _this.featureFlags.saferDispatchedTransactions || _this.featureFlags.saferDispatchedTransactionsAnalyticsOnly ? new Proxy(unsafeTransaction, freezeUnsafeTransactionProperties({
|
|
272
|
-
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
273
|
-
pluginKey: 'unknown-reacteditorview',
|
|
274
|
-
analyticsOnly: _this.featureFlags.saferDispatchedTransactionsAnalyticsOnly
|
|
275
|
-
})) : unsafeTransaction;
|
|
276
|
-
if (changedNodesValid) {
|
|
277
|
-
var oldEditorState = _this.view.state;
|
|
278
|
-
|
|
279
|
-
// go ahead and update the state now we know the transaction is good
|
|
280
|
-
startMeasure(EVENT_NAME_STATE_APPLY);
|
|
281
|
-
var _this$view$state$appl = _this.view.state.applyTransaction(transaction),
|
|
282
|
-
editorState = _this$view$state$appl.state,
|
|
283
|
-
transactions = _this$view$state$appl.transactions;
|
|
284
|
-
stopMeasure(EVENT_NAME_STATE_APPLY, function (duration, startTime) {
|
|
285
|
-
var _this$experienceStore2;
|
|
286
|
-
(_this$experienceStore2 = _this.experienceStore) === null || _this$experienceStore2 === void 0 || _this$experienceStore2.mark(EditorExperience.interaction, 'stateApply', startTime + duration);
|
|
287
|
-
});
|
|
288
|
-
_this.trackValidTransactions();
|
|
289
|
-
if (editorState === oldEditorState) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
startMeasure(EVENT_NAME_UPDATE_STATE);
|
|
293
|
-
_this.view.updateState(editorState);
|
|
294
|
-
stopMeasure(EVENT_NAME_UPDATE_STATE, function (duration, startTime) {
|
|
295
|
-
var _this$experienceStore3;
|
|
296
|
-
(_this$experienceStore3 = _this.experienceStore) === null || _this$experienceStore3 === void 0 || _this$experienceStore3.mark(EditorExperience.interaction, 'viewUpdateState', startTime + duration);
|
|
297
|
-
});
|
|
298
|
-
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
299
|
-
newEditorState: editorState,
|
|
300
|
-
oldEditorState: oldEditorState
|
|
301
|
-
});
|
|
302
|
-
startMeasure(EVENT_NAME_VIEW_STATE_UPDATED);
|
|
303
|
-
_this.onEditorViewStateUpdated({
|
|
304
|
-
originalTransaction: transaction,
|
|
305
|
-
transactions: transactions,
|
|
306
|
-
oldEditorState: oldEditorState,
|
|
307
|
-
newEditorState: editorState
|
|
308
|
-
});
|
|
309
|
-
stopMeasure(EVENT_NAME_VIEW_STATE_UPDATED, function (duration, startTime) {
|
|
310
|
-
var _this$experienceStore4;
|
|
311
|
-
(_this$experienceStore4 = _this.experienceStore) === null || _this$experienceStore4 === void 0 || _this$experienceStore4.mark(EditorExperience.interaction, 'onEditorViewStateUpdated', startTime + duration);
|
|
312
|
-
});
|
|
313
|
-
if (_this.props.editorProps.onChange && transaction.docChanged) {
|
|
314
|
-
var source = transaction.getMeta('isRemote') ? 'remote' : 'local';
|
|
315
|
-
startMeasure(EVENT_NAME_ON_CHANGE);
|
|
316
|
-
_this.props.editorProps.onChange(_this.view, {
|
|
317
|
-
source: source
|
|
318
|
-
});
|
|
319
|
-
stopMeasure(EVENT_NAME_ON_CHANGE, function (duration, startTime) {
|
|
320
|
-
var _this$experienceStore5, _this$props$editorPro3;
|
|
321
|
-
(_this$experienceStore5 = _this.experienceStore) === null || _this$experienceStore5 === void 0 || _this$experienceStore5.mark(EditorExperience.interaction, 'onChange', startTime + duration);
|
|
322
|
-
if (((_this$props$editorPro3 = _this.props.editorProps.performanceTracking) === null || _this$props$editorPro3 === void 0 || (_this$props$editorPro3 = _this$props$editorPro3.onChangeCallbackTracking) === null || _this$props$editorPro3 === void 0 ? void 0 : _this$props$editorPro3.enabled) !== true) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
_this.dispatchAnalyticsEvent({
|
|
326
|
-
action: ACTION.ON_CHANGE_CALLBACK,
|
|
327
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
328
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
329
|
-
attributes: {
|
|
330
|
-
duration: duration,
|
|
331
|
-
startTime: startTime
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
_this.editorState = editorState;
|
|
337
|
-
stopMeasure(EVENT_NAME_DISPATCH_TRANSACTION, function (duration, startTime) {
|
|
338
|
-
var _this$experienceStore6, _this$experienceStore7;
|
|
339
|
-
(_this$experienceStore6 = _this.experienceStore) === null || _this$experienceStore6 === void 0 || _this$experienceStore6.mark(EditorExperience.interaction, 'dispatchTransaction', startTime + duration);
|
|
340
|
-
(_this$experienceStore7 = _this.experienceStore) === null || _this$experienceStore7 === void 0 || _this$experienceStore7.success(EditorExperience.interaction);
|
|
341
|
-
});
|
|
342
|
-
} else {
|
|
343
|
-
var _this$experienceStore8;
|
|
344
|
-
var invalidNodes = nodes.filter(function (node) {
|
|
345
|
-
return !validNode(node);
|
|
346
|
-
}).map(function (node) {
|
|
347
|
-
return getDocStructure(node, {
|
|
348
|
-
compact: true
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
if (!_this.isTransactionTrackingExplicitlyDisabled()) {
|
|
352
|
-
_this.dispatchAnalyticsEvent({
|
|
353
|
-
action: ACTION.DISPATCHED_INVALID_TRANSACTION,
|
|
354
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
355
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
356
|
-
attributes: {
|
|
357
|
-
analyticsEventPayloads: getAnalyticsEventsFromTransaction(transaction),
|
|
358
|
-
invalidNodes: invalidNodes
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
(_this$experienceStore8 = _this.experienceStore) === null || _this$experienceStore8 === void 0 || _this$experienceStore8.fail(EditorExperience.interaction, {
|
|
363
|
-
reason: 'invalid transaction',
|
|
364
|
-
invalidNodes: invalidNodes.toString()
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
_defineProperty(_assertThisInitialized(_this), "getDirectEditorProps", function (state) {
|
|
369
|
-
return {
|
|
370
|
-
state: state || _this.editorState,
|
|
371
|
-
dispatchTransaction: function dispatchTransaction(tr) {
|
|
372
|
-
// Block stale transactions:
|
|
373
|
-
// Prevent runtime exeptions from async transactions that would attempt to
|
|
374
|
-
// update the DOM after React has unmounted the Editor.
|
|
375
|
-
if (_this.canDispatchTransactions) {
|
|
376
|
-
_this.dispatchTransaction(tr);
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
380
|
-
editable: function editable(_state) {
|
|
381
|
-
return !_this.props.editorProps.disabled;
|
|
382
|
-
},
|
|
383
|
-
attributes: {
|
|
384
|
-
'data-gramm': 'false'
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
});
|
|
388
|
-
_defineProperty(_assertThisInitialized(_this), "createEditorView", function (node) {
|
|
389
|
-
measureRender(measurements.PROSEMIRROR_RENDERED, function (_ref3) {
|
|
390
|
-
var _this$props$editorPro4, _proseMirrorRenderedT, _proseMirrorRenderedT2;
|
|
391
|
-
var duration = _ref3.duration,
|
|
392
|
-
startTime = _ref3.startTime,
|
|
393
|
-
distortedDuration = _ref3.distortedDuration;
|
|
394
|
-
var proseMirrorRenderedTracking = (_this$props$editorPro4 = _this.props.editorProps) === null || _this$props$editorPro4 === void 0 || (_this$props$editorPro4 = _this$props$editorPro4.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.proseMirrorRenderedTracking;
|
|
395
|
-
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && shouldForceTracking();
|
|
396
|
-
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? getAnalyticsEventSeverity(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
397
|
-
if (_this.view) {
|
|
398
|
-
var _this$pluginInjection, _this$experienceStore10;
|
|
399
|
-
var nodes = getNodesCount(_this.view.state.doc);
|
|
400
|
-
var ttfb = getResponseEndTime();
|
|
401
|
-
var contextIdentifier = (_this$pluginInjection = _this.pluginInjectionAPI.api().base) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.sharedState.currentState();
|
|
402
|
-
_this.dispatchAnalyticsEvent({
|
|
403
|
-
action: ACTION.PROSEMIRROR_RENDERED,
|
|
404
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
405
|
-
attributes: {
|
|
406
|
-
duration: duration,
|
|
407
|
-
startTime: startTime,
|
|
408
|
-
nodes: nodes,
|
|
409
|
-
ttfb: ttfb,
|
|
410
|
-
severity: _this.proseMirrorRenderedSeverity,
|
|
411
|
-
objectId: contextIdentifier === null || contextIdentifier === void 0 ? void 0 : contextIdentifier.objectId,
|
|
412
|
-
distortedDuration: distortedDuration
|
|
413
|
-
},
|
|
414
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
415
|
-
});
|
|
416
|
-
if (!distortedDuration) {
|
|
417
|
-
var _this$experienceStore9;
|
|
418
|
-
(_this$experienceStore9 = _this.experienceStore) === null || _this$experienceStore9 === void 0 || _this$experienceStore9.mark(EditorExperience.loadEditor, ACTION.PROSEMIRROR_RENDERED, startTime + duration);
|
|
419
|
-
}
|
|
420
|
-
(_this$experienceStore10 = _this.experienceStore) === null || _this$experienceStore10 === void 0 || _this$experienceStore10.addMetadata(EditorExperience.loadEditor, {
|
|
421
|
-
nodes: nodes,
|
|
422
|
-
ttfb: ttfb
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
// Creates the editor-view from this.editorState. If an editor has been mounted
|
|
428
|
-
// previously, this will contain the previous state of the editor.
|
|
429
|
-
_this.view = new EditorView({
|
|
430
|
-
mount: node
|
|
431
|
-
}, _this.getDirectEditorProps());
|
|
432
|
-
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
433
|
-
newEditorState: _this.view.state,
|
|
434
|
-
oldEditorState: undefined
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
_defineProperty(_assertThisInitialized(_this), "handleEditorViewRef", function (node) {
|
|
438
|
-
if (!_this.view && node) {
|
|
439
|
-
_this.createEditorView(node);
|
|
440
|
-
var view = _this.view;
|
|
441
|
-
_this.props.onEditorCreated({
|
|
442
|
-
view: view,
|
|
443
|
-
config: _this.config,
|
|
444
|
-
eventDispatcher: _this.eventDispatcher,
|
|
445
|
-
transformer: _this.contentTransformer
|
|
446
|
-
});
|
|
447
|
-
if (_this.props.editorProps.shouldFocus && view.props.editable && view.props.editable(view.state)) {
|
|
448
|
-
_this.focusTimeoutId = handleEditorFocus(view);
|
|
449
|
-
}
|
|
450
|
-
if (_this.featureFlags.ufo) {
|
|
451
|
-
_this.experienceStore = ExperienceStore.getInstance(view);
|
|
452
|
-
_this.experienceStore.start(EditorExperience.editSession);
|
|
453
|
-
_this.experienceStore.addMetadata(EditorExperience.editSession, {
|
|
454
|
-
reliabilityInterval: RELIABILITY_INTERVAL
|
|
455
|
-
});
|
|
456
|
-
_this.reliabilityInterval = window.setInterval(function () {
|
|
457
|
-
var _this$experienceStore11;
|
|
458
|
-
(_this$experienceStore11 = _this.experienceStore) === null || _this$experienceStore11 === void 0 || (_this$experienceStore11 = _this$experienceStore11.success(EditorExperience.editSession)) === null || _this$experienceStore11 === void 0 || _this$experienceStore11.finally(function () {
|
|
459
|
-
var _this$experienceStore12, _this$experienceStore13;
|
|
460
|
-
(_this$experienceStore12 = _this.experienceStore) === null || _this$experienceStore12 === void 0 || _this$experienceStore12.start(EditorExperience.editSession);
|
|
461
|
-
(_this$experienceStore13 = _this.experienceStore) === null || _this$experienceStore13 === void 0 || _this$experienceStore13.addMetadata(EditorExperience.editSession, {
|
|
462
|
-
reliabilityInterval: RELIABILITY_INTERVAL
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
var reliabilityEvent = {
|
|
466
|
-
action: ACTION.UFO_SESSION_COMPLETE,
|
|
467
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
468
|
-
attributes: {
|
|
469
|
-
interval: RELIABILITY_INTERVAL
|
|
470
|
-
},
|
|
471
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
472
|
-
};
|
|
473
|
-
_this.dispatchAnalyticsEvent(reliabilityEvent);
|
|
474
|
-
}, RELIABILITY_INTERVAL);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// Force React to re-render so consumers get a reference to the editor view
|
|
478
|
-
_this.forceUpdate();
|
|
479
|
-
} else if (_this.view && !node) {
|
|
480
|
-
// When the appearance is changed, React will call handleEditorViewRef with node === null
|
|
481
|
-
// to destroy the old EditorView, before calling this method again with node === div to
|
|
482
|
-
// create the new EditorView
|
|
483
|
-
_this.props.onEditorDestroyed({
|
|
484
|
-
view: _this.view,
|
|
485
|
-
config: _this.config,
|
|
486
|
-
eventDispatcher: _this.eventDispatcher,
|
|
487
|
-
transformer: _this.contentTransformer
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
// Allows us to dispatch analytics within the plugin view.destory methods
|
|
491
|
-
var analyticsConnected = _this.eventDispatcher.has(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
492
|
-
if (!analyticsConnected) {
|
|
493
|
-
_this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
494
|
-
}
|
|
495
|
-
_this.view.destroy(); // Destroys the dom node & all node views
|
|
496
|
-
|
|
497
|
-
if (!analyticsConnected) {
|
|
498
|
-
_this.eventDispatcher.off(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
499
|
-
}
|
|
500
|
-
_this.view = undefined;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
_defineProperty(_assertThisInitialized(_this), "dispatchAnalyticsEvent", function (payload) {
|
|
504
|
-
if (_this.eventDispatcher) {
|
|
505
|
-
var dispatch = createDispatch(_this.eventDispatcher);
|
|
506
|
-
dispatch(analyticsEventKey, {
|
|
507
|
-
payload: payload
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
_defineProperty(_assertThisInitialized(_this), "createEditor", function (assistiveLabel) {
|
|
512
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
513
|
-
className: getUAPrefix(),
|
|
514
|
-
key: "ProseMirror",
|
|
515
|
-
ref: _this.handleEditorViewRef,
|
|
516
|
-
"aria-label": assistiveLabel || _this.props.intl.formatMessage(editorMessages.editorAssistiveLabel)
|
|
517
|
-
// setting aria-multiline to true when not mobile appearance.
|
|
518
|
-
// because somehow mobile tests are failing when it set.
|
|
519
|
-
// don't know why that is happening.
|
|
520
|
-
// Created https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-1675
|
|
521
|
-
// to investigate further.
|
|
522
|
-
,
|
|
523
|
-
"aria-multiline": _this.props.editorProps.appearance !== 'mobile' ? true : false,
|
|
524
|
-
role: "textbox",
|
|
525
|
-
id: EDIT_AREA_ID
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
_defineProperty(_assertThisInitialized(_this), "editor", _this.createEditor(_this.props.editorProps.assistiveLabel));
|
|
529
|
-
_this.pluginInjectionAPI = new EditorPluginInjectionAPI({
|
|
530
|
-
getEditorState: _this.getEditorState,
|
|
531
|
-
getEditorView: _this.getEditorView
|
|
532
|
-
});
|
|
533
|
-
(_props$setEditorApi = props.setEditorApi) === null || _props$setEditorApi === void 0 || _props$setEditorApi.call(props, _this.pluginInjectionAPI.api());
|
|
534
|
-
_this.eventDispatcher = new EventDispatcher();
|
|
535
|
-
_this.dispatch = createDispatch(_this.eventDispatcher);
|
|
536
|
-
_this.errorReporter = createErrorReporter(props.editorProps.errorReporterHandler);
|
|
537
|
-
_this.transactionTracker = new TransactionTracker();
|
|
538
|
-
_this.pluginPerformanceObserver = new PluginPerformanceObserver(function (report) {
|
|
539
|
-
return _this.onPluginObservation(report, _this.editorState);
|
|
540
|
-
}).withPlugins(function () {
|
|
541
|
-
return _this.getPluginNames();
|
|
542
|
-
}).withNodeCounts(function () {
|
|
543
|
-
return _this.countNodes();
|
|
544
|
-
}).withOptions(function () {
|
|
545
|
-
return _this.transactionTracking;
|
|
546
|
-
}).withTransactionTracker(function () {
|
|
547
|
-
return _this.transactionTracker;
|
|
548
|
-
});
|
|
549
|
-
_this.validTransactionCount = 0;
|
|
550
|
-
_this.featureFlags = createFeatureFlagsFromProps(_this.props.editorProps);
|
|
551
|
-
var featureFlagsEnabled = _this.featureFlags ? getEnabledFeatureFlagKeys(_this.featureFlags) : [];
|
|
552
|
-
|
|
553
|
-
// START TEMPORARY CODE ED-10584
|
|
554
|
-
if (_this.props.createAnalyticsEvent) {
|
|
555
|
-
_this.props.createAnalyticsEvent.__queueAnalytics = _this.featureFlags.queueAnalytics;
|
|
556
|
-
}
|
|
557
|
-
// END TEMPORARY CODE ED-10584
|
|
558
|
-
|
|
559
|
-
// This needs to be before initialising editorState because
|
|
560
|
-
// we dispatch analytics events in plugin initialisation
|
|
561
|
-
_this.eventDispatcher.on(analyticsEventKey, _this.handleAnalyticsEvent);
|
|
562
|
-
_this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
|
|
563
|
-
_this.editorState = _this.createEditorState({
|
|
564
|
-
props: props,
|
|
565
|
-
context: context,
|
|
566
|
-
doc: props.editorProps.defaultValue,
|
|
567
|
-
// ED-4759: Don't set selection at end for full-page editor - should be at start.
|
|
568
|
-
selectionAtStart: isFullPage(props.editorProps.appearance)
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
// ED-16320: Check for explicit disable so that by default
|
|
572
|
-
// it will still be enabled as it currently is. Then we can
|
|
573
|
-
// progressively opt out synthetic tenants.
|
|
574
|
-
var isEditorStartedExplicitlyDisabled = ((_props$editorProps = props.editorProps) === null || _props$editorProps === void 0 || (_props$editorProps = _props$editorProps.performanceTracking) === null || _props$editorProps === void 0 || (_props$editorProps = _props$editorProps.startedTracking) === null || _props$editorProps === void 0 ? void 0 : _props$editorProps.enabled) === false;
|
|
575
|
-
if (!isEditorStartedExplicitlyDisabled) {
|
|
576
|
-
_this.dispatchAnalyticsEvent({
|
|
577
|
-
action: ACTION.STARTED,
|
|
578
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
579
|
-
attributes: {
|
|
580
|
-
platform: PLATFORMS.WEB,
|
|
581
|
-
featureFlags: featureFlagsEnabled
|
|
582
|
-
},
|
|
583
|
-
eventType: EVENT_TYPE.UI
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
return _this;
|
|
587
|
-
}
|
|
588
|
-
_createClass(ReactEditorView, [{
|
|
589
|
-
key: "transactionTracking",
|
|
590
|
-
get: function get() {
|
|
591
|
-
var _this$props$editorPro5, _this$props$editorPro6;
|
|
592
|
-
return (_this$props$editorPro5 = (_this$props$editorPro6 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro6 === void 0 ? void 0 : _this$props$editorPro6.transactionTracking) !== null && _this$props$editorPro5 !== void 0 ? _this$props$editorPro5 : {
|
|
593
|
-
enabled: false
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
}, {
|
|
597
|
-
key: "getPluginNames",
|
|
598
|
-
value: function getPluginNames() {
|
|
599
|
-
return this.editorState.plugins.map(function (p) {
|
|
600
|
-
return p.key;
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
}, {
|
|
604
|
-
key: "countNodes",
|
|
605
|
-
value: function countNodes() {
|
|
606
|
-
return _countNodes(this.editorState);
|
|
607
|
-
}
|
|
608
|
-
}, {
|
|
609
|
-
key: "isTransactionTrackingExplicitlyDisabled",
|
|
610
|
-
value: function isTransactionTrackingExplicitlyDisabled() {
|
|
611
|
-
var _this$props$editorPro7;
|
|
612
|
-
// ED-16320: Check for explicit disable so that by default
|
|
613
|
-
// it will still be enabled as it currently is. Then we can
|
|
614
|
-
// progressively opt out synthetic tenants.
|
|
615
|
-
return ((_this$props$editorPro7 = this.props.editorProps) === null || _this$props$editorPro7 === void 0 || (_this$props$editorPro7 = _this$props$editorPro7.performanceTracking) === null || _this$props$editorPro7 === void 0 || (_this$props$editorPro7 = _this$props$editorPro7.transactionTracking) === null || _this$props$editorPro7 === void 0 ? void 0 : _this$props$editorPro7.enabled) === false;
|
|
616
|
-
}
|
|
617
|
-
}, {
|
|
618
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
619
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
620
|
-
// START TEMPORARY CODE ED-10584
|
|
621
|
-
if (nextProps.createAnalyticsEvent && nextProps.createAnalyticsEvent !== this.props.createAnalyticsEvent) {
|
|
622
|
-
var featureFlags = createFeatureFlagsFromProps(nextProps.editorProps);
|
|
623
|
-
nextProps.createAnalyticsEvent.__queueAnalytics = featureFlags.queueAnalytics;
|
|
624
|
-
}
|
|
625
|
-
// END TEMPORARY CODE ED-10584
|
|
626
|
-
|
|
627
|
-
if (this.view && this.props.editorProps.disabled !== nextProps.editorProps.disabled) {
|
|
628
|
-
// Disables the contentEditable attribute of the editor if the editor is disabled
|
|
629
|
-
this.view.setProps({
|
|
630
|
-
editable: function editable(_state) {
|
|
631
|
-
return !nextProps.editorProps.disabled;
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
if (!nextProps.editorProps.disabled && nextProps.editorProps.shouldFocus) {
|
|
635
|
-
this.focusTimeoutId = handleEditorFocus(this.view);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
var appearance = this.props.editorProps.appearance;
|
|
639
|
-
var nextAppearance = nextProps.editorProps.appearance;
|
|
640
|
-
if (this.props.preset !== nextProps.preset) {
|
|
641
|
-
this.reconfigureState(nextProps);
|
|
642
|
-
}
|
|
643
|
-
if (nextAppearance !== appearance) {
|
|
644
|
-
if (nextAppearance === 'full-width' || appearance === 'full-width') {
|
|
645
|
-
this.dispatchAnalyticsEvent({
|
|
646
|
-
action: ACTION.CHANGED_FULL_WIDTH_MODE,
|
|
647
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
648
|
-
eventType: EVENT_TYPE.TRACK,
|
|
649
|
-
attributes: {
|
|
650
|
-
previousMode: this.formatFullWidthAppearance(appearance),
|
|
651
|
-
newMode: this.formatFullWidthAppearance(nextAppearance)
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
if (!this.transactionTracking.enabled) {
|
|
657
|
-
this.pluginPerformanceObserver.disconnect();
|
|
658
|
-
}
|
|
659
|
-
if (nextProps.editorProps.assistiveLabel !== this.props.editorProps.assistiveLabel) {
|
|
660
|
-
this.editor = this.createEditor(nextProps.editorProps.assistiveLabel);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}, {
|
|
664
|
-
key: "reconfigureState",
|
|
665
|
-
value: function reconfigureState(props) {
|
|
666
|
-
var _this2 = this;
|
|
667
|
-
if (!this.view) {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
// We cannot currently guarentee when all the portals will have re-rendered during a reconfigure
|
|
672
|
-
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
673
|
-
// nodes that haven't been re-rendered to the document yet.
|
|
674
|
-
this.blur();
|
|
675
|
-
var editorPlugins = this.getPlugins(props.preset);
|
|
676
|
-
this.config = processPluginsList(editorPlugins);
|
|
677
|
-
var state = this.editorState;
|
|
678
|
-
var plugins = createPMPlugins({
|
|
679
|
-
schema: state.schema,
|
|
680
|
-
dispatch: this.dispatch,
|
|
681
|
-
errorReporter: this.errorReporter,
|
|
682
|
-
editorConfig: this.config,
|
|
683
|
-
eventDispatcher: this.eventDispatcher,
|
|
684
|
-
providerFactory: props.providerFactory,
|
|
685
|
-
portalProviderAPI: props.portalProviderAPI,
|
|
686
|
-
reactContext: function reactContext() {
|
|
687
|
-
return _this2.context;
|
|
688
|
-
},
|
|
689
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
690
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
691
|
-
transactionTracker: this.transactionTracker,
|
|
692
|
-
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
693
|
-
getIntl: function getIntl() {
|
|
694
|
-
return _this2.props.intl;
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
var newState = state.reconfigure({
|
|
698
|
-
plugins: plugins
|
|
699
|
-
});
|
|
700
|
-
|
|
701
|
-
// need to update the state first so when the view builds the nodeviews it is
|
|
702
|
-
// using the latest plugins
|
|
703
|
-
this.view.updateState(newState);
|
|
704
|
-
return this.view.update(_objectSpread(_objectSpread({}, this.view.props), {}, {
|
|
705
|
-
state: newState
|
|
706
|
-
}));
|
|
707
|
-
}
|
|
708
|
-
}, {
|
|
709
|
-
key: "componentDidMount",
|
|
710
|
-
value: function componentDidMount() {
|
|
711
|
-
// Transaction dispatching is already enabled by default prior to
|
|
712
|
-
// mounting, but we reset it here, just in case the editor view
|
|
713
|
-
// instance is ever recycled (mounted again after unmounting) with
|
|
714
|
-
// the same key.
|
|
715
|
-
// Although storing mounted state is an anti-pattern in React,
|
|
716
|
-
// we do so here so that we can intercept and abort asynchronous
|
|
717
|
-
// ProseMirror transactions when a dismount is imminent.
|
|
718
|
-
this.canDispatchTransactions = true;
|
|
719
|
-
if (this.transactionTracking.enabled) {
|
|
720
|
-
this.pluginPerformanceObserver.observe();
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Clean up any non-PM resources when the editor is unmounted
|
|
726
|
-
*/
|
|
727
|
-
}, {
|
|
728
|
-
key: "componentWillUnmount",
|
|
729
|
-
value: function componentWillUnmount() {
|
|
730
|
-
// We can ignore any transactions from this point onwards.
|
|
731
|
-
// This serves to avoid potential runtime exceptions which could arise
|
|
732
|
-
// from an async dispatched transaction after it's unmounted.
|
|
733
|
-
this.canDispatchTransactions = false;
|
|
734
|
-
clearTimeout(this.focusTimeoutId);
|
|
735
|
-
if (this.reliabilityInterval) {
|
|
736
|
-
clearInterval(this.reliabilityInterval);
|
|
737
|
-
}
|
|
738
|
-
this.pluginPerformanceObserver.disconnect();
|
|
739
|
-
if (this.view) {
|
|
740
|
-
// Destroy the state if the Editor is being unmounted
|
|
741
|
-
var editorState = this.view.state;
|
|
742
|
-
editorState.plugins.forEach(function (plugin) {
|
|
743
|
-
var state = plugin.getState(editorState);
|
|
744
|
-
if (state && state.destroy) {
|
|
745
|
-
state.destroy();
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
this.eventDispatcher.destroy();
|
|
750
|
-
// this.view will be destroyed when React unmounts in handleEditorViewRef
|
|
751
|
-
}
|
|
752
|
-
}, {
|
|
753
|
-
key: "getPlugins",
|
|
754
|
-
value:
|
|
755
|
-
// Helper to allow tests to inject plugins directly
|
|
756
|
-
function getPlugins(preset) {
|
|
757
|
-
var plugins = createPluginsList(preset, this.props.editorProps, this.pluginInjectionAPI);
|
|
758
|
-
this.editorPlugins = plugins;
|
|
759
|
-
return this.editorPlugins;
|
|
760
|
-
}
|
|
761
|
-
}, {
|
|
762
|
-
key: "render",
|
|
763
|
-
value: function render() {
|
|
764
|
-
var _this$props$editorPro8;
|
|
765
|
-
var renderTracking = (_this$props$editorPro8 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro8 === void 0 || (_this$props$editorPro8 = _this$props$editorPro8.renderTracking) === null || _this$props$editorPro8 === void 0 ? void 0 : _this$props$editorPro8.reactEditorView;
|
|
766
|
-
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
767
|
-
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
768
|
-
return /*#__PURE__*/React.createElement(ReactEditorViewContext.Provider, {
|
|
769
|
-
value: {
|
|
770
|
-
editorRef: this.editorRef,
|
|
771
|
-
editorView: this.view
|
|
772
|
-
}
|
|
773
|
-
}, renderTrackingEnabled && /*#__PURE__*/React.createElement(RenderTracking, {
|
|
774
|
-
componentProps: this.props,
|
|
775
|
-
action: ACTION.RE_RENDERED,
|
|
776
|
-
actionSubject: ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
777
|
-
handleAnalyticsEvent: this.handleAnalyticsEvent,
|
|
778
|
-
useShallow: useShallow
|
|
779
|
-
}), this.props.render ? this.props.render({
|
|
780
|
-
editor: this.editor,
|
|
781
|
-
view: this.view,
|
|
782
|
-
config: this.config,
|
|
783
|
-
eventDispatcher: this.eventDispatcher,
|
|
784
|
-
transformer: this.contentTransformer,
|
|
785
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
786
|
-
editorRef: this.editorRef
|
|
787
|
-
}) : this.editor);
|
|
788
|
-
}
|
|
789
|
-
}]);
|
|
790
|
-
return ReactEditorView;
|
|
791
|
-
}(React.Component);
|
|
792
|
-
_defineProperty(ReactEditorView, "contextTypes", {
|
|
793
|
-
getAtlaskitAnalyticsEventHandlers: PropTypes.func
|
|
794
|
-
});
|
|
795
|
-
function getUAPrefix() {
|
|
796
|
-
if (browser.chrome) {
|
|
797
|
-
return 'ua-chrome';
|
|
798
|
-
} else if (browser.ie) {
|
|
799
|
-
return 'ua-ie';
|
|
800
|
-
} else if (browser.gecko) {
|
|
801
|
-
return 'ua-firefox';
|
|
802
|
-
} else if (browser.safari) {
|
|
803
|
-
return 'ua-safari';
|
|
804
|
-
}
|
|
805
|
-
return '';
|
|
806
|
-
}
|