-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Placeholder after initialization #14627
Update Placeholder after initialization #14627
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of remarks, there was also no breaking change information - be sure to add it as this is a backward-incompatible change.
Also, I don't see a PR in collaboration features repo. You must also add a related PR in there as at least commenteditor.ts file uses the enablePlaceholder
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following docs are no longer true:
* To change the placeholder text, simply call this method again with new options. |
You should update it so that it describes how one should change the placeholder from here on.
* Enable the placeholder text on the editing root, if any was configured. |
Be sure to check the surrounding API docs when changing something.
Enable the placeholder text on the editing root, if any was configured.
"if any was configured" part is no longer true after your changes. Because placeholder mechanism is added anyway and it listens to the placeholder
property.
Logic like that:
ckeditor5/packages/ckeditor5-editor-balloon/src/ballooneditorui.ts
Lines 108 to 128 in ce44c03
private _initPlaceholder(): void { | |
const editor = this.editor; | |
const editingView = editor.editing.view; | |
const editingRoot = editingView.document.getRoot()!; | |
const placeholder = editor.config.get( 'placeholder' ); | |
if ( placeholder ) { | |
const placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[ editingRoot.rootName ]; | |
if ( placeholderText ) { | |
editingRoot.placeholder = placeholderText; | |
} | |
} | |
enablePlaceholder( { | |
view: editingView, | |
element: editingRoot, | |
isDirectHost: false, | |
keepOnFocus: true | |
} ); | |
} |
Is repeated in multiple places. It would be a good idea to make a common helper reused by all the editor UIs.
I'll handle the review comments to conclude this PR. |
Suggested merge commit message (convention)
MINOR BREAKING CHANGE (engine): placeholder could be be updated after initialization. Closes #9925.
Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.