@ckeditor/ckeditor5-list
Advanced tools
Comparing version 23.1.0 to 24.0.0
{ | ||
"name": "@ckeditor/ckeditor5-list", | ||
"version": "23.1.0", | ||
"version": "24.0.0", | ||
"description": "Ordered and unordered lists feature to CKEditor 5.", | ||
@@ -13,24 +13,24 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^23.1.0", | ||
"@ckeditor/ckeditor5-engine": "^23.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^23.1.0", | ||
"@ckeditor/ckeditor5-ui": "^23.1.0", | ||
"@ckeditor/ckeditor5-utils": "^23.1.0" | ||
"@ckeditor/ckeditor5-core": "^24.0.0", | ||
"@ckeditor/ckeditor5-engine": "^24.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^24.0.0", | ||
"@ckeditor/ckeditor5-ui": "^24.0.0", | ||
"@ckeditor/ckeditor5-utils": "^24.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^23.1.0", | ||
"@ckeditor/ckeditor5-block-quote": "^23.1.0", | ||
"@ckeditor/ckeditor5-clipboard": "^23.1.0", | ||
"@ckeditor/ckeditor5-essentials": "^23.1.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^23.1.0", | ||
"@ckeditor/ckeditor5-enter": "^23.1.0", | ||
"@ckeditor/ckeditor5-font": "^23.1.0", | ||
"@ckeditor/ckeditor5-heading": "^23.1.0", | ||
"@ckeditor/ckeditor5-highlight": "^23.1.0", | ||
"@ckeditor/ckeditor5-indent": "^23.1.0", | ||
"@ckeditor/ckeditor5-link": "^23.1.0", | ||
"@ckeditor/ckeditor5-remove-format": "^23.1.0", | ||
"@ckeditor/ckeditor5-table": "^23.1.0", | ||
"@ckeditor/ckeditor5-typing": "^23.1.0", | ||
"@ckeditor/ckeditor5-undo": "^23.1.0" | ||
"@ckeditor/ckeditor5-basic-styles": "^24.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^24.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^24.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^24.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^24.0.0", | ||
"@ckeditor/ckeditor5-enter": "^24.0.0", | ||
"@ckeditor/ckeditor5-font": "^24.0.0", | ||
"@ckeditor/ckeditor5-heading": "^24.0.0", | ||
"@ckeditor/ckeditor5-highlight": "^24.0.0", | ||
"@ckeditor/ckeditor5-indent": "^24.0.0", | ||
"@ckeditor/ckeditor5-link": "^24.0.0", | ||
"@ckeditor/ckeditor5-remove-format": "^24.0.0", | ||
"@ckeditor/ckeditor5-table": "^24.0.0", | ||
"@ckeditor/ckeditor5-typing": "^24.0.0", | ||
"@ckeditor/ckeditor5-undo": "^24.0.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "engines": { |
@@ -117,5 +117,5 @@ /** | ||
// First the most-outer `listItem` in the first list reference. | ||
// If found, lists should be merged and this `listItem` provides the `listStyle` attribute | ||
// and it' also a starting point when searching for items in the second list. | ||
// First the outer-most`listItem` in the first list reference. | ||
// If found, the lists should be merged and this `listItem` provides the `listStyle` attribute | ||
// and it is also a starting point when searching for items in the second list. | ||
let firstMostOuterItem; | ||
@@ -253,4 +253,4 @@ | ||
// | ||
// @param {module:engine/model/element~Element} listItem1 The first list item to check. | ||
// @param {module:engine/model/element~Element|null} listItem2 The second list item to check. | ||
// @param {module:engine/model/element~Element} `listItem1` The first list item to check. | ||
// @param {module:engine/model/element~Element|null} `listItem2` The second list item to check. | ||
// @returns {Boolean} | ||
@@ -300,3 +300,3 @@ function areRepresentingSameList( listItem1, listItem2 ) { | ||
// A case where a few list items are intended must be checked separately | ||
// A case where a few list items are indented must be checked separately | ||
// since `getSiblingListItem()` returns the first changed element. | ||
@@ -496,4 +496,29 @@ // ■ List item 1. | ||
} | ||
wasFixed = true; | ||
} else { | ||
// Adjust the `listStyle` attribute for inserted (pasted) items. See #8160. | ||
// | ||
// ■ List item 1. // [listStyle="square", listType="bulleted"] | ||
// ○ List item 1.1. // [listStyle="circle", listType="bulleted"] | ||
// ○ [] (selection is here) | ||
// | ||
// Then, pasting a list with different attributes (listStyle, listType): | ||
// | ||
// 1. First. // [listStyle="decimal", listType="numbered"] | ||
// 2. Second // [listStyle="decimal", listType="numbered"] | ||
// | ||
// The `listType` attribute will be corrected by the `ListEditing` converters. | ||
// We need to adjust the `listStyle` attribute. Expected structure: | ||
// | ||
// ■ List item 1. // [listStyle="square", listType="bulleted"] | ||
// ○ List item 1.1. // [listStyle="circle", listType="bulleted"] | ||
// ○ First. // [listStyle="circle", listType="bulleted"] | ||
// ○ Second // [listStyle="circle", listType="bulleted"] | ||
const previousSibling = item.previousSibling; | ||
wasFixed = true; | ||
if ( shouldInheritListTypeFromPreviousItem( previousSibling, item ) ) { | ||
writer.setAttribute( 'listStyle', previousSibling.getAttribute( 'listStyle' ), item ); | ||
wasFixed = true; | ||
} | ||
} | ||
@@ -504,32 +529,64 @@ } | ||
}; | ||
} | ||
// Checks whether the `listStyle` attribute should be copied from the `baseItem` element. | ||
// | ||
// The attribute should be copied if the inserted element does not have defined it and | ||
// the value for the element is other than default in the base element. | ||
// | ||
// @param {module:engine/model/element~Element|null} baseItem | ||
// @param {module:engine/model/element~Element} itemToChange | ||
// @returns {Boolean} | ||
function shouldInheritListType( baseItem, itemToChange ) { | ||
if ( !baseItem ) { | ||
return false; | ||
} | ||
// Checks whether the `listStyle` attribute should be copied from the `baseItem` element. | ||
// | ||
// The attribute should be copied if the inserted element does not have defined it and | ||
// the value for the element is other than default in the base element. | ||
// | ||
// @param {module:engine/model/element~Element|null} baseItem | ||
// @param {module:engine/model/element~Element} itemToChange | ||
// @returns {Boolean} | ||
function shouldInheritListType( baseItem, itemToChange ) { | ||
if ( !baseItem ) { | ||
return false; | ||
} | ||
const baseListStyle = baseItem.getAttribute( 'listStyle' ); | ||
const baseListStyle = baseItem.getAttribute( 'listStyle' ); | ||
if ( !baseListStyle ) { | ||
return false; | ||
} | ||
if ( !baseListStyle ) { | ||
return false; | ||
} | ||
if ( baseListStyle === DEFAULT_LIST_TYPE ) { | ||
return false; | ||
} | ||
if ( baseListStyle === DEFAULT_LIST_TYPE ) { | ||
return false; | ||
} | ||
if ( baseItem.getAttribute( 'listType' ) !== itemToChange.getAttribute( 'listType' ) ) { | ||
return false; | ||
} | ||
if ( baseItem.getAttribute( 'listType' ) !== itemToChange.getAttribute( 'listType' ) ) { | ||
return false; | ||
} | ||
return true; | ||
return true; | ||
} | ||
// Checks whether the `listStyle` attribute should be copied from previous list item. | ||
// | ||
// The attribute should be copied if there's a mismatch of styles of the pasted list into a nested list. | ||
// Top-level lists are not normalized as we allow side-by-side list of different types. | ||
// | ||
// @param {module:engine/model/element~Element|null} previousItem | ||
// @param {module:engine/model/element~Element} itemToChange | ||
// @returns {Boolean} | ||
function shouldInheritListTypeFromPreviousItem( previousItem, itemToChange ) { | ||
if ( !previousItem || !previousItem.is( 'element', 'listItem' ) ) { | ||
return false; | ||
} | ||
if ( itemToChange.getAttribute( 'listType' ) !== previousItem.getAttribute( 'listType' ) ) { | ||
return false; | ||
} | ||
const previousItemIndent = previousItem.getAttribute( 'listIndent' ); | ||
if ( previousItemIndent < 1 || previousItemIndent !== itemToChange.getAttribute( 'listIndent' ) ) { | ||
return false; | ||
} | ||
const previousItemListStyle = previousItem.getAttribute( 'listStyle' ); | ||
if ( !previousItemListStyle || previousItemListStyle === itemToChange.getAttribute( 'listStyle' ) ) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
@@ -578,3 +635,3 @@ | ||
// Returns `listItem` that were inserted or changed. | ||
// Returns the `listItem` that was inserted or changed. | ||
// | ||
@@ -581,0 +638,0 @@ // @param {Array.<Object>} changes The changes list returned by the differ. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
388671
3528
+ Added@ckeditor/ckeditor5-core@24.0.0(transitive)
+ Added@ckeditor/ckeditor5-engine@24.0.0(transitive)
+ Added@ckeditor/ckeditor5-paragraph@24.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@24.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@24.0.0(transitive)
- Removed@ckeditor/ckeditor5-core@23.1.0(transitive)
- Removed@ckeditor/ckeditor5-engine@23.1.0(transitive)
- Removed@ckeditor/ckeditor5-paragraph@23.1.0(transitive)
- Removed@ckeditor/ckeditor5-ui@23.1.0(transitive)
- Removed@ckeditor/ckeditor5-utils@23.1.0(transitive)