@atlaskit/editor-core 172.0.5 → 172.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/CHANGELOG.md +44 -0
- package/dist/cjs/create-editor/ReactEditorView.js +11 -2
- package/dist/cjs/create-editor/ReactEditorViewContext.js +15 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +7 -1
- package/dist/cjs/labs/next/mobile.js +5 -3
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +8 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -26
- package/dist/cjs/plugins/card/toolbar.js +118 -86
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +37 -1
- package/dist/cjs/plugins/code-block/toolbar.js +3 -1
- package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +42 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +43 -8
- package/dist/cjs/plugins/media/commands/helpers.js +1 -8
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +0 -10
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/cjs/plugins/media/picker-facade.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +3 -13
- package/dist/cjs/plugins/paste/handlers.js +9 -20
- package/dist/cjs/plugins/paste/md.js +8 -2
- package/dist/cjs/plugins/paste/newline-md-plugin.js +67 -0
- package/dist/cjs/plugins/paste/paragraph-md-plugin.js +72 -0
- package/dist/cjs/plugins/table/commands/hover.js +4 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/decoration.js +53 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +3 -2
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +78 -53
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/cjs/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +13 -13
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -7
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/Mobile.js +4 -2
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/DropdownMenu/index.js +5 -5
- package/dist/cjs/ui/with-outer-listeners.js +105 -50
- package/dist/cjs/utils/deprecation-warnings.js +4 -0
- package/dist/cjs/utils/linking-utils.js +40 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +11 -2
- package/dist/es2019/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/editor.js +7 -1
- package/dist/es2019/labs/next/mobile.js +5 -3
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +10 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -24
- package/dist/es2019/plugins/card/toolbar.js +114 -86
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +40 -2
- package/dist/es2019/plugins/code-block/toolbar.js +2 -1
- package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +37 -0
- package/dist/es2019/plugins/hyperlink/Toolbar.js +40 -9
- package/dist/es2019/plugins/media/commands/helpers.js +0 -2
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +0 -7
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/es2019/plugins/media/picker-facade.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -13
- package/dist/es2019/plugins/paste/handlers.js +7 -19
- package/dist/es2019/plugins/paste/md.js +6 -2
- package/dist/es2019/plugins/paste/newline-md-plugin.js +56 -0
- package/dist/es2019/plugins/paste/paragraph-md-plugin.js +61 -0
- package/dist/es2019/plugins/table/commands/hover.js +4 -4
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +39 -0
- package/dist/es2019/plugins/table/utils/decoration.js +60 -24
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +78 -59
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +6 -2
- package/dist/es2019/ui/Addon/ClickAreaMobile/index.js +7 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +12 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +7 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/Mobile.js +4 -2
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/DropdownMenu/index.js +10 -6
- package/dist/es2019/ui/with-outer-listeners.js +83 -33
- package/dist/es2019/utils/deprecation-warnings.js +4 -0
- package/dist/es2019/utils/linking-utils.js +37 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +11 -2
- package/dist/esm/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/editor.js +7 -1
- package/dist/esm/labs/next/mobile.js +5 -3
- package/dist/esm/messages.js +5 -0
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +9 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -20
- package/dist/esm/plugins/card/toolbar.js +108 -83
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +37 -2
- package/dist/esm/plugins/code-block/toolbar.js +2 -1
- package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +41 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +43 -10
- package/dist/esm/plugins/media/commands/helpers.js +0 -4
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +0 -8
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/esm/plugins/media/picker-facade.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -15
- package/dist/esm/plugins/paste/handlers.js +11 -22
- package/dist/esm/plugins/paste/md.js +6 -2
- package/dist/esm/plugins/paste/newline-md-plugin.js +58 -0
- package/dist/esm/plugins/paste/paragraph-md-plugin.js +63 -0
- package/dist/esm/plugins/table/commands/hover.js +4 -4
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/decoration.js +50 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +77 -51
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/esm/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +12 -12
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +7 -6
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/Mobile.js +4 -2
- package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/DropdownMenu/index.js +5 -5
- package/dist/esm/ui/with-outer-listeners.js +105 -51
- package/dist/esm/utils/deprecation-warnings.js +4 -0
- package/dist/esm/utils/linking-utils.js +37 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorViewContext.d.ts +8 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
- package/dist/types/plugins/hyperlink/types.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/media/pm-plugins/types.d.ts +0 -2
- package/dist/types/plugins/paste/newline-md-plugin.d.ts +2 -0
- package/dist/types/plugins/paste/paragraph-md-plugin.d.ts +2 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +9 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -0
- package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -1
- package/dist/types/ui/Dropdown/index.d.ts +1 -1
- package/dist/types/ui/with-outer-listeners.d.ts +2 -1
- package/dist/types/utils/linking-utils.d.ts +1 -0
- package/package.json +30 -32
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -77
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -118
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -70
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -97
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -53
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -101
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -48
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +0 -21
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 172.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0a2a2ff14d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0a2a2ff14d9) - [ux] ED-15284 Updated shared styles to add margin-top to paragraphs and headings with indentation mark. Prior to this, indented content had different spacing to the rest of the document.
|
|
8
|
+
- [`d7c4506066d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7c4506066d) - [ux][ed-15295] improve code block copy button label to better indicate to users what will end up in the clipboard when used.
|
|
9
|
+
- [`82d38ab18c1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/82d38ab18c1) - [ux] ED-11600 Fixed - Keyboard composition in code block removes texts
|
|
10
|
+
- [`1c7de731b84`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c7de731b84) - [ux][ed-15135] Add image and video to keywords of files & images typeahead item
|
|
11
|
+
- [`a7e0b90de6a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7e0b90de6a) - [ux] ED-15243 fixed page scroll unexpectedly on action item check
|
|
12
|
+
- [`84b5a76c7d5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/84b5a76c7d5) - [ux] Add link settings button to hyperlink and smart card toolbars.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`a6df7e823d8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a6df7e823d8) - [ux] Fixed trello card overflow issue in table cells & fixed merged table cells selection / hover state
|
|
17
|
+
- [`d3d1dd0a666`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d3d1dd0a666) - Hyperlink: Fix embed option not showing on toolbar after converting smart link to url
|
|
18
|
+
- [`f5f3d1a0db9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f5f3d1a0db9) - Smart Links: Fix edit unresolved link lost link url
|
|
19
|
+
- [`f01b0350e42`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f01b0350e42) - Repaints editor nodes when theme mode changes.
|
|
20
|
+
- [`da7d675ec1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da7d675ec1e) - [ux] ED-15363: Preserve leading and trailing whitespaces when pasting plain text into Editor
|
|
21
|
+
- [`bd524db3926`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bd524db3926) - ED-15380 Update fragment prosemirror-schema to match ADF schema
|
|
22
|
+
- [`d28c3de46fe`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d28c3de46fe) - ED-14771 Replaced react-window with react-virtualized
|
|
23
|
+
- [`c64c93a5cab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c64c93a5cab) - Internal ED-12831 changes to not to log deprecated warnings in prod mode"
|
|
24
|
+
- [`f718a9eb83a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f718a9eb83a) - Fixing usage of diffLines return types in 23-diffing example to be pulled from @types/diff
|
|
25
|
+
- [`c73fb17957a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c73fb17957a) - [ux] ED-10207 When the floating toolbar unmounts or updates, remove any temporary styling that was added to the node via hovering over a floating toolbar button.
|
|
26
|
+
- [`688f1d012a9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/688f1d012a9) - [ux][ed-15181] Fix typeahead not opening when typing really quickly
|
|
27
|
+
- [`d3ae8684731`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d3ae8684731) - [ux] ED-14658 Pressing escape in edit mode when popover open shouldn't cancel changes
|
|
28
|
+
|
|
29
|
+
- Moved keydown listener from document to editor element .akEditor to be able to prevent bubbling
|
|
30
|
+
- Applies to toolbar menus and typeahead, date, emoji picker
|
|
31
|
+
|
|
32
|
+
- [`9b778e5cd54`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9b778e5cd54) - [ME-2621] Remove legacy code that imposes risks
|
|
33
|
+
- [`cb72385b5f4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb72385b5f4) - [ux] Prevented cursor selecting table corner controls
|
|
34
|
+
- [`15c39553e92`](https://bitbucket.org/atlassian/atlassian-frontend/commits/15c39553e92) - [ux] ED-15130: Make tableRenderOptimization flag default enabled to fix table row control heights being incorrect when smart link inlineCards finish rendering
|
|
35
|
+
- [`45b6d35ea96`](https://bitbucket.org/atlassian/atlassian-frontend/commits/45b6d35ea96) - [ME-1327] Added new upload methods to editor mobile bridge to support previews and progress for media cards.
|
|
36
|
+
- [`1bdeac4d8a5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1bdeac4d8a5) - [ux] ED-13528 Fixed - Unable to exit list with an empty character after cursor
|
|
37
|
+
- [`a75f0f02c24`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a75f0f02c24) - [ux] ED-14683 fix arrow keys in code block unpredictable
|
|
38
|
+
|
|
39
|
+
Fixed cursor jumping to expand title when pressing up in a code
|
|
40
|
+
block in an expand.
|
|
41
|
+
|
|
42
|
+
- [`e2d54b5e990`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e2d54b5e990) - ED-9738 selection should work when editor is disabled
|
|
43
|
+
- [`1ac9c1f7234`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1ac9c1f7234) - [ux] Fixes analytics not firing and ctrl+z not downgrading a smart link paste when smartLinks.resolveBeforeMacros and featureFlags.smartCards.macro-override are enabled.
|
|
44
|
+
- [`cbc6a5ed686`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cbc6a5ed686) - Fixes a bug where active states for Editor dropdown menus rendered incorrectly
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
|
|
3
47
|
## 172.0.5
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
@@ -82,6 +82,8 @@ var _consts = require("./consts");
|
|
|
82
82
|
|
|
83
83
|
var _contextIdentifier = require("../plugins/base/pm-plugins/context-identifier");
|
|
84
84
|
|
|
85
|
+
var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
|
|
86
|
+
|
|
85
87
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
86
88
|
|
|
87
89
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -133,6 +135,7 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
133
135
|
|
|
134
136
|
(0, _classCallCheck2.default)(this, ReactEditorView);
|
|
135
137
|
_this = _super.call(this, _props, context);
|
|
138
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorRef", /*#__PURE__*/_react.default.createRef());
|
|
136
139
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "canDispatchTransactions", true);
|
|
137
140
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onPluginObservation", function (report, editorState) {
|
|
138
141
|
_this.dispatchAnalyticsEvent({
|
|
@@ -848,7 +851,12 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
848
851
|
var renderTracking = (_this$props$editorPro9 = this.props.editorProps.performanceTracking) === null || _this$props$editorPro9 === void 0 ? void 0 : (_this$props$editorPro10 = _this$props$editorPro9.renderTracking) === null || _this$props$editorPro10 === void 0 ? void 0 : _this$props$editorPro10.reactEditorView;
|
|
849
852
|
var renderTrackingEnabled = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.enabled;
|
|
850
853
|
var useShallow = renderTracking === null || renderTracking === void 0 ? void 0 : renderTracking.useShallow;
|
|
851
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
854
|
+
return /*#__PURE__*/_react.default.createElement(_ReactEditorViewContext.default.Provider, {
|
|
855
|
+
value: {
|
|
856
|
+
editorRef: this.editorRef,
|
|
857
|
+
editorView: this.view
|
|
858
|
+
}
|
|
859
|
+
}, renderTrackingEnabled && /*#__PURE__*/_react.default.createElement(_RenderTracking.RenderTracking, {
|
|
852
860
|
componentProps: this.props,
|
|
853
861
|
action: _analytics.ACTION.RE_RENDERED,
|
|
854
862
|
actionSubject: _analytics.ACTION_SUBJECT.REACT_EDITOR_VIEW,
|
|
@@ -860,7 +868,8 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
860
868
|
config: this.config,
|
|
861
869
|
eventDispatcher: this.eventDispatcher,
|
|
862
870
|
transformer: this.contentTransformer,
|
|
863
|
-
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
|
|
871
|
+
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
872
|
+
editorRef: this.editorRef
|
|
864
873
|
}) : this.editor);
|
|
865
874
|
}
|
|
866
875
|
}]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var ReactEditorViewContext = /*#__PURE__*/_react.default.createContext({});
|
|
13
|
+
|
|
14
|
+
var _default = ReactEditorViewContext;
|
|
15
|
+
exports.default = _default;
|
|
@@ -118,7 +118,8 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
|
118
118
|
cardOptions: cardOptions,
|
|
119
119
|
hyperlinkOptions: {
|
|
120
120
|
linkPicker: (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.linkPicker,
|
|
121
|
-
cardOptions: cardOptions
|
|
121
|
+
cardOptions: cardOptions,
|
|
122
|
+
platform: isMobile ? 'mobile' : 'web'
|
|
122
123
|
},
|
|
123
124
|
codeBlock: _objectSpread(_objectSpread({}, props.codeBlock), {}, {
|
|
124
125
|
useLongPressSelection: false,
|
package/dist/cjs/editor.js
CHANGED
|
@@ -439,6 +439,10 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
439
439
|
}, {
|
|
440
440
|
key: "deprecationWarnings",
|
|
441
441
|
value: function deprecationWarnings(props) {
|
|
442
|
+
if (process.env.NODE_ENV === 'production') {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
442
446
|
var nextVersion = (0, _versionWrapper.nextMajorVersion)();
|
|
443
447
|
var deprecatedProperties = {
|
|
444
448
|
allowTasksAndDecisions: {
|
|
@@ -608,10 +612,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
608
612
|
view = _ref3.view,
|
|
609
613
|
eventDispatcher = _ref3.eventDispatcher,
|
|
610
614
|
config = _ref3.config,
|
|
611
|
-
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent
|
|
615
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
|
|
616
|
+
editorRef = _ref3.editorRef;
|
|
612
617
|
return (0, _react2.jsx)(_ui.BaseTheme, {
|
|
613
618
|
baseFontSize: _this5.getBaseFontSize()
|
|
614
619
|
}, (0, _react2.jsx)(Component, {
|
|
620
|
+
innerRef: editorRef,
|
|
615
621
|
appearance: _this5.props.appearance,
|
|
616
622
|
disabled: _this5.props.disabled,
|
|
617
623
|
editorActions: _this5.editorActions,
|
|
@@ -30,14 +30,16 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
30
|
|
|
31
31
|
function MobileEditor(props) {
|
|
32
32
|
var maxHeight = props.maxHeight,
|
|
33
|
-
createAnalyticsEvent = props.createAnalyticsEvent
|
|
33
|
+
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
34
|
+
disabled = props.disabled;
|
|
34
35
|
var handleAnalyticsEvent = (0, _useAnalytics.useCreateAnalyticsHandler)(createAnalyticsEvent);
|
|
35
36
|
var renderWithConfig = (0, _react.useCallback)(function (config) {
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_Mobile.MobileAppearance, {
|
|
37
38
|
editorView: config && config.editorView,
|
|
38
|
-
maxHeight: maxHeight
|
|
39
|
+
maxHeight: maxHeight,
|
|
40
|
+
editorDisabled: disabled
|
|
39
41
|
}, /*#__PURE__*/_react.default.createElement(_Editor.EditorContent, null));
|
|
40
|
-
}, [maxHeight]);
|
|
42
|
+
}, [maxHeight, disabled]);
|
|
41
43
|
return /*#__PURE__*/_react.default.createElement(_contextAdapter.ContextAdapter, null, /*#__PURE__*/_react.default.createElement(_Editor.Editor, (0, _extends2.default)({}, props, {
|
|
42
44
|
onAnalyticsEvent: handleAnalyticsEvent
|
|
43
45
|
}), /*#__PURE__*/_react.default.createElement(_Editor.EditorSharedConfigConsumer, null, renderWithConfig)));
|
package/dist/cjs/messages.js
CHANGED
|
@@ -78,6 +78,11 @@ var linkToolbarMessages = (0, _reactIntlNext.defineMessages)({
|
|
|
78
78
|
id: 'fabric.editor.emptyLink',
|
|
79
79
|
defaultMessage: 'Please enter a link.',
|
|
80
80
|
description: 'Please enter a link.'
|
|
81
|
+
},
|
|
82
|
+
settingsLink: {
|
|
83
|
+
id: 'fabric.editor.settingsLinks',
|
|
84
|
+
defaultMessage: 'Go to Link Preferences',
|
|
85
|
+
description: 'Go to Link Preferences'
|
|
81
86
|
}
|
|
82
87
|
});
|
|
83
88
|
exports.linkToolbarMessages = linkToolbarMessages;
|
|
@@ -321,6 +321,7 @@ exports.ACTION_SUBJECT_ID = ACTION_SUBJECT_ID;
|
|
|
321
321
|
ACTION_SUBJECT_ID["EDIT_LINK"] = "editLink";
|
|
322
322
|
ACTION_SUBJECT_ID["UNLINK"] = "unlink";
|
|
323
323
|
ACTION_SUBJECT_ID["OPEN_LINK"] = "openLink";
|
|
324
|
+
ACTION_SUBJECT_ID["GOTO_SMART_LINK_SETTINGS"] = "goToSmartLinkSettings";
|
|
324
325
|
ACTION_SUBJECT_ID["EMBEDS"] = "embeds";
|
|
325
326
|
ACTION_SUBJECT_ID["HYPERLINK"] = "hyperlink";
|
|
326
327
|
})(ACTION_SUBJECT_ID || (exports.ACTION_SUBJECT_ID = ACTION_SUBJECT_ID = {}));
|
|
@@ -23,7 +23,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
23
23
|
|
|
24
24
|
var blockTypeMenuItemStyle = function blockTypeMenuItemStyle(tagName, selected) {
|
|
25
25
|
// TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
|
|
26
|
-
var selectedStyle = selected ? "".concat(tagName, " { color: ").concat((0, _tokens.token)('color.text
|
|
26
|
+
var selectedStyle = selected ? "".concat(tagName, " { color: ").concat((0, _tokens.token)('color.text', 'white'), " !important; }") : '';
|
|
27
27
|
return function (themeProps) {
|
|
28
28
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n "])), (0, _styles.headingsSharedStyles)(themeProps), selectedStyle);
|
|
29
29
|
};
|
|
@@ -77,6 +77,13 @@ var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
77
77
|
})(view.state.tr));
|
|
78
78
|
})();
|
|
79
79
|
});
|
|
80
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onError", function (data) {
|
|
81
|
+
var url = data.url;
|
|
82
|
+
|
|
83
|
+
_this.onResolve({
|
|
84
|
+
url: url
|
|
85
|
+
});
|
|
86
|
+
});
|
|
80
87
|
return _this;
|
|
81
88
|
}
|
|
82
89
|
|
|
@@ -108,6 +115,7 @@ var InlineCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
108
115
|
onClick: this.onClick,
|
|
109
116
|
container: this.scrollContainer,
|
|
110
117
|
onResolve: this.onResolve,
|
|
118
|
+
onError: this.onError,
|
|
111
119
|
inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined
|
|
112
120
|
})); // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
113
121
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -5,9 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLinkFallback = exports.changeSelectedCardToLink = void 0;
|
|
9
|
-
exports.insertCard = insertCard;
|
|
10
|
-
exports.updateCard = exports.setSelectedCardAppearance = exports.replaceQueuedUrlWithCard = exports.queueCardsFromChangedTr = void 0;
|
|
8
|
+
exports.updateCard = exports.setSelectedCardAppearance = exports.replaceQueuedUrlWithCard = exports.queueCardsFromChangedTr = exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLinkFallback = exports.changeSelectedCardToLink = void 0;
|
|
11
9
|
|
|
12
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
11
|
|
|
@@ -15,8 +13,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
15
13
|
|
|
16
14
|
var _prosemirrorState = require("prosemirror-state");
|
|
17
15
|
|
|
18
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
19
|
-
|
|
20
16
|
var _prosemirrorHistory = require("prosemirror-history");
|
|
21
17
|
|
|
22
18
|
var _pluginKey = require("./plugin-key");
|
|
@@ -47,24 +43,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
47
43
|
|
|
48
44
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
45
|
|
|
50
|
-
function insertCard(tr, cardAdf, schema) {
|
|
51
|
-
var inlineCard = schema.nodes.inlineCard; // ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
52
|
-
|
|
53
|
-
var nodes = [cardAdf];
|
|
54
|
-
|
|
55
|
-
if (cardAdf.type === inlineCard) {
|
|
56
|
-
nodes.push(schema.text(' '));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return tr.replaceSelection(new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.fromArray(nodes), 0, 0));
|
|
60
|
-
}
|
|
61
46
|
/**
|
|
62
47
|
* Attempt to replace the link into the respective card.
|
|
63
48
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
49
|
function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
67
|
-
var inlineCard = schema.nodes.inlineCard;
|
|
68
50
|
var url = request.url;
|
|
69
51
|
|
|
70
52
|
if (!(0, _adfSchema.isSafeUrl)(url)) {
|
|
@@ -84,15 +66,9 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
84
66
|
|
|
85
67
|
if (!replaceLink) {
|
|
86
68
|
return;
|
|
87
|
-
} // ED-5638: add an extra space after inline cards to avoid re-rendering them
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var nodes = [cardAdf];
|
|
91
|
-
|
|
92
|
-
if (cardAdf.type === inlineCard) {
|
|
93
|
-
nodes.push(schema.text(' '));
|
|
94
69
|
}
|
|
95
70
|
|
|
71
|
+
var nodes = [cardAdf];
|
|
96
72
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
97
73
|
return $pos.node($pos.depth - 1).type.name;
|
|
98
74
|
}
|
|
@@ -7,12 +7,12 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.visitCardLink = exports.removeCard = exports.floatingToolbar = void 0;
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
exports.visitCardLink = exports.removeCard = exports.openLinkSettings = exports.floatingToolbar = void 0;
|
|
13
11
|
|
|
14
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
18
|
var _prosemirrorState = require("prosemirror-state");
|
|
@@ -23,6 +23,8 @@ var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove
|
|
|
23
23
|
|
|
24
24
|
var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
|
|
25
25
|
|
|
26
|
+
var _settings = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/settings"));
|
|
27
|
+
|
|
26
28
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
27
29
|
|
|
28
30
|
var _analytics = require("../analytics");
|
|
@@ -55,6 +57,8 @@ var _styles2 = require("./styles");
|
|
|
55
57
|
|
|
56
58
|
var _toolbar = require("../copy-button/toolbar");
|
|
57
59
|
|
|
60
|
+
var _featureFlagsContext = require("../feature-flags-context");
|
|
61
|
+
|
|
58
62
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
59
63
|
|
|
60
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -112,6 +116,76 @@ var visitCardLink = function visitCardLink(state, dispatch) {
|
|
|
112
116
|
|
|
113
117
|
exports.visitCardLink = visitCardLink;
|
|
114
118
|
|
|
119
|
+
var openLinkSettings = function openLinkSettings(state, dispatch) {
|
|
120
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
window.open('https://id.atlassian.com/manage-profile/link-preferences');
|
|
125
|
+
|
|
126
|
+
if (dispatch) {
|
|
127
|
+
var type = state.selection.node.type;
|
|
128
|
+
dispatch((0, _analytics.addAnalytics)(state, state.tr, (0, _linkingUtils.buildOpenedSettingsPayload)(type.name)));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return true;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
exports.openLinkSettings = openLinkSettings;
|
|
135
|
+
|
|
136
|
+
var floatingToolbar = function floatingToolbar(cardOptions, platform, linkPickerOptions) {
|
|
137
|
+
return function (state, intl, providerFactory) {
|
|
138
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
139
|
+
inlineCard = _state$schema$nodes.inlineCard,
|
|
140
|
+
blockCard = _state$schema$nodes.blockCard,
|
|
141
|
+
embedCard = _state$schema$nodes.embedCard;
|
|
142
|
+
var nodeType = [inlineCard, blockCard, embedCard];
|
|
143
|
+
|
|
144
|
+
var pluginState = _main.pluginKey.getState(state);
|
|
145
|
+
|
|
146
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
var selectedNode = state.selection.node;
|
|
151
|
+
|
|
152
|
+
if (!selectedNode) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
var isEmbedCard = (0, _utils.appearanceForNodeType)(selectedNode.type) === 'embed';
|
|
157
|
+
/* add an offset to embeds due to extra padding */
|
|
158
|
+
|
|
159
|
+
var toolbarOffset = isEmbedCard ? {
|
|
160
|
+
offset: [0, 24]
|
|
161
|
+
} : {}; // Applies padding override for when link picker is currently displayed
|
|
162
|
+
|
|
163
|
+
var className = pluginState.showLinkingToolbar ? _styles2.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
164
|
+
return _objectSpread(_objectSpread({
|
|
165
|
+
title: intl.formatMessage(_messages2.messages.card),
|
|
166
|
+
className: className,
|
|
167
|
+
nodeType: nodeType
|
|
168
|
+
}, toolbarOffset), {}, {
|
|
169
|
+
getDomRef: function getDomRef(view) {
|
|
170
|
+
var element = (0, _prosemirrorUtils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
|
|
171
|
+
|
|
172
|
+
if (!element) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (isEmbedCard) {
|
|
177
|
+
return element.querySelector(".".concat(_styles.richMediaClassName));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return element;
|
|
181
|
+
},
|
|
182
|
+
items: generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPickerOptions)
|
|
183
|
+
}, pluginState.showLinkingToolbar ? _EditLinkToolbar.editLinkToolbarConfig : {});
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
exports.floatingToolbar = floatingToolbar;
|
|
188
|
+
|
|
115
189
|
var unlinkCard = function unlinkCard(node, state) {
|
|
116
190
|
var displayInfo = (0, _utils.displayInfoForCard)(node, (0, _utils.findCardInfo)(state));
|
|
117
191
|
var text = displayInfo.title || displayInfo.url;
|
|
@@ -129,40 +203,6 @@ var buildAlignmentOptions = function buildAlignmentOptions(state, intl) {
|
|
|
129
203
|
return (0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.embedCard, true, true);
|
|
130
204
|
};
|
|
131
205
|
|
|
132
|
-
var generateDeleteButton = function generateDeleteButton(node, state, intl) {
|
|
133
|
-
var inlineCard = state.schema.nodes.inlineCard;
|
|
134
|
-
var removeButton = {
|
|
135
|
-
id: 'editor.link.delete',
|
|
136
|
-
type: 'button',
|
|
137
|
-
appearance: 'danger',
|
|
138
|
-
icon: _remove.default,
|
|
139
|
-
onMouseEnter: (0, _decoration.hoverDecoration)(node.type, true),
|
|
140
|
-
onMouseLeave: (0, _decoration.hoverDecoration)(node.type, false),
|
|
141
|
-
onFocus: (0, _decoration.hoverDecoration)(node.type, true),
|
|
142
|
-
onBlur: (0, _decoration.hoverDecoration)(node.type, false),
|
|
143
|
-
title: intl.formatMessage(_messages.default.remove),
|
|
144
|
-
onClick: removeCard
|
|
145
|
-
};
|
|
146
|
-
var copyButton = (0, _toConsumableArray2.default)(state && (0, _toolbar.showCopyButton)(state) ? [(0, _toolbar.getCopyButtonConfig)(state, intl.formatMessage, node.type), {
|
|
147
|
-
type: 'separator'
|
|
148
|
-
}] : []);
|
|
149
|
-
|
|
150
|
-
if (node.type === inlineCard) {
|
|
151
|
-
var unlinkButtonWithSeparator = [{
|
|
152
|
-
id: 'editor.link.unlink',
|
|
153
|
-
type: 'button',
|
|
154
|
-
title: intl.formatMessage(_messages.linkToolbarMessages.unlink),
|
|
155
|
-
icon: _unlink.default,
|
|
156
|
-
onClick: unlinkCard(node, state)
|
|
157
|
-
}, {
|
|
158
|
-
type: 'separator'
|
|
159
|
-
}];
|
|
160
|
-
return [].concat(unlinkButtonWithSeparator, (0, _toConsumableArray2.default)(copyButton), [removeButton]);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return [].concat((0, _toConsumableArray2.default)(copyButton), [removeButton]);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
206
|
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, platform, linkPicker) {
|
|
167
207
|
return function (node) {
|
|
168
208
|
var _titleUrlPairFromNode2 = (0, _utils.titleUrlPairFromNode)(node),
|
|
@@ -194,6 +234,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
194
234
|
node: node
|
|
195
235
|
})];
|
|
196
236
|
} else {
|
|
237
|
+
var inlineCard = state.schema.nodes.inlineCard;
|
|
197
238
|
var toolbarItems = [{
|
|
198
239
|
id: 'editor.link.edit',
|
|
199
240
|
type: 'button',
|
|
@@ -215,7 +256,18 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
215
256
|
onClick: visitCardLink
|
|
216
257
|
}, {
|
|
217
258
|
type: 'separator'
|
|
218
|
-
}].concat((0, _toConsumableArray2.default)(
|
|
259
|
+
}].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard)), (0, _toConsumableArray2.default)(getCopyButtonGroup(state, intl, node)), (0, _toConsumableArray2.default)(getSettingsButtonGroup(state, intl)), [{
|
|
260
|
+
id: 'editor.link.delete',
|
|
261
|
+
type: 'button',
|
|
262
|
+
appearance: 'danger',
|
|
263
|
+
icon: _remove.default,
|
|
264
|
+
onMouseEnter: (0, _decoration.hoverDecoration)(node.type, true),
|
|
265
|
+
onMouseLeave: (0, _decoration.hoverDecoration)(node.type, false),
|
|
266
|
+
onFocus: (0, _decoration.hoverDecoration)(node.type, true),
|
|
267
|
+
onBlur: (0, _decoration.hoverDecoration)(node.type, false),
|
|
268
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
269
|
+
onClick: removeCard
|
|
270
|
+
}]);
|
|
219
271
|
|
|
220
272
|
if (currentAppearance === 'embed') {
|
|
221
273
|
var alignmentOptions = buildAlignmentOptions(state, intl);
|
|
@@ -258,55 +310,35 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
258
310
|
};
|
|
259
311
|
};
|
|
260
312
|
|
|
261
|
-
var
|
|
262
|
-
return
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
var selectedNode = state.selection.node;
|
|
276
|
-
|
|
277
|
-
if (!selectedNode) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
var isEmbedCard = (0, _utils.appearanceForNodeType)(selectedNode.type) === 'embed';
|
|
282
|
-
/* add an offset to embeds due to extra padding */
|
|
283
|
-
|
|
284
|
-
var toolbarOffset = isEmbedCard ? {
|
|
285
|
-
offset: [0, 24]
|
|
286
|
-
} : {}; // Applies padding override for when link picker is currently displayed
|
|
287
|
-
|
|
288
|
-
var className = pluginState.showLinkingToolbar ? _styles2.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
289
|
-
return _objectSpread(_objectSpread({
|
|
290
|
-
title: intl.formatMessage(_messages2.messages.card),
|
|
291
|
-
className: className,
|
|
292
|
-
nodeType: nodeType
|
|
293
|
-
}, toolbarOffset), {}, {
|
|
294
|
-
getDomRef: function getDomRef(view) {
|
|
295
|
-
var element = (0, _prosemirrorUtils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
|
|
296
|
-
|
|
297
|
-
if (!element) {
|
|
298
|
-
return undefined;
|
|
299
|
-
}
|
|
313
|
+
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard) {
|
|
314
|
+
return node.type === inlineCard ? [{
|
|
315
|
+
id: 'editor.link.unlink',
|
|
316
|
+
type: 'button',
|
|
317
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.unlink),
|
|
318
|
+
icon: _unlink.default,
|
|
319
|
+
onClick: unlinkCard(node, state)
|
|
320
|
+
}, {
|
|
321
|
+
type: 'separator'
|
|
322
|
+
}] : [];
|
|
323
|
+
};
|
|
300
324
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
325
|
+
var getSettingsButtonGroup = function getSettingsButtonGroup(state, intl) {
|
|
326
|
+
var _getFeatureFlags = (0, _featureFlagsContext.getFeatureFlags)(state),
|
|
327
|
+
floatingToolbarLinkSettingsButton = _getFeatureFlags.floatingToolbarLinkSettingsButton;
|
|
304
328
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
329
|
+
return floatingToolbarLinkSettingsButton === 'true' ? [{
|
|
330
|
+
id: 'editor.link.settings',
|
|
331
|
+
type: 'button',
|
|
332
|
+
icon: _settings.default,
|
|
333
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.settingsLink),
|
|
334
|
+
onClick: openLinkSettings
|
|
335
|
+
}, {
|
|
336
|
+
type: 'separator'
|
|
337
|
+
}] : [];
|
|
310
338
|
};
|
|
311
339
|
|
|
312
|
-
|
|
340
|
+
var getCopyButtonGroup = function getCopyButtonGroup(state, intl, node) {
|
|
341
|
+
return state && (0, _toolbar.showCopyButton)(state) ? [(0, _toolbar.getCopyButtonConfig)(state, intl.formatMessage, node.type), {
|
|
342
|
+
type: 'separator'
|
|
343
|
+
}] : [];
|
|
344
|
+
};
|
|
@@ -33,6 +33,9 @@ var toDOM = function toDOM(node) {
|
|
|
33
33
|
return ['div', {
|
|
34
34
|
class: 'code-block'
|
|
35
35
|
}, ['div', {
|
|
36
|
+
class: _classNames.codeBlockClassNames.start,
|
|
37
|
+
contenteditable: 'false'
|
|
38
|
+
}], ['div', {
|
|
36
39
|
class: _classNames.codeBlockClassNames.gutter,
|
|
37
40
|
contenteditable: 'false'
|
|
38
41
|
}], ['div', {
|
|
@@ -40,8 +43,12 @@ var toDOM = function toDOM(node) {
|
|
|
40
43
|
}, ['code', {
|
|
41
44
|
'data-language': node.attrs.language || '',
|
|
42
45
|
spellcheck: 'false',
|
|
43
|
-
contenteditable: 'true'
|
|
44
|
-
|
|
46
|
+
contenteditable: 'true',
|
|
47
|
+
'data-testid': 'code-block--code'
|
|
48
|
+
}, 0]], ['div', {
|
|
49
|
+
class: _classNames.codeBlockClassNames.end,
|
|
50
|
+
contenteditable: 'false'
|
|
51
|
+
}]];
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
var CodeBlockView = /*#__PURE__*/function () {
|
|
@@ -27,13 +27,49 @@ var _lineHandling = require("../ide-ux/line-handling");
|
|
|
27
27
|
|
|
28
28
|
var _commands2 = require("../ide-ux/commands");
|
|
29
29
|
|
|
30
|
+
var codeBlockIDEKeyBindingsKey = new _prosemirrorState.PluginKey('codeBlockIDEKeyBindings');
|
|
31
|
+
|
|
30
32
|
var _default = new _safePlugin.SafePlugin({
|
|
33
|
+
key: codeBlockIDEKeyBindingsKey,
|
|
34
|
+
state: {
|
|
35
|
+
init: function init() {
|
|
36
|
+
return {
|
|
37
|
+
isComposing: false
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
apply: function apply(tr, value) {
|
|
41
|
+
var isComposing = tr.getMeta(codeBlockIDEKeyBindingsKey);
|
|
42
|
+
|
|
43
|
+
if (typeof isComposing === 'undefined') {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
isComposing: isComposing
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
},
|
|
31
52
|
props: {
|
|
53
|
+
handleDOMEvents: {
|
|
54
|
+
compositionstart: function compositionstart(view, event) {
|
|
55
|
+
var tr = view.state.tr;
|
|
56
|
+
tr.setMeta(codeBlockIDEKeyBindingsKey, true);
|
|
57
|
+
view.dispatch(tr);
|
|
58
|
+
return false;
|
|
59
|
+
},
|
|
60
|
+
compositionend: function compositionend(view, event) {
|
|
61
|
+
var tr = view.state.tr;
|
|
62
|
+
tr.setMeta(codeBlockIDEKeyBindingsKey, false);
|
|
63
|
+
view.dispatch(tr);
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
32
67
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
33
68
|
var state = view.state,
|
|
34
69
|
dispatch = view.dispatch;
|
|
70
|
+
var isComposing = codeBlockIDEKeyBindingsKey.getState(state).isComposing;
|
|
35
71
|
|
|
36
|
-
if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
|
|
72
|
+
if ((0, _lineHandling.isCursorInsideCodeBlock)(state) && !isComposing) {
|
|
37
73
|
var beforeText = (0, _lineHandling.getStartOfCurrentLine)(state).text;
|
|
38
74
|
var afterText = (0, _lineHandling.getEndOfCurrentLine)(state).text; // If text is a closing bracket/quote and we've already inserted it, move the selection after
|
|
39
75
|
|
|
@@ -19,6 +19,8 @@ var _actions = require("./actions");
|
|
|
19
19
|
|
|
20
20
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
21
21
|
|
|
22
|
+
var _messages2 = require("@atlaskit/editor-common/messages");
|
|
23
|
+
|
|
22
24
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
23
25
|
|
|
24
26
|
var _decoration = require("../base/pm-plugins/decoration");
|
|
@@ -96,7 +98,7 @@ var getToolbarConfig = function getToolbarConfig() {
|
|
|
96
98
|
// note: copyContentToClipboard contains logic that also removes the
|
|
97
99
|
// visual feedback for the copy button
|
|
98
100
|
onClick: _actions.copyContentToClipboard,
|
|
99
|
-
title: formatMessage(codeBlockState.contentCopied ?
|
|
101
|
+
title: formatMessage(codeBlockState.contentCopied ? _messages2.codeBlockCopyButtonMessages.copiedCodeToClipboard : _messages2.codeBlockCopyButtonMessages.copyCodeToClipboard),
|
|
100
102
|
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
101
103
|
// note: resetCopiedState contains logic that also removes the
|
|
102
104
|
// visual feedback for the copy button
|
|
@@ -8,6 +8,8 @@ exports.codeBlockClassNames = void 0;
|
|
|
8
8
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
9
9
|
|
|
10
10
|
var codeBlockClassNames = {
|
|
11
|
+
start: _styles.CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
12
|
+
end: _styles.CodeBlockSharedCssClassName.CODEBLOCK_END,
|
|
11
13
|
gutter: _styles.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER,
|
|
12
14
|
content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
13
15
|
};
|