@atlaskit/editor-core 182.0.3 → 182.1.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/.eslintrc.js +2 -0
- package/CHANGELOG.md +40 -0
- package/README.md +20 -0
- package/architecture/0001-record-architecture-decisions.md +25 -0
- package/architecture/0002-deep-equality-check-for-getsharedstate.md +67 -0
- package/architecture/0003-explicit-plugin-dependencies.md +291 -0
- package/dist/cjs/actions/index.js +17 -6
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/cjs/create-editor/ErrorBoundary.js +1 -16
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +3 -3
- package/dist/cjs/editor-next/editor-internal.js +2 -1
- package/dist/cjs/editor-next/index.js +5 -1
- package/dist/cjs/editor.js +9 -5
- package/dist/cjs/keymaps/index.js +12 -0
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +5 -7
- package/dist/cjs/labs/next/presets/default.js +1 -2
- package/dist/cjs/plugins/card/index.js +16 -5
- package/dist/cjs/plugins/card/pm-plugins/actions.js +10 -1
- package/dist/cjs/plugins/card/pm-plugins/analytics/create-analytics-queue.js +48 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/events-from-tr.js +337 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/index.js +19 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/types.js +5 -0
- package/dist/cjs/plugins/card/pm-plugins/analytics/utils.js +139 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +99 -22
- package/dist/cjs/plugins/card/pm-plugins/main.js +16 -10
- package/dist/cjs/plugins/card/pm-plugins/reducers.js +7 -0
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/cjs/plugins/card/toolbar.js +18 -8
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +12 -8
- package/dist/cjs/plugins/card/ui/EditorSmartCardEventsNext.js +202 -0
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +12 -4
- package/dist/cjs/plugins/card/utils.js +4 -2
- package/dist/cjs/plugins/extension/context-panel.js +3 -2
- package/dist/cjs/plugins/extension/index.js +4 -1
- package/dist/cjs/plugins/help-dialog/ui/index.js +29 -8
- package/dist/cjs/plugins/hyperlink/Toolbar.js +12 -2
- package/dist/cjs/plugins/hyperlink/commands.js +9 -5
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/index.js +5 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +25 -23
- package/dist/cjs/plugins/media/index.js +9 -5
- package/dist/cjs/plugins/media/pm-plugins/main.js +5 -4
- package/dist/cjs/plugins/media/utils/media-single.js +1 -4
- package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +2 -1
- package/dist/cjs/plugins/paste/handlers.js +5 -5
- package/dist/cjs/plugins/paste/index.js +4 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +6 -4
- package/dist/cjs/plugins/rule/commands.js +2 -2
- package/dist/cjs/plugins/rule/index.js +5 -4
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +6 -8
- package/dist/cjs/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/text-color/index.js +5 -2
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -4
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/cjs/ui/ColorPalette/index.js +6 -0
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +15 -10
- package/dist/cjs/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +248 -17
- package/dist/cjs/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/cjs/ui/ConfigPanel/utils.js +2 -12
- package/dist/cjs/ui/ContentStyles/index.js +2 -5
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +16 -8
- package/dist/cjs/utils/document.js +5 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +10 -4
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/es2019/create-editor/ErrorBoundary.js +1 -13
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +2 -2
- package/dist/es2019/editor-next/editor-internal.js +2 -1
- package/dist/es2019/editor-next/index.js +5 -1
- package/dist/es2019/editor.js +5 -2
- package/dist/es2019/keymaps/index.js +1 -1
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +4 -6
- package/dist/es2019/labs/next/presets/default.js +1 -2
- package/dist/es2019/plugins/card/index.js +15 -5
- package/dist/es2019/plugins/card/pm-plugins/actions.js +4 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/create-analytics-queue.js +38 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/events-from-tr.js +316 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/index.js +2 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/types.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/analytics/utils.js +124 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +94 -20
- package/dist/es2019/plugins/card/pm-plugins/main.js +17 -8
- package/dist/es2019/plugins/card/pm-plugins/reducers.js +8 -0
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/es2019/plugins/card/toolbar.js +16 -8
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +13 -9
- package/dist/es2019/plugins/card/ui/EditorSmartCardEventsNext.js +180 -0
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +11 -2
- package/dist/es2019/plugins/card/utils.js +6 -2
- package/dist/es2019/plugins/extension/context-panel.js +3 -2
- package/dist/es2019/plugins/extension/index.js +45 -41
- package/dist/es2019/plugins/help-dialog/ui/index.js +17 -1
- package/dist/es2019/plugins/hyperlink/Toolbar.js +13 -4
- package/dist/es2019/plugins/hyperlink/commands.js +9 -6
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +96 -91
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/es2019/plugins/media/index.js +202 -198
- package/dist/es2019/plugins/media/pm-plugins/main.js +5 -4
- package/dist/es2019/plugins/media/utils/media-single.js +1 -5
- package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +3 -2
- package/dist/es2019/plugins/paste/handlers.js +6 -6
- package/dist/es2019/plugins/paste/index.js +18 -14
- package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -5
- package/dist/es2019/plugins/rule/commands.js +2 -2
- package/dist/es2019/plugins/rule/index.js +49 -46
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +6 -7
- package/dist/es2019/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/text-color/index.js +49 -44
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/es2019/ui/ColorPalette/index.js +2 -2
- package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +8 -4
- package/dist/es2019/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +238 -13
- package/dist/es2019/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/es2019/ui/ConfigPanel/utils.js +1 -11
- package/dist/es2019/ui/ContentStyles/index.js +2 -5
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +12 -10
- package/dist/es2019/utils/document.js +5 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +17 -6
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +2 -1
- package/dist/esm/create-editor/ErrorBoundary.js +1 -16
- package/dist/esm/create-editor/ReactEditorViewInternal.js +2 -2
- package/dist/esm/editor-next/editor-internal.js +2 -1
- package/dist/esm/editor-next/index.js +5 -1
- package/dist/esm/editor.js +9 -5
- package/dist/esm/keymaps/index.js +1 -1
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +4 -6
- package/dist/esm/labs/next/presets/default.js +1 -2
- package/dist/esm/plugins/card/index.js +13 -5
- package/dist/esm/plugins/card/pm-plugins/actions.js +8 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/create-analytics-queue.js +41 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/events-from-tr.js +328 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/index.js +2 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/types.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/analytics/utils.js +124 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +98 -22
- package/dist/esm/plugins/card/pm-plugins/main.js +16 -10
- package/dist/esm/plugins/card/pm-plugins/reducers.js +7 -0
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +3 -7
- package/dist/esm/plugins/card/toolbar.js +18 -8
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +13 -9
- package/dist/esm/plugins/card/ui/EditorSmartCardEventsNext.js +191 -0
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +12 -4
- package/dist/esm/plugins/card/utils.js +4 -2
- package/dist/esm/plugins/extension/context-panel.js +3 -2
- package/dist/esm/plugins/extension/index.js +4 -1
- package/dist/esm/plugins/help-dialog/ui/index.js +29 -8
- package/dist/esm/plugins/hyperlink/Toolbar.js +13 -3
- package/dist/esm/plugins/hyperlink/commands.js +9 -5
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +4 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +2 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +5 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +25 -23
- package/dist/esm/plugins/media/index.js +9 -5
- package/dist/esm/plugins/media/pm-plugins/main.js +5 -4
- package/dist/esm/plugins/media/utils/media-single.js +1 -4
- package/dist/esm/plugins/panel/pm-plugins/keymaps.js +3 -2
- package/dist/esm/plugins/paste/handlers.js +6 -6
- package/dist/esm/plugins/paste/index.js +4 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +7 -5
- package/dist/esm/plugins/rule/commands.js +2 -2
- package/dist/esm/plugins/rule/index.js +5 -4
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +6 -8
- package/dist/esm/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/text-color/index.js +5 -2
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -4
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +10 -0
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +2 -4
- package/dist/esm/ui/ColorPalette/index.js +2 -2
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +15 -10
- package/dist/esm/ui/ConfigPanel/ConfigPanelFieldsLoader.js +3 -1
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +244 -19
- package/dist/esm/ui/ConfigPanel/FormContent.js +12 -6
- package/dist/esm/ui/ConfigPanel/utils.js +0 -10
- package/dist/esm/ui/ContentStyles/index.js +2 -5
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +16 -8
- package/dist/esm/utils/document.js +5 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -2
- package/dist/types/create-editor/ErrorBoundary.d.ts +2 -2
- package/dist/types/editor-next/index.d.ts +1 -0
- package/dist/types/editor.d.ts +1 -0
- package/dist/types/keymaps/index.d.ts +1 -1
- package/dist/types/labs/next/internal/hooks/use-editor/index.d.ts +2 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +1 -5
- package/dist/types/labs/next/presets/default.d.ts +2 -10
- package/dist/types/labs/next/presets/mobile.d.ts +1 -5
- package/dist/types/plugins/card/pm-plugins/actions.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types/plugins/card/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types/plugins/card/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types/plugins/card/pm-plugins/analytics/types.d.ts +10 -0
- package/dist/types/plugins/card/pm-plugins/analytics/utils.d.ts +26 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +8 -7
- package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -2
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +3 -0
- package/dist/types/plugins/card/types.d.ts +81 -7
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +2 -1
- package/dist/types/plugins/card/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types/plugins/card/utils.d.ts +1 -1
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +2 -0
- package/dist/types/plugins/hyperlink/commands.d.ts +3 -2
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +2 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +2 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +2 -1
- package/dist/types/plugins/media/index.d.ts +2 -0
- package/dist/types/plugins/media/pm-plugins/main.d.ts +3 -2
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
- package/dist/types/plugins/paste/index.d.ts +2 -0
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/rule/commands.d.ts +2 -1
- package/dist/types/plugins/rule/index.d.ts +5 -1
- package/dist/types/plugins/rule/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types/plugins/rule/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/text-color/index.d.ts +2 -0
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +2 -0
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +10 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +2 -0
- package/dist/types/ui/ColorPalette/index.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +3 -1
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +3 -1
- package/dist/types/ui/ConfigPanel/Fields/ColorPicker.d.ts +12 -1
- package/dist/types/ui/ConfigPanel/FormContent.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/types.d.ts +3 -0
- package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
- package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/package.json +14 -13
- package/report.api.md +10 -0
- package/dist/cjs/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -12
- package/dist/cjs/plugins/feature-flags-context/get-feature-flags.js +0 -11
- package/dist/cjs/plugins/feature-flags-context/index.js +0 -50
- package/dist/cjs/plugins/feature-flags-context/plugin-key.js +0 -9
- package/dist/es2019/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -1
- package/dist/es2019/plugins/feature-flags-context/get-feature-flags.js +0 -2
- package/dist/es2019/plugins/feature-flags-context/index.js +0 -29
- package/dist/es2019/plugins/feature-flags-context/plugin-key.js +0 -2
- package/dist/esm/plugins/feature-flags-context/get-enabled-feature-flag-keys.js +0 -1
- package/dist/esm/plugins/feature-flags-context/get-feature-flags.js +0 -4
- package/dist/esm/plugins/feature-flags-context/index.js +0 -40
- package/dist/esm/plugins/feature-flags-context/plugin-key.js +0 -2
- package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +0 -1
- package/dist/types/plugins/feature-flags-context/get-feature-flags.d.ts +0 -3
- package/dist/types/plugins/feature-flags-context/index.d.ts +0 -9
- package/dist/types/plugins/feature-flags-context/plugin-key.d.ts +0 -2
package/.eslintrc.js
CHANGED
|
@@ -19,12 +19,14 @@ module.exports = {
|
|
|
19
19
|
],
|
|
20
20
|
},
|
|
21
21
|
],
|
|
22
|
+
'react/no-danger': 'error',
|
|
22
23
|
},
|
|
23
24
|
overrides: [
|
|
24
25
|
{
|
|
25
26
|
files: ['**/__tests__/**/*.{js,ts,tsx}', 'examples/**/*.{js,ts,tsx}'],
|
|
26
27
|
rules: {
|
|
27
28
|
'import/no-restricted-paths': ['off'],
|
|
29
|
+
'react/no-danger': 'off',
|
|
28
30
|
},
|
|
29
31
|
},
|
|
30
32
|
],
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 182.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ba95f121a52`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ba95f121a52) - ED-17378 Added assistiveLabel prop to Editor.
|
|
8
|
+
- [`c2385dcb8f7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2385dcb8f7) - [ux] ED-17043 Expanded table chart colors from 20 to 36 colors.
|
|
9
|
+
- [`e88e54a14e3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e88e54a14e3) - [ux] [ux] Added 'allowAlignment' and 'allowWrapping' as options in 'cardOptions' to let Trello to disable the features
|
|
10
|
+
- [`d9a8fe191f2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d9a8fe191f2) - [ED-17295] Update feature flag usage for media plugin
|
|
11
|
+
- [`0237059f136`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0237059f136) - Integrates @atlaskit/link-analytics for improved tracking of links
|
|
12
|
+
This can be enabled via the `lp-analytics-events-next` feature flag.
|
|
13
|
+
When enabled, tracks links changed in every transaction and fires `link created`, `link deleted` and `link updated` accordingly.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
<SmartCardProvider
|
|
17
|
+
featureFlags={{
|
|
18
|
+
enableResolveMetadataForLinkAnalytics: true,
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Editor
|
|
22
|
+
featureFlags={{
|
|
23
|
+
'lp-analytics-events-next': true,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</SmartCardProvider>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- [`21b20f571fa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21b20f571fa) - [ED-17382] Update feature flag usage for rule plugin
|
|
30
|
+
- [`b289da93d3c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b289da93d3c) - [ED-17384] Remove feature flags context plugin
|
|
31
|
+
- [`f99b84adfab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f99b84adfab) - Fix backspace behaviour in block quotes to prevent merging into panels
|
|
32
|
+
- [`2cfb05a2cf8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2cfb05a2cf8) - [ux] ED-17278 - Added shortcuts to Editor Help dialog
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
37
|
+
- [`e9422d1b0c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9422d1b0c9) - [ED-17383] Update feature flag usage in text color plugin
|
|
38
|
+
- [`b6ee3d64a94`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6ee3d64a94) - Improves internal getStepRange utility accuracy
|
|
39
|
+
- [`3e612ba32a6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3e612ba32a6) - [ED-17381] Update feature flag usage in paste plugin
|
|
40
|
+
- [`1be4313d684`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1be4313d684) - Removes redundant code paths related to outstanding card requests from internal card plugin
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
|
|
3
43
|
## 182.0.3
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# editor-core
|
|
2
|
+
|
|
3
|
+
Main package for the Atlassian Editor.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
Current devloop involves leveraging the atlaskit website shell to build out examples.
|
|
8
|
+
|
|
9
|
+
0. After following https://developer.atlassian.com/cloud/framework/atlassian-frontend/getting-started/getting-started/
|
|
10
|
+
1. `yarn start editor-core`
|
|
11
|
+
|
|
12
|
+
Then hit http://localhost:9000/examples/editor/editor-core
|
|
13
|
+
|
|
14
|
+
This opts you into the default esbuild configuration. If needing to fall back to webpack, this can be done via
|
|
15
|
+
`yarn start editor-core --experimental=webpack`
|
|
16
|
+
|
|
17
|
+
Running visual regression tests will also use the webpack build, due to the slight variation in how those assets are built for styling
|
|
18
|
+
`VISUAL_REGRESSION=true yarn start editor-core`
|
|
19
|
+
|
|
20
|
+
If you need to override the default port and run multiple builds side by side, use the `PORT` env variable: `PORT=9005 yarn start editor-core`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 1. Record architecture decisions
|
|
2
|
+
|
|
3
|
+
Date: 2023-04-05
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
We need to record some lightweight architectural decisions made on this project.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
As a mechanism for a more "lightweight" RFC approach for smaller decisions.
|
|
16
|
+
|
|
17
|
+
Scope could also include larger ones summarised once an RFC/DACI might be accepted.
|
|
18
|
+
|
|
19
|
+
Some of the dates will be backdated to port/transfer over some of the decisions from our decision log/registry.
|
|
20
|
+
|
|
21
|
+
We will use Architecture Decision Records, as [described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions).
|
|
22
|
+
|
|
23
|
+
## Consequences
|
|
24
|
+
|
|
25
|
+
See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's [adr-tools](https://github.com/npryce/adr-tools).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 2. Deep equality check for getSharedState
|
|
2
|
+
|
|
3
|
+
Date: 2023-03-17
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
via @Rodrigo Vieira https://atlassian.slack.com/archives/C046RBH9HT5/p1679018928924739
|
|
12
|
+
|
|
13
|
+
People, we have a optimisation situation with the getSharedState.
|
|
14
|
+
|
|
15
|
+
Right now, it is expect to be a pure function, That means return the same value for the same input, but you could do something like that
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
getSharedState(editorState) {
|
|
19
|
+
if (isDocumentEmpty(editorState) ) {
|
|
20
|
+
return {
|
|
21
|
+
isDocEmpty: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
isDocEmpty: false,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Right we are doing a shallow check before call the onChange listeners:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// Dumb check - should we do a deepcheck?
|
|
35
|
+
if (isInitialization || prevSharedState !== nextSharedState) {
|
|
36
|
+
(listeners.get(pluginName) || new Set<Callback>()).forEach((callback) => {
|
|
37
|
+
callbacks.push(
|
|
38
|
+
callback.bind(callback, { nextSharedState, prevSharedState }),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
As expected, we need to improve it.
|
|
45
|
+
|
|
46
|
+
We have two possible approaches
|
|
47
|
+
|
|
48
|
+
1. Do the same as ProseMirror does
|
|
49
|
+
2. Do a deep check
|
|
50
|
+
|
|
51
|
+
### Same as ProseMirror does
|
|
52
|
+
|
|
53
|
+
We can give the last shared state to the getSharedState and the dev would be responsible to return the same object in case there is no change
|
|
54
|
+
|
|
55
|
+
### Do a deep check
|
|
56
|
+
|
|
57
|
+
We can use something like `isEqual` and let dev do whatever they want to
|
|
58
|
+
|
|
59
|
+
## Decision
|
|
60
|
+
|
|
61
|
+
Use a deep check.
|
|
62
|
+
|
|
63
|
+
See https://bitbucket.org/%7B%7D/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/31238
|
|
64
|
+
|
|
65
|
+
## Consequences
|
|
66
|
+
|
|
67
|
+
Slight additional performance cost incurred, trading off for safety against plugins having to do the deep check itself.
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# 3. Explicit Plugin Dependencies
|
|
2
|
+
|
|
3
|
+
Date: 2023-04-06
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
Editor plugins are extremely dependent on each other, and import from each other.
|
|
12
|
+
|
|
13
|
+
Sometimes to the point of having circular dependencies.
|
|
14
|
+
|
|
15
|
+
This has many massive side effects, to name just a few:
|
|
16
|
+
|
|
17
|
+
- Complexity!
|
|
18
|
+
- devs not being able to clearly reason about the implicit dependencies between plugins
|
|
19
|
+
- extremely difficult to ship features, bug fixes, without breaking something unintended or even unrelated
|
|
20
|
+
- Performance!
|
|
21
|
+
- products not being able to integrate a lighter weight of the Atlassian Editor
|
|
22
|
+
- single bundle size whether you only use a handful of features in a small Editor, or the entire weight of the Full Page Editor
|
|
23
|
+
|
|
24
|
+
We learned from the [table extraction effort](https://product-fabric.atlassian.net/wiki/spaces/E/pages/3289779107/Editor+DACI+019+Bring+Tables+back) that it was feasible to extract and untangle one of our most complex Editor Plugins, with some temporary APIs to prevent cross importing.
|
|
25
|
+
|
|
26
|
+
## Decision
|
|
27
|
+
|
|
28
|
+
We must now prevent plugins from importing one another to reduce complexity within the Editor. In doing so, we can eliminate intricate dependency chains and, using the `getSharedState()` and `actions()` APIs, offer a clear understanding of how different plugins share their state.
|
|
29
|
+
|
|
30
|
+
Although making this choice is essential, the aim is to address the initial necessity for cross imports to begin with by outlining some "migration examples" and documentation below. This ADR outlines two of the APIs that are now in place, to address some of the challenges and insights gained from the initial table plugin extraction.
|
|
31
|
+
|
|
32
|
+
### Prevention
|
|
33
|
+
|
|
34
|
+
Linting errors will now be present for any new code that gets added, where we continue to attempt importing from one plugin into another. (See `ELR101`, `ELR102` in `repo-docs/content/cloud/framework/atlassian-frontend/editor/lint.md`).
|
|
35
|
+
|
|
36
|
+
### Other resources
|
|
37
|
+
|
|
38
|
+
- https://product-fabric.atlassian.net/wiki/spaces/EA/pages/3097395592/EXPLORE+Project+Poster+Composable+Editor+prev+Architecture+V3
|
|
39
|
+
- https://product-fabric.atlassian.net/wiki/spaces/EA/pages/3308192650/Composable+Editor+Table+Extraction
|
|
40
|
+
- https://product-fabric.atlassian.net/wiki/spaces/EA/pages/3352725568/MAKE+Project+Poster+Editor+Scalability
|
|
41
|
+
- https://product-fabric.atlassian.net/wiki/spaces/E/pages/3350692271/Editor+RFC+028+Composition+EditorPlugin+Dependency+Injection
|
|
42
|
+
|
|
43
|
+
## Consequences
|
|
44
|
+
|
|
45
|
+
Devs will need to stop importing from one plugin into another, and eventually be blocked on it when we upgrade the lint error from warning to erroring.
|
|
46
|
+
|
|
47
|
+
We are mitigating this, by presenting some samples of how to quickly migrate / "turn on" a plugin into utilising the new `actions()` and `getSharedState()` APIs in EditorPlugin.
|
|
48
|
+
|
|
49
|
+
A brief "HOWTO" / "HOW TO" guide of how you can migrate existing or new "cross imports", and get the same functionality:
|
|
50
|
+
|
|
51
|
+
## 1. `getSharedState()` (and `useSharedPluginState()` hook for React Components)
|
|
52
|
+
|
|
53
|
+
**Problem**: Let's say you want to access the state from `Foo` plugin, into a second Plugin `Bar`. Something like `previouslyInternalStateA`. Previously, you needed to import that plugin key, and then use it. Now we can use `getSharedState()` and 2 methods `currentState()` & `onChange` methods on `api.dependencies.[plugin-name].sharedState`.
|
|
54
|
+
|
|
55
|
+
### **Before**
|
|
56
|
+
|
|
57
|
+
**Implicit state dependency**, you are using `Foo` plugin internals from `Bar` plugin.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// editor-core/src/plugins/bar-plugin/index.ts
|
|
61
|
+
import { pluginKey as internalFooPluginKey } from '../plugins/foo/pm-plugins/some-internal-to-foo-prosemirror-plugin';
|
|
62
|
+
//...
|
|
63
|
+
const previouslyInternalStateC = internalFooPluginKey.getState(view.state);
|
|
64
|
+
doSomethingBasedOnAnotherPluginInternalState(previouslyInternalStateC);
|
|
65
|
+
///...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### **After**
|
|
69
|
+
|
|
70
|
+
**Explicit state dependency**, `Foo` plugin "pushes" out, explicitly publicly, shares state surfaced from `internalFooPlugin` prosemirror state internals, for _any_ plugin to use.
|
|
71
|
+
|
|
72
|
+
### Usage inside general `EditorPlugin` and prosemirror plugins:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
// editor-core/src/plugins/bar-plugin/index.ts
|
|
76
|
+
|
|
77
|
+
// Note that this type import can come from a fully extracted plugin, or from a plugin inside editor-core. Cross importing _types_ is OK at this stage
|
|
78
|
+
import type { fooPlugin } from '@atlaskit/editor-plugin-foo';
|
|
79
|
+
// import type { fooPlugin } from '../../src/plugins/editor-plugin-foo/index.ts';
|
|
80
|
+
|
|
81
|
+
const barPlugin: NextEditorPlugin<
|
|
82
|
+
'bar',
|
|
83
|
+
{
|
|
84
|
+
pluginConfiguration: BarPluginOptions | undefined;
|
|
85
|
+
dependencies: [typeof fooPlugin];
|
|
86
|
+
}
|
|
87
|
+
> = (options, api) => {
|
|
88
|
+
const {
|
|
89
|
+
nowExplicitStateA,
|
|
90
|
+
nowExplicitStateB,
|
|
91
|
+
nowExplicitStateC
|
|
92
|
+
} = api?.dependencies?.foo?.sharedState.currentState();
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
name: 'bar',
|
|
96
|
+
pmPlugins() {//... use nowExplicitStateA
|
|
97
|
+
}
|
|
98
|
+
nodes() {...}
|
|
99
|
+
marks() {...}
|
|
100
|
+
contentComponent() {//... use nowExplicitStateB
|
|
101
|
+
}
|
|
102
|
+
primaryToolbarComponent() {//... use nowExplicitStateC
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### New `getSharedState()` to expose all explicitly shared state from plugin `Foo`
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
// editor-core/src/plugins/foo-plugin/index.ts
|
|
112
|
+
const fooPlugin: NextEditorPlugin <...> {
|
|
113
|
+
getSharedState(editorState) {
|
|
114
|
+
if (!editorState) {
|
|
115
|
+
return {
|
|
116
|
+
nowExplicitStateA: null,
|
|
117
|
+
nowExplicitStateB: false,
|
|
118
|
+
nowExplicitStateC: "and so on"
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const { nowExplicitStateA, nowExplicitStateB, nowExplicitStateC } =
|
|
123
|
+
selfInternalPluginKey.getState(editorState);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
nowExplicitStateA,
|
|
127
|
+
nowExplicitStateB,
|
|
128
|
+
nowExplicitStateC,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### **The "new parts" again:**
|
|
135
|
+
|
|
136
|
+
```diff
|
|
137
|
+
// editor-core/src/plugins/bar-plugin/index.ts
|
|
138
|
+
- import { pluginKey as internalFooPluginKey } from '../plugins/foo/pm-plugins/some-internal-to-foo-prosemirror-plugin';
|
|
139
|
+
|
|
140
|
+
// Note that this type import can come from a fully extracted plugin, or from a plugin inside editor-core. Cross importing _types_ is OK at this stage
|
|
141
|
+
+ import type { fooPlugin } from '@atlaskit/editor-plugin-foo';
|
|
142
|
+
// import type { fooPlugin } from '../../src/plugins/editor-plugin-foo/index.ts';
|
|
143
|
+
|
|
144
|
+
const fooPlugin: NextEditorPlugin<
|
|
145
|
+
'bar',
|
|
146
|
+
{
|
|
147
|
+
pluginConfiguration: SomePluginOptions | undefined;
|
|
148
|
+
+ dependencies: [typeof fooPlugin];
|
|
149
|
+
}
|
|
150
|
+
> = (options, api) => {
|
|
151
|
+
const {
|
|
152
|
+
+ nowExplicitStateA,
|
|
153
|
+
+ nowExplicitStateB,
|
|
154
|
+
+ nowExplicitStateC,
|
|
155
|
+
+ } = api?.dependencies?.foo?.sharedState.currentState();
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
name: 'bar',
|
|
159
|
+
+ pmPlugins() {//... use nowExplicitStateA
|
|
160
|
+
// deeper inside the pm plugins...
|
|
161
|
+
- const previouslyInternalStateC = internalFooPluginKey.getState(view.state);
|
|
162
|
+
}
|
|
163
|
+
nodes() {...}
|
|
164
|
+
marks() {...}
|
|
165
|
+
+ contentComponent() {//... use nowExplicitStateB
|
|
166
|
+
}
|
|
167
|
+
+ primaryToolbarComponent() {//... use nowExplicitStateC
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Usage inside a React component
|
|
174
|
+
|
|
175
|
+
(See date plugin at `packages/editor/editor-core/src/plugins/date/index.tsx` for a full code sample of using `useSharedPluginState`)
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
// editor-core/src/plugins/bar-some-react-component-based-plugin/index.tsx
|
|
179
|
+
function SomeBarComponent({ dependencyApi }) {
|
|
180
|
+
const { fooState } = useSharedPluginState(
|
|
181
|
+
dependencyApi,
|
|
182
|
+
['foo'],
|
|
183
|
+
);
|
|
184
|
+
const { nowExplicitStateA, nowExplicitStateB, nowExplicitStateC } = fooState;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const barPlugin: NextEditorPlugin<
|
|
188
|
+
'bar',
|
|
189
|
+
{
|
|
190
|
+
pluginConfiguration: BarPluginOptions | undefined;
|
|
191
|
+
dependencies: [typeof fooPlugin];
|
|
192
|
+
}
|
|
193
|
+
> = (options, api) => {
|
|
194
|
+
return {
|
|
195
|
+
name: 'cat',
|
|
196
|
+
pmPlugins() {}
|
|
197
|
+
contentComponent() {
|
|
198
|
+
return <SomeBarComponent dependencyApi={api} />
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Important parts to note:
|
|
206
|
+
|
|
207
|
+
1. You will need to implement a new `getSharedState()` function inside the current `EditorPlugin` that you require the state from, to expose any "public state" that you would like to make available to other plugins. **Treat this state as "public API" for other plugins**, as any plugin will be able to depend on this and react to it.
|
|
208
|
+
|
|
209
|
+
2. You _may_ need to update `packages/editor/editor-core/src/labs/next/presets/universal.ts`, if you are creating a new EditorPlugin to depend on.
|
|
210
|
+
|
|
211
|
+
3. Anywhere where we used to use `WithPluginState` and import plugin keys, you can now use `useSharedPluginState`
|
|
212
|
+
|
|
213
|
+
## 2. `actions()`
|
|
214
|
+
|
|
215
|
+
For a full code sample, please see `actions()` implementation in https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31264?w=1#chg_packages/editor/editor-core/src/plugins/analytics/plugin.ts_newline116
|
|
216
|
+
|
|
217
|
+
Our first attempt with actions, was on the analytics plugin, which touches almost all plugins and surfaced some other issues. However the same approach can be applied at a smaller scale, for smaller plugins that have "cross action dependencies".
|
|
218
|
+
|
|
219
|
+
**Problem**: Let's say you had an "`addAnalytics()`" action, used in the `Foo` plugin, and wanted to use it inside of a second, `Bar` plugin.
|
|
220
|
+
|
|
221
|
+
### **Before**
|
|
222
|
+
|
|
223
|
+
Again, cross importing from `Foo` plugin, into `Bar` plugin:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
// editor-core/src/plugins/bar-plugin/index.tsx
|
|
227
|
+
import { addAnalytics } from "../foo-plugin/pm-plugins/actions";
|
|
228
|
+
|
|
229
|
+
const barPlugin: NextEditorPlugin<
|
|
230
|
+
'bar'
|
|
231
|
+
> = () => ({
|
|
232
|
+
someBarPluginCode() {
|
|
233
|
+
addAnalytics();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### **After**
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
// editor-core/src/plugins/foo-plugin/index.tsx
|
|
242
|
+
const fooPlugin: NextEditorPlugin<
|
|
243
|
+
'foo',
|
|
244
|
+
{
|
|
245
|
+
dependencies: [typeof fooPlugin],
|
|
246
|
+
}
|
|
247
|
+
> = (options, api) => ({
|
|
248
|
+
actions() {
|
|
249
|
+
addAnalytics() {
|
|
250
|
+
// Do something
|
|
251
|
+
// return something
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
// editor-core/src/plugins/bar-plugin/index.tsx
|
|
259
|
+
import type { default as fooPlugin } from "../foo-plugin";
|
|
260
|
+
|
|
261
|
+
const barPlugin: NextEditorPlugin<
|
|
262
|
+
'bar',
|
|
263
|
+
{
|
|
264
|
+
dependencies: [typeof fooPlugin],
|
|
265
|
+
}
|
|
266
|
+
> = (options, api) => ({
|
|
267
|
+
someBarPluginCode() {
|
|
268
|
+
api.externalPlugins?.foo?.actions?.addAnalytics();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### **The "new parts" again:**
|
|
274
|
+
|
|
275
|
+
```diff
|
|
276
|
+
// editor-core/src/plugins/bar-plugin/index.tsx
|
|
277
|
+
- import { addAnalytics as crossImportedAddAnalytics } from "../foo-plugin/pm-plugins/actions";
|
|
278
|
+
+ import type { default as fooPlugin } from "../foo-plugin";
|
|
279
|
+
|
|
280
|
+
const barPlugin: NextEditorPlugin<
|
|
281
|
+
'bar',
|
|
282
|
+
{
|
|
283
|
+
+ dependencies: [typeof fooPlugin],
|
|
284
|
+
}
|
|
285
|
+
> = (options, api) => ({
|
|
286
|
+
someBarPluginCode() {
|
|
287
|
+
- const addAnalytics = crossImportedAddAnalytics;
|
|
288
|
+
+ const addAnalytics = api.externalPlugins?.foo?.actions?.addAnalytics();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
@@ -17,7 +17,6 @@ var _prosemirrorUtils = require("prosemirror-utils");
|
|
|
17
17
|
var _eventDispatcher = require("../event-dispatcher");
|
|
18
18
|
var _nativeCollabProviderPlugin = require("../plugins/collab-edit/native-collab-provider-plugin");
|
|
19
19
|
var _utils2 = require("../plugins/extension/utils");
|
|
20
|
-
var _getFeatureFlags = require("../plugins/feature-flags-context/get-feature-flags");
|
|
21
20
|
var _utils3 = require("../utils");
|
|
22
21
|
var _action = require("../utils/action");
|
|
23
22
|
var _deprecationWarnings = _interopRequireDefault(require("../utils/deprecation-warnings"));
|
|
@@ -39,19 +38,19 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
39
38
|
});
|
|
40
39
|
(0, _defineProperty2.default)(this, "getResolvedEditorState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
41
40
|
var _getCollabProvider;
|
|
42
|
-
var
|
|
41
|
+
var _this$getFeatureFlags, useNativeCollabPlugin, editorValue, editorView;
|
|
43
42
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
43
|
while (1) {
|
|
45
44
|
switch (_context.prev = _context.next) {
|
|
46
45
|
case 0:
|
|
46
|
+
_this$getFeatureFlags = _this.getFeatureFlags(), useNativeCollabPlugin = _this$getFeatureFlags.useNativeCollabPlugin;
|
|
47
47
|
if (_this.editorView) {
|
|
48
|
-
_context.next =
|
|
48
|
+
_context.next = 3;
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
throw new Error('Called getResolvedEditorState before editorView is ready');
|
|
52
|
-
case
|
|
53
|
-
|
|
54
|
-
if (featureFlags.useNativeCollabPlugin) {
|
|
52
|
+
case 3:
|
|
53
|
+
if (useNativeCollabPlugin) {
|
|
55
54
|
_context.next = 10;
|
|
56
55
|
break;
|
|
57
56
|
}
|
|
@@ -97,13 +96,22 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
97
96
|
value: function _privateGetEventDispatcher() {
|
|
98
97
|
return this.eventDispatcher;
|
|
99
98
|
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "getFeatureFlags",
|
|
101
|
+
value: function getFeatureFlags() {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
100
104
|
|
|
101
105
|
// This method needs to be public for EditorContext component.
|
|
102
106
|
}, {
|
|
103
107
|
key: "_privateRegisterEditor",
|
|
104
108
|
value: function _privateRegisterEditor(editorView, eventDispatcher, contentTransformer) {
|
|
109
|
+
var getFeatureFlags = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
|
|
110
|
+
return {};
|
|
111
|
+
};
|
|
105
112
|
this.contentTransformer = contentTransformer;
|
|
106
113
|
this.eventDispatcher = eventDispatcher;
|
|
114
|
+
this.getFeatureFlags = getFeatureFlags;
|
|
107
115
|
if (!this.editorView && editorView) {
|
|
108
116
|
this.editorView = editorView;
|
|
109
117
|
this.listeners.forEach(function (cb) {
|
|
@@ -125,6 +133,9 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
125
133
|
this.contentTransformer = undefined;
|
|
126
134
|
this.contentEncode = undefined;
|
|
127
135
|
this.eventDispatcher = undefined;
|
|
136
|
+
this.getFeatureFlags = function () {
|
|
137
|
+
return {};
|
|
138
|
+
};
|
|
128
139
|
}
|
|
129
140
|
}, {
|
|
130
141
|
key: "_privateSubscribe",
|
|
@@ -17,10 +17,11 @@ var attachPayloadIntoTransaction = function attachPayloadIntoTransaction(_ref) {
|
|
|
17
17
|
payload = (0, _editorStateContext.getStateContext)(editorState, payload);
|
|
18
18
|
payload = (0, _mapAttributes.mapActionSubjectIdToAttributes)(payload);
|
|
19
19
|
var storedMarks = tr.storedMarks;
|
|
20
|
+
var pos = tr.mapping.map(editorState.selection.$from.pos, -1);
|
|
20
21
|
tr.step(new _steps.AnalyticsStep([{
|
|
21
22
|
payload: payload,
|
|
22
23
|
channel: channel
|
|
23
|
-
}], actionsToIgnore,
|
|
24
|
+
}], actionsToIgnore, pos) // We need to create the step based on a position, this prevent split history for relative changes.
|
|
24
25
|
);
|
|
25
26
|
|
|
26
27
|
// When you add a new step all the storedMarks are removed it
|
|
@@ -14,7 +14,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
18
17
|
var _react = _interopRequireDefault(require("react"));
|
|
19
18
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
20
19
|
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
@@ -22,7 +21,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
22
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
22
|
var _analytics = require("../plugins/analytics");
|
|
24
23
|
var _consts = require("../plugins/analytics/consts");
|
|
25
|
-
var _featureFlagsContext = require("../plugins/feature-flags-context");
|
|
26
24
|
var _documentLogger = require("../utils/document-logger");
|
|
27
25
|
var _WithEditorView = require("./WithEditorView");
|
|
28
26
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
@@ -41,12 +39,6 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
41
39
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
42
40
|
error: undefined
|
|
43
41
|
});
|
|
44
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFeatureFlags", (0, _memoizeOne.default)(function (editorView) {
|
|
45
|
-
if (!editorView) {
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
return (0, _featureFlagsContext.getFeatureFlags)(editorView.state);
|
|
49
|
-
}));
|
|
50
42
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sendErrorData", /*#__PURE__*/function () {
|
|
51
43
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(analyticsErrorPayload) {
|
|
52
44
|
var _window, _window$navigator;
|
|
@@ -153,20 +145,13 @@ var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
153
145
|
docStructure: attributes.docStructure
|
|
154
146
|
};
|
|
155
147
|
});
|
|
148
|
+
_this.featureFlags = props.featureFlags;
|
|
156
149
|
if (props.editorView) {
|
|
157
150
|
_this.experienceStore = _ufo.ExperienceStore.getInstance(props.editorView);
|
|
158
151
|
}
|
|
159
152
|
return _this;
|
|
160
153
|
}
|
|
161
154
|
(0, _createClass2.default)(ErrorBoundaryWithEditorView, [{
|
|
162
|
-
key: "featureFlags",
|
|
163
|
-
get:
|
|
164
|
-
// Memoizing this as react alternative suggestion of https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
|
|
165
|
-
|
|
166
|
-
function get() {
|
|
167
|
-
return this.getFeatureFlags(this.props.editorView);
|
|
168
|
-
}
|
|
169
|
-
}, {
|
|
170
155
|
key: "componentDidCatch",
|
|
171
156
|
value: function componentDidCatch(error, errorInfo) {
|
|
172
157
|
var _this2 = this;
|
|
@@ -27,7 +27,7 @@ var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
|
27
27
|
var _nodes = require("../utils/nodes");
|
|
28
28
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
29
29
|
var _featureFlagsFromProps = require("./feature-flags-from-props");
|
|
30
|
-
var
|
|
30
|
+
var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
|
|
31
31
|
var _createEditor = require("./create-editor");
|
|
32
32
|
var _documentLogger = require("../utils/document-logger");
|
|
33
33
|
var _isFullPage = require("../utils/is-full-page");
|
|
@@ -484,7 +484,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
484
484
|
className: getUAPrefix(),
|
|
485
485
|
key: "ProseMirror",
|
|
486
486
|
ref: _this.handleEditorViewRef,
|
|
487
|
-
"aria-label": _this.props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel),
|
|
487
|
+
"aria-label": _this.props.editorProps.assistiveLabel ? _this.props.editorProps.assistiveLabel : _this.props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel),
|
|
488
488
|
role: "textbox"
|
|
489
489
|
}));
|
|
490
490
|
_this.pluginInjectionAPI = new _preset.EditorPluginInjectionAPI({
|
|
@@ -507,7 +507,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
507
507
|
});
|
|
508
508
|
_this.validTransactionCount = 0;
|
|
509
509
|
_this.featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(_this.props.editorProps);
|
|
510
|
-
var featureFlagsEnabled = _this.featureFlags ? (0,
|
|
510
|
+
var featureFlagsEnabled = _this.featureFlags ? (0, _normalizeFeatureFlags.getEnabledFeatureFlagKeys)(_this.featureFlags) : [];
|
|
511
511
|
|
|
512
512
|
// START TEMPORARY CODE ED-10584
|
|
513
513
|
if (_this.props.createAnalyticsEvent) {
|
|
@@ -75,7 +75,8 @@ function EditorInternalWithoutHooks(_ref) {
|
|
|
75
75
|
useShallow: useShallow
|
|
76
76
|
}), (0, _react.jsx)(_ErrorBoundary.default, {
|
|
77
77
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
78
|
-
contextIdentifierProvider: props.contextIdentifierProvider
|
|
78
|
+
contextIdentifierProvider: props.contextIdentifierProvider,
|
|
79
|
+
featureFlags: featureFlags
|
|
79
80
|
}, (0, _react.jsx)(_ui.WidthProvider, {
|
|
80
81
|
css: (0, _react.css)({
|
|
81
82
|
height: '100%'
|