-
-
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
Implement configurable editor's placeholder #479
Comments
Ref: mozilla/notes#405 |
BTW, I forgot to mention that @alexeckermann wrote a simple plugin which adds a placeholder to the editor: https://github.com/alexeckermann/ckeditor5-emptyness ❤️ |
@Reinmar Awesome! We are gonna try using that! |
Is this still a TODO item? status? |
Look as though from the tags above that its been pushed to a future milestone but not any known milestone in the pipeline. The emptyness plugin mentioned above is what I am using in production at the moment as a solution. It will also be greatly improved soon pending some pull requests in CK5 to fix some integration issues. If you need any help with that just let me know. |
alexeckermann, I took a look at the overview of your plugin and did have a question. Your overview talks about making a custom build of ckeditor to pull that plugin in, but I was wondering if there is a way to just do that at runtime. There is a plugin for CKEditor v4 that is commonly used to provide this same type of html5 placeholder. It was written by a guy named alfonsoML. His plugin you could just load at runtime when the editor instance was created similar to this: https://github.com/AlfonsoML/confighelper
Not sure if that was a v4 feature that isnt in v5 as i didnt dig that far yet, but I was hoping that maybe your plugin could just be loaded at the time the instance is created to and how I could go about doing that? The other thing that was nice about his was that you could just set the standard html5 placeholder property on the textarea and it would read that one instead of having its own property. not a big deal but kept the coding standard for how placeholders are typically added to textboxes and textareas. |
It depends on a plugin. Technically speaking, some can be loaded on runtime. But it's safer to assume that it cannot be loaded on runtime. We wrote more about it in https://docs.ckeditor.com/ckeditor5/latest/builds/guides/integration/installing-plugins.html |
@kirk-quinbar The emptiness plugin will need to be loaded with the editor during its initialisation, it can't be loaded thereafter because of view extension restrictions after rendering. Moreover, because of duplicated dependencies it would get out of hand really quickly. I would highly recommend setting up a custom build, even if its to add one or two plugins to a base editor. If thats not possible or unsuitable let me know (email in my profile) and I can help put something together for you. Since the editor uses |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@Mgsy Could you take a look at the There are some new manual tests (called "placeholder" in ckeditor5-editor-*) but also some serious changes were made to the architecture and it would be great if we knew that the editor is still rock–solid in other, normal, non–placeholder use cases. |
I was playing with those changes and found a problem in Edge. The editor doesn't initialize and throws the error (works fine on the master):
|
It looks like Edge does not offer DOM element attributes as iterable. Curious... it passed CI. Don't we run tests on Edge in CI? |
Docs: Introduced `EditorConfig#placeholder`. Aligned `ClassicTestEditor` to the latest `InlineEditableUIView` API (see ckeditor/ckeditor5#479).
Feature: Enabled the balloon editor placeholder (see ckeditor/ckeditor5#479). BREAKING CHANGE: The second argument of `BalloonEditorUIView.constructor()` is an editing view instance now.
Feature: Enabled the classic editor placeholder (see ckeditor/ckeditor5#479).
Feature: Enabled the decoupled editor placeholder (see ckeditor/ckeditor5#479). BREAKING CHANGE: The second argument of `DecoupledEditorUIView.constructor()` is an editing view instance now.
Feature: Enabled the inline editor placeholder (see ckeditor/ckeditor5#479). BREAKING CHANGE: The second argument of `InlineEditorUIView.constructor()` is an editing view instance now.
Internal: Aligned to changes in the engine API (renamed `attachPlaceholder()` to `addPlaceholder()` (see ckeditor/ckeditor5#479).
Tests: Aligned tests to the new editing view behavior (see ckeditor/ckeditor5#479).
Internal: Moved the `EditableUIView` and `InlineEditableUIView` attributes management to the engine (see ckeditor/ckeditor5#479). Closes ckeditor/ckeditor5#798. BREAKING CHANGE: The `EditableUIView#isReadOnly` property has been removed. Use the engine `EditableElement#isReadOnly` instead. BREAKING CHANGE: The second argument of `EditableUIView.constructor()` and `InlineEditableUIView.constructor()` became the instance of the editing view (previously an optional editable element reference).
Feature: Moved the root element DOM attributes management from the UI to the engine. Made it possible to use `addPlaceholder()` (now `enablePlaceholder()`) on the root editable. Introduced the `View.detachDomRoot()` method. Implemented additional placeholder helpers (`showPlaceholder()`, `hidePlaceholder()`, `needsPlaceholder()`) (see ckeditor/ckeditor5#479). Closes #899. BREAKING CHANGE: The `attachPlaceholder()` has been renamed to `enablePlaceholder()`. BREAKING CHANGE: `enablePlaceholder()` accepts a configuration object instead of separate parameters. BREAKING CHANGE: The `detachPlaceholder()` has been renamed to `disablePlaceholder()`.
Docs: Created the "Editor placeholder" guide. Closes #479.
…iterable in MS Edge (see ckeditor/ckeditor5#479).
…ttributes in MSEdge (see ckeditor/ckeditor5#479).
…ttributes in MSEdge (see ckeditor/ckeditor5#479).
…ttributes in MSEdge (see ckeditor/ckeditor5#479).
…ttributes in MSEdge (see ckeditor/ckeditor5#479).
…ttributes in MSEdge (see ckeditor/ckeditor5#479).
We could support:
config.placeholder = 'Type here...'
,placeholder
from the editor element if the editor was initialised on a textarea.We should also:
Of course, it will depend on editor creator how to set the placeholder (e.g. some creators may have multiple editables and then they will have to support setting multiple placeholders in
config.placeholder
).The text was updated successfully, but these errors were encountered: