Skip to content

Commit 15481a9

Browse files
committed
refactor: rename placeholderOnEmpty to showPlaceholderOnEmpty across editor components
1 parent 9285705 commit 15481a9

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

apps/web/core/components/editor/lite-text/editor.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const LiteTextEditor = React.forwardRef(function LiteTextEditor(
7272
placeholder = t("issue.comments.placeholder"),
7373
disabledExtensions: additionalDisabledExtensions = [],
7474
editorClassName = "",
75+
showPlaceholderOnEmpty = true,
7576
...rest
7677
} = props;
7778
// states
@@ -154,7 +155,7 @@ export const LiteTextEditor = React.forwardRef(function LiteTextEditor(
154155
}),
155156
}}
156157
placeholder={placeholder}
157-
placeholderOnEmpty={true}
158+
showPlaceholderOnEmpty={showPlaceholderOnEmpty}
158159
containerClassName={cn(containerClassName, "relative", {
159160
"p-2": !editable,
160161
})}

packages/editor/src/core/components/editors/editor-wrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function EditorWrapper(props: Props) {
4141
handleEditorReady,
4242
autofocus,
4343
placeholder,
44-
placeholderOnEmpty,
44+
showPlaceholderOnEmpty,
4545
tabIndex,
4646
value,
4747
} = props;
@@ -68,7 +68,7 @@ export function EditorWrapper(props: Props) {
6868
handleEditorReady,
6969
autofocus,
7070
placeholder,
71-
placeholderOnEmpty,
71+
showPlaceholderOnEmpty,
7272
tabIndex,
7373
value,
7474
});

packages/editor/src/core/extensions/extensions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type TArguments = Pick<
4747
| "isTouchDevice"
4848
| "mentionHandler"
4949
| "placeholder"
50-
| "placeholderOnEmpty"
50+
| "showPlaceholderOnEmpty"
5151
| "tabIndex"
5252
| "extendedEditorProps"
5353
> & {
@@ -66,7 +66,7 @@ export const CoreEditorExtensions = (args: TArguments): Extensions => {
6666
isTouchDevice = false,
6767
mentionHandler,
6868
placeholder,
69-
placeholderOnEmpty,
69+
showPlaceholderOnEmpty,
7070
tabIndex,
7171
editable,
7272
extendedEditorProps,
@@ -110,7 +110,7 @@ export const CoreEditorExtensions = (args: TArguments): Extensions => {
110110
TableCell,
111111
TableRow,
112112
CustomMentionExtension(mentionHandler),
113-
CustomPlaceholderExtension({ placeholder, placeholderOnEmpty }),
113+
CustomPlaceholderExtension({ placeholder, showPlaceholderOnEmpty }),
114114
CharacterCount,
115115
CustomColorExtension,
116116
CustomTextAlignExtension,

packages/editor/src/core/extensions/placeholder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import type { IEditorProps } from "@/types";
66

77
type TArgs = {
88
placeholder: IEditorProps["placeholder"];
9-
placeholderOnEmpty: IEditorProps["placeholderOnEmpty"];
9+
showPlaceholderOnEmpty: IEditorProps["showPlaceholderOnEmpty"];
1010
};
1111

1212
export const CustomPlaceholderExtension = (args: TArgs) => {
13-
const { placeholder, placeholderOnEmpty } = args;
13+
const { placeholder, showPlaceholderOnEmpty } = args;
1414

1515
return Placeholder.configure({
1616
placeholder: ({ editor, node }) => {
@@ -30,7 +30,7 @@ export const CustomPlaceholderExtension = (args: TArgs) => {
3030

3131
if (shouldHidePlaceholder) return "";
3232

33-
if (placeholderOnEmpty) {
33+
if (showPlaceholderOnEmpty) {
3434
const isDocumentEmpty = editor.state.doc.textContent.length === 0;
3535
if (!isDocumentEmpty) {
3636
return "";

packages/editor/src/core/hooks/use-collaborative-editor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
3333
mentionHandler,
3434
onEditorFocus,
3535
placeholder,
36-
placeholderOnEmpty,
36+
showPlaceholderOnEmpty,
3737
realtimeConfig,
3838
serverHandler,
3939
tabIndex,
@@ -120,7 +120,7 @@ export const useCollaborativeEditor = (props: TCollaborativeEditorHookProps) =>
120120
onEditorFocus,
121121
onTransaction,
122122
placeholder,
123-
placeholderOnEmpty,
123+
showPlaceholderOnEmpty,
124124
provider,
125125
tabIndex,
126126
});

packages/editor/src/core/hooks/use-editor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const useEditor = (props: TEditorHookProps) => {
4040
onEditorFocus,
4141
onTransaction,
4242
placeholder,
43-
placeholderOnEmpty,
43+
showPlaceholderOnEmpty,
4444
tabIndex,
4545
provider,
4646
value,
@@ -71,7 +71,7 @@ export const useEditor = (props: TEditorHookProps) => {
7171
isTouchDevice,
7272
mentionHandler,
7373
placeholder,
74-
placeholderOnEmpty,
74+
showPlaceholderOnEmpty,
7575
tabIndex,
7676
provider,
7777
}),

packages/editor/src/core/types/editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export type IEditorProps = {
164164
onEnterKeyPress?: (e?: any) => void;
165165
onTransaction?: () => void;
166166
placeholder?: string | ((isFocused: boolean, value: string) => string);
167-
placeholderOnEmpty?: boolean;
167+
showPlaceholderOnEmpty?: boolean;
168168
tabIndex?: number;
169169
value?: string | null;
170170
extendedEditorProps: IEditorPropsExtended;

packages/editor/src/core/types/hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type TEditorHookProps = TCoreHookProps &
2929
| "onChange"
3030
| "onTransaction"
3131
| "placeholder"
32-
| "placeholderOnEmpty"
32+
| "showPlaceholderOnEmpty"
3333
| "tabIndex"
3434
| "value"
3535
> & {
@@ -51,7 +51,7 @@ export type TCollaborativeEditorHookProps = TCoreHookProps &
5151
| "onChange"
5252
| "onTransaction"
5353
| "placeholder"
54-
| "placeholderOnEmpty"
54+
| "showPlaceholderOnEmpty"
5555
| "tabIndex"
5656
> &
5757
Pick<

0 commit comments

Comments
 (0)