Skip to content
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

Closed
5 of 6 tasks
Reinmar opened this issue Jun 22, 2017 · 22 comments
Closed
5 of 6 tasks

Implement configurable editor's placeholder #479

Reinmar opened this issue Jun 22, 2017 · 22 comments
Assignees
Labels
domain:accessibility This issue reports an accessibility problem. package:core package:engine type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Jun 22, 2017

We could support:

  • config.placeholder = 'Type here...',
  • and even reading the 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).

@vladikoff
Copy link

Ref: mozilla/notes#405

@Reinmar
Copy link
Member Author

Reinmar commented Jan 3, 2018

BTW, I forgot to mention that @alexeckermann wrote a simple plugin which adds a placeholder to the editor: https://github.com/alexeckermann/ckeditor5-emptyness ❤️

@vladikoff
Copy link

@Reinmar Awesome! We are gonna try using that!

@Reinmar Reinmar modified the milestones: iteration 14, iteration 15 Jan 24, 2018
@Reinmar Reinmar modified the milestones: iteration 15, backlog, next Mar 30, 2018
@kirk-quinbar
Copy link

Is this still a TODO item? status?

@alexeckermann
Copy link

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.

@kirk-quinbar
Copy link

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

//ckeditor plugin placeholder text plugin, pulled from placerholder="" on #ReplyTextArea CKEDITOR.plugins.addExternal( 'confighelper', '/ckeditor/confighelper/'); CKEDITOR.config.extraPlugins = '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.

@Reinmar
Copy link
Member Author

Reinmar commented Jul 26, 2018

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?

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

@alexeckermann
Copy link

@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 contenteditable there is no possibility to have a native placeholder attribute supported. Additionally, it has to be added so that it doesn't interfere with the content structure in the editor.

@Reinmar Reinmar removed this from the next milestone Jul 27, 2018
@sauravraj95

This comment has been minimized.

1 similar comment
@Ghustavh97

This comment has been minimized.

@oleq
Copy link
Member

oleq commented Feb 6, 2019

@Mgsy Could you take a look at the t/479 constellation (in ckeditor5)?

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.

@Mgsy
Copy link
Member

Mgsy commented Feb 7, 2019

@Mgsy Could you take a look at the t/479 constellation (in ckeditor5)?

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):

 TypeError: Object doesn't support property or method 'Symbol.iterator'
   at View.prototype.attachDomRoot (http://192.168.1.48:8125/ckeditor5-core/tests/manual/article.js:77674:3)
   at ClassicEditorUI.prototype.init (http://192.168.1.48:8125/ckeditor5-core/tests/manual/article.js:38984:3)
   at Anonymous function (http://192.168.1.48:8125/ckeditor5-core/tests/manual/article.js:38844:19)

@oleq
Copy link
Member

oleq commented Feb 7, 2019

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?

pjasiun pushed a commit to ckeditor/ckeditor5-core that referenced this issue Feb 7, 2019
Docs: Introduced `EditorConfig#placeholder`. Aligned `ClassicTestEditor` to the latest `InlineEditableUIView` API (see ckeditor/ckeditor5#479).
pjasiun pushed a commit to ckeditor/ckeditor5-editor-balloon that referenced this issue Feb 7, 2019
Feature: Enabled the balloon editor placeholder (see ckeditor/ckeditor5#479).

BREAKING CHANGE: The second argument of `BalloonEditorUIView.constructor()` is an editing view instance now.
pjasiun pushed a commit to ckeditor/ckeditor5-editor-classic that referenced this issue Feb 7, 2019
Feature: Enabled the classic editor placeholder (see ckeditor/ckeditor5#479).
pjasiun pushed a commit to ckeditor/ckeditor5-editor-decoupled that referenced this issue Feb 7, 2019
Feature: Enabled the decoupled editor placeholder (see ckeditor/ckeditor5#479).

BREAKING CHANGE: The second argument of `DecoupledEditorUIView.constructor()` is an editing view instance now.
pjasiun pushed a commit to ckeditor/ckeditor5-editor-inline that referenced this issue Feb 7, 2019
Feature: Enabled the inline editor placeholder (see ckeditor/ckeditor5#479).

BREAKING CHANGE: The second argument of `InlineEditorUIView.constructor()` is an editing view instance now.
pjasiun pushed a commit to ckeditor/ckeditor5-image that referenced this issue Feb 7, 2019
Internal: Aligned to changes in the engine API (renamed `attachPlaceholder()` to `addPlaceholder()` (see ckeditor/ckeditor5#479).
pjasiun pushed a commit to ckeditor/ckeditor5-widget that referenced this issue Feb 7, 2019
Tests: Aligned tests to the new editing view behavior (see ckeditor/ckeditor5#479).
pjasiun pushed a commit to ckeditor/ckeditor5-ui that referenced this issue Feb 7, 2019
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).
pjasiun pushed a commit to ckeditor/ckeditor5-engine that referenced this issue Feb 7, 2019
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()`.
pjasiun pushed a commit that referenced this issue Feb 7, 2019
Docs: Created the "Editor placeholder" guide. Closes #479.
oleq added a commit to ckeditor/ckeditor5-engine that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-editor-balloon that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-editor-decoupled that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-editor-classic that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-editor-inline that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-engine that referenced this issue Feb 7, 2019
oleq added a commit to ckeditor/ckeditor5-editor-balloon that referenced this issue Feb 7, 2019
@Reinmar Reinmar added the domain:accessibility This issue reports an accessibility problem. label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:accessibility This issue reports an accessibility problem. package:core package:engine type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests