@atlaskit/editor-plugin-placeholder 26.0.3 → 26.0.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 +12 -0
- package/dist/cjs/placeholderPlugin.js +2 -2
- package/dist/cjs/pm-plugins/adf-builders.js +5 -4
- package/dist/cjs/pm-plugins/decorations.js +2 -2
- package/dist/cjs/pm-plugins/utils.js +2 -1
- package/dist/es2019/placeholderPlugin.js +1 -1
- package/dist/es2019/pm-plugins/adf-builders.js +3 -2
- package/dist/es2019/pm-plugins/decorations.js +1 -1
- package/dist/es2019/pm-plugins/utils.js +2 -1
- package/dist/esm/placeholderPlugin.js +1 -1
- package/dist/esm/pm-plugins/adf-builders.js +3 -2
- package/dist/esm/pm-plugins/decorations.js +1 -1
- package/dist/esm/pm-plugins/utils.js +2 -1
- package/dist/types/placeholderPluginType.d.ts +6 -5
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +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
|
|
12
|
+
var _isSsr = require("@atlaskit/editor-common/is-ssr");
|
|
13
13
|
var _document = require("@atlaskit/editor-common/utils/document");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
@@ -67,7 +67,7 @@ var placeholderPlugin = exports.placeholderPlugin = function placeholderPlugin(_
|
|
|
67
67
|
},
|
|
68
68
|
contentComponent: function contentComponent(params) {
|
|
69
69
|
var _params$editorView, _params$editorView2;
|
|
70
|
-
if ((0,
|
|
70
|
+
if ((0, _isSsr.isSSR)()) {
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createShortEmptyNodePlaceholderADF = exports.createLongEmptyNodePlaceholderADF = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _code = require("@atlaskit/adf-utils/code");
|
|
8
|
+
var _text = require("@atlaskit/adf-utils/text");
|
|
9
|
+
var _placeholderText = require("@atlaskit/editor-common/messages/placeholder-text");
|
|
9
10
|
var createShortEmptyNodePlaceholderADF = exports.createShortEmptyNodePlaceholderADF = function createShortEmptyNodePlaceholderADF(_ref) {
|
|
10
11
|
var formatMessage = _ref.formatMessage;
|
|
11
12
|
return {
|
|
@@ -13,7 +14,7 @@ var createShortEmptyNodePlaceholderADF = exports.createShortEmptyNodePlaceholder
|
|
|
13
14
|
type: 'doc',
|
|
14
15
|
content: [{
|
|
15
16
|
type: 'paragraph',
|
|
16
|
-
content: [(0,
|
|
17
|
+
content: [(0, _code.code)(formatMessage(_placeholderText.placeholderTextMessages.shortEmptyNodePlaceholderADFSlashShortcut)), (0, _text.text)(' '), (0, _text.text)(formatMessage(_placeholderText.placeholderTextMessages.shortEmptyNodePlaceholderADFSuffix))]
|
|
17
18
|
}]
|
|
18
19
|
};
|
|
19
20
|
};
|
|
@@ -24,7 +25,7 @@ var createLongEmptyNodePlaceholderADF = exports.createLongEmptyNodePlaceholderAD
|
|
|
24
25
|
type: 'doc',
|
|
25
26
|
content: [{
|
|
26
27
|
type: 'paragraph',
|
|
27
|
-
content: [(0,
|
|
28
|
+
content: [(0, _text.text)(formatMessage(_placeholderText.placeholderTextMessages.longEmptyNodePlaceholderADFPrefix)), (0, _text.text)(' '), (0, _code.code)(formatMessage(_placeholderText.placeholderTextMessages.longEmptyNodePlaceholderADFSlashShortcut)), (0, _text.text)(' '), (0, _text.text)(formatMessage(_placeholderText.placeholderTextMessages.longEmptyNodePlaceholderADFSuffix))]
|
|
28
29
|
}]
|
|
29
30
|
};
|
|
30
31
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createPlaceholderDecoration = createPlaceholderDecoration;
|
|
7
7
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
8
8
|
var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
|
|
9
|
-
var
|
|
9
|
+
var _whitespace = require("@atlaskit/editor-common/whitespace/whitespace");
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
@@ -99,7 +99,7 @@ function createPlaceholderDecoration(editorState, placeholderText, placeholderPr
|
|
|
99
99
|
// An issue occurs with the caret where it gets bigger when it's next to a non-editable element like a decoration.
|
|
100
100
|
// See: https://discuss.prosemirror.net/t/chrome-caret-cursor-larger-than-the-text-with-inlined-items/5946/2
|
|
101
101
|
// Adding a zero-width space seems to fix this issue.
|
|
102
|
-
fragment.appendChild(document.createTextNode(
|
|
102
|
+
fragment.appendChild(document.createTextNode(_whitespace.ZERO_WIDTH_SPACE));
|
|
103
103
|
fragment.appendChild(placeholderDecoration);
|
|
104
104
|
return _view.DecorationSet.create(editorState.doc, [_view.Decoration.widget(pos, fragment, {
|
|
105
105
|
side: 0,
|
|
@@ -11,6 +11,7 @@ exports.getPlaceholderState = getPlaceholderState;
|
|
|
11
11
|
exports.setPlaceHolderState = setPlaceHolderState;
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _document = require("@atlaskit/editor-common/utils/document");
|
|
14
15
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
15
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
16
17
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
@@ -204,7 +205,7 @@ function createPlaceHolderStateFrom(_ref3) {
|
|
|
204
205
|
userHadTyped: userHadTyped
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
|
-
if (bracketPlaceholderText && (0,
|
|
208
|
+
if (bracketPlaceholderText && (0, _document.bracketTyped)(editorState) && isEditorFocused) {
|
|
208
209
|
var _$from = editorState.selection.$from;
|
|
209
210
|
// Space is to account for positioning of the bracket
|
|
210
211
|
var bracketHint = ' ' + bracketPlaceholderText;
|
|
@@ -2,7 +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 { isSSR } from '@atlaskit/editor-common/
|
|
5
|
+
import { isSSR } from '@atlaskit/editor-common/is-ssr';
|
|
6
6
|
import { isEmptyDocument } from '@atlaskit/editor-common/utils/document';
|
|
7
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { code
|
|
2
|
-
import {
|
|
1
|
+
import { code } from '@atlaskit/adf-utils/code';
|
|
2
|
+
import { text } from '@atlaskit/adf-utils/text';
|
|
3
|
+
import { placeholderTextMessages as messages } from '@atlaskit/editor-common/messages/placeholder-text';
|
|
3
4
|
export const createShortEmptyNodePlaceholderADF = ({
|
|
4
5
|
formatMessage
|
|
5
6
|
}) => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
2
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
3
|
-
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/
|
|
3
|
+
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace/whitespace';
|
|
4
4
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasDocAsParent, isEmptyDocument, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { bracketTyped } from '@atlaskit/editor-common/utils/document';
|
|
2
3
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
3
4
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -2,7 +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 { isSSR } from '@atlaskit/editor-common/
|
|
5
|
+
import { isSSR } from '@atlaskit/editor-common/is-ssr';
|
|
6
6
|
import { isEmptyDocument } from '@atlaskit/editor-common/utils/document';
|
|
7
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { code
|
|
2
|
-
import {
|
|
1
|
+
import { code } from '@atlaskit/adf-utils/code';
|
|
2
|
+
import { text } from '@atlaskit/adf-utils/text';
|
|
3
|
+
import { placeholderTextMessages as messages } from '@atlaskit/editor-common/messages/placeholder-text';
|
|
3
4
|
export var createShortEmptyNodePlaceholderADF = function createShortEmptyNodePlaceholderADF(_ref) {
|
|
4
5
|
var formatMessage = _ref.formatMessage;
|
|
5
6
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
2
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
3
|
-
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/
|
|
3
|
+
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace/whitespace';
|
|
4
4
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
-
import {
|
|
4
|
+
import { hasDocAsParent, isEmptyDocument, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { bracketTyped } from '@atlaskit/editor-common/utils/document';
|
|
5
6
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
6
7
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { DocNode } from '@atlaskit/adf-schema/doc';
|
|
2
|
-
import type { EditorCommand
|
|
2
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types/editor-command';
|
|
3
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
4
|
import type { CollabEditPlugin } from '@atlaskit/editor-plugin-collab-edit/collabEditPluginType';
|
|
4
|
-
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
5
|
-
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
6
|
-
import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff';
|
|
7
|
-
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
|
+
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition/compositionPluginType';
|
|
6
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus/focusPluginType';
|
|
7
|
+
import type { ShowDiffPlugin } from '@atlaskit/editor-plugin-show-diff/show-diff-plugin-type';
|
|
8
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead/type-ahead-plugin-type';
|
|
8
9
|
import type { PlaceholderPromptAnimationOptions } from './pm-plugins/types';
|
|
9
10
|
export interface PlaceholderPluginOptions {
|
|
10
11
|
emptyLinePlaceholder?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { DocNode } from '@atlaskit/adf-schema/doc';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
5
5
|
import type { PlaceholderPlugin, PlaceholderPluginOptions } from '../placeholderPluginType';
|
|
6
6
|
export default function createPlugin(intl: IntlShape, defaultPlaceholderText?: string, bracketPlaceholderText?: string, emptyLinePlaceholder?: string, placeholderPrompts?: string[], withEmptyParagraph?: boolean, initialIsPlaceholderHidden?: boolean, placeholderADF?: DocNode, placeholderPromptAnimationOptions?: PlaceholderPluginOptions['placeholderPromptAnimationOptions'], isRovoLLMEnabled?: boolean, api?: ExtractInjectionAPI<PlaceholderPlugin>): SafePlugin | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-placeholder",
|
|
3
|
-
"version": "26.0.
|
|
3
|
+
"version": "26.0.5",
|
|
4
4
|
"description": "Placeholder plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
32
32
|
"@atlaskit/primitives": "^22.5.0",
|
|
33
33
|
"@atlaskit/spinner": "^20.4.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^232.0.0",
|
|
35
35
|
"@atlaskit/tokens": "^20.4.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0"
|
|
37
37
|
},
|