@atlaskit/editor-core 171.0.1 → 172.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
- package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
- package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +13 -4
- package/dist/cjs/create-editor/create-plugins-list.js +21 -12
- package/dist/cjs/editor.js +8 -23
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/nodeviews/context-adapter.js +2 -2
- package/dist/cjs/plugins/analytics/plugin.js +24 -11
- package/dist/cjs/plugins/base/index.js +3 -3
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
- package/dist/cjs/plugins/card/index.js +1 -1
- package/dist/cjs/plugins/card/toolbar.js +11 -5
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/code-block/actions.js +13 -0
- package/dist/cjs/plugins/code-block/index.js +7 -0
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
- package/dist/cjs/plugins/code-block/styles.js +3 -36
- package/dist/cjs/plugins/code-block/toolbar.js +9 -0
- package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
- package/dist/cjs/plugins/copy-button/commands.js +40 -20
- package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
- package/dist/cjs/plugins/copy-button/utils.js +16 -38
- package/dist/cjs/plugins/expand/toolbar.js +8 -2
- package/dist/cjs/plugins/extension/toolbar.js +5 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
- package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
- package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
- package/dist/cjs/plugins/hyperlink/index.js +4 -4
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
- package/dist/cjs/plugins/indentation/commands/index.js +35 -7
- package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
- package/dist/cjs/plugins/layout/toolbar.js +3 -1
- package/dist/cjs/plugins/media/toolbar/index.js +13 -5
- package/dist/cjs/plugins/mentions/analytics.js +5 -5
- package/dist/cjs/plugins/panel/toolbar.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
- package/dist/cjs/plugins/paste/handlers.js +25 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
- package/dist/cjs/plugins/status/analytics.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
- package/dist/cjs/types/browser.js +6 -0
- package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +1 -3
- package/dist/cjs/ui/DropList/index.js +215 -0
- package/dist/cjs/ui/Dropdown/index.js +2 -5
- package/dist/cjs/ui/DropdownMenu/index.js +140 -86
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
- package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
- package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
- package/dist/cjs/ui/Layer/index.js +245 -0
- package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
- package/dist/cjs/ui/PortalProvider/index.js +7 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +15 -4
- package/dist/es2019/create-editor/create-plugins-list.js +21 -11
- package/dist/es2019/editor.js +9 -23
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/nodeviews/context-adapter.js +2 -2
- package/dist/es2019/plugins/analytics/plugin.js +19 -4
- package/dist/es2019/plugins/base/index.js +3 -3
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
- package/dist/es2019/plugins/card/index.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +10 -5
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/code-block/actions.js +12 -0
- package/dist/es2019/plugins/code-block/index.js +4 -0
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
- package/dist/es2019/plugins/code-block/styles.js +2 -159
- package/dist/es2019/plugins/code-block/toolbar.js +8 -0
- package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
- package/dist/es2019/plugins/copy-button/commands.js +35 -15
- package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
- package/dist/es2019/plugins/copy-button/utils.js +15 -27
- package/dist/es2019/plugins/expand/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
- package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
- package/dist/es2019/plugins/hyperlink/index.js +4 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
- package/dist/es2019/plugins/indentation/commands/index.js +24 -9
- package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/es2019/plugins/layout/toolbar.js +2 -1
- package/dist/es2019/plugins/media/toolbar/index.js +10 -3
- package/dist/es2019/plugins/mentions/analytics.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
- package/dist/es2019/plugins/paste/handlers.js +27 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
- package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
- package/dist/es2019/plugins/status/analytics.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/es2019/types/browser.js +2 -0
- package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +5 -9
- package/dist/es2019/ui/DropList/index.js +186 -0
- package/dist/es2019/ui/Dropdown/index.js +2 -6
- package/dist/es2019/ui/DropdownMenu/index.js +124 -75
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
- package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
- package/dist/es2019/ui/Layer/index.js +195 -0
- package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
- package/dist/es2019/ui/PortalProvider/index.js +5 -23
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +13 -4
- package/dist/esm/create-editor/create-plugins-list.js +21 -12
- package/dist/esm/editor.js +9 -23
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/nodeviews/context-adapter.js +2 -2
- package/dist/esm/plugins/analytics/plugin.js +24 -11
- package/dist/esm/plugins/base/index.js +3 -3
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
- package/dist/esm/plugins/card/index.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +11 -5
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/code-block/actions.js +12 -0
- package/dist/esm/plugins/code-block/index.js +6 -0
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
- package/dist/esm/plugins/code-block/styles.js +4 -32
- package/dist/esm/plugins/code-block/toolbar.js +8 -0
- package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
- package/dist/esm/plugins/copy-button/commands.js +35 -15
- package/dist/esm/plugins/copy-button/toolbar.js +31 -0
- package/dist/esm/plugins/copy-button/utils.js +14 -29
- package/dist/esm/plugins/expand/toolbar.js +6 -2
- package/dist/esm/plugins/extension/toolbar.js +4 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
- package/dist/esm/plugins/hyperlink/index.js +4 -4
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
- package/dist/esm/plugins/indentation/commands/index.js +30 -9
- package/dist/esm/plugins/indentation/commands/utils.js +12 -8
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/esm/plugins/layout/toolbar.js +2 -1
- package/dist/esm/plugins/media/toolbar/index.js +12 -5
- package/dist/esm/plugins/mentions/analytics.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
- package/dist/esm/plugins/paste/handlers.js +23 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
- package/dist/esm/plugins/status/analytics.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +8 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/esm/types/browser.js +2 -0
- package/dist/esm/ui/Addon/click-area-helper.js +37 -18
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +2 -4
- package/dist/esm/ui/DropList/index.js +203 -0
- package/dist/esm/ui/Dropdown/index.js +2 -6
- package/dist/esm/ui/DropdownMenu/index.js +134 -88
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
- package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/esm/ui/ElementBrowser/constants.js +1 -4
- package/dist/esm/ui/Layer/index.js +228 -0
- package/dist/esm/ui/Layer/internal/helpers.js +62 -0
- package/dist/esm/ui/PortalProvider/index.js +7 -26
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/plugins/analytics/plugin.d.ts +5 -1
- package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
- package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
- package/dist/types/plugins/card/index.d.ts +2 -7
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +3 -5
- package/dist/types/plugins/card/types.d.ts +2 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
- package/dist/types/plugins/code-block/styles.d.ts +0 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -6
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/index.d.ts +2 -2
- package/dist/types/plugins/hyperlink/types.d.ts +30 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
- package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
- package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
- package/dist/types/plugins/paste/handlers.d.ts +1 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/types/browser.d.ts +10 -0
- package/dist/types/types/editor-props.d.ts +6 -5
- package/dist/types/types/feature-flags.d.ts +29 -24
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/DropList/index.d.ts +22 -0
- package/dist/types/ui/Dropdown/index.d.ts +2 -1
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
- package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
- package/dist/types/ui/Layer/index.d.ts +47 -0
- package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
- package/package.json +23 -18
- package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
- package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
- package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
- package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
- package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
- package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
- package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
|
2
|
+
import { Data } from 'popper.js';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
content: ReactNode | null;
|
|
5
|
+
offset: string;
|
|
6
|
+
position: string;
|
|
7
|
+
onPositioned: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare type State = {
|
|
10
|
+
hasExtractedStyles: boolean;
|
|
11
|
+
position?: string;
|
|
12
|
+
transform?: string;
|
|
13
|
+
offsets: {
|
|
14
|
+
popper: {
|
|
15
|
+
left: number;
|
|
16
|
+
top: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
cssPosition: string;
|
|
20
|
+
originalHeight: number | null;
|
|
21
|
+
maxHeight: number | null;
|
|
22
|
+
};
|
|
23
|
+
export default class Layer extends Component<Props, State> {
|
|
24
|
+
private popper;
|
|
25
|
+
private targetRef;
|
|
26
|
+
private contentRef;
|
|
27
|
+
static defaultProps: {
|
|
28
|
+
boundariesElement: string;
|
|
29
|
+
children: null;
|
|
30
|
+
content: null;
|
|
31
|
+
offset: string;
|
|
32
|
+
position: string;
|
|
33
|
+
zIndex: number;
|
|
34
|
+
lockScroll: boolean;
|
|
35
|
+
isAlwaysFixed: boolean;
|
|
36
|
+
onPositioned: () => void;
|
|
37
|
+
};
|
|
38
|
+
constructor(props: Props);
|
|
39
|
+
componentDidMount(): void;
|
|
40
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
41
|
+
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
42
|
+
componentWillUnmount(): void;
|
|
43
|
+
calculateMaxHeight(originalHeight: number, currentHeight: number, positionTop: number, cssPosition: string): number | null;
|
|
44
|
+
extractStyles: (state: Data) => void;
|
|
45
|
+
applyPopper(props: Props): void;
|
|
46
|
+
render(): JSX.Element;
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "172.0.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/activity": "^1.0.1",
|
|
28
28
|
"@atlaskit/activity-provider": "^2.3.0",
|
|
29
|
-
"@atlaskit/adf-schema": "^23.
|
|
29
|
+
"@atlaskit/adf-schema": "^23.3.0",
|
|
30
30
|
"@atlaskit/adf-utils": "^17.1.0",
|
|
31
31
|
"@atlaskit/analytics-gas-types": "^5.0.0",
|
|
32
32
|
"@atlaskit/analytics-listeners": "^8.3.0",
|
|
@@ -41,23 +41,22 @@
|
|
|
41
41
|
"@atlaskit/code": "^14.3.0",
|
|
42
42
|
"@atlaskit/date": "^0.9.0",
|
|
43
43
|
"@atlaskit/datetime-picker": "^12.1.0",
|
|
44
|
-
"@atlaskit/
|
|
45
|
-
"@atlaskit/editor-common": "^69.0.0",
|
|
44
|
+
"@atlaskit/editor-common": "^69.1.0",
|
|
46
45
|
"@atlaskit/editor-json-transformer": "^8.7.0",
|
|
47
46
|
"@atlaskit/editor-markdown-transformer": "^4.1.0",
|
|
48
47
|
"@atlaskit/editor-shared-styles": "^2.1.0",
|
|
49
48
|
"@atlaskit/editor-tables": "^2.1.0",
|
|
50
|
-
"@atlaskit/emoji": "^65.
|
|
49
|
+
"@atlaskit/emoji": "^65.1.0",
|
|
51
50
|
"@atlaskit/empty-state": "^7.3.0",
|
|
52
51
|
"@atlaskit/form": "^8.5.0",
|
|
53
52
|
"@atlaskit/icon": "^21.10.0",
|
|
54
53
|
"@atlaskit/icon-object": "^6.2.0",
|
|
55
|
-
"@atlaskit/
|
|
54
|
+
"@atlaskit/link-picker": "^1.1.2",
|
|
56
55
|
"@atlaskit/locale": "^2.3.0",
|
|
57
56
|
"@atlaskit/logo": "^13.8.0",
|
|
58
|
-
"@atlaskit/media-card": "^74.
|
|
57
|
+
"@atlaskit/media-card": "^74.1.0",
|
|
59
58
|
"@atlaskit/media-client": "^17.1.0",
|
|
60
|
-
"@atlaskit/media-common": "^2.
|
|
59
|
+
"@atlaskit/media-common": "^2.16.0",
|
|
61
60
|
"@atlaskit/media-filmstrip": "^45.0.0",
|
|
62
61
|
"@atlaskit/media-picker": "^63.0.0",
|
|
63
62
|
"@atlaskit/media-ui": "^22.1.0",
|
|
@@ -68,8 +67,9 @@
|
|
|
68
67
|
"@atlaskit/prosemirror-input-rules": "^2.1.0",
|
|
69
68
|
"@atlaskit/radio": "^5.3.0",
|
|
70
69
|
"@atlaskit/section-message": "^6.1.0",
|
|
71
|
-
"@atlaskit/select": "^15.
|
|
72
|
-
"@atlaskit/smart-
|
|
70
|
+
"@atlaskit/select": "^15.5.0",
|
|
71
|
+
"@atlaskit/smart-card": "^21.0.0",
|
|
72
|
+
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
73
73
|
"@atlaskit/spinner": "^15.1.0",
|
|
74
74
|
"@atlaskit/status": "^1.1.0",
|
|
75
75
|
"@atlaskit/tabs": "^13.2.0",
|
|
@@ -104,8 +104,9 @@
|
|
|
104
104
|
"is-number": "^7.0.0",
|
|
105
105
|
"linkify-it": "^2.0.3",
|
|
106
106
|
"lodash": "^4.17.21",
|
|
107
|
-
"markdown-it": "^
|
|
107
|
+
"markdown-it": "^12.3.2",
|
|
108
108
|
"memoize-one": "^6.0.0",
|
|
109
|
+
"popper.js": "^1.14.1",
|
|
109
110
|
"prop-types": "^15.5.10",
|
|
110
111
|
"prosemirror-collab": "^1.2.2",
|
|
111
112
|
"prosemirror-commands": "1.1.11",
|
|
@@ -128,8 +129,8 @@
|
|
|
128
129
|
"w3c-keyname": "^2.1.0"
|
|
129
130
|
},
|
|
130
131
|
"peerDependencies": {
|
|
132
|
+
"@atlaskit/link-provider": "^1.0.0",
|
|
131
133
|
"@atlaskit/media-core": "^33.0.1",
|
|
132
|
-
"@atlaskit/smart-card": "^21.0.0",
|
|
133
134
|
"react": "^16.8.0",
|
|
134
135
|
"react-dom": "^16.8.0",
|
|
135
136
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
@@ -139,28 +140,30 @@
|
|
|
139
140
|
"@atlaskit/atlassian-navigation": "^2.2.0",
|
|
140
141
|
"@atlaskit/breadcrumbs": "11.6.2",
|
|
141
142
|
"@atlaskit/code": "^14.3.0",
|
|
142
|
-
"@atlaskit/collab-provider": "7.
|
|
143
|
+
"@atlaskit/collab-provider": "7.5.0",
|
|
143
144
|
"@atlaskit/docs": "*",
|
|
144
145
|
"@atlaskit/drawer": "^7.1.0",
|
|
145
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
146
|
+
"@atlaskit/dropdown-menu": "^11.3.0",
|
|
147
|
+
"@atlaskit/droplist": "^11.0.0",
|
|
146
148
|
"@atlaskit/editor-bitbucket-transformer": "^7.2.0",
|
|
147
149
|
"@atlaskit/editor-extension-dropbox": "^0.3.0",
|
|
148
150
|
"@atlaskit/editor-test-helpers": "^17.1.0",
|
|
149
151
|
"@atlaskit/flag": "^14.6.0",
|
|
150
152
|
"@atlaskit/inline-dialog": "^13.3.0",
|
|
153
|
+
"@atlaskit/link-provider": "^1.0.0",
|
|
154
|
+
"@atlaskit/link-test-helpers": "^1.1.0",
|
|
151
155
|
"@atlaskit/lozenge": "^11.1.0",
|
|
152
156
|
"@atlaskit/media-core": "^33.0.0",
|
|
153
157
|
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
154
158
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
155
159
|
"@atlaskit/menu": "^1.3.0",
|
|
156
160
|
"@atlaskit/page-layout": "^1.2.0",
|
|
157
|
-
"@atlaskit/profilecard": "^16.
|
|
161
|
+
"@atlaskit/profilecard": "^16.11.0",
|
|
158
162
|
"@atlaskit/pubsub": "^6.0.0",
|
|
159
|
-
"@atlaskit/renderer": "^
|
|
163
|
+
"@atlaskit/renderer": "^101.0.0",
|
|
160
164
|
"@atlaskit/section-message": "^6.1.0",
|
|
161
165
|
"@atlaskit/share": "*",
|
|
162
|
-
"@atlaskit/smart-
|
|
163
|
-
"@atlaskit/smart-user-picker": "^5.1.0",
|
|
166
|
+
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
164
167
|
"@atlaskit/synchrony-test-helpers": "^2.3.0",
|
|
165
168
|
"@atlaskit/textarea": "^4.3.0",
|
|
166
169
|
"@atlaskit/toggle": "^12.4.0",
|
|
@@ -169,6 +172,7 @@
|
|
|
169
172
|
"@atlaskit/visual-regression": "*",
|
|
170
173
|
"@atlaskit/webdriver-runner": "*",
|
|
171
174
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
175
|
+
"@atlassian/link-picker-atlassian-plugin": "^16.0.0",
|
|
172
176
|
"@atlassian/search-provider": "2.3.2",
|
|
173
177
|
"@atlassian/ufo": "^0.1.0",
|
|
174
178
|
"@emotion/jest": "^11.8.0",
|
|
@@ -176,6 +180,7 @@
|
|
|
176
180
|
"@testing-library/react": "^8.0.1",
|
|
177
181
|
"@testing-library/react-hooks": "^1.0.4",
|
|
178
182
|
"@testing-library/user-event": "10.4.0",
|
|
183
|
+
"@types/diff": "^5.0.2",
|
|
179
184
|
"@types/jscodeshift": "^0.11.0",
|
|
180
185
|
"@types/lodash": "^4.14.157",
|
|
181
186
|
"@types/lz-string": "^1.3.34",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
-
|
|
10
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
|
-
var _featureFlagsContext = require("../../feature-flags-context");
|
|
13
|
-
|
|
14
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
|
|
16
|
-
var _default = function _default() {
|
|
17
|
-
return new _safePlugin.SafePlugin({
|
|
18
|
-
key: new _prosemirrorState.PluginKey('fixChrome96SpellChecking'),
|
|
19
|
-
props: {
|
|
20
|
-
attributes: function attributes(editorState) {
|
|
21
|
-
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(editorState);
|
|
22
|
-
|
|
23
|
-
if (_utils.browser.chrome && featureFlags.maxUnsafeChromeSpellcheckingVersion && _utils.browser.chrome_version >= 96 && // This check is valid for any browser
|
|
24
|
-
// that uses the chrome engine as base like Edge
|
|
25
|
-
_utils.browser.chrome_version <= featureFlags.maxUnsafeChromeSpellcheckingVersion) {
|
|
26
|
-
return {
|
|
27
|
-
spellcheck: 'false'
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
exports.default = _default;
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.highlightingCodeBlockNodeView = exports.CodeBlockView = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
|
-
|
|
18
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
19
|
-
|
|
20
|
-
var _code = require("@atlaskit/code");
|
|
21
|
-
|
|
22
|
-
var _classNames = require("../ui/class-names");
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _percentile4 = require("../../../utils/performance/percentile");
|
|
27
|
-
|
|
28
|
-
var GUTTER = ".".concat(_classNames.codeBlockClassNames.gutter);
|
|
29
|
-
var HIGHLIGHT = ".".concat(_classNames.codeBlockClassNames.highlighting);
|
|
30
|
-
var CONTENT = ".".concat(_classNames.codeBlockClassNames.content);
|
|
31
|
-
var NOOP_LANGUAGES = [null, undefined, 'none', 'plaintext'];
|
|
32
|
-
|
|
33
|
-
var toDOM = function toDOM(node) {
|
|
34
|
-
return ['div', {
|
|
35
|
-
class: 'code-block'
|
|
36
|
-
}, ['div', {
|
|
37
|
-
class: _classNames.codeBlockClassNames.gutter,
|
|
38
|
-
contenteditable: 'false'
|
|
39
|
-
}], ['div', {
|
|
40
|
-
class: _classNames.codeBlockClassNames.content,
|
|
41
|
-
'data-debounce': 'false'
|
|
42
|
-
}, ['code', {
|
|
43
|
-
'data-language': node.attrs.language || '',
|
|
44
|
-
spellcheck: 'false',
|
|
45
|
-
contenteditable: 'true'
|
|
46
|
-
}, 0], ['div', {
|
|
47
|
-
class: _classNames.codeBlockClassNames.highlighting,
|
|
48
|
-
contenteditable: 'false'
|
|
49
|
-
}]]];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var CodeBlockView = /*#__PURE__*/function () {
|
|
53
|
-
function CodeBlockView(_node, view, getPos, codeBidiWarningOptions) {
|
|
54
|
-
var _this = this;
|
|
55
|
-
|
|
56
|
-
(0, _classCallCheck2.default)(this, CodeBlockView);
|
|
57
|
-
(0, _defineProperty2.default)(this, "highlighting", null);
|
|
58
|
-
(0, _defineProperty2.default)(this, "highlighter", null);
|
|
59
|
-
(0, _defineProperty2.default)(this, "measurements", []);
|
|
60
|
-
(0, _defineProperty2.default)(this, "count", 0);
|
|
61
|
-
(0, _defineProperty2.default)(this, "shouldDebounce", false);
|
|
62
|
-
(0, _defineProperty2.default)(this, "timer", null);
|
|
63
|
-
(0, _defineProperty2.default)(this, "ensureLineNumbers", function () {
|
|
64
|
-
var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.node;
|
|
65
|
-
var lines = node.textContent.split('\n').length;
|
|
66
|
-
|
|
67
|
-
while (_this.lineNumberGutter.childElementCount < lines) {
|
|
68
|
-
_this.lineNumberGutter.appendChild(document.createElement('span'));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
while (_this.lineNumberGutter.childElementCount > lines) {
|
|
72
|
-
_this.lineNumberGutter.removeChild(_this.lineNumberGutter.lastChild);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
var _DOMSerializer$render = _prosemirrorModel.DOMSerializer.renderSpec(document, toDOM(_node)),
|
|
77
|
-
dom = _DOMSerializer$render.dom,
|
|
78
|
-
contentDOM = _DOMSerializer$render.contentDOM;
|
|
79
|
-
|
|
80
|
-
this.codeBidiWarningOptions = codeBidiWarningOptions;
|
|
81
|
-
this.getPos = getPos;
|
|
82
|
-
this.view = view;
|
|
83
|
-
this.node = _node;
|
|
84
|
-
this.dom = dom;
|
|
85
|
-
this.contentDOM = contentDOM;
|
|
86
|
-
this.lineNumberGutter = this.dom.querySelector(GUTTER);
|
|
87
|
-
this.ensureLineNumbers();
|
|
88
|
-
this.highlight(_node);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
(0, _createClass2.default)(CodeBlockView, [{
|
|
92
|
-
key: "measure",
|
|
93
|
-
value: function measure(measurement) {
|
|
94
|
-
var index = this.count % 10;
|
|
95
|
-
this.count++;
|
|
96
|
-
this.measurements[index] = measurement;
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "highlight",
|
|
100
|
-
value: function highlight() {
|
|
101
|
-
var _this2 = this,
|
|
102
|
-
_percentile2,
|
|
103
|
-
_percentile3;
|
|
104
|
-
|
|
105
|
-
var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.node;
|
|
106
|
-
var forced = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
107
|
-
|
|
108
|
-
if (NOOP_LANGUAGES.includes(node.attrs.language)) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
var highlighting = this.dom.querySelector(HIGHLIGHT);
|
|
113
|
-
var content = this.dom.querySelector(CONTENT);
|
|
114
|
-
|
|
115
|
-
if (this.timer) {
|
|
116
|
-
clearTimeout(this.timer);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (this.shouldDebounce && !forced && content) {
|
|
120
|
-
var _percentile;
|
|
121
|
-
|
|
122
|
-
content.setAttribute('data-debounce', 'true');
|
|
123
|
-
this.timer = setTimeout(function () {
|
|
124
|
-
return _this2.highlight(node, true);
|
|
125
|
-
}, ((_percentile = (0, _percentile4.percentile)(this.measurements, 0.99)) !== null && _percentile !== void 0 ? _percentile : 100) * 10);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
var start = performance.now();
|
|
130
|
-
|
|
131
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_code.CodeBlock, {
|
|
132
|
-
text: node.textContent,
|
|
133
|
-
language: node.attrs.language,
|
|
134
|
-
showLineNumbers: false,
|
|
135
|
-
codeBidiWarnings: this.codeBidiWarningOptions.enabled,
|
|
136
|
-
codeBidiWarningLabel: this.codeBidiWarningOptions.label,
|
|
137
|
-
codeBidiWarningTooltipEnabled: this.codeBidiWarningOptions.tooltipEnabled
|
|
138
|
-
}), highlighting);
|
|
139
|
-
|
|
140
|
-
this.measure(performance.now() - start);
|
|
141
|
-
content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
|
|
142
|
-
this.shouldDebounce = ((_percentile2 = (0, _percentile4.percentile)(this.measurements, 0.99)) !== null && _percentile2 !== void 0 ? _percentile2 : 0) >= 100 || ((_percentile3 = (0, _percentile4.percentile)(this.measurements, 0.95)) !== null && _percentile3 !== void 0 ? _percentile3 : 0) >= 30;
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "update",
|
|
146
|
-
value: function update(node) {
|
|
147
|
-
if (node.type !== this.node.type) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (node.textContent !== this.node.textContent) {
|
|
152
|
-
this.ensureLineNumbers(node);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (node.attrs.language !== this.node.attrs.language) {
|
|
156
|
-
this.contentDOM.setAttribute('data-language', node.attrs.language || '');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (node.textContent !== this.node.textContent || node.attrs.language !== this.node.attrs.language) {
|
|
160
|
-
this.highlight(node);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.node = node;
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
}, {
|
|
167
|
-
key: "ignoreMutation",
|
|
168
|
-
value: function ignoreMutation(record) {
|
|
169
|
-
var _this$highlighting$co, _this$highlighting;
|
|
170
|
-
|
|
171
|
-
var lineNumberChanges = record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
|
|
172
|
-
var outsideTheCodeBlockChanges = (_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false;
|
|
173
|
-
var codeBidiWarningDecorationChanges = record.type === 'attributes' && record.attributeName === 'aria-describedby';
|
|
174
|
-
return lineNumberChanges || outsideTheCodeBlockChanges || codeBidiWarningDecorationChanges;
|
|
175
|
-
}
|
|
176
|
-
}]);
|
|
177
|
-
return CodeBlockView;
|
|
178
|
-
}();
|
|
179
|
-
|
|
180
|
-
exports.CodeBlockView = CodeBlockView;
|
|
181
|
-
|
|
182
|
-
var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView(_ref) {
|
|
183
|
-
var codeBidiWarnings = _ref.codeBidiWarnings,
|
|
184
|
-
codeBidiWarningLabel = _ref.codeBidiWarningLabel,
|
|
185
|
-
codeBidiWarningTooltipEnabled = _ref.codeBidiWarningTooltipEnabled;
|
|
186
|
-
return function (node, view, getPos) {
|
|
187
|
-
return new CodeBlockView(node, view, getPos, {
|
|
188
|
-
label: codeBidiWarningLabel,
|
|
189
|
-
enabled: codeBidiWarnings,
|
|
190
|
-
tooltipEnabled: codeBidiWarningTooltipEnabled
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
exports.highlightingCodeBlockNodeView = highlightingCodeBlockNodeView;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.checkIfMobileBridge = checkIfMobileBridge;
|
|
7
|
-
|
|
8
|
-
function checkIfMobileBridge() {
|
|
9
|
-
/**
|
|
10
|
-
* This variable is setup on mobile prior to the editor being
|
|
11
|
-
* rendered.
|
|
12
|
-
*
|
|
13
|
-
* -- packages/editor/editor-mobile-bridge/src/editor/native-to-web/bridge-initialiser.ts
|
|
14
|
-
* - packages/editor/editor-mobile-bridge/src/__tests__/integration-webview/_mocks/editor-component.tsx
|
|
15
|
-
*/
|
|
16
|
-
var isMobileBridge = typeof window !== 'undefined' && 'bridge' in window && // @ts-ignore
|
|
17
|
-
'mediaMap' in window.bridge;
|
|
18
|
-
return isMobileBridge;
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { getFeatureFlags } from '../../feature-flags-context';
|
|
4
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
5
|
-
export default (() => new SafePlugin({
|
|
6
|
-
key: new PluginKey('fixChrome96SpellChecking'),
|
|
7
|
-
props: {
|
|
8
|
-
attributes: editorState => {
|
|
9
|
-
const featureFlags = getFeatureFlags(editorState);
|
|
10
|
-
|
|
11
|
-
if (browser.chrome && featureFlags.maxUnsafeChromeSpellcheckingVersion && browser.chrome_version >= 96 && // This check is valid for any browser
|
|
12
|
-
// that uses the chrome engine as base like Edge
|
|
13
|
-
browser.chrome_version <= featureFlags.maxUnsafeChromeSpellcheckingVersion) {
|
|
14
|
-
return {
|
|
15
|
-
spellcheck: 'false'
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import { DOMSerializer } from 'prosemirror-model';
|
|
4
|
-
import { CodeBlock } from '@atlaskit/code';
|
|
5
|
-
import { codeBlockClassNames } from '../ui/class-names';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { percentile } from '../../../utils/performance/percentile';
|
|
8
|
-
const GUTTER = `.${codeBlockClassNames.gutter}`;
|
|
9
|
-
const HIGHLIGHT = `.${codeBlockClassNames.highlighting}`;
|
|
10
|
-
const CONTENT = `.${codeBlockClassNames.content}`;
|
|
11
|
-
const NOOP_LANGUAGES = [null, undefined, 'none', 'plaintext'];
|
|
12
|
-
|
|
13
|
-
const toDOM = node => ['div', {
|
|
14
|
-
class: 'code-block'
|
|
15
|
-
}, ['div', {
|
|
16
|
-
class: codeBlockClassNames.gutter,
|
|
17
|
-
contenteditable: 'false'
|
|
18
|
-
}], ['div', {
|
|
19
|
-
class: codeBlockClassNames.content,
|
|
20
|
-
'data-debounce': 'false'
|
|
21
|
-
}, ['code', {
|
|
22
|
-
'data-language': node.attrs.language || '',
|
|
23
|
-
spellcheck: 'false',
|
|
24
|
-
contenteditable: 'true'
|
|
25
|
-
}, 0], ['div', {
|
|
26
|
-
class: codeBlockClassNames.highlighting,
|
|
27
|
-
contenteditable: 'false'
|
|
28
|
-
}]]];
|
|
29
|
-
|
|
30
|
-
export class CodeBlockView {
|
|
31
|
-
constructor(_node, view, getPos, codeBidiWarningOptions) {
|
|
32
|
-
_defineProperty(this, "highlighting", null);
|
|
33
|
-
|
|
34
|
-
_defineProperty(this, "highlighter", null);
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "measurements", []);
|
|
37
|
-
|
|
38
|
-
_defineProperty(this, "count", 0);
|
|
39
|
-
|
|
40
|
-
_defineProperty(this, "shouldDebounce", false);
|
|
41
|
-
|
|
42
|
-
_defineProperty(this, "timer", null);
|
|
43
|
-
|
|
44
|
-
_defineProperty(this, "ensureLineNumbers", (node = this.node) => {
|
|
45
|
-
const lines = node.textContent.split('\n').length;
|
|
46
|
-
|
|
47
|
-
while (this.lineNumberGutter.childElementCount < lines) {
|
|
48
|
-
this.lineNumberGutter.appendChild(document.createElement('span'));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
while (this.lineNumberGutter.childElementCount > lines) {
|
|
52
|
-
this.lineNumberGutter.removeChild(this.lineNumberGutter.lastChild);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const {
|
|
57
|
-
dom,
|
|
58
|
-
contentDOM
|
|
59
|
-
} = DOMSerializer.renderSpec(document, toDOM(_node));
|
|
60
|
-
this.codeBidiWarningOptions = codeBidiWarningOptions;
|
|
61
|
-
this.getPos = getPos;
|
|
62
|
-
this.view = view;
|
|
63
|
-
this.node = _node;
|
|
64
|
-
this.dom = dom;
|
|
65
|
-
this.contentDOM = contentDOM;
|
|
66
|
-
this.lineNumberGutter = this.dom.querySelector(GUTTER);
|
|
67
|
-
this.ensureLineNumbers();
|
|
68
|
-
this.highlight(_node);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
measure(measurement) {
|
|
72
|
-
const index = this.count % 10;
|
|
73
|
-
this.count++;
|
|
74
|
-
this.measurements[index] = measurement;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
highlight(node = this.node, forced = false) {
|
|
78
|
-
var _percentile2, _percentile3;
|
|
79
|
-
|
|
80
|
-
if (NOOP_LANGUAGES.includes(node.attrs.language)) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const highlighting = this.dom.querySelector(HIGHLIGHT);
|
|
85
|
-
const content = this.dom.querySelector(CONTENT);
|
|
86
|
-
|
|
87
|
-
if (this.timer) {
|
|
88
|
-
clearTimeout(this.timer);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (this.shouldDebounce && !forced && content) {
|
|
92
|
-
var _percentile;
|
|
93
|
-
|
|
94
|
-
content.setAttribute('data-debounce', 'true');
|
|
95
|
-
this.timer = setTimeout(() => this.highlight(node, true), ((_percentile = percentile(this.measurements, 0.99)) !== null && _percentile !== void 0 ? _percentile : 100) * 10);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const start = performance.now();
|
|
100
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(CodeBlock, {
|
|
101
|
-
text: node.textContent,
|
|
102
|
-
language: node.attrs.language,
|
|
103
|
-
showLineNumbers: false,
|
|
104
|
-
codeBidiWarnings: this.codeBidiWarningOptions.enabled,
|
|
105
|
-
codeBidiWarningLabel: this.codeBidiWarningOptions.label,
|
|
106
|
-
codeBidiWarningTooltipEnabled: this.codeBidiWarningOptions.tooltipEnabled
|
|
107
|
-
}), highlighting);
|
|
108
|
-
this.measure(performance.now() - start);
|
|
109
|
-
content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
|
|
110
|
-
this.shouldDebounce = ((_percentile2 = percentile(this.measurements, 0.99)) !== null && _percentile2 !== void 0 ? _percentile2 : 0) >= 100 || ((_percentile3 = percentile(this.measurements, 0.95)) !== null && _percentile3 !== void 0 ? _percentile3 : 0) >= 30;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
update(node) {
|
|
114
|
-
if (node.type !== this.node.type) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (node.textContent !== this.node.textContent) {
|
|
119
|
-
this.ensureLineNumbers(node);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (node.attrs.language !== this.node.attrs.language) {
|
|
123
|
-
this.contentDOM.setAttribute('data-language', node.attrs.language || '');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (node.textContent !== this.node.textContent || node.attrs.language !== this.node.attrs.language) {
|
|
127
|
-
this.highlight(node);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.node = node;
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
ignoreMutation(record) {
|
|
135
|
-
var _this$highlighting$co, _this$highlighting;
|
|
136
|
-
|
|
137
|
-
const lineNumberChanges = record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
|
|
138
|
-
const outsideTheCodeBlockChanges = (_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false;
|
|
139
|
-
const codeBidiWarningDecorationChanges = record.type === 'attributes' && record.attributeName === 'aria-describedby';
|
|
140
|
-
return lineNumberChanges || outsideTheCodeBlockChanges || codeBidiWarningDecorationChanges;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
export const highlightingCodeBlockNodeView = ({
|
|
145
|
-
codeBidiWarnings,
|
|
146
|
-
codeBidiWarningLabel,
|
|
147
|
-
codeBidiWarningTooltipEnabled
|
|
148
|
-
}) => (node, view, getPos) => new CodeBlockView(node, view, getPos, {
|
|
149
|
-
label: codeBidiWarningLabel,
|
|
150
|
-
enabled: codeBidiWarnings,
|
|
151
|
-
tooltipEnabled: codeBidiWarningTooltipEnabled
|
|
152
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function checkIfMobileBridge() {
|
|
2
|
-
/**
|
|
3
|
-
* This variable is setup on mobile prior to the editor being
|
|
4
|
-
* rendered.
|
|
5
|
-
*
|
|
6
|
-
* -- packages/editor/editor-mobile-bridge/src/editor/native-to-web/bridge-initialiser.ts
|
|
7
|
-
* - packages/editor/editor-mobile-bridge/src/__tests__/integration-webview/_mocks/editor-component.tsx
|
|
8
|
-
*/
|
|
9
|
-
const isMobileBridge = typeof window !== 'undefined' && 'bridge' in window && // @ts-ignore
|
|
10
|
-
'mediaMap' in window.bridge;
|
|
11
|
-
return isMobileBridge;
|
|
12
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { getFeatureFlags } from '../../feature-flags-context';
|
|
4
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
5
|
-
export default (function () {
|
|
6
|
-
return new SafePlugin({
|
|
7
|
-
key: new PluginKey('fixChrome96SpellChecking'),
|
|
8
|
-
props: {
|
|
9
|
-
attributes: function attributes(editorState) {
|
|
10
|
-
var featureFlags = getFeatureFlags(editorState);
|
|
11
|
-
|
|
12
|
-
if (browser.chrome && featureFlags.maxUnsafeChromeSpellcheckingVersion && browser.chrome_version >= 96 && // This check is valid for any browser
|
|
13
|
-
// that uses the chrome engine as base like Edge
|
|
14
|
-
browser.chrome_version <= featureFlags.maxUnsafeChromeSpellcheckingVersion) {
|
|
15
|
-
return {
|
|
16
|
-
spellcheck: 'false'
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|