When creating a field with Text (formatted, long) type, then the CKEditor buttons appear and are enabled for use.
But when creating a field with Text (formatted) type, then the CKEditor buttons do not appear.

Comments

liorf created an issue. See original summary.

wim leers’s picture

Status: Active » Closed (works as designed)

Because CKEditor doesn't work for input[type=text], only for textarea.

It doesn't make sense for a tiny rectangular box with only one line of space to write huge piles of formatted text with.

wim leers’s picture

And yes, this is highly confusing :( But not for CKEditor to fix.

wim leers’s picture

Title: WYSIWYG editor does not appear for Text (Formatted) type » CKEditor does not appear for "Text (Formatted)" type, because "Text (Formatted)" makes little sense
Version: 8.1.1 » 8.1.x-dev
Component: ckeditor.module » field system
Priority: Normal » Major
Status: Closed (works as designed) » Active
Issue tags: +Site builder experience (SX)

So, actually, let's move this there.

Bojhan’s picture

Should we offer this at all? This type of field? I guess it makes some sense, if you want to format something like your title?

wim leers’s picture

Should we offer this at all? This type of field?

I think not.

I guess it makes some sense, if you want to format something like your title?

If it's HTML, it can be any HTML anyway. So it feels like the wrong solution even for that.

wim leers’s picture

Issue tags: +DrupalWTF, +Usability
Bojhan’s picture

Yup, deleting this field would be a D9 thing though?

wim leers’s picture

Yes. But we can make it hidden, so that no new sites can start using this confusing field type.

yoroy’s picture

Yeah, this is not a useful combination.

Don't we have this trick where we can hide it by default for new installs and have upgrade/update routines check for it being used and then enable it for existing sites?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

pasqualle’s picture

Title: CKEditor does not appear for "Text (Formatted)" type, because "Text (Formatted)" makes little sense » Remove "Text (Formatted)"
Version: 8.6.x-dev » 9.x-dev
Component: field system » text.module
Category: Bug report » Feature request
wim leers’s picture

🙏

tstoeckler’s picture

I don't think the issue title as is is a good idea. I agree with the "symptom" of the issue that because CKEditor does not work for text input (only textarea) that the current UI is confusing or misleading.

However, I disagree with the proposed solution. The problem is that due to the history of the field system, we have modelled our field types after the form widgets they can be edited with instead of considering the underlying data structure. That is why we have the distinction between "Text (formatted)" and "Text (formatted, long)" in the first place (and the same goes for the "String" field types). Both fields actually store the same data structure, so they should not be two different field types. (The fact that they use different database column types for the text is a) an implementation detail and b) based on legacy restrictions of ancient database versions so are fairly arbitrary nowadays, so should not be relevant for this decision.) We actually have an issue for removing that distinction but I can't find it right now.

And then for the scope of this issue we can still decide that we don't want to allow people to populate formatted text fields via text inputs. We already have mechanisms in place to hide widgets under certain conditions, and possibly we need to improve those mechanisms if we come up with new use-cases here.

pasqualle’s picture

Thinking about it a bit more:

It doesn't make sense for a tiny rectangular box with only one line of space to write huge piles of formatted text with.

Actually I use it like that a lot. I need italic and bold (and a device specific linebreak) on title fields, and need a CKEditor for that.

Switching every text field to longtext can have an impact on performance as the db storage is different, therefore removing "Text (formatted)" field might not be a good idea.
DB storage:
Text (formatted) is a VARCHAR(n)
Text (formatted, long) is LONGTEXT

Can "Text (formatted)" field have an additional widget?
Looks like I need to check the textarea_widget_for_text module. Seems too easy..

xjm’s picture

Title: Remove "Text (Formatted)" » Deprecate "Text (Formatted)"
Version: 9.x-dev » 8.8.x-dev

