@atlaskit/editor-plugin-placeholder 7.2.2 → 7.2.4
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 +14 -0
- package/dist/cjs/placeholderPlugin.js +18 -10
- package/dist/es2019/placeholderPlugin.js +18 -10
- package/dist/esm/placeholderPlugin.js +18 -10
- package/dist/types/placeholderPluginType.d.ts +1 -0
- package/dist/types-ts4.5/placeholderPluginType.d.ts +1 -0
- package/package.json +5 -8
- package/dist/cjs/pm-plugins/placeholderPluginLegacy.js +0 -651
- package/dist/es2019/pm-plugins/placeholderPluginLegacy.js +0 -631
- package/dist/esm/pm-plugins/placeholderPluginLegacy.js +0 -641
- package/dist/types/pm-plugins/placeholderPluginLegacy.d.ts +0 -13
- package/dist/types-ts4.5/pm-plugins/placeholderPluginLegacy.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-placeholder
|
|
2
2
|
|
|
3
|
+
## 7.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4a4392c5bdf9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4a4392c5bdf9d) -
|
|
8
|
+
[EDITOR-4807] fg cleanup platform_editor_placeholder_plugin_tidying
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 7.2.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -9,25 +9,18 @@ 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
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
15
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner/spinner"));
|
|
16
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
17
|
var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
18
|
-
var _placeholderPluginLegacy = require("./pm-plugins/placeholderPluginLegacy");
|
|
19
18
|
var EMPTY_PARAGRAPH_TIMEOUT_DELAY = exports.EMPTY_PARAGRAPH_TIMEOUT_DELAY = 2000; // Delay before showing placeholder on empty paragraph
|
|
20
19
|
|
|
21
20
|
var pluginKey = exports.pluginKey = new _state.PluginKey('placeholderPlugin');
|
|
22
21
|
var placeholderPlugin = exports.placeholderPlugin = function placeholderPlugin(_ref) {
|
|
23
22
|
var options = _ref.config,
|
|
24
23
|
api = _ref.api;
|
|
25
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_placeholder_plugin_tidying')) {
|
|
26
|
-
return (0, _placeholderPluginLegacy.placeholderPluginLegacy)({
|
|
27
|
-
config: options,
|
|
28
|
-
api: api
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
24
|
var currentPlaceholder = options === null || options === void 0 ? void 0 : options.placeholder;
|
|
32
25
|
return {
|
|
33
26
|
name: 'placeholder',
|
|
@@ -71,10 +64,25 @@ var placeholderPlugin = exports.placeholderPlugin = function placeholderPlugin(_
|
|
|
71
64
|
}];
|
|
72
65
|
},
|
|
73
66
|
contentComponent: (0, _expValEquals.expValEquals)('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? function (params) {
|
|
74
|
-
var _params$editorView;
|
|
67
|
+
var _params$editorView, _params$editorView2;
|
|
68
|
+
// If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
|
|
69
|
+
if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
var doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
|
|
73
|
+
|
|
75
74
|
// @ts-ignore fix which needs follow up to use standard apis
|
|
76
|
-
var collabEditPluginState = (_params$
|
|
75
|
+
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
76
|
if (collabEditPluginState && collabEditPluginState.isReady !== true) {
|
|
77
|
+
if (doc && !(0, _document.isEmptyDocument)(doc)) {
|
|
78
|
+
// If we have a document, and it's not empty - we should not show a loading component
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// In this scenario
|
|
83
|
+
// - the collab plugin exists - but we don't have a "initial/placeholder" document
|
|
84
|
+
// - and the collab plugin is not yet ready
|
|
85
|
+
// So we show a placeholder spinner to indicate the content is still loading
|
|
78
86
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
79
87
|
xcss: spinnerContainerStyles.spinnerContainer
|
|
80
88
|
}, /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
@@ -2,13 +2,12 @@
|
|
|
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
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import Spinner from '@atlaskit/spinner/spinner';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import createPlugin from './pm-plugins/main';
|
|
11
|
-
import { placeholderPluginLegacy } from './pm-plugins/placeholderPluginLegacy';
|
|
12
11
|
export const EMPTY_PARAGRAPH_TIMEOUT_DELAY = 2000; // Delay before showing placeholder on empty paragraph
|
|
13
12
|
|
|
14
13
|
export const pluginKey = new PluginKey('placeholderPlugin');
|
|
@@ -16,12 +15,6 @@ export const placeholderPlugin = ({
|
|
|
16
15
|
config: options,
|
|
17
16
|
api
|
|
18
17
|
}) => {
|
|
19
|
-
if (!fg('platform_editor_placeholder_plugin_tidying')) {
|
|
20
|
-
return placeholderPluginLegacy({
|
|
21
|
-
config: options,
|
|
22
|
-
api
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
18
|
let currentPlaceholder = options === null || options === void 0 ? void 0 : options.placeholder;
|
|
26
19
|
return {
|
|
27
20
|
name: 'placeholder',
|
|
@@ -61,10 +54,25 @@ export const placeholderPlugin = ({
|
|
|
61
54
|
}];
|
|
62
55
|
},
|
|
63
56
|
contentComponent: expValEquals('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? params => {
|
|
64
|
-
var _params$editorView, _params$
|
|
57
|
+
var _params$editorView, _params$editorView2, _params$editorView2$s;
|
|
58
|
+
// If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
|
|
59
|
+
if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
|
|
63
|
+
|
|
65
64
|
// @ts-ignore fix which needs follow up to use standard apis
|
|
66
|
-
const collabEditPluginState = (_params$
|
|
65
|
+
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
66
|
if (collabEditPluginState && collabEditPluginState.isReady !== true) {
|
|
67
|
+
if (doc && !isEmptyDocument(doc)) {
|
|
68
|
+
// If we have a document, and it's not empty - we should not show a loading component
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// In this scenario
|
|
73
|
+
// - the collab plugin exists - but we don't have a "initial/placeholder" document
|
|
74
|
+
// - and the collab plugin is not yet ready
|
|
75
|
+
// So we show a placeholder spinner to indicate the content is still loading
|
|
68
76
|
return /*#__PURE__*/React.createElement(Box, {
|
|
69
77
|
xcss: spinnerContainerStyles.spinnerContainer
|
|
70
78
|
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
@@ -2,25 +2,18 @@
|
|
|
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
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import Spinner from '@atlaskit/spinner/spinner';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import createPlugin from './pm-plugins/main';
|
|
11
|
-
import { placeholderPluginLegacy } from './pm-plugins/placeholderPluginLegacy';
|
|
12
11
|
export var EMPTY_PARAGRAPH_TIMEOUT_DELAY = 2000; // Delay before showing placeholder on empty paragraph
|
|
13
12
|
|
|
14
13
|
export var pluginKey = new PluginKey('placeholderPlugin');
|
|
15
14
|
export var placeholderPlugin = function placeholderPlugin(_ref) {
|
|
16
15
|
var options = _ref.config,
|
|
17
16
|
api = _ref.api;
|
|
18
|
-
if (!fg('platform_editor_placeholder_plugin_tidying')) {
|
|
19
|
-
return placeholderPluginLegacy({
|
|
20
|
-
config: options,
|
|
21
|
-
api: api
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
17
|
var currentPlaceholder = options === null || options === void 0 ? void 0 : options.placeholder;
|
|
25
18
|
return {
|
|
26
19
|
name: 'placeholder',
|
|
@@ -64,10 +57,25 @@ export var placeholderPlugin = function placeholderPlugin(_ref) {
|
|
|
64
57
|
}];
|
|
65
58
|
},
|
|
66
59
|
contentComponent: expValEquals('confluence_load_editor_title_on_transition', 'contentPlaceholder', true) ? function (params) {
|
|
67
|
-
var _params$editorView;
|
|
60
|
+
var _params$editorView, _params$editorView2;
|
|
61
|
+
// If loading spinner is explicitly disabled (e.g., for DiffEditor/version history), skip
|
|
62
|
+
if ((options === null || options === void 0 ? void 0 : options.enableLoadingSpinner) === false) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
var doc = (_params$editorView = params.editorView) === null || _params$editorView === void 0 ? void 0 : _params$editorView.state.doc;
|
|
66
|
+
|
|
68
67
|
// @ts-ignore fix which needs follow up to use standard apis
|
|
69
|
-
var collabEditPluginState = (_params$
|
|
68
|
+
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
69
|
if (collabEditPluginState && collabEditPluginState.isReady !== true) {
|
|
70
|
+
if (doc && !isEmptyDocument(doc)) {
|
|
71
|
+
// If we have a document, and it's not empty - we should not show a loading component
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// In this scenario
|
|
76
|
+
// - the collab plugin exists - but we don't have a "initial/placeholder" document
|
|
77
|
+
// - and the collab plugin is not yet ready
|
|
78
|
+
// So we show a placeholder spinner to indicate the content is still loading
|
|
71
79
|
return /*#__PURE__*/React.createElement(Box, {
|
|
72
80
|
xcss: spinnerContainerStyles.spinnerContainer
|
|
73
81
|
}, /*#__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.
|
|
3
|
+
"version": "7.2.4",
|
|
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.
|
|
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": "^
|
|
41
|
-
"@atlaskit/tokens": "^10.
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^17.2.0",
|
|
41
|
+
"@atlaskit/tokens": "^10.1.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/editor-common": "^111.
|
|
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"
|
|
@@ -57,9 +57,6 @@
|
|
|
57
57
|
"platform_editor_ai_aifc_patch_ga_blockers": {
|
|
58
58
|
"type": "boolean"
|
|
59
59
|
},
|
|
60
|
-
"platform_editor_placeholder_plugin_tidying": {
|
|
61
|
-
"type": "boolean"
|
|
62
|
-
},
|
|
63
60
|
"platform_editor_ai_aifc_adf_placeholder": {
|
|
64
61
|
"type": "boolean"
|
|
65
62
|
}
|