@atlaskit/editor-core 207.19.6 → 207.20.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/create-editor/ReactEditorView.js +6 -1
  4. package/dist/cjs/i18n/sl.js +19 -0
  5. package/dist/cjs/i18n/sr_RS.js +19 -0
  6. package/dist/cjs/presets/default.js +8 -1
  7. package/dist/cjs/ui/Appearance/Comment/Comment.js +3 -1
  8. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +24 -4
  9. package/dist/cjs/ui/Toolbar/getPrimaryToolbarComponents.js +21 -0
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/es2019/create-editor/ReactEditorView.js +6 -1
  12. package/dist/es2019/i18n/sl.js +13 -0
  13. package/dist/es2019/i18n/sr_RS.js +13 -0
  14. package/dist/es2019/presets/default.js +6 -1
  15. package/dist/es2019/ui/Appearance/Comment/Comment.js +3 -1
  16. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +24 -4
  17. package/dist/es2019/ui/Toolbar/getPrimaryToolbarComponents.js +16 -0
  18. package/dist/es2019/version-wrapper.js +1 -1
  19. package/dist/esm/create-editor/ReactEditorView.js +6 -1
  20. package/dist/esm/i18n/sl.js +13 -0
  21. package/dist/esm/i18n/sr_RS.js +13 -0
  22. package/dist/esm/presets/default.js +8 -1
  23. package/dist/esm/ui/Appearance/Comment/Comment.js +3 -1
  24. package/dist/esm/ui/Appearance/FullPage/FullPage.js +24 -4
  25. package/dist/esm/ui/Toolbar/getPrimaryToolbarComponents.js +16 -0
  26. package/dist/esm/version-wrapper.js +1 -1
  27. package/dist/types/create-editor/create-universal-preset.d.ts +121 -7
  28. package/dist/types/i18n/sl.d.ts +12 -0
  29. package/dist/types/i18n/sr_RS.d.ts +12 -0
  30. package/dist/types/presets/default-preset-type.d.ts +2 -0
  31. package/dist/types/presets/universal.d.ts +121 -7
  32. package/dist/types/presets/useUniversalPreset.d.ts +121 -7
  33. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -1
  34. package/dist/types/ui/Toolbar/getPrimaryToolbarComponents.d.ts +5 -0
  35. package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +150 -5
  36. package/dist/types-ts4.5/i18n/sl.d.ts +12 -0
  37. package/dist/types-ts4.5/i18n/sr_RS.d.ts +12 -0
  38. package/dist/types-ts4.5/presets/default-preset-type.d.ts +2 -0
  39. package/dist/types-ts4.5/presets/universal.d.ts +150 -5
  40. package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +150 -5
  41. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +1 -1
  42. package/dist/types-ts4.5/ui/Toolbar/getPrimaryToolbarComponents.d.ts +7 -0
  43. package/package.json +11 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 207.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#158546](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158546)
8
+ [`b7fe4e6f226f3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7fe4e6f226f3) -
9
+ ED-27284 use user preferences plugin in editor preset.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#171482](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/171482)
14
+ [`aaa3084f0ce5e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aaa3084f0ce5e) - \*
15
+ I18n translations, see
16
+ [commit](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c5e33f6fd2cf86464047d15fc050a0759daa17a6)
17
+ - Add `platform_editor_disable_context_panel_animation`, see
18
+ [commit](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f5354e057194e15abfc9fa16aa288e42044d710c)
19
+ - Updated dependencies
20
+
3
21
  ## 207.19.6
4
22
 
5
23
  ### Patch Changes
@@ -45,6 +45,9 @@
45
45
  {
46
46
  "path": "../../editor-plugin-quick-insert/afm-cc/tsconfig.json"
47
47
  },
48
+ {
49
+ "path": "../../editor-plugin-user-preferences/afm-cc/tsconfig.json"
50
+ },
48
51
  {
49
52
  "path": "../../editor-plugins/afm-cc/tsconfig.json"
50
53
  },
@@ -117,7 +117,9 @@ function ReactEditorView(props) {
117
117
  fireAnalyticsEvent: handleAnalyticsEvent
118
118
  }));
119
119
  (0, _react.useLayoutEffect)(function () {
120
- setEditorAPI(pluginInjectionAPI.current.api());
120
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_setup_editorapi_sync')) {
121
+ setEditorAPI(pluginInjectionAPI.current.api());
122
+ }
121
123
  }, []);
