Skip to content

Commit

Permalink
Fixed handling for placeholders in inline editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Jul 26, 2023
1 parent 8be265b commit 54a683f
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions packages/ckeditor5-editor-inline/src/inlineeditorui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,27 @@ export default class InlineEditorUI 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;
}
}

if ( placeholderText ) {
enablePlaceholder( {
view: editingView,
element: editingRoot,
isDirectHost: false,
keepOnFocus: true
} );
}
enablePlaceholder( {
view: editingView,
element: editingRoot,
isDirectHost: false,
keepOnFocus: true
} );
}
}

0 comments on commit 54a683f

Please sign in to comment.