We would need to deprecate this first in order to remove it. So moving back to a minor branch. (It's likely to end up filed against 9.1.x a couple bulk updates from now, but putting filed in 8.8.x is how we get to that branch.) Thanks!

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

daletrexel’s picture

I'm going to strongly agree with Pasqualle in #19 that there IS a use case for having a wysiwyg editor for shorter text input fields. In my case, I need limited formatting for a title field that includes <em> and the ability to add special symbols (smart quotes, non-English characters, etc.), and the CKEditor WYSIWYG would provide non-technical content editors with the ability to do this without having to know HTML or entity codes. Because this is a short formatted text field, the "Text (formatted)" field type sounds a LOT more appropriate than either "Text (formatted, long)" or "Text (formatted, long, with summary)". It's the obvious choice for this use case, but it is NOT obvious in any of the UI that this option does not provide for the CKEditor toolbar. It just looks broken when you add a text formatter with a configured CKEditor to a "Text (formatted)" field.

The initial assertion at the top of this issue that CKEditor can not be used with input[type=text] is not (no longer?) correct. You can replace any DOM object with CKEditor. In CKE4 although it is "recommended" for only textarea and div elements, there is a proof-of-concept that it's possible with an input[type=text], and CKE5 seems to be even more DOM-agnostic:

Since the "Text (formatted)" field CAN handle non-text HTML, etc., just fine in input[type=text] via a properly formatted text formatter, there is no ideological reason to not also provide the same toolbar that is available to the other formattable-text fields. The main technical challenge appears to be that Drupal's implementation has baked textarea in pretty heavily, which may make expanding it to even only one other DOM element a challenge.

If this field is deprecated, then the other formattable text fields should be re-named to remove the "long" descriptor, which would be both confusing and inaccurate.

It would also be REALLY helpful to have some sort of documentation for all the default field types: how the data are formatted, what they can and can not be used for, etc. Especially where similarly-named field types have different storage configurations that impact their capabilities. I looked all over and found nothing but one stackoverflow question that provided incomplete details on text formats. I'm glad that I finally found this issue, after way too much searching for information about why the CKEditor toolbar was not showing up where I expected it to.

daletrexel’s picture

One more follow up on how Drupal 8 sets up site builders to fail (as it did for me):

  1. The "Text formats and editors" form for adding/editing a text format happily allows you to choose CKEditor and configure a toolbar with NO alerts/warnings that it may not be available on certain formatted text fields (including default ones).
  2. The entity "add field" UI does not provide any information (or links to information) on the differences between field types: you just get to choose a field type to associate with the new field.
  3. Allowed Formats, if enabled, does not flag any of the available CKEditor-using text formatters as inappropriate.
  4. There is a documentation page on core field types, with links, but absolutely no information here on how they're different, even in a general sense: https://www.drupal.org/docs/8/api/entity-api/fieldtypes-fieldwidgets-and-fieldformatters
  5. (Note that the above page lists fields by machine name, whereas the field selection UI presented to site builders is the field label. It's up to the user to figure out that "text" maps to "Text (formatted)".)
  6. The link on the page above to the various fields in the API points to a page that is devoid of any useful information: https://api.drupal.org/api/drupal/core%21modules%21text%21src%21Plugin%21Field%21FieldType%21TextItem.php/8.3.x
  7. And the page linked from that to the class definition is equally lacking in information that might help someone determine how the field is expected to be used: https://api.drupal.org/api/drupal/core%21modules%21text%21src%21Plugin%21Field%21FieldType%21TextItem.php/class/TextItem/8.3.x
  8. When you view a form where you expect to see your CKEditor toolbar above a formatted text field, the output is incomplete and looks like something is broken. There is no indication of what went wrong: Did you miss a crucial configuration? Is this a bug in CKEditor? Or in your particular site's setup? You're going to spend a lot of time trying to debug what appears to be an error before you think "Maybe this is how it's supposed to be."
  9. More on the above point: https://drupal.stackexchange.com/questions/254931/how-to-use-ckeditor-layout-on-textfield-input-drupal-8 The outline that usually surrounds the form item is continuous below the form element for the text formatter details, but just cuts off where normally it would continue above to outline the toolbar. It LOOKS like a rendering error, not expected behavior for a formattable text field that you've properly configured with a text formatter. (The red outline in the image on this page is NOT part of Drupal, but the poster's addition to highlight the problem.)

As long as the "Text (formatted)" field type remains available, but remains incompatible with the CKEditor toolbar, there needs to be some information communicated to the site builder that the text formatter's behavior and appearance will be different from the other formatted text fields.

pasqualle’s picture

Yes, it should be definitely written somewhere: if you want to use CKEditor on "Text (formatted)" field, then use the textarea_widget_for_text module.

I am wondering why it is not mentioned on the project page.

daletrexel’s picture

Thanks, Pasqualle! I just finished trying out the textarea_widget_for_text module and I can confirm that it just works, and is way too easy. Just switch the text field to the new textarea widget and the CKEditor toolbar comes along for the ride.

Looking at the module's code, it would be super easy to accommodate the "Text (formatted)" field in the existing CKEditor implementation if you simply added a condition that implements hook_field_widget_info_alter() to any input[type=text] field configured to use a text formatter for which CKEditor has been implemented. (No need to change anything if the text formatter for the field does NOT use CKEditor.) This would make the field work automatically and consistently like the other formatted text fields, without needing extra documentation pointing to the helper module or explaining why "Text (formatted)" is special.

At the moment, it looks like the CKEditor does not respect the form widgets' height configurations for ANY of the formatted text fields. That would be a very handy fix to implement as well in conjunction with this.

[Edit to add]
I just tried the CKEditorHeight module in conjunction with Textarea widget for text fields and they work great together to handle both the initial problem and my comment about CKEditor height configuration. Both would be great additions to core for making text fields and their configuration consistent and intuitive.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

anthony.bouch’s picture

I'd like to add to Pasqualle and DaleTrexel's comments. We also have a need to use "Text (formatted)" restricted to italic and bold - for our scientific publication libraries. Textarea widget for text fields. Also works great. Would also add CKEditor height options that works to our wish list. "Text (formatted") seems like the appropriate choice in this case.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dave reid’s picture

"Description" fields also make perfect sense to use with Text (Formatted) because I want to enforce a 100-300 maximum character length, but the fields may contain HTML. I don't agree about deprecating the field type, I'd rather be able to use the textarea widgets on it. I think we should take https://www.drupal.org/project/textarea_widget_for_text and make a core patch out of it.

dave reid’s picture

I opened #3344041: Allow textarea widgets to be used for text (formatted) fields to propose allow the textarea fields for these field types in core.

lauriii’s picture

Issue tags: +Field UX

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)

Know we are planning to deprecate #3427095: [Meta] Deprecate text_with_summary do we want to really deprecate both?

dalemoore’s picture

I'm also against deprecating this field as I'm also using the textarea widget for text fields module for the exact same use cases: for adding strong, italics, exponents, etc. in title fields, SDC props, and other short text fields where it doesn't make sense for a full textarea/longtext field. I see I commented in the other issue 2 years ago, and just want to say it still works very well. I have custom text formats explicitly limiting the number of buttons that are used in the CKEditor for these fields.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Agree

Text_with_summary is going to be removed so think this needs to remain.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.