Content authoring

The settings within this section control the experience of content editing for your users. It's quite a complex area with many options, so we'll go through one step at a time.

Text formats and editors

Go to Configuration | Text formatters and editors (admin/config/content/formats).

You will see four text formats listed, the particular JavaScript editor that is assigned to them, and which roles can use them:

Text formats and editors

CKEditor is the name of the WYSIWYG editor included with Drupal 8.

We first looked at fields back in Chapters 3, Basic concepts, and Chapter 4, Getting Started with the UI. You also touched on the idea of text formats back in Chapter 5, Basic Content when you first looked at creating and editing page content, specifically the Body field, which is a text area rather than simply a single line of text.

Text formats apply whenever there is a text area field in use. It is possible to specify a text formatter on a per-field basis.

The idea of text formatters is that different markup effects can be applied in different scenarios. For example, you may not want people adding links in article comments.

In normal use, the text formats are allocated to a site role (see roles and permissions in Chapter 9, Users and Access Control). Thus, some users can use advanced formatting while others may only have more restricted options.

Let's explore this by looking at the Basic HTML format. Click on the Configure button on the Basic HTML row.

Text formats and editors

We can decide which roles are permitted to use this text format. You'll see from the checkboxes that this formatter can be accessed by users when they are logged in to the site.

Text formats and editors

Tip

Note that there is also a dropdown menu that suggests that you can choose from a variety of JavaScript editors in addition to the CKEditor. However, by default, there are no other editors installed.

You'll recall how, back in Chapter 5, Basic Content, we were able to demonstrate how the toolbar changes when you switch between Basic HTML and Full HTML.

You can configure the toolbar that is available to the user when editing text areas in this particular text format.

Text formats and editors

Try dragging some buttons from the available list to the active toolbar now. You'd most likely want to do this if the type of content you are creating calls for addition HTML elements, for example, superscript or subscript if you are creating mathematical content.

As a rule, we want to keep the Basic HTML format simple so that it is easy for all content editors to understand.

Further down the page, we have the CKEditor plugin settings. It is configured so that you can include images within text areas and those images will be automatically uploaded to Drupal.

Text formats and editors

Tip

Not everyone likes this function as it is very easy to break the layout of a page by uploading an image of an inappropriate size directly into an HTML area. We recommend using image fields instead wherever practical, like the one you saw in Chapter 5, Basic Content when you created your first Article.

If you don't want to allow images to be uploaded to text area fields that are using this format, untick the Enable image uploads box.

Note that dragging away the image button also removes the plugin:

Text formats and editors

In general, adding or removing elements from the toolbar will also adjust the corresponding plugins and their respective settings.

The final three sections of the screen (Enabled filters, Filter processing order, and Filter settings) work in combination.

There are a number of filters that can be set to automatically apply. The filters are actually applied at the time of building the page and do not modify the original content. We'll go through in detail what each one of these does, but you'll see here that you can easily enable and disable the filters using the checkboxes.

Text formats and editors

Underneath the filter list, you'll see that some filters have a settings panel and the order in which filters are applied can be changed by dragging them up and down the list.

Depending on what you are looking to achieve, the order in which the enabled filters are applied could be important.

Text formats and editors

Available filters

Name

Description

Limit allowed HTML tags

Strips out any HTML in the content except for those tags included in this list.

Note that you can specify which HTML tags you want to allow in the settings for this filter.

Display any HTML as plain text

Do not allow any HTML markup at all—strip these out completely and only display as plain text.

Convert line breaks into HTML

When the user has entered line breaks and paragraph breaks in the editor, convert these to <br> and <p> tags so that the same layout is achieved in a web browser.

Convert URLs into links

If a URL is entered in the text, automatically make this a link so that the user doesn't have to when creating the content.

Align images

This applies an HTML 5 standard attribute to image tags to correctly align them.

Caption images

This applies an HTML 5 standard attribute for image captions.

Restrict images to this site

This ensures that images used are hosted within the same domain so that you cannot reference images on an external source.

Correct faulty and chopped off HTML

If the user has entered html directly, attempt to correct any mistakes or missing tags.

Track images uploaded via a Text Editor

This ensures that images uploaded via the editor are displayed correctly if they are updated elsewhere in Drupal for example, by editing the image in the files tab under:

Manage | Content | Files (admin/content/files)

Don't forget to save your settings after making alterations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset