@atlaskit/editor-plugin-placeholder 7.2.2 → 7.2.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-placeholder
2
2
 
3
+ ## 7.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 7.2.2
4
10
 
5
11
  ### Patch Changes
@@ -9,6 +9,7 @@ exports.pluginKey = exports.placeholderPlugin = exports.EMPTY_PARAGRAPH_TIMEOUT_
9
9
  require("./placeholderPlugin.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireDefault(require("react"));
12
+ var _document = require("@atlaskit/editor-common/utils/document");
12
13
  var _state = require("@atlaskit/editor-prosemirror/state");
13
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _compiled = require("@atlaskit/primitives/compiled");
@@ -71,10 +72,25 @@ var placeholderPlugin = exports.placeholderPlugin = function placeholderPlugin(_
71
72
  }];
72
73
  },
73
74
  contentComponent: (0, _expValEquals.expValEquals)('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? function (params) {
74
- var _params$editorView;
75
+ var _params$editorView, _params$editorView2;
76
+ // If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
77
+ if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
78
+ return null;
79
+ }
80
+ var doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
81
+
75
82
  // @ts-ignore fix which needs follow up to use standard apis
76
- var collabEditPluginState = (_params$editorView = params.editorView) === null || _params$editorView === void 0 || (_params$editorView = _params$editorView.state) === null || _params$editorView === void 0 ? void 0 : _params$editorView.collabEditPlugin$;
83
+ var collabEditPluginState = (_params$editorView2 = params.editorView) === null || _params$editorView2 === void 0 || (_params$editorView2 = _params$editorView2.state) === null || _params$editorView2 === void 0 ? void 0 : _params$editorView2.collabEditPlugin$;
77
84
  if (collabEditPluginState && collabEditPluginState.isReady !== true) {
85
+ if (doc && !(0, _document.isEmptyDocument)(doc)) {
86
+ // If we have a document, and it's not empty - we should not show a loading component
87
+ return null;
88
+ }
89
+
90
+ // In this scenario
91
+ // - the collab plugin exists - but we don't have a "initial/placeholder" document
92
+ // - and the collab plugin is not yet ready
93
+ // So we show a placeholder spinner to indicate the content is still loading
78
94
  return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
79
95
  xcss: spinnerContainerStyles.spinnerContainer
80
96
  }, /*#__PURE__*/_react.default.createElement(_spinner.default, {
@@ -2,6 +2,7 @@
2
2
  import "./placeholderPlugin.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils/document';
5
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
7
  import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Box } from '@atlaskit/primitives/compiled';
@@ -61,10 +62,25 @@ export const placeholderPlugin = ({
61
62
  }];
62
63
  },
63
64
  contentComponent: expValEquals('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? params => {
64
- var _params$editorView, _params$editorView$st;
65
+ var _params$editorView, _params$editorView2, _params$editorView2$s;
66
+ // If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
67
+ if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
68
+ return null;
69
+ }
70
+ const doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
71
+
65
72
  // @ts-ignore fix which needs follow up to use standard apis
