Skip to content

Commit

Permalink
Updated the comment - placeholder is also added if no initial placeho…
Browse files Browse the repository at this point in the history
…lder text is passed.
  • Loading branch information
mlewand committed Jul 26, 2023
1 parent ce44c03 commit 8be265b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/ckeditor5-editor-balloon/src/ballooneditorui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class BalloonEditorUI extends EditorUI {
}

/**
* Enable the placeholder text on the editing root, if any was configured.
* Enable the placeholder text on the editing root.
*/
private _initPlaceholder(): void {
const editor = this.editor;
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-editor-classic/src/classiceditorui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class ClassicEditorUI extends EditorUI {
}

/**
* Enable the placeholder text on the editing root, if any was configured.
* Enable the placeholder text on the editing root.
*/
private _initPlaceholder(): void {
const editor = this.editor;
Expand Down
12 changes: 5 additions & 7 deletions packages/ckeditor5-editor-decoupled/src/decouplededitorui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,20 @@ export default class DecoupledEditorUI extends EditorUI {
}

/**
* Enable the placeholder text on the editing root, if any was configured.
* Enable the placeholder text on the editing root.
*/
private _initPlaceholder(): void {
const editor = this.editor;
const editingView = editor.editing.view;
const editingRoot = editingView.document.getRoot()!;

const placeholder = editor.config.get( 'placeholder' );
let placeholderText;

if ( placeholder ) {
placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[ editingRoot.rootName ];
}
const placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[ editingRoot.rootName ];

if ( placeholderText ) {
editingRoot.placeholder = placeholderText;
if ( placeholderText ) {
editingRoot.placeholder = placeholderText;
}
}

enablePlaceholder( {
Expand Down

0 comments on commit 8be265b

Please sign in to comment.