122
124
  var createEditorState = (0, _react.useCallback)(function (options) {
123
125
  var _api$editorViewMode;
@@ -145,6 +147,9 @@ function ReactEditorView(props) {
145
147
  } else {
146
148
  config.current = (0, _createEditor.processPluginsList)((0, _createPluginsList.default)(options.props.preset, props.editorProps, pluginInjectionAPI.current));
147
149
  schema = (0, _createSchema.createSchema)(config.current);
150
+ if ((0, _platformFeatureFlags.fg)('platform_editor_setup_editorapi_sync')) {
151
+ setEditorAPI(pluginInjectionAPI.current.api());
152
+ }
148
153
  }
149
154
  var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
150
155
  var plugins = (0, _createEditor.createPMPlugins)({
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /* prettier-ignore */
8
+ /**
9
+ * NOTE:
10
+ *
11
+ * This file is automatically generated by Traduki 2.0.
12
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
+ */
14
+ //Slovenian (Slovenia) [sl-SI]
15
+ var _default = exports.default = {
16
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Vnesite nekaj …',
17
+ 'fabric.editor.editorAssistiveLabel': 'Glavno področje za vsebino; začnite tipkati, da vnesete besedilo.',
18
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Odpri pogovorno okno pomoči'
19
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /* prettier-ignore */
8
+ /**
9
+ * NOTE:
10
+ *
11
+ * This file is automatically generated by Traduki 2.0.
12
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
13
+ */
14
+ //Serbian (Serbia) [sr-RS]
15
+ var _default = exports.default = {
16
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Unesite tekst…',
17
+ 'fabric.editor.editorAssistiveLabel': 'Glavna oblast za sadržaj, počnite da unosite tekst.',
18
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Otvori dijalog pomoći'
19
+ };
@@ -8,6 +8,7 @@ exports.createDefaultPreset = createDefaultPreset;
8
8
  exports.useDefaultPreset = useDefaultPreset;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _preset = require("@atlaskit/editor-common/preset");
11
+ var _editorPluginUserPreferences = require("@atlaskit/editor-plugin-user-preferences");
11
12
  var _analytics = require("@atlaskit/editor-plugins/analytics");
12
13
  var _base = require("@atlaskit/editor-plugins/base");
13
14
  var _betterTypeHistory = require("@atlaskit/editor-plugins/better-type-history");
@@ -59,7 +60,13 @@ function createDefaultPreset(options) {
59
60
  performanceTracking: options.performanceTracking
60
61
  }], Boolean(options.allowAnalyticsGASV3)).add(_betterTypeHistory.betterTypeHistoryPlugin).add([_paste.pastePlugin, _objectSpread(_objectSpread({}, options === null || options === void 0 ? void 0 : options.paste), {}, {
61
62
  isFullPage: isFullPage
62
- })]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).maybeAdd(_interaction.interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? (0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') : (0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
63
+ })]).add(_clipboard.clipboardPlugin).add(_focus.focusPlugin).maybeAdd([_editorPluginUserPreferences.userPreferencesPlugin, {
64
+ initialUserPreferences: {
65
+ toolbarDockingPosition: isFullPage ? 'none' : 'top'
66
+ }
67
+ }], function () {
68
+ return (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin');
69
+ }).maybeAdd(_interaction.interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? (0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') : (0, _expValEquals.expValEquals)('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(_composition.compositionPlugin).add([_contextIdentifier.contextIdentifierPlugin, {
63
70
  contextIdentifierProvider: options.contextIdentifierProvider
64
71
  }]).add([_base.basePlugin, options.base]).add(_decorations.decorationsPlugin).add([_typeAhead.typeAheadPlugin, options.typeAhead]).maybeAdd(_history.historyPlugin, Boolean(options.allowUndoRedoButtons)).add([_primaryToolbar.primaryToolbarPlugin, {
65
72
  contextualFormattingEnabled: isFullPage
@@ -28,6 +28,7 @@ var _contentComponentWrapper = require("../../Addon/ClickAreaBlock/contentCompon
28
28
  var _ContentStyles = require("../../ContentStyles");
29
29
  var _EditorContentContainer = _interopRequireDefault(require("../../EditorContentContainer/EditorContentContainer"));
30
30
  var _PluginSlot = _interopRequireDefault(require("../../PluginSlot"));
31
+ var _getPrimaryToolbarComponents = require("../../Toolbar/getPrimaryToolbarComponents");
31
32
  var _ToolbarWithSizeDetector = require("../../Toolbar/ToolbarWithSizeDetector");
32
33
  var _WithFlash = _interopRequireDefault(require("../../WithFlash"));
33
34
  var _Toolbar = require("./Toolbar");
@@ -116,8 +117,9 @@ var CommentEditorWithIntl = exports.CommentEditorWithIntl = function CommentEdit
116
117
  var editorAPI = props.editorAPI;
117
118
  var _useCommentEditorPlug = useCommentEditorPluginsStates(editorAPI),
118
119
  maxContentSizeState = _useCommentEditorPlug.maxContentSizeState,
119
- primaryToolbarState = _useCommentEditorPlug.primaryToolbarState,
120
+ primaryToolbarHookState = _useCommentEditorPlug.primaryToolbarState,
120
121
  editorViewModeState = _useCommentEditorPlug.editorViewModeState;
122
+ var primaryToolbarState = (0, _getPrimaryToolbarComponents.getPrimaryToolbarComponents)(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
121
123
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['media']),
122
124
  mediaState = _useSharedPluginState.mediaState;
123
125
  var intl = (0, _reactIntlNext.useIntl)();
@@ -15,6 +15,7 @@ var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
16
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
+ var _getPrimaryToolbarComponents = require("../../Toolbar/getPrimaryToolbarComponents");
18
19
  var _FullPageContentArea = require("./FullPageContentArea");
19
20
  var _FullPageToolbar = require("./FullPageToolbar");
20
21
  var _getEditorViewModeSync = require("./getEditorViewModeSync");
@@ -95,8 +96,9 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
95
96
  var editorAPI = props.editorAPI;
96
97
  var _useFullPageEditorPlu = useFullPageEditorPluginsStates(editorAPI),
97
98
  editorViewModeState = _useFullPageEditorPlu.editorViewModeState,
98
- primaryToolbarState = _useFullPageEditorPlu.primaryToolbarState,
99
+ primaryToolbarHookState = _useFullPageEditorPlu.primaryToolbarState,
99
100
  interactionState = _useFullPageEditorPlu.interactionState;
101
+ var primaryToolbarState = (0, _getPrimaryToolbarComponents.getPrimaryToolbarComponents)(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
100
102
  var viewMode = (0, _getEditorViewModeSync.getEditorViewMode)(editorViewModeState, props.preset);
101
103
 
102
104
  // Remove all this logic when platform_editor_interaction_api_refactor is cleaned up
@@ -111,8 +113,18 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
111
113
  } else {
112
114
  hasHadInteraction = interactionState === null || interactionState === void 0 ? void 0 : interactionState.hasHadInteraction;
113
115
  }
114
- var toolbarDocking = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'selectionToolbar.toolbarDocking');
115
- if (!toolbarDocking && (0, _platformFeatureFlags.fg)('platform_editor_controls_toolbar_ssr_fix')) {
116
+ var toolbarDocking = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'selectionToolbar.toolbarDocking', {
117
+ disabled: (0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')
118
+ });
119
+ var toolbarDockingPref = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'userPreferences.preferences.toolbarDockingPosition', {
120
+ disabled: !(0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')
121
+ });
122
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
123
+ if (!toolbarDockingPref) {
124
+ var _editorAPI$userPrefer;
125
+ toolbarDockingPref = editorAPI === null || editorAPI === void 0 || (_editorAPI$userPrefer = editorAPI.userPreferences) === null || _editorAPI$userPrefer === void 0 || (_editorAPI$userPrefer = _editorAPI$userPrefer.sharedState.currentState()) === null || _editorAPI$userPrefer === void 0 ? void 0 : _editorAPI$userPrefer.preferences.toolbarDockingPosition;
126
+ }
127
+ } else if (!toolbarDocking && (0, _platformFeatureFlags.fg)('platform_editor_controls_toolbar_ssr_fix')) {
116
128
  var _editorAPI$selectionT, _editorAPI$selectionT2;
117
129
  // This is a workaround for the rendering issue with the selection toolbar
118
130
  // where using useSharedPluginStateSelector or useSharedPluginState the state are not
@@ -129,7 +141,15 @@ var FullPageEditor = exports.FullPageEditor = function FullPageEditor(props) {
129
141
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
130
142
  exposure: true
131
143
  })) {
132
- if ((0, _platformFeatureFlags.fg)('platform_editor_controls_toolbar_ssr_fix')) {
144
+ if ((0, _platformFeatureFlags.fg)('platform_editor_use_preferences_plugin')) {
145
+ // need to check if the toolbarDockingPref is set to 'none' or 'top'
146
+ if (toolbarDockingPref === 'none') {
147
+ primaryToolbarComponents = [];
148
+ if (!hasCustomComponents(customPrimaryToolbarComponents)) {
149
+ isEditorToolbarHidden = true;
150
+ }
151
+ }
152
+ } else if ((0, _platformFeatureFlags.fg)('platform_editor_controls_toolbar_ssr_fix')) {
133
153
  if (toolbarDocking === 'none') {
134
154
  primaryToolbarComponents = [];
135
155
  if (!hasCustomComponents(customPrimaryToolbarComponents)) {
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPrimaryToolbarComponents = void 0;
7
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
+ // Primary toolbar doesn't actually use plugin state so the state selector doesn't update as intended
9
+ // We need a proper API to deal with non-prosemirror based state in plugins but until then we can retrieve
10
+ // the latest
11
+ var getPrimaryToolbarComponents = exports.getPrimaryToolbarComponents = function getPrimaryToolbarComponents(editorAPI, components) {
12
+ if ((0, _platformFeatureFlags.fg)('platform_editor_setup_editorapi_sync')) {
13
+ var _editorAPI$primaryToo;
14
+ return {
15
+ components: components !== null && components !== void 0 ? components : editorAPI === null || editorAPI === void 0 || (_editorAPI$primaryToo = editorAPI.primaryToolbar) === null || _editorAPI$primaryToo === void 0 || (_editorAPI$primaryToo = _editorAPI$primaryToo.sharedState.currentState()) === null || _editorAPI$primaryToo === void 0 ? void 0 : _editorAPI$primaryToo.components
16
+ };
17
+ }
18
+ return {
19
+ components: components
20
+ };
21
+ };
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "207.19.6";
8
+ var version = exports.version = "207.20.0";
@@ -93,7 +93,9 @@ export function ReactEditorView(props) {
93
93
  fireAnalyticsEvent: handleAnalyticsEvent
94
94
  }));
95
95
  useLayoutEffect(() => {
96
- setEditorAPI(pluginInjectionAPI.current.api());
96
+ if (!fg('platform_editor_setup_editorapi_sync')) {
97
+ setEditorAPI(pluginInjectionAPI.current.api());
98
+ }
97
99
  }, []);
98
100
  const createEditorState = useCallback(options => {
99
101
  var _api$editorViewMode;
@@ -121,6 +123,9 @@ export function ReactEditorView(props) {
121
123
  } else {
122
124
  config.current = processPluginsList(createPluginsList(options.props.preset, props.editorProps, pluginInjectionAPI.current));
123
125
  schema = createSchema(config.current);
126
+ if (fg('platform_editor_setup_editorapi_sync')) {
127
+ setEditorAPI(pluginInjectionAPI.current.api());
128
+ }
124
129
  }
125
130
  const {
126
131
  contentTransformerProvider
@@ -0,0 +1,13 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+ //Slovenian (Slovenia) [sl-SI]
9
+ export default {
10
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Vnesite nekaj …',
11
+ 'fabric.editor.editorAssistiveLabel': 'Glavno področje za vsebino; začnite tipkati, da vnesete besedilo.',
12
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Odpri pogovorno okno pomoči'
13
+ };
@@ -0,0 +1,13 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+ //Serbian (Serbia) [sr-RS]
9
+ export default {
10
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Unesite tekst…',
11
+ 'fabric.editor.editorAssistiveLabel': 'Glavna oblast za sadržaj, počnite da unosite tekst.',
12
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Otvori dijalog pomoći'
13
+ };
@@ -1,6 +1,7 @@
1
1
  // #region Imports
2
2
 
3
3
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
4
+ import { userPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
4
5
  import { analyticsPlugin } from '@atlaskit/editor-plugins/analytics';
5
6
  import { basePlugin } from '@atlaskit/editor-plugins/base';
6
7
  import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugins/better-type-history';
@@ -52,7 +53,11 @@ export function createDefaultPreset(options) {
52
53
  }], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, {
53
54
  ...(options === null || options === void 0 ? void 0 : options.paste),
54
55
  isFullPage
55
- }]).add(clipboardPlugin).add(focusPlugin).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? fg('platform_editor_no_cursor_on_live_doc_init') : expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
56
+ }]).add(clipboardPlugin).add(focusPlugin).maybeAdd([userPreferencesPlugin, {
57
+ initialUserPreferences: {
58
+ toolbarDockingPosition: isFullPage ? 'none' : 'top'
59
+ }
60
+ }], () => fg('platform_editor_use_preferences_plugin')).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? fg('platform_editor_no_cursor_on_live_doc_init') : expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
56
61
  contextIdentifierProvider: options.contextIdentifierProvider
57
62
  }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add([primaryToolbarPlugin, {
58
63
  contextualFormattingEnabled: isFullPage
@@ -27,6 +27,7 @@ import { contentComponentClickWrapper } from '../../Addon/ClickAreaBlock/content
27
27
  import { createEditorContentStyle } from '../../ContentStyles';
28
28
  import EditorContentContainer from '../../EditorContentContainer/EditorContentContainer';
29
29
  import PluginSlot from '../../PluginSlot';
30
+ import { getPrimaryToolbarComponents } from '../../Toolbar/getPrimaryToolbarComponents';
30
31
  import { ToolbarWithSizeDetector as Toolbar } from '../../Toolbar/ToolbarWithSizeDetector';
31
32
  import WithFlash from '../../WithFlash';
32
33
  import { MainToolbar, mainToolbarCustomComponentsSlotStyle } from './Toolbar';
@@ -104,9 +105,10 @@ export const CommentEditorWithIntl = props => {
104
105
  } = props;
105
106
  const {
106
107
  maxContentSizeState,
107
- primaryToolbarState,
108
+ primaryToolbarState: primaryToolbarHookState,
108
109
  editorViewModeState
109
110
  } = useCommentEditorPluginsStates(editorAPI);
111
+ const primaryToolbarState = getPrimaryToolbarComponents(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
110
112
  const {
111
113
  mediaState
112
114
  } = useSharedPluginState(editorAPI, ['media']);
@@ -12,6 +12,7 @@ import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
12
12
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
+ import { getPrimaryToolbarComponents } from '../../Toolbar/getPrimaryToolbarComponents';
15
16
  import { FullPageContentArea } from './FullPageContentArea';
16
17
  import { FullPageToolbar } from './FullPageToolbar';
17
18
  import { getEditorViewMode } from './getEditorViewModeSync';
@@ -77,9 +78,10 @@ export const FullPageEditor = props => {
77
78
  const editorAPI = props.editorAPI;
78
79
  const {
79
80
  editorViewModeState,
80
- primaryToolbarState,
81
+ primaryToolbarState: primaryToolbarHookState,
81
82
  interactionState
82
83
  } = useFullPageEditorPluginsStates(editorAPI);
84
+ const primaryToolbarState = getPrimaryToolbarComponents(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
83
85
  const viewMode = getEditorViewMode(editorViewModeState, props.preset);
84
86
 
85
87
  // Remove all this logic when platform_editor_interaction_api_refactor is cleaned up
@@ -94,8 +96,18 @@ export const FullPageEditor = props => {
94
96
  } else {
95
97
  hasHadInteraction = interactionState === null || interactionState === void 0 ? void 0 : interactionState.hasHadInteraction;
96
98
  }
97
- let toolbarDocking = useSharedPluginStateSelector(editorAPI, 'selectionToolbar.toolbarDocking');
98
- if (!toolbarDocking && fg('platform_editor_controls_toolbar_ssr_fix')) {
99
+ let toolbarDocking = useSharedPluginStateSelector(editorAPI, 'selectionToolbar.toolbarDocking', {
100
+ disabled: fg('platform_editor_use_preferences_plugin')
101
+ });
102
+ let toolbarDockingPref = useSharedPluginStateSelector(editorAPI, 'userPreferences.preferences.toolbarDockingPosition', {
103
+ disabled: !fg('platform_editor_use_preferences_plugin')
104
+ });
105
+ if (fg('platform_editor_use_preferences_plugin')) {
106
+ if (!toolbarDockingPref) {
107
+ var _editorAPI$userPrefer, _editorAPI$userPrefer2;
108
+ toolbarDockingPref = editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$userPrefer = editorAPI.userPreferences) === null || _editorAPI$userPrefer === void 0 ? void 0 : (_editorAPI$userPrefer2 = _editorAPI$userPrefer.sharedState.currentState()) === null || _editorAPI$userPrefer2 === void 0 ? void 0 : _editorAPI$userPrefer2.preferences.toolbarDockingPosition;
109
+ }
110
+ } else if (!toolbarDocking && fg('platform_editor_controls_toolbar_ssr_fix')) {
99
111
  var _editorAPI$selectionT, _editorAPI$selectionT2, _editorAPI$selectionT3;
100
112
  // This is a workaround for the rendering issue with the selection toolbar
101
113
  // where using useSharedPluginStateSelector or useSharedPluginState the state are not
@@ -114,7 +126,15 @@ export const FullPageEditor = props => {
114
126
  if (editorExperiment('platform_editor_controls', 'variant1', {
115
127
  exposure: true
116
128
  })) {
117
- if (fg('platform_editor_controls_toolbar_ssr_fix')) {
129
+ if (fg('platform_editor_use_preferences_plugin')) {
130
+ // need to check if the toolbarDockingPref is set to 'none' or 'top'
131
+ if (toolbarDockingPref === 'none') {
132
+ primaryToolbarComponents = [];
133
+ if (!hasCustomComponents(customPrimaryToolbarComponents)) {
134
+ isEditorToolbarHidden = true;
135
+ }
136
+ }
137
+ } else if (fg('platform_editor_controls_toolbar_ssr_fix')) {
118
138
  if (toolbarDocking === 'none') {
119
139
  primaryToolbarComponents = [];
120
140
  if (!hasCustomComponents(customPrimaryToolbarComponents)) {
@@ -0,0 +1,16 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
+ // Primary toolbar doesn't actually use plugin state so the state selector doesn't update as intended
4
+ // We need a proper API to deal with non-prosemirror based state in plugins but until then we can retrieve
5
+ // the latest
6
+ export const getPrimaryToolbarComponents = (editorAPI, components) => {
7
+ if (fg('platform_editor_setup_editorapi_sync')) {
8
+ var _editorAPI$primaryToo, _editorAPI$primaryToo2;
9
+ return {
10
+ components: components !== null && components !== void 0 ? components : editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$primaryToo = editorAPI.primaryToolbar) === null || _editorAPI$primaryToo === void 0 ? void 0 : (_editorAPI$primaryToo2 = _editorAPI$primaryToo.sharedState.currentState()) === null || _editorAPI$primaryToo2 === void 0 ? void 0 : _editorAPI$primaryToo2.components
11
+ };
12
+ }
13
+ return {
14
+ components
15
+ };
16
+ };
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "207.19.6";
2
+ export const version = "207.20.0";
@@ -107,7 +107,9 @@ export function ReactEditorView(props) {
107
107
  fireAnalyticsEvent: handleAnalyticsEvent
108
108
  }));
109
109
  useLayoutEffect(function () {
110
- setEditorAPI(pluginInjectionAPI.current.api());
110
+ if (!fg('platform_editor_setup_editorapi_sync')) {
111
+ setEditorAPI(pluginInjectionAPI.current.api());
112
+ }
111
113
  }, []);
112
114
  var createEditorState = useCallback(function (options) {
113
115
  var _api$editorViewMode;
@@ -135,6 +137,9 @@ export function ReactEditorView(props) {
135
137
  } else {
136
138
  config.current = processPluginsList(createPluginsList(options.props.preset, props.editorProps, pluginInjectionAPI.current));
137
139
  schema = createSchema(config.current);
140
+ if (fg('platform_editor_setup_editorapi_sync')) {
141
+ setEditorAPI(pluginInjectionAPI.current.api());
142
+ }
138
143
  }
139
144
  var contentTransformerProvider = options.props.editorProps.contentTransformerProvider;
140
145
  var plugins = createPMPlugins({
@@ -0,0 +1,13 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+ //Slovenian (Slovenia) [sl-SI]
9
+ export default {
10
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Vnesite nekaj …',
11
+ 'fabric.editor.editorAssistiveLabel': 'Glavno področje za vsebino; začnite tipkati, da vnesete besedilo.',
12
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Odpri pogovorno okno pomoči'
13
+ };
@@ -0,0 +1,13 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+ //Serbian (Serbia) [sr-RS]
9
+ export default {
10
+ 'fabric.editor.chromeCollapsedPlaceholder': 'Unesite tekst…',
11
+ 'fabric.editor.editorAssistiveLabel': 'Glavna oblast za sadržaj, počnite da unosite tekst.',
12
+ 'fabric.editor.headingLink.toolbarHelpTitle': 'Otvori dijalog pomoći'
13
+ };
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  // #region Imports
5
5
 
6
6
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
7
+ import { userPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
7
8
  import { analyticsPlugin } from '@atlaskit/editor-plugins/analytics';
8
9
  import { basePlugin } from '@atlaskit/editor-plugins/base';
9
10
  import { betterTypeHistoryPlugin } from '@atlaskit/editor-plugins/better-type-history';
@@ -54,7 +55,13 @@ export function createDefaultPreset(options) {
54
55
  performanceTracking: options.performanceTracking
55
56
  }], Boolean(options.allowAnalyticsGASV3)).add(betterTypeHistoryPlugin).add([pastePlugin, _objectSpread(_objectSpread({}, options === null || options === void 0 ? void 0 : options.paste), {}, {
56
57
  isFullPage: isFullPage
57
- })]).add(clipboardPlugin).add(focusPlugin).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? fg('platform_editor_no_cursor_on_live_doc_init') : expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
58
+ })]).add(clipboardPlugin).add(focusPlugin).maybeAdd([userPreferencesPlugin, {
59
+ initialUserPreferences: {
60
+ toolbarDockingPosition: isFullPage ? 'none' : 'top'
61
+ }
62
+ }], function () {
63
+ return fg('platform_editor_use_preferences_plugin');
64
+ }).maybeAdd(interactionPlugin, Boolean(options === null || options === void 0 ? void 0 : options.__livePage) ? fg('platform_editor_no_cursor_on_live_doc_init') : expValEquals('platform_editor_no_cursor_on_edit_page_init', 'isEnabled', true)).add(compositionPlugin).add([contextIdentifierPlugin, {
58
65
  contextIdentifierProvider: options.contextIdentifierProvider
59
66
  }]).add([basePlugin, options.base]).add(decorationsPlugin).add([typeAheadPlugin, options.typeAhead]).maybeAdd(historyPlugin, Boolean(options.allowUndoRedoButtons)).add([primaryToolbarPlugin, {
60
67
  contextualFormattingEnabled: isFullPage
@@ -28,6 +28,7 @@ import { contentComponentClickWrapper } from '../../Addon/ClickAreaBlock/content
28
28
  import { createEditorContentStyle } from '../../ContentStyles';
29
29
  import EditorContentContainer from '../../EditorContentContainer/EditorContentContainer';
30
30
  import PluginSlot from '../../PluginSlot';
31
+ import { getPrimaryToolbarComponents } from '../../Toolbar/getPrimaryToolbarComponents';
31
32
  import { ToolbarWithSizeDetector as Toolbar } from '../../Toolbar/ToolbarWithSizeDetector';
32
33
  import WithFlash from '../../WithFlash';
33
34
  import { MainToolbar, mainToolbarCustomComponentsSlotStyle } from './Toolbar';
@@ -105,8 +106,9 @@ export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
105
106
  var editorAPI = props.editorAPI;
106
107
  var _useCommentEditorPlug = useCommentEditorPluginsStates(editorAPI),
107
108
  maxContentSizeState = _useCommentEditorPlug.maxContentSizeState,
108
- primaryToolbarState = _useCommentEditorPlug.primaryToolbarState,
109
+ primaryToolbarHookState = _useCommentEditorPlug.primaryToolbarState,
109
110
  editorViewModeState = _useCommentEditorPlug.editorViewModeState;
111
+ var primaryToolbarState = getPrimaryToolbarComponents(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
110
112
  var _useSharedPluginState = useSharedPluginState(editorAPI, ['media']),
111
113
  mediaState = _useSharedPluginState.mediaState;
112
114
  var intl = useIntl();
@@ -13,6 +13,7 @@ import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
13
13
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
+ import { getPrimaryToolbarComponents } from '../../Toolbar/getPrimaryToolbarComponents';
16
17
  import { FullPageContentArea } from './FullPageContentArea';
17
18
  import { FullPageToolbar } from './FullPageToolbar';
18
19
  import { getEditorViewMode } from './getEditorViewModeSync';
@@ -85,8 +86,9 @@ export var FullPageEditor = function FullPageEditor(props) {
85
86
  var editorAPI = props.editorAPI;
86
87
  var _useFullPageEditorPlu = useFullPageEditorPluginsStates(editorAPI),
87
88
  editorViewModeState = _useFullPageEditorPlu.editorViewModeState,
88
- primaryToolbarState = _useFullPageEditorPlu.primaryToolbarState,
89
+ primaryToolbarHookState = _useFullPageEditorPlu.primaryToolbarState,
89
90
  interactionState = _useFullPageEditorPlu.interactionState;
91
+ var primaryToolbarState = getPrimaryToolbarComponents(editorAPI, primaryToolbarHookState === null || primaryToolbarHookState === void 0 ? void 0 : primaryToolbarHookState.components);
90
92
  var viewMode = getEditorViewMode(editorViewModeState, props.preset);
91
93
 
92
94
  // Remove all this logic when platform_editor_interaction_api_refactor is cleaned up
@@ -101,8 +103,18 @@ export var FullPageEditor = function FullPageEditor(props) {
101
103
  } else {
102
104
  hasHadInteraction = interactionState === null || interactionState === void 0 ? void 0 : interactionState.hasHadInteraction;
103
105
  }
104
- var toolbarDocking = useSharedPluginStateSelector(editorAPI, 'selectionToolbar.toolbarDocking');
105
- if (!toolbarDocking && fg('platform_editor_controls_toolbar_ssr_fix')) {
106
+ var toolbarDocking = useSharedPluginStateSelector(editorAPI, 'selectionToolbar.toolbarDocking', {
107
+ disabled: fg('platform_editor_use_preferences_plugin')
108
+ });
109
+ var toolbarDockingPref = useSharedPluginStateSelector(editorAPI, 'userPreferences.preferences.toolbarDockingPosition', {
110
+ disabled: !fg('platform_editor_use_preferences_plugin')
111
+ });
112
+ if (fg('platform_editor_use_preferences_plugin')) {
113
+ if (!toolbarDockingPref) {
114
+ var _editorAPI$userPrefer;
115
+ toolbarDockingPref = editorAPI === null || editorAPI === void 0 || (_editorAPI$userPrefer = editorAPI.userPreferences) === null || _editorAPI$userPrefer === void 0 || (_editorAPI$userPrefer = _editorAPI$userPrefer.sharedState.currentState()) === null || _editorAPI$userPrefer === void 0 ? void 0 : _editorAPI$userPrefer.preferences.toolbarDockingPosition;
116
+ }
117
+ } else if (!toolbarDocking && fg('platform_editor_controls_toolbar_ssr_fix')) {
106
118
  var _editorAPI$selectionT, _editorAPI$selectionT2;
107
119
  // This is a workaround for the rendering issue with the selection toolbar
108
120
  // where using useSharedPluginStateSelector or useSharedPluginState the state are not
@@ -119,7 +131,15 @@ export var FullPageEditor = function FullPageEditor(props) {
119
131
  if (editorExperiment('platform_editor_controls', 'variant1', {
120
132
  exposure: true
121
133
  })) {
122
- if (fg('platform_editor_controls_toolbar_ssr_fix')) {
134
+ if (fg('platform_editor_use_preferences_plugin')) {
135
+ // need to check if the toolbarDockingPref is set to 'none' or 'top'
136
+ if (toolbarDockingPref === 'none') {
137
+ primaryToolbarComponents = [];
138
+ if (!hasCustomComponents(customPrimaryToolbarComponents)) {
139
+ isEditorToolbarHidden = true;
140
+ }
141
+ }
142
+ } else if (fg('platform_editor_controls_toolbar_ssr_fix')) {
123
143
  if (toolbarDocking === 'none') {
124
144
  primaryToolbarComponents = [];
125
145
  if (!hasCustomComponents(customPrimaryToolbarComponents)) {
@@ -0,0 +1,16 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
+ // Primary toolbar doesn't actually use plugin state so the state selector doesn't update as intended
4
+ // We need a proper API to deal with non-prosemirror based state in plugins but until then we can retrieve
5
+ // the latest
6
+ export var getPrimaryToolbarComponents = function getPrimaryToolbarComponents(editorAPI, components) {
7
+ if (fg('platform_editor_setup_editorapi_sync')) {
8
+ var _editorAPI$primaryToo;
9
+ return {
10
+ components: components !== null && components !== void 0 ? components : editorAPI === null || editorAPI === void 0 || (_editorAPI$primaryToo = editorAPI.primaryToolbar) === null || _editorAPI$primaryToo === void 0 || (_editorAPI$primaryToo = _editorAPI$primaryToo.sharedState.currentState()) === null || _editorAPI$primaryToo === void 0 ? void 0 : _editorAPI$primaryToo.components
11
+ };
12
+ }
13
+ return {
14
+ components: components
15
+ };
16
+ };
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "207.19.6";
2
+ export var version = "207.20.0";