66
- const collabEditPluginState = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : (_params$editorView$st = _params$editorView.state) === null || _params$editorView$st === void 0 ? void 0 : _params$editorView$st.collabEditPlugin$;
73
+ const collabEditPluginState = (_params$editorView2 = params.editorView) === null || _params$editorView2 === void 0 ? void 0 : (_params$editorView2$s = _params$editorView2.state) === null || _params$editorView2$s === void 0 ? void 0 : _params$editorView2$s.collabEditPlugin$;
67
74
  if (collabEditPluginState && collabEditPluginState.isReady !== true) {
75
+ if (doc && !isEmptyDocument(doc)) {
76
+ // If we have a document, and it's not empty - we should not show a loading component
77
+ return null;
78
+ }
79
+
80
+ // In this scenario
81
+ // - the collab plugin exists - but we don't have a "initial/placeholder" document
82
+ // - and the collab plugin is not yet ready
83
+ // So we show a placeholder spinner to indicate the content is still loading
68
84
  return /*#__PURE__*/React.createElement(Box, {
69
85
  xcss: spinnerContainerStyles.spinnerContainer
70
86
  }, /*#__PURE__*/React.createElement(Spinner, {
@@ -2,6 +2,7 @@
2
2
  import "./placeholderPlugin.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils/document';
5
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
7
  import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Box } from '@atlaskit/primitives/compiled';
@@ -64,10 +65,25 @@ export var placeholderPlugin = function placeholderPlugin(_ref) {
64
65
  }];
65
66
  },
66
67
  contentComponent: expValEquals('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? function (params) {
67
- var _params$editorView;
68
+ var _params$editorView, _params$editorView2;
69
+ // If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
70
+ if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
71
+ return null;
72
+ }
73
+ var doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
74
+
68
75
  // @ts-ignore fix which needs follow up to use standard apis
69
- var collabEditPluginState = (_params$editorView = params.editorView) === null || _params$editorView === void 0 || (_params$editorView = _params$editorView.state) === null || _params$editorView === void 0 ? void 0 : _params$editorView.collabEditPlugin$;
76
+ var collabEditPluginState = (_params$editorView2 = params.editorView) === null || _params$editorView2 === void 0 || (_params$editorView2 = _params$editorView2.state) === null || _params$editorView2 === void 0 ? void 0 : _params$editorView2.collabEditPlugin$;
70
77
  if (collabEditPluginState && collabEditPluginState.isReady !== true) {
78
+ if (doc && !isEmptyDocument(doc)) {
79
+ // If we have a document, and it's not empty - we should not show a loading component
80
+ return null;
81
+ }
82
+
83
+ // In this scenario
84
+ // - the collab plugin exists - but we don't have a "initial/placeholder" document
85
+ // - and the collab plugin is not yet ready
86
+ // So we show a placeholder spinner to indicate the content is still loading
71
87
  return /*#__PURE__*/React.createElement(Box, {
72
88
  xcss: spinnerContainerStyles.spinnerContainer
73
89
  }, /*#__PURE__*/React.createElement(Spinner, {
@@ -6,6 +6,7 @@ import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff';
6
6
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
7
  export interface PlaceholderPluginOptions {
8
8
  emptyLinePlaceholder?: string;
9
+ enableLoadingSpinner?: boolean;
9
10
  placeholder?: string;
10
11
  placeholderADF?: DocNode;
11
12
  placeholderBracketHint?: string;
@@ -6,6 +6,7 @@ import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff';
6
6
  import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
7
  export interface PlaceholderPluginOptions {
8
8
  emptyLinePlaceholder?: string;
9
+ enableLoadingSpinner?: boolean;
9
10
  placeholder?: string;
10
11
  placeholderADF?: DocNode;
11
12
  placeholderBracketHint?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-placeholder",
3
- "version": "7.2.2",
3
+ "version": "7.2.3",
4
4
  "description": "Placeholder plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-utils": "^19.26.0",
30
+ "@atlaskit/adf-utils": "^19.27.0",
31
31
  "@atlaskit/css": "^0.19.0",
32
32
  "@atlaskit/editor-plugin-composition": "^6.0.0",
33
33
  "@atlaskit/editor-plugin-focus": "^6.0.0",
@@ -37,12 +37,12 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/primitives": "^17.1.0",
39
39
  "@atlaskit/spinner": "^19.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^16.23.0",
41
- "@atlaskit/tokens": "^10.0.0",
40
+ "@atlaskit/tmp-editor-statsig": "^17.0.0",
41
+ "@atlaskit/tokens": "^10.1.0",
42
42
  "@babel/runtime": "^7.0.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@atlaskit/editor-common": "^111.8.0",
45
+ "@atlaskit/editor-common": "^111.9.0",
46
46
  "react": "^18.2.0",
47
47
  "react-dom": "^18.2.0",
48
48
  "react-intl-next": "npm:react-intl@^5.18.1"