@atlaskit/editor-core 187.41.3 → 187.41.5
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 +38 -18
- package/dist/cjs/create-editor/feature-flags-from-props.js +2 -3
- package/dist/cjs/plugins/collab-edit/ui/styles.js +2 -2
- package/dist/cjs/plugins/date/nodeviews/date.js +6 -1
- package/dist/cjs/plugins/extension/index.js +35 -9
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +7 -18
- package/dist/cjs/plugins/media/styles.js +1 -1
- package/dist/cjs/plugins/media/toolbar/commands.js +63 -25
- package/dist/cjs/plugins/media/toolbar/index.js +13 -18
- package/dist/cjs/plugins/media/ui/ImageBorder/index.js +1 -3
- package/dist/cjs/plugins/media/ui/PixelEntry/index.js +6 -5
- package/dist/cjs/plugins/media/utils/analytics.js +1 -1
- package/dist/cjs/plugins/paste/handlers.js +2 -1
- package/dist/cjs/plugins/text-color/index.js +2 -6
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -5
- package/dist/cjs/ui/ColorPickerButton/index.js +3 -4
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
- package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/feature-flags-from-props.js +2 -3
- package/dist/es2019/plugins/collab-edit/ui/styles.js +2 -2
- package/dist/es2019/plugins/date/nodeviews/date.js +6 -1
- package/dist/es2019/plugins/extension/index.js +30 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -15
- package/dist/es2019/plugins/media/styles.js +3 -5
- package/dist/es2019/plugins/media/toolbar/commands.js +31 -1
- package/dist/es2019/plugins/media/toolbar/index.js +14 -20
- package/dist/es2019/plugins/media/ui/ImageBorder/index.js +1 -3
- package/dist/es2019/plugins/media/ui/PixelEntry/index.js +6 -5
- package/dist/es2019/plugins/media/utils/analytics.js +1 -1
- package/dist/es2019/plugins/paste/handlers.js +2 -1
- package/dist/es2019/plugins/text-color/index.js +2 -6
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -7
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -3
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
- package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/feature-flags-from-props.js +2 -3
- package/dist/esm/plugins/collab-edit/ui/styles.js +2 -2
- package/dist/esm/plugins/date/nodeviews/date.js +6 -1
- package/dist/esm/plugins/extension/index.js +35 -9
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +8 -15
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +7 -18
- package/dist/esm/plugins/media/styles.js +1 -1
- package/dist/esm/plugins/media/toolbar/commands.js +37 -1
- package/dist/esm/plugins/media/toolbar/index.js +14 -19
- package/dist/esm/plugins/media/ui/ImageBorder/index.js +1 -3
- package/dist/esm/plugins/media/ui/PixelEntry/index.js +6 -5
- package/dist/esm/plugins/media/utils/analytics.js +1 -1
- package/dist/esm/plugins/paste/handlers.js +2 -1
- package/dist/esm/plugins/text-color/index.js +2 -6
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -5
- package/dist/esm/ui/ColorPickerButton/index.js +3 -4
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +1 -11
- package/dist/esm/ui/ConfigPanel/Fields/Expand.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +44 -2
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types/plugins/media/toolbar/commands.d.ts +3 -1
- package/dist/types/plugins/media/ui/ImageBorder/index.d.ts +3 -4
- package/dist/types/plugins/media/ui/PixelEntry/types.d.ts +2 -0
- package/dist/types/plugins/text-color/index.d.ts +1 -2
- package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -2
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -2
- package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +54 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/toolbar/commands.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/ui/ImageBorder/index.d.ts +3 -4
- package/dist/types-ts4.5/plugins/media/ui/PixelEntry/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/text-color/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/ConfigPanel/Fields/Expand.d.ts +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.41.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1e26db8ffd0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1e26db8ffd0) - ED-18264: Clean up useSomewhatSemanticTextColorNames - default behaviour will be same as when FF was on.
|
|
8
|
+
- [`6900f89eb0e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6900f89eb0e) - Internal changes to use space tokens. There is no expected visual or behaviour change.
|
|
9
|
+
- [`69857bbbff0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/69857bbbff0) - [ED-20004] Capture errors in getPos due to prosemirror-view bump
|
|
10
|
+
- [`ba95f6c1fd5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ba95f6c1fd5) - handleMarkdown no longer throws RangeError when 'from' argument exceeds document length, resolving bug where pasting a Jira issue datasource node at the end of a document would result in the legacy Jira issue macro being rendered instead
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 187.41.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`aeb5c9a01e8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb5c9a01e8) - Delete adf-schema from AFE and rely on npm package for adf-schema
|
|
18
|
+
- [`111ff4f4f1f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/111ff4f4f1f) - Add input resizing event analytics
|
|
19
|
+
- [`da629b62ef9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da629b62ef9) - ED-19617 Refactor actions to remove createExtenstionAPI and call it instead during initialisation
|
|
20
|
+
- [`4b4dcfe0bba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4b4dcfe0bba) - Delete adf-schema, use published version
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 187.41.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -15081,105 +15101,105 @@ Remove applicationCard node and action mark
|
|
|
15081
15101
|
|
|
15082
15102
|
## 87.6.1
|
|
15083
15103
|
|
|
15084
|
-
- [patch][bdc9961
|
|
15104
|
+
- [patch][bdc9961](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/bdc9961"
|
|
15085
15105
|
d):
|
|
15086
15106
|
|
|
15087
15107
|
- Fixes the codeblock insert rules
|
|
15088
15108
|
|
|
15089
15109
|
## 87.6.0
|
|
15090
15110
|
|
|
15091
|
-
- [minor][bb3336a
|
|
15111
|
+
- [minor][bb3336a](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/bb3336a"
|
|
15092
15112
|
d):
|
|
15093
15113
|
|
|
15094
15114
|
- Make text formatting toolbar account for different item titles legnths
|
|
15095
15115
|
|
|
15096
15116
|
## 87.5.0
|
|
15097
15117
|
|
|
15098
|
-
- [minor][d182ad9
|
|
15118
|
+
- [minor][d182ad9](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d182ad9"
|
|
15099
15119
|
d):
|
|
15100
15120
|
|
|
15101
15121
|
- Add <-> to ↔︎ convertion rule
|
|
15102
15122
|
|
|
15103
15123
|
## 87.4.3
|
|
15104
15124
|
|
|
15105
|
-
- [patch][8fb4b1e
|
|
15125
|
+
- [patch][8fb4b1e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8fb4b1e"
|
|
15106
15126
|
d):
|
|
15107
15127
|
|
|
15108
15128
|
- ED-5274 Fixes tables have excessive margin above
|
|
15109
15129
|
|
|
15110
15130
|
## 87.4.2
|
|
15111
15131
|
|
|
15112
|
-
- [patch][4cc767e
|
|
15132
|
+
- [patch][4cc767e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/4cc767e"
|
|
15113
15133
|
d):
|
|
15114
15134
|
|
|
15115
15135
|
- ED-5030: Fixed gap-cursor on nodeviews in breakout mode.
|
|
15116
15136
|
|
|
15117
15137
|
## 87.4.1
|
|
15118
15138
|
|
|
15119
|
-
- [patch][abd19cd
|
|
15139
|
+
- [patch][abd19cd](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/abd19cd"
|
|
15120
15140
|
d):
|
|
15121
15141
|
|
|
15122
15142
|
- ED-5616: fix inline cursor navigation
|
|
15123
15143
|
|
|
15124
15144
|
## 87.4.0
|
|
15125
15145
|
|
|
15126
|
-
- [minor][5981cec
|
|
15146
|
+
- [minor][5981cec](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/5981cec"
|
|
15127
15147
|
d):
|
|
15128
15148
|
|
|
15129
15149
|
- TypeAhead to preserve marks
|
|
15130
15150
|
|
|
15131
15151
|
## 87.3.2
|
|
15132
15152
|
|
|
15133
|
-
- [patch][14d581b
|
|
15153
|
+
- [patch][14d581b](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/14d581b"
|
|
15134
15154
|
d):
|
|
15135
15155
|
|
|
15136
15156
|
- Disable clear formatting menu when there is no formatting
|
|
15137
15157
|
|
|
15138
15158
|
## 87.3.1
|
|
15139
15159
|
|
|
15140
|
-
- [patch][52f5b51
|
|
15160
|
+
- [patch][52f5b51](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/52f5b51"
|
|
15141
15161
|
d):
|
|
15142
15162
|
|
|
15143
15163
|
- ED-4366: fix text selection inside table cell on triple click
|
|
15144
15164
|
|
|
15145
15165
|
## 87.3.0
|
|
15146
15166
|
|
|
15147
|
-
- [minor][b911028
|
|
15167
|
+
- [minor][b911028](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b911028"
|
|
15148
15168
|
d):
|
|
15149
15169
|
|
|
15150
15170
|
- Show selected color in a table contextual menu
|
|
15151
15171
|
|
|
15152
15172
|
## 87.2.0
|
|
15153
15173
|
|
|
15154
|
-
- [minor][746c927
|
|
15174
|
+
- [minor][746c927](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/746c927"
|
|
15155
15175
|
d):
|
|
15156
15176
|
|
|
15157
15177
|
- Add buffer to the bottom fullpage editor
|
|
15158
15178
|
|
|
15159
15179
|
## 87.1.13
|
|
15160
15180
|
|
|
15161
|
-
- [patch][f3d067d
|
|
15181
|
+
- [patch][f3d067d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f3d067d"
|
|
15162
15182
|
d):
|
|
15163
15183
|
|
|
15164
15184
|
- Fix font size for numbered column in tables with dynamic text sizing
|
|
15165
15185
|
|
|
15166
15186
|
## 87.1.12
|
|
15167
15187
|
|
|
15168
|
-
- [patch][534f6ab
|
|
15188
|
+
- [patch][534f6ab](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/534f6ab"
|
|
15169
15189
|
d):
|
|
15170
15190
|
|
|
15171
15191
|
- ED-5615: Fix block element padding inside table cells.
|
|
15172
15192
|
|
|
15173
15193
|
## 87.1.11
|
|
15174
15194
|
|
|
15175
|
-
- [patch][cb4168f
|
|
15195
|
+
- [patch][cb4168f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/cb4168f"
|
|
15176
15196
|
d):
|
|
15177
15197
|
|
|
15178
15198
|
- ED-5307: make text white for selected heading menu item
|
|
15179
15199
|
|
|
15180
15200
|
## 87.1.10
|
|
15181
15201
|
|
|
15182
|
-
- [patch][db65837
|
|
15202
|
+
- [patch][db65837](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/db65837"
|
|
15183
15203
|
d):
|
|
15184
15204
|
|
|
15185
15205
|
- ED-3762: fix setting text cursor when clicking on editor gutter
|
|
@@ -15192,7 +15212,7 @@ Remove applicationCard node and action mark
|
|
|
15192
15212
|
|
|
15193
15213
|
## 87.1.8
|
|
15194
15214
|
|
|
15195
|
-
- [patch][3c505aa
|
|
15215
|
+
- [patch][3c505aa](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3c505aa"
|
|
15196
15216
|
d):
|
|
15197
15217
|
|
|
15198
15218
|
- Adds Danish and Romanian translations
|
|
@@ -15205,14 +15225,14 @@ Remove applicationCard node and action mark
|
|
|
15205
15225
|
|
|
15206
15226
|
## 87.1.6
|
|
15207
15227
|
|
|
15208
|
-
- [patch][6201223
|
|
15228
|
+
- [patch][6201223](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/6201223"
|
|
15209
15229
|
d):
|
|
15210
15230
|
|
|
15211
15231
|
- Add examples.
|
|
15212
15232
|
|
|
15213
15233
|
## 87.1.5
|
|
15214
15234
|
|
|
15215
|
-
- [patch][1662ae0
|
|
15235
|
+
- [patch][1662ae0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/1662ae0"
|
|
15216
15236
|
d):
|
|
15217
15237
|
|
|
15218
15238
|
- ED-5440 convert sections to use percentages
|
|
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
|
|
|
32
32
|
* which is used by both current and archv3 editors.
|
|
33
33
|
*/
|
|
34
34
|
function createFeatureFlagsFromProps(props) {
|
|
35
|
-
var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$collabEdit, _props$collabEdit2, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27
|
|
35
|
+
var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$collabEdit, _props$collabEdit2, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27;
|
|
36
36
|
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
37
37
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
38
38
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
@@ -63,8 +63,7 @@ function createFeatureFlagsFromProps(props) {
|
|
|
63
63
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
64
64
|
// are included (they are not kebab cased)
|
|
65
65
|
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags25 = props.featureFlags) === null || _props$featureFlags25 === void 0 ? void 0 : _props$featureFlags25.restartNumberedLists) === true,
|
|
66
|
-
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.useSomewhatSemanticTextColorNames) : false)),
|
|
67
66
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
68
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
67
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27['prevent-popup-overflow']) : false)
|
|
69
68
|
});
|
|
70
69
|
}
|
|
@@ -10,9 +10,9 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _templateObject, _templateObject2, _templateObject3;
|
|
13
|
-
var inviteTeamWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border-radius: 50%;\n min-width: ", ";\n margin-left:
|
|
13
|
+
var inviteTeamWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border-radius: 50%;\n min-width: ", ";\n margin-left: ", ";\n"])), "var(--ds-background-neutral, ".concat(_colors.N20, ")"), "var(--ds-space-400, 32px)", "var(--ds-space-negative-050, -4px)");
|
|
14
14
|
exports.inviteTeamWrapper = inviteTeamWrapper;
|
|
15
|
-
var avatarContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: ", ";\n display: flex;\n align-items: center;\n\n // ED-13102: This is to override list styles that come from the\n // .wiki-content class in Confluence that should not apply within\n // the toolbar. Has to be extra specific to override.\n && > ul {\n list-style-type: none;\n }\n\n div:last-child button.invite-to-edit {\n border-radius: 50%;\n height: 32px;\n width: 32px;\n padding:
|
|
15
|
+
var avatarContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: ", ";\n display: flex;\n align-items: center;\n\n // ED-13102: This is to override list styles that come from the\n // .wiki-content class in Confluence that should not apply within\n // the toolbar. Has to be extra specific to override.\n && > ul {\n list-style-type: none;\n }\n\n div:last-child button.invite-to-edit {\n border-radius: 50%;\n height: 32px;\n width: 32px;\n padding: ", ";\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-025, 2px)");
|
|
16
16
|
exports.avatarContainer = avatarContainer;
|
|
17
17
|
var badge = function badge(color) {
|
|
18
18
|
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n position: absolute;\n right: 1px;\n bottom: 1px;\n width: 13px;\n height: 13px;\n z-index: ", ";\n border-radius: 3px;\n background: ", ";\n color: ", ";\n font-size: ", ";\n line-height: 0;\n padding-top: 7px;\n text-align: center;\n box-shadow: 0 0 1px ", ";\n box-sizing: border-box;\n"])), _editorSharedStyles.akEditorSmallZIndex, color, "var(--ds-text-inverse, #fff)", (0, _editorSharedStyles.relativeFontSizeToBase16)(9), "var(--ds-border-inverse, #fff)");
|
|
@@ -19,7 +19,12 @@ function DateNodeView(props) {
|
|
|
19
19
|
selection = _props$view$state.selection,
|
|
20
20
|
getPos = props.getPos;
|
|
21
21
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
22
|
-
var pos
|
|
22
|
+
var pos;
|
|
23
|
+
try {
|
|
24
|
+
pos = typeof getPos === 'function' ? getPos() : undefined;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
pos = undefined;
|
|
27
|
+
}
|
|
23
28
|
|
|
24
29
|
// We fall back to selection.$from even though it does not cover all use cases
|
|
25
30
|
// eg. upon Editor init, selection is at the start, not at the Date node
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
9
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
10
|
var _main = require("./pm-plugins/main");
|
|
10
11
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
11
12
|
var _uniqueId = require("./pm-plugins/unique-id");
|
|
@@ -13,11 +14,16 @@ var _toolbar = require("./toolbar");
|
|
|
13
14
|
var _contextPanel = require("./context-panel");
|
|
14
15
|
var _extensionApi = require("./extension-api");
|
|
15
16
|
var extensionPlugin = function extensionPlugin(_ref) {
|
|
16
|
-
var _api$featureFlags, _api$
|
|
17
|
+
var _api$featureFlags, _api$contextPanel3, _api$contextPanel4;
|
|
17
18
|
var _ref$config = _ref.config,
|
|
18
19
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
19
|
-
|
|
20
|
-
var featureFlags = (
|
|
20
|
+
_api = _ref.api;
|
|
21
|
+
var featureFlags = (_api === null || _api === void 0 ? void 0 : (_api$featureFlags = _api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
22
|
+
//Note: This is a hack to get the editor view reference in the plugin. Copied from table plugin.
|
|
23
|
+
//This is needed to get the current selection in the editor
|
|
24
|
+
var editorViewRef = {
|
|
25
|
+
current: null
|
|
26
|
+
};
|
|
21
27
|
return {
|
|
22
28
|
name: 'extension',
|
|
23
29
|
nodes: function nodes() {
|
|
@@ -41,7 +47,7 @@ var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
41
47
|
portalProviderAPI = _ref2.portalProviderAPI,
|
|
42
48
|
eventDispatcher = _ref2.eventDispatcher;
|
|
43
49
|
var extensionHandlers = options.extensionHandlers || {};
|
|
44
|
-
return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher,
|
|
50
|
+
return (0, _main.createPlugin)(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, _api, options.useLongPressSelection, {
|
|
45
51
|
appearance: options.appearance
|
|
46
52
|
});
|
|
47
53
|
}
|
|
@@ -49,25 +55,45 @@ var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
49
55
|
name: 'extensionKeymap',
|
|
50
56
|
plugin: function plugin() {
|
|
51
57
|
var _api$contextPanel;
|
|
52
|
-
return (0, _keymap.default)(
|
|
58
|
+
return (0, _keymap.default)(_api === null || _api === void 0 ? void 0 : (_api$contextPanel = _api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange);
|
|
53
59
|
}
|
|
54
60
|
}, {
|
|
55
61
|
name: 'extensionUniqueId',
|
|
56
62
|
plugin: function plugin() {
|
|
57
63
|
return (0, _uniqueId.createPlugin)();
|
|
58
64
|
}
|
|
65
|
+
}, {
|
|
66
|
+
name: 'extensionEditorViewRef',
|
|
67
|
+
plugin: function plugin() {
|
|
68
|
+
return new _safePlugin.SafePlugin({
|
|
69
|
+
view: function view(editorView) {
|
|
70
|
+
editorViewRef.current = editorView;
|
|
71
|
+
return {
|
|
72
|
+
destroy: function destroy() {
|
|
73
|
+
editorViewRef.current = null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
59
79
|
}];
|
|
60
80
|
},
|
|
61
81
|
actions: {
|
|
62
|
-
|
|
82
|
+
api: function api() {
|
|
83
|
+
var _api$contextPanel2;
|
|
84
|
+
return (0, _extensionApi.createExtensionAPI)({
|
|
85
|
+
editorView: editorViewRef.current,
|
|
86
|
+
applyChange: _api === null || _api === void 0 ? void 0 : (_api$contextPanel2 = _api.contextPanel) === null || _api$contextPanel2 === void 0 ? void 0 : _api$contextPanel2.actions.applyChange
|
|
87
|
+
});
|
|
88
|
+
}
|
|
63
89
|
},
|
|
64
90
|
pluginsOptions: {
|
|
65
91
|
floatingToolbar: (0, _toolbar.getToolbarConfig)({
|
|
66
92
|
breakoutEnabled: options.breakoutEnabled,
|
|
67
|
-
hoverDecoration:
|
|
68
|
-
applyChangeToContextPanel:
|
|
93
|
+
hoverDecoration: _api === null || _api === void 0 ? void 0 : _api.decorations.actions.hoverDecoration,
|
|
94
|
+
applyChangeToContextPanel: _api === null || _api === void 0 ? void 0 : (_api$contextPanel3 = _api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange
|
|
69
95
|
}),
|
|
70
|
-
contextPanel: (0, _contextPanel.getContextPanel)(options.allowAutoSave, featureFlags,
|
|
96
|
+
contextPanel: (0, _contextPanel.getContextPanel)(options.allowAutoSave, featureFlags, _api === null || _api === void 0 ? void 0 : (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
|
|
71
97
|
}
|
|
72
98
|
};
|
|
73
99
|
};
|
|
@@ -14,7 +14,6 @@ var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
|
14
14
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
15
15
|
var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group"));
|
|
16
16
|
var _utils = require("../../../utils");
|
|
17
|
-
var _extensionApi = require("../../extension/extension-api");
|
|
18
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
18
|
var _Separator = _interopRequireDefault(require("./Separator"));
|
|
20
19
|
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); }
|
|
@@ -55,8 +54,7 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
|
55
54
|
var ExtensionButton = function ExtensionButton(props) {
|
|
56
55
|
var item = props.item,
|
|
57
56
|
node = props.node,
|
|
58
|
-
|
|
59
|
-
applyChangeToContextPanel = props.applyChangeToContextPanel;
|
|
57
|
+
extensionApi = props.extensionApi;
|
|
60
58
|
var ButtonIcon = _react.default.useMemo(function () {
|
|
61
59
|
return item.icon ? (0, _reactLoadable.default)({
|
|
62
60
|
loader: function () {
|
|
@@ -84,11 +82,7 @@ var ExtensionButton = function ExtensionButton(props) {
|
|
|
84
82
|
throw new Error("'action' of context toolbar item '".concat(item.key, "' is not a function"));
|
|
85
83
|
}
|
|
86
84
|
var targetNodeAdf = (0, _utils.nodeToJSON)(node);
|
|
87
|
-
|
|
88
|
-
editorView: editorView,
|
|
89
|
-
applyChange: applyChangeToContextPanel
|
|
90
|
-
});
|
|
91
|
-
item.action(targetNodeAdf, api);
|
|
85
|
+
item.action(targetNodeAdf, extensionApi);
|
|
92
86
|
};
|
|
93
87
|
return /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
|
|
94
88
|
title: item.label,
|
|
@@ -106,7 +100,8 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
106
100
|
editorView = props.editorView,
|
|
107
101
|
extensionProvider = props.extensionProvider,
|
|
108
102
|
separator = props.separator,
|
|
109
|
-
applyChangeToContextPanel = props.applyChangeToContextPanel
|
|
103
|
+
applyChangeToContextPanel = props.applyChangeToContextPanel,
|
|
104
|
+
extensionApi = props.extensionApi;
|
|
110
105
|
var _useState = (0, _react.useState)([]),
|
|
111
106
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
112
107
|
extensions = _useState2[0],
|
|
@@ -150,11 +145,8 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
150
145
|
return (0, _utils.nodeToJSON)(node);
|
|
151
146
|
}, [node]);
|
|
152
147
|
var extensionItems = _react.default.useMemo(function () {
|
|
153
|
-
return (0, _extensions.getContextualToolbarItemsFromModule)(extensions, nodeAdf,
|
|
154
|
-
|
|
155
|
-
applyChange: applyChangeToContextPanel
|
|
156
|
-
}));
|
|
157
|
-
}, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
|
|
148
|
+
return (0, _extensions.getContextualToolbarItemsFromModule)(extensions, nodeAdf, extensionApi);
|
|
149
|
+
}, [extensions, nodeAdf, extensionApi]);
|
|
158
150
|
if (!extensionItems.length) {
|
|
159
151
|
return null;
|
|
160
152
|
}
|
|
@@ -170,7 +162,8 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
170
162
|
node: node,
|
|
171
163
|
item: item,
|
|
172
164
|
editorView: editorView,
|
|
173
|
-
applyChangeToContextPanel: applyChangeToContextPanel
|
|
165
|
+
applyChangeToContextPanel: applyChangeToContextPanel,
|
|
166
|
+
extensionApi: extensionApi
|
|
174
167
|
}));
|
|
175
168
|
if (index < extensionItems.length - 1) {
|
|
176
169
|
children.push( /*#__PURE__*/_react.default.createElement(_Separator.default, null));
|
|
@@ -62,14 +62,10 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
62
62
|
featureFlags = _ref.featureFlags,
|
|
63
63
|
api = _ref.api;
|
|
64
64
|
var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
65
|
-
var _ref2 = featureFlags || {
|
|
66
|
-
useSomewhatSemanticTextColorNames: false
|
|
67
|
-
},
|
|
68
|
-
useSomewhatSemanticTextColorNames = _ref2.useSomewhatSemanticTextColorNames;
|
|
69
65
|
return (0, _react2.jsx)(_buttonGroup.default, null, items.filter(function (item) {
|
|
70
66
|
return !item.hidden;
|
|
71
67
|
}).map(function (item, idx) {
|
|
72
|
-
var _api$contextPanel;
|
|
68
|
+
var _api$contextPanel, _api$extension;
|
|
73
69
|
switch (item.type) {
|
|
74
70
|
case 'button':
|
|
75
71
|
var ButtonIcon = item.icon;
|
|
@@ -201,14 +197,6 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
201
197
|
,
|
|
202
198
|
hexToPaletteColor: _editorPalette.hexToEditorBackgroundPaletteColor,
|
|
203
199
|
paletteColorTooltipMessages: _ColorPalette.backgroundPaletteTooltipMessages
|
|
204
|
-
// We did not want to create new FF or update
|
|
205
|
-
// useSomewhatSemanticTextColorNames name
|
|
206
|
-
// because it is temporary and require extra work.
|
|
207
|
-
// So even though it says text color names,
|
|
208
|
-
// we are going to use for all color pickers
|
|
209
|
-
// such as text, background and table charts.
|
|
210
|
-
,
|
|
211
|
-
showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames
|
|
212
200
|
});
|
|
213
201
|
}
|
|
214
202
|
if (item.selectType === 'emoji') {
|
|
@@ -230,8 +218,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
230
218
|
if (!editorView || !extensionsProvider) {
|
|
231
219
|
return null;
|
|
232
220
|
}
|
|
233
|
-
var
|
|
234
|
-
extendFloatingToolbar =
|
|
221
|
+
var _ref2 = featureFlags || {},
|
|
222
|
+
extendFloatingToolbar = _ref2.extendFloatingToolbar;
|
|
235
223
|
if (!extendFloatingToolbar) {
|
|
236
224
|
return null;
|
|
237
225
|
}
|
|
@@ -241,7 +229,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
241
229
|
editorView: editorView,
|
|
242
230
|
extensionProvider: extensionsProvider,
|
|
243
231
|
separator: item.separator,
|
|
244
|
-
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange
|
|
232
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange,
|
|
233
|
+
extensionApi: api === null || api === void 0 ? void 0 : (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : _api$extension.actions.api()
|
|
245
234
|
});
|
|
246
235
|
case 'separator':
|
|
247
236
|
return (0, _react2.jsx)(_Separator.default, {
|
|
@@ -376,8 +365,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
376
365
|
// this prevents https://product-fabric.atlassian.net/browse/ED-10207
|
|
377
366
|
(0, _createClass2.default)(Toolbar, [{
|
|
378
367
|
key: "resetStyling",
|
|
379
|
-
value: function resetStyling(
|
|
380
|
-
var table =
|
|
368
|
+
value: function resetStyling(_ref3) {
|
|
369
|
+
var table = _ref3.table;
|
|
381
370
|
if (this.props.editorView) {
|
|
382
371
|
var _this$props$api;
|
|
383
372
|
var _this$props$editorVie2 = this.props.editorView,
|
|
@@ -12,7 +12,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
var _mediaCard = require("@atlaskit/media-card");
|
|
14
14
|
var _templateObject;
|
|
15
|
-
var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .media-extended-resize-experience[layout^='wrap-'] {\n // override 'overflow: auto' when viewport <= 410 set by mediaSingleSharedStyle\n // to prevent scroll bar\n overflow: visible !important;\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: ", ";\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: ", ";\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .
|
|
15
|
+
var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .media-extended-resize-experience[layout^='wrap-'] {\n // override 'overflow: auto' when viewport <= 410 set by mediaSingleSharedStyle\n // to prevent scroll bar\n overflow: visible !important;\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: ", ";\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: ", ";\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s, box-shadow 0s;\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n /* Media resize handlers */\n .resizer-handle-thumb {\n background: ", " !important;\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: ", "; /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n\n .warning {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n\n .", " .", "::after {\n border: 1px solid ", ";\n }\n\n .", " .", " {\n box-shadow: 0 0 0 1px ", " !important;\n }\n\n .resizer-handle-thumb {\n background: ", " !important;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, "var(--ds-space-150, 12px)", _editorSharedStyles.akEditorMediaResizeHandlerPadding, "var(--ds-space-150, 12px)", _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border, ".concat(_colors.N60, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-border-focused, ".concat(_colors.B200, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.akEditorSelectedBorderBoldSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-icon-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), "var(--ds-blanket-danger, rgb(255, 189, 173, 0.5))", _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, "var(--ds-border-warning, ".concat(_colors.Y500, ")"), "var(--ds-icon-warning, ".concat(_colors.Y500, ")"));
|
|
16
16
|
|
|
17
17
|
/* `left: unset` above is to work around Chrome bug where rendering a div with
|
|
18
18
|
* that style applied inside a container that has a scroll, causes any svgs on
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.toggleBorderMark = exports.setBorderMark = exports.removeInlineCard = exports.changeMediaCardToInline = exports.changeInlineToMediaCard = exports.DEFAULT_BORDER_SIZE = exports.DEFAULT_BORDER_COLOR = void 0;
|
|
7
|
+
exports.updateMediaSingleWidth = exports.toggleBorderMark = exports.setBorderMark = exports.removeInlineCard = exports.changeMediaCardToInline = exports.changeInlineToMediaCard = exports.DEFAULT_BORDER_SIZE = exports.DEFAULT_BORDER_COLOR = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
|
-
var _analytics = require("
|
|
12
|
+
var _analytics = require("../utils/analytics");
|
|
13
|
+
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
11
14
|
var _utils2 = require("./utils");
|
|
12
15
|
var _currentMediaNode = require("../utils/current-media-node");
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
18
|
var DEFAULT_BORDER_COLOR = '#091e4224';
|
|
14
19
|
exports.DEFAULT_BORDER_COLOR = DEFAULT_BORDER_COLOR;
|
|
15
20
|
var DEFAULT_BORDER_SIZE = 2;
|
|
@@ -40,12 +45,12 @@ var changeInlineToMediaCard = function changeInlineToMediaCard(editorAnalyticsAP
|
|
|
40
45
|
tr = (0, _utils.safeInsert)(group, nodePos, true)(tr);
|
|
41
46
|
if (dispatch) {
|
|
42
47
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
43
|
-
action:
|
|
44
|
-
actionSubject:
|
|
45
|
-
eventType:
|
|
48
|
+
action: _analytics2.ACTION.CHANGED_TYPE,
|
|
49
|
+
actionSubject: _analytics2.ACTION_SUBJECT.MEDIA,
|
|
50
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
46
51
|
attributes: {
|
|
47
|
-
newType:
|
|
48
|
-
previousType:
|
|
52
|
+
newType: _analytics2.ACTION_SUBJECT_ID.MEDIA_GROUP,
|
|
53
|
+
previousType: _analytics2.ACTION_SUBJECT_ID.MEDIA_INLINE
|
|
49
54
|
}
|
|
50
55
|
})(tr);
|
|
51
56
|
dispatch(tr);
|
|
@@ -78,12 +83,12 @@ var changeMediaCardToInline = function changeMediaCardToInline(editorAnalyticsAP
|
|
|
78
83
|
tr = (0, _utils.safeInsert)(node, nodePos, true)(tr);
|
|
79
84
|
if (dispatch) {
|
|
80
85
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
81
|
-
action:
|
|
82
|
-
actionSubject:
|
|
83
|
-
eventType:
|
|
86
|
+
action: _analytics2.ACTION.CHANGED_TYPE,
|
|
87
|
+
actionSubject: _analytics2.ACTION_SUBJECT.MEDIA,
|
|
88
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
84
89
|
attributes: {
|
|
85
|
-
newType:
|
|
86
|
-
previousType:
|
|
90
|
+
newType: _analytics2.ACTION_SUBJECT_ID.MEDIA_INLINE,
|
|
91
|
+
previousType: _analytics2.ACTION_SUBJECT_ID.MEDIA_GROUP
|
|
87
92
|
}
|
|
88
93
|
})(tr);
|
|
89
94
|
dispatch(tr);
|
|
@@ -129,10 +134,10 @@ var toggleBorderMark = function toggleBorderMark(editorAnalyticsAPI) {
|
|
|
129
134
|
if (dispatch) {
|
|
130
135
|
if (borderMark !== null && borderMark !== void 0 && borderMark.attrs) {
|
|
131
136
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
132
|
-
action:
|
|
133
|
-
actionSubject:
|
|
134
|
-
actionSubjectId:
|
|
135
|
-
eventType:
|
|
137
|
+
action: _analytics2.ACTION.DELETED,
|
|
138
|
+
actionSubject: _analytics2.ACTION_SUBJECT.MEDIA,
|
|
139
|
+
actionSubjectId: _analytics2.ACTION_SUBJECT_ID.BORDER,
|
|
140
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
136
141
|
attributes: {
|
|
137
142
|
previousColor: borderMark.attrs.color,
|
|
138
143
|
previousSize: borderMark.attrs.size
|
|
@@ -140,10 +145,10 @@ var toggleBorderMark = function toggleBorderMark(editorAnalyticsAPI) {
|
|
|
140
145
|
})(tr);
|
|
141
146
|
} else {
|
|
142
147
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
143
|
-
action:
|
|
144
|
-
actionSubject:
|
|
145
|
-
actionSubjectId:
|
|
146
|
-
eventType:
|
|
148
|
+
action: _analytics2.ACTION.ADDED,
|
|
149
|
+
actionSubject: _analytics2.ACTION_SUBJECT.MEDIA,
|
|
150
|
+
actionSubjectId: _analytics2.ACTION_SUBJECT_ID.BORDER,
|
|
151
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
147
152
|
attributes: {
|
|
148
153
|
color: DEFAULT_BORDER_COLOR,
|
|
149
154
|
size: DEFAULT_BORDER_SIZE
|
|
@@ -186,10 +191,10 @@ var setBorderMark = function setBorderMark(editorAnalyticsAPI) {
|
|
|
186
191
|
}
|
|
187
192
|
if (dispatch) {
|
|
188
193
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
189
|
-
action:
|
|
190
|
-
actionSubject:
|
|
191
|
-
actionSubjectId:
|
|
192
|
-
eventType:
|
|
194
|
+
action: _analytics2.ACTION.UPDATED,
|
|
195
|
+
actionSubject: _analytics2.ACTION_SUBJECT.MEDIA,
|
|
196
|
+
actionSubjectId: _analytics2.ACTION_SUBJECT_ID.BORDER,
|
|
197
|
+
eventType: _analytics2.EVENT_TYPE.TRACK,
|
|
193
198
|
attributes: {
|
|
194
199
|
previousColor: borderMark === null || borderMark === void 0 ? void 0 : borderMark.color,
|
|
195
200
|
previousSize: borderMark === null || borderMark === void 0 ? void 0 : borderMark.size,
|
|
@@ -203,4 +208,37 @@ var setBorderMark = function setBorderMark(editorAnalyticsAPI) {
|
|
|
203
208
|
};
|
|
204
209
|
};
|
|
205
210
|
};
|
|
206
|
-
exports.setBorderMark = setBorderMark;
|
|
211
|
+
exports.setBorderMark = setBorderMark;
|
|
212
|
+
var updateMediaSingleWidth = function updateMediaSingleWidth(editorAnalyticsAPI) {
|
|
213
|
+
return function (width, validation, layout) {
|
|
214
|
+
return function (state, dispatch) {
|
|
215
|
+
var selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
|
|
216
|
+
if (!selectedMediaSingleNode) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
220
|
+
width: width,
|
|
221
|
+
widthType: 'pixel',
|
|
222
|
+
layout: layout
|
|
223
|
+
}));
|
|
224
|
+
tr.setMeta('scrollIntoView', false);
|
|
225
|
+
tr.setSelection(_state.NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
226
|
+
var $pos = state.doc.resolve(selectedMediaSingleNode.pos);
|
|
227
|
+
var parentNodeType = $pos ? $pos.parent.type.name : undefined;
|
|
228
|
+
var payload = (0, _analytics.getMediaInputResizeAnalyticsEvent)('mediaSingle', {
|
|
229
|
+
width: width,
|
|
230
|
+
layout: layout,
|
|
231
|
+
validation: validation,
|
|
232
|
+
parentNode: parentNodeType
|
|
233
|
+
});
|
|
234
|
+
if (payload) {
|
|
235
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
|
|
236
|
+
}
|
|
237
|
+
if (dispatch) {
|
|
238
|
+
dispatch(tr);
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
exports.updateMediaSingleWidth = updateMediaSingleWidth;
|