Skip to content

Commit

Permalink
Merge pull request #11036 from ckeditor/ck/10964-rename-liststyle-lis…
Browse files Browse the repository at this point in the history
…tproperties

Other (list): Renames `ListStyle` plugin to `ListProperties`. Closes #10964.
  • Loading branch information
niegowski authored Dec 28, 2021
2 parents c862e85 + 826202d commit 82ce2e9
Show file tree
Hide file tree
Showing 33 changed files with 256 additions and 175 deletions.
2 changes: 1 addition & 1 deletion docs/framework/guides/contributing/code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ Plugins should follow the **feature** or the **feature + sub-feature** conventio
* `SpecialCharacters`
* The **feature + sub-feature** convention:
* `ImageResize`
* `ListStyle`
* `ListProperties`
* `TableClipboard`

Plugins must be named in [UpperCamelCase](http://en.wikipedia.org/wiki/CamelCase).
Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-build-decoupled-document/src/ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Indent from '@ckeditor/ckeditor5-indent/src/indent';
import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
import Link from '@ckeditor/ckeditor5-link/src/link';
import List from '@ckeditor/ckeditor5-list/src/list';
import ListStyle from '@ckeditor/ckeditor5-list/src/liststyle';
import ListProperties from '@ckeditor/ckeditor5-list/src/listproperties';
import MediaEmbed from '@ckeditor/ckeditor5-media-embed/src/mediaembed';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
Expand Down Expand Up @@ -72,7 +72,7 @@ DecoupledEditor.builtinPlugins = [
IndentBlock,
Link,
List,
ListStyle,
ListProperties,
MediaEmbed,
Paragraph,
PasteFromOffice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import LinkEditing from '@ckeditor/ckeditor5-link/src/linkediting';
import LinkImageEditing from '@ckeditor/ckeditor5-link/src/linkimageediting';

import ListEditing from '@ckeditor/ckeditor5-list/src/listediting';
import ListStyleEditing from '@ckeditor/ckeditor5-list/src/liststyleediting';
import ListPropertiesEditing from '@ckeditor/ckeditor5-list/src/listpropertiesediting';
import TodoListEditing from '@ckeditor/ckeditor5-list/src/todolistediting';

import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting';
Expand Down Expand Up @@ -611,7 +611,7 @@ describe( 'HtmlComment integration', () => {
function createEditor( initialData = '' ) {
return ClassicTestEditor
.create( initialData, {
plugins: [ HtmlComment, Essentials, Paragraph, ListEditing, ListStyleEditing, TodoListEditing ]
plugins: [ HtmlComment, Essentials, Paragraph, ListEditing, ListPropertiesEditing, TodoListEditing ]
} );
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-html-support/tests/manual/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import HtmlEmbed from '@ckeditor/ckeditor5-html-embed/src/htmlembed';
import ImageResize from '@ckeditor/ckeditor5-image/src/imageresize';
import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
import LinkImage from '@ckeditor/ckeditor5-link/src/linkimage';
import ListStyle from '@ckeditor/ckeditor5-list/src/liststyle';
import ListProperties from '@ckeditor/ckeditor5-list/src/listproperties';
import PageBreak from '@ckeditor/ckeditor5-page-break/src/pagebreak';
import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';
import Subscript from '@ckeditor/ckeditor5-basic-styles/src/subscript';
Expand All @@ -41,7 +41,7 @@ ClassicEditor
plugins: [
ArticlePluginSet, Underline, Strikethrough, Superscript, Subscript, Code,
FontColor, FontBackgroundColor, FontFamily, FontSize, Highlight,
CodeBlock, TodoList, ListStyle, TableProperties, TableCellProperties, TableCaption,
CodeBlock, TodoList, ListProperties, TableProperties, TableCellProperties, TableCaption,
EasyImage, ImageResize, LinkImage, HtmlEmbed,
Alignment, IndentBlock,
PageBreak, HorizontalLine,
Expand Down
12 changes: 8 additions & 4 deletions packages/ckeditor5-list/ckeditor5-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
]
},
{
"name": "List style",
"className": "ListStyle",
"description": "Enables styling the list item markers for both ordered and unordered lists. You can choose various types of numerals and letters or visual markers to use with these lists.",
"name": "List properties",
"className": "ListProperties",
"description": "Enables styling the list item markers for both ordered and unordered lists. Also enables start index and list reversal for numbered lists. You can choose various types of numerals and letters or visual markers to use with these lists.",
"docs": "features/lists/lists.html#list-styles",
"path": "src/liststyle.js",
"path": "src/listproperties.js",
"requires": [
"List"
],
Expand All @@ -85,6 +85,10 @@
"ol",
"ul"
],
"attributes": [
"start",
"reversed"
],
"styles": "list-style-type"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* globals window */

import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
import ListStyle from '@ckeditor/ckeditor5-list/src/liststyle';
import ListProperties from '@ckeditor/ckeditor5-list/src/listproperties';

window.ClassicEditor = ClassicEditor;
window.ListStyle = ListStyle;
window.ListProperties = ListProperties;
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* globals window, document, console, ClassicEditor, ListStyle */
/* globals window, document, console, ClassicEditor, ListProperties */

import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';

ClassicEditor
.create( document.querySelector( '#snippet-lists-styles' ), {
extraPlugins: [ ListStyle ],
extraPlugins: [ ListProperties ],
toolbar: {
items: [
'heading',
Expand Down
14 changes: 7 additions & 7 deletions packages/ckeditor5-list/docs/features/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ A Markdown code provided by the {@link features/autoformat autoformatting featur

## List styles

The {@link module:list/liststyle~ListStyle list style} feature introduces some more styles for the list item markers. When enabled, it adds 3 styles for unordered lists and 6 styles for ordered lists to choose from. The styles can be changed via the dropdown that opens when you click the arrow next to the appropriate list button in the toolbar.
The {@link module:list/listproperties~ListProperties list style} feature introduces some more styles for the list item markers. When enabled, it adds 3 styles for unordered lists and 6 styles for ordered lists to choose from. The styles can be changed via the dropdown that opens when you click the arrow next to the appropriate list button in the toolbar.

### Demo

Use the editor below to see the list style plugin in action.
Use the editor below to see the list properties plugin in action.

{@snippet features/lists-style}

Expand All @@ -60,14 +60,14 @@ To add this feature to your editor, install the [`@ckeditor/ckeditor5-list`](htt
npm install --save @ckeditor/ckeditor5-list
```

Then add the `ListStyle` plugin to your plugin list and the toolbar configuration:
Then add the `ListProperties` plugin to your plugin list and the toolbar configuration:

```js
import ListStyle from '@ckeditor/ckeditor5-list/src/liststyle';
import ListProperties from '@ckeditor/ckeditor5-list/src/listproperties';

ClassicEditor
.create( document.querySelector( '#editor' ), {
plugins: [ ListStyle, ... ],
plugins: [ ListProperties, ... ],
toolbar: [ 'bulletedList', 'numberedList', ... ],
} )
.then( ... )
Expand All @@ -79,7 +79,7 @@ ClassicEditor
</info-box>

<info-box warning>
The {@link module:list/liststyle~ListStyle} feature overrides UI button implementations from the {@link module:list/listui~ListUI}.
The {@link module:list/listproperties~ListProperties} feature overrides UI button implementations from the {@link module:list/listui~ListUI}.
</info-box>

## List indentation
Expand All @@ -97,7 +97,7 @@ The {@link module:list/list~List} plugin registers:
* The `'numberedList'` UI button.
* The `'bulletedList'` UI button.

The {@link module:list/liststyle~ListStyle} plugin registers:
The {@link module:list/listproperties~ListProperties} plugin registers:

* The {@link module:list/liststylecommand~ListStyleCommand `'listStyle'`} command that accepts a `type` of the list style to set.
```js
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-list/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
export { default as List } from './list';
export { default as ListEditing } from './listediting';
export { default as ListUI } from './listui';
export { default as ListStyle } from './liststyle';
export { default as ListStyleEditing } from './liststyleediting';
export { default as ListStyleUI } from './liststyleui';
export { default as ListProperties } from './listproperties';
export { default as ListPropertiesEditing } from './listpropertiesediting';
export { default as ListPropertiesUI } from './listpropertiesui';
export { default as TodoList } from './todolist';
export { default as TodoListEditing } from './todolistediting';
export { default as TodoListUI } from './todolistui';
94 changes: 94 additions & 0 deletions packages/ckeditor5-list/src/listproperties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/**
* @module list/listproperties
*/

import { Plugin } from 'ckeditor5/src/core';
import ListPropertiesEditing from './listpropertiesediting';
import ListPropertiesUI from './listpropertiesui';

/**
* The list properties feature.
*
* This is a "glue" plugin that loads the {@link module:list/listpropertiesediting~ListPropertiesEditing list properties editing feature}
* and the {@link module:list/listpropertiesui~ListPropertiesUI list properties UI feature}.
*
* @extends module:core/plugin~Plugin
*/
export default class ListProperties extends Plugin {
/**
* @inheritDoc
*/
static get requires() {
return [ ListPropertiesEditing, ListPropertiesUI ];
}

/**
* @inheritDoc
*/
static get pluginName() {
return 'ListProperties';
}
}

/**
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature.
*
* This configuration controls the individual list properties. For instance, it enables or disables specific editor commands
* operating on lists ({@link module:list/liststylecommand~ListStyleCommand `'listStyle'`},
* {@link module:list/liststartcommand~ListStartCommand `'listStart'`},
* {@link module:list/listreversedcommand~ListReversedCommand `'listReversed'`}), the look of the UI
* (`'numberedList'` and `'bulletedList'` dropdowns), and editor data pipeline (allowed HTML attributes).
*
* ClassicEditor
* .create( editorElement, {
* list: {
* properties: {
* styles: true,
* startIndex: true,
* reversed: true
* }
* }
* } )
* .then( ... )
* .catch( ... );
*
* @interface ListPropertiesConfig
*/

/**
* When set, the list style feature will be enabled. It allows changing the `list-style-type` HTML attribute of the lists.
*
* @default true
* @member {Boolean} module:list/listproperties~ListPropertiesConfig#styles
*/

/**
* When set, the list start index feature will be enabled. It allows changing the `start` HTML attribute of the numbered lists.
*
* **Note**: This configuration doesn't affect bulleted and todo lists.
*
* @default false
* @member {Boolean} module:list/listproperties~ListPropertiesConfig#startIndex
*/

/**
* When set, the list reversed feature will be enabled. It allows changing the `reversed` HTML attribute of the numbered lists.
*
* **Note**: This configuration doesn't affect bulleted and todo lists.
*
* @default false
* @member {Boolean} module:list/listproperties~ListPropertiesConfig#reversed
*/

/**
* The configuration of the {@link module:list/listproperties~ListProperties} feature.
*
* Read more in {@link module:list/listproperties~ListPropertiesConfig}.
*
* @member {module:list/listproperties~ListPropertiesConfig} module:list/list~ListConfig#properties
*/
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/**
* @module list/liststyleediting
* @module list/listpropertiesediting
*/

import { Plugin } from 'ckeditor5/src/core';
Expand All @@ -23,11 +23,11 @@ const DEFAULT_LIST_TYPE = 'default';
* allows modifying the list style type.
*
* It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they're enabled in config.
* Read more in {@link module:list/liststyle~ListPropertiesConfig}.
* Read more in {@link module:list/listproperties~ListPropertiesConfig}.
*
* @extends module:core/plugin~Plugin
*/
export default class ListStyleEditing extends Plugin {
export default class ListPropertiesEditing extends Plugin {
/**
* @inheritDoc
*/
Expand All @@ -39,7 +39,7 @@ export default class ListStyleEditing extends Plugin {
* @inheritDoc
*/
static get pluginName() {
return 'ListStyleEditing';
return 'ListPropertiesEditing';
}

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ export default class ListStyleEditing extends Plugin {
editor.conversion.for( 'downcast' ).add( downcastListItemAttributes( strategies ) );

// Handle merging two separated lists into the single one.
this._mergeListStyleAttributeWhileMergingLists( strategies );
this._mergeListAttributesWhileMergingLists( strategies );
}

/**
Expand All @@ -101,7 +101,7 @@ export default class ListStyleEditing extends Plugin {
const editor = this.editor;

// Enable post-fixer that removes the attributes from to-do list items only if the "TodoList" plugin is on.
// We need to registry the hook here since the `TodoList` plugin can be added after the `ListStyleEditing`.
// We need to registry the hook here since the `TodoList` plugin can be added after the `ListPropertiesEditing`.
if ( editor.commands.get( 'todoList' ) ) {
editor.model.document.registerPostFixer( removeListItemAttributesFromTodoList( editor ) );
}
Expand Down Expand Up @@ -133,9 +133,9 @@ export default class ListStyleEditing extends Plugin {
* See https://github.com/ckeditor/ckeditor5/issues/7879.
*
* @private
* @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies Strategies for the enabled attributes.
* @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies Strategies for the enabled attributes.
*/
_mergeListStyleAttributeWhileMergingLists( attributeStrategies ) {
_mergeListAttributesWhileMergingLists( attributeStrategies ) {
const editor = this.editor;
const model = editor.model;

Expand Down Expand Up @@ -255,7 +255,7 @@ export default class ListStyleEditing extends Plugin {
// @param {Boolean} enabledProperties.styles
// @param {Boolean} enabledProperties.reversed
// @param {Boolean} enabledProperties.startIndex
// @returns {Array.<module:list/liststyleediting~AttributeStrategy>}
// @returns {Array.<module:list/listpropertiesediting~AttributeStrategy>}
function createAttributeStrategies( enabledProperties ) {
const strategies = [];

Expand Down Expand Up @@ -347,7 +347,7 @@ function createAttributeStrategies( enabledProperties ) {
// In `style` it searches for the `list-style-type` definition.
// If not found, the `"default"` value will be used.
//
// @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies
// @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies
// @returns {Function}
function upcastListItemAttributes( attributeStrategies ) {
return dispatcher => {
Expand Down Expand Up @@ -375,7 +375,7 @@ function upcastListItemAttributes( attributeStrategies ) {
// Returns a converter that adds `reversed`, `start` attributes and adds `list-style-type` definition as a value for the `style` attribute.
// The `"default"` values are removed and not present in the view/data.
//
// @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies
// @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies
// @returns {Function}
function downcastListItemAttributes( attributeStrategies ) {
return dispatcher => {
Expand Down Expand Up @@ -428,7 +428,7 @@ function downcastListItemAttributes( attributeStrategies ) {
// ■ List item 3.
//
// @param {module:core/editor/editor~Editor} editor
// @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies
// @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies
// @returns {Function}
function fixListAfterIndentListCommand( editor, attributeStrategies ) {
return ( evt, changedItems ) => {
Expand Down Expand Up @@ -483,7 +483,7 @@ function fixListAfterIndentListCommand( editor, attributeStrategies ) {
// ■ List item 3.
//
// @param {module:core/editor/editor~Editor} editor
// @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies
// @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies
// @returns {Function}
function fixListAfterOutdentListCommand( editor, attributeStrategies ) {
return ( evt, changedItems ) => {
Expand Down Expand Up @@ -591,7 +591,7 @@ function fixListAfterOutdentListCommand( editor, attributeStrategies ) {
// ■ List item 3. // ...
//
// @param {module:core/editor/editor~Editor} editor
// @param {Array.<module:list/liststyleediting~AttributeStrategy>} attributeStrategies
// @param {Array.<module:list/listpropertiesediting~AttributeStrategy>} attributeStrategies
// @returns {Function}
function fixListAttributesOnListItemElements( editor, attributeStrategies ) {
return writer => {
Expand Down Expand Up @@ -700,7 +700,7 @@ function fixListAttributesOnListItemElements( editor, attributeStrategies ) {
//
// @param {module:engine/model/element~Element|null} baseItem
// @param {module:engine/model/element~Element} itemToChange
// @param {module:list/liststyleediting~AttributeStrategy} attributeStrategy
// @param {module:list/listpropertiesediting~AttributeStrategy} attributeStrategy
// @returns {Boolean}
function shouldInheritListType( baseItem, itemToChange, attributeStrategy ) {
if ( !baseItem ) {
Expand Down
Loading

0 comments on commit 82ce2e9

Please sign in to comment.