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

<ul type> & <ol type> #11699

Merged
merged 6 commits into from
May 6, 2022
Merged

<ul type> & <ol type> #11699

merged 6 commits into from
May 6, 2022

Conversation

arkflpc
Copy link
Contributor

@arkflpc arkflpc commented May 4, 2022

Suggested merge commit message (convention)

Feature (list): Adds support for type attribute of <ul> and <ol> elements in addition to list-style-type style. Closes #11615.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@arkflpc arkflpc requested a review from oleq May 4, 2022 08:20
* Converts `list-style-type` style to `type` attribute of `<ul>` or `<ol>` elements.
*
* @param {String} value
* @retun {String|null}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return

* Converts `type` attribute of `<ul>` or `<ol>` elements to `list-style-type` equivalent.
*
* @param {String} value
* @retun {String|null}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return

writer.removeStyle( 'list-style-type', element );
}
},
setAttributeOnDowncast: useAttribute ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing wrong with keeping this logic within a single function. Using tenary operator like this only makes it harder to read.

@@ -68,7 +68,7 @@ export default class ListProperties extends Plugin {
* When set, the list style feature will be enabled. It allows changing the `list-style-type` HTML attribute of the lists.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth mentioning here that it's controlling either list-style-type style or the type attribute depending on the value.

packages/ckeditor5-list/src/listproperties.js Outdated Show resolved Hide resolved
@@ -277,7 +277,12 @@ function createListPropertiesView( {
listStyleCommand
} );

styleButtonViews = styleDefinitions.map( styleButtonCreator );
// The command can be ListStyleCommand or DocumentListStyleComman. Let's checks if it has expected function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DocumentListStyleCommand

@@ -87,7 +87,8 @@
],
"attributes": [
"start",
"reversed"
"reversed",
"type"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is OK? Only the DocumentListProperties supports the type attribute. ListProperties is incapable of returning type in the data pipeline.

Copy link
Member

@oleq oleq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Minor changes requested.

@oleq oleq merged commit a6c677f into master May 6, 2022
@oleq oleq deleted the ck/11615-ul-ol-type-attribute branch May 6, 2022 08:08
@wimleers
Copy link

wimleers commented May 6, 2022

YAY! This unblocks https://www.drupal.org/project/drupal/issues/3274635 — which means Drupal will be able to offer the superior list type UX that CKE5 supports, instead of the GHS-based work-around we were planning to ship with in https://www.drupal.org/project/drupal/issues/3274651 👍 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<ul type> and <ol type> not supported by List nor ListProperties
3 participants