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

Ck/10812 document list editing #11010

Closed
wants to merge 374 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
374 commits
Select commit Hold shift + click to select a range
bf56228
Replace string model with ASCII lists in utils tests
CatStrategist Dec 30, 2021
3f9861e
Merge branch 'ck/10975-document-list-command' of github.com:ckeditor/…
CatStrategist Dec 30, 2021
4471565
WiP.
niegowski Dec 30, 2021
5a00db8
Added list mocking manual test
CatStrategist Jan 4, 2022
f6d94bb
Updated docs. Cleanup.
niegowski Jan 4, 2022
800a927
Fix lost mocking manual test
CatStrategist Jan 4, 2022
0d27ada
Merge branch 'ck/10975-document-list-command' of github.com:ckeditor/…
CatStrategist Jan 4, 2022
b340587
Fix list mocking manual test label
CatStrategist Jan 4, 2022
ceb31f1
Code refactoring.
oleq Jan 4, 2022
e3e2c9b
Apply review comment.
niegowski Jan 4, 2022
162d0fd
Apply review comment.
niegowski Jan 4, 2022
2dc9e98
Apply review comment.
niegowski Jan 4, 2022
31b6aa3
Apply review comment.
niegowski Jan 4, 2022
76fcdfc
Apply review comment.
niegowski Jan 4, 2022
77b7684
Updated docs.
niegowski Jan 4, 2022
7cfad2c
Updated docs.
niegowski Jan 4, 2022
842c89b
Util functions renaming.
niegowski Jan 4, 2022
d2cded2
Prototype of DocumentListMergeCommand.
niegowski Jan 5, 2022
4dd2637
Bootstrapped enter support (and split command).
oleq Jan 5, 2022
c495ba2
Introducing conversion for DocumentListProperties.
niegowski Jan 5, 2022
d51046a
Added support for data downcast.
niegowski Jan 5, 2022
e89652c
Fix list mocking manual test
CatStrategist Jan 7, 2022
a4d2624
Tests: Indent/Outdent refactoring WIP.
oleq Jan 10, 2022
c0bedaa
Outdent/indent aligns list item types.
niegowski Jan 10, 2022
b2bb055
Fix copyoutput mockinglist
CatStrategist Jan 10, 2022
a32f75d
Merge branch 'ck/10975-document-list-command' of github.com:ckeditor/…
CatStrategist Jan 10, 2022
5158462
Cleaning.
niegowski Jan 10, 2022
97e5aeb
Fixed model list stringify.
niegowski Jan 10, 2022
ba75822
Merge pull request #11057 from ckeditor/ck/10975-document-list-command
niegowski Jan 10, 2022
23bd4b2
Merge branch 'ck/10812-document-list-editing' into ck/10879-document-…
oleq Jan 10, 2022
2bc35ac
Merge branch 'ck/10812-document-list-editing' into ck/10878-document-…
niegowski Jan 10, 2022
906dcc3
Cleaning.
niegowski Jan 10, 2022
cdcb9e9
Refactor.
niegowski Jan 11, 2022
410ce8a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 11, 2022
6a6e4ff
WiP.
niegowski Jan 11, 2022
90e77dc
WiP.
niegowski Jan 11, 2022
87aae67
DocumentListSplitCommand implementation + tests.
oleq Jan 12, 2022
3500d83
Let\'s assume EnterCommand will always be present when DocumentListEd…
oleq Jan 12, 2022
d6604f9
Docs.
oleq Jan 12, 2022
c5cc8db
Tests: Moved clipboard and enter integration tests of DocumentListEdi…
oleq Jan 12, 2022
83eb457
Docs.
oleq Jan 12, 2022
df97642
Docs: Moved the EnterCommand#afterExecute listener in DocumentListEdi…
oleq Jan 12, 2022
d3c20e6
Apply review comment.
niegowski Jan 12, 2022
7e627b2
Apply review comment.
niegowski Jan 12, 2022
f46fcef
Docs.
niegowski Jan 12, 2022
9cd6e85
Merge pull request #11098 from ckeditor/ck/10879-document-list-enter
niegowski Jan 12, 2022
279054a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 12, 2022
a9f9754
Finish is enabled for mergelistcommand
CatStrategist Jan 12, 2022
4e22128
Altering enter behavior in the empty first block of a list item.
niegowski Jan 12, 2022
da35c95
The modelList() helper accepts string as input.
niegowski Jan 13, 2022
68f8ee9
Adding tests.
niegowski Jan 13, 2022
f43bdd4
Tests: Added document list enter tests for splitting the list item wh…
oleq Jan 13, 2022
f62c909
Merge pull request #11103 from ckeditor/ck/10879-document-list-enter-2
oleq Jan 13, 2022
ce1228e
Adding tests.
niegowski Jan 13, 2022
4f542fe
Merge branch 'ck/10812-document-list-editing' into ck/10878-document-…
CatStrategist Jan 13, 2022
76a5e18
Merge branch 'ck/10812-document-list-editing' into ck/10878-document-…
CatStrategist Jan 13, 2022
c341ec9
Backspace handling.
niegowski Jan 13, 2022
b8c7489
Code cleaning.
niegowski Jan 14, 2022
48ddf76
Backspace handling for non-collapsed selections.
oleq Jan 18, 2022
b50aa13
Add tests to stringifyList()
CatStrategist Jan 18, 2022
8a5bd88
Adding tests.
niegowski Jan 18, 2022
f81916a
Simplified DocumentListMergeCommand.
oleq Jan 19, 2022
79a5a62
Tests: Settled on expected output in corner cases when merging list i…
oleq Jan 19, 2022
3b61938
Improvements to backspace handling in lists.
oleq Jan 19, 2022
e78e518
Started forward delete integration in document lists.
oleq Jan 19, 2022
208296f
Merge branch 'ck/10294/reconversion' into ck/10812-document-list-editing
niegowski Jan 20, 2022
64cff8d
Updated copyright header.
niegowski Jan 20, 2022
c51bcce
Merge branch 'ck/10294/reconversion' into ck/10812-document-list-editing
niegowski Jan 20, 2022
2dc04e2
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Jan 20, 2022
f5c7cb7
Updated copyright header.
niegowski Jan 20, 2022
96064ae
Support for forward delete.
niegowski Jan 20, 2022
8237e50
WiP.
niegowski Jan 20, 2022
32fd295
WiP.
niegowski Jan 24, 2022
0eb44d8
Adding tests.
niegowski Jan 24, 2022
9c3f0a0
Add tests to document list editing integrations
CatStrategist Jan 24, 2022
03b1406
Code refactoring: split DocumentListEditing integration tests into se…
oleq Jan 25, 2022
1f1173b
Code refactoring in delete/backspace tests.
oleq Jan 25, 2022
7b908fa
Skip DocumentListMergeCommand tests for now. They need refactoring an…
oleq Jan 25, 2022
dd4d81a
Delete and backspace actions in DocumentListEditing should announce t…
oleq Jan 26, 2022
542cc94
WiP.
niegowski Jan 26, 2022
a24effc
WIP.
oleq Jan 27, 2022
253f68c
WiP.
niegowski Jan 27, 2022
c7b3a7f
Code refactoring.
oleq Jan 27, 2022
fed5396
WiP.
niegowski Jan 27, 2022
e71e1c6
Refactored bogus paragraph handling.
niegowski Jan 27, 2022
9adc93e
Allowed selected objects and nested elements to be passed into modelL…
oleq Jan 27, 2022
12f5cfd
Added block and inline widgets to the list mocking manual test.
oleq Jan 27, 2022
0876914
WIP: Added block&inline widget tests to the DocumentListEditing backs…
oleq Jan 27, 2022
27881e3
Resolved conflicts.
oleq Jan 27, 2022
dc1ade4
Updating tests.
niegowski Jan 27, 2022
bb43c5c
Add option to register commands with priority in multicommand
CatStrategist Jan 28, 2022
0f5646c
Add enter before return and break statements
CatStrategist Jan 28, 2022
09edaf6
Fix docs for multicommand
CatStrategist Jan 28, 2022
9ebcd36
WiP.
niegowski Jan 31, 2022
ca6ade7
Added option to inject custom callbacks for post-fixer and change han…
niegowski Jan 31, 2022
8f76321
Merge branch 'ck/11083-multicommand-with-priorities' into ck/10880-ta…
CatStrategist Feb 1, 2022
8e3e480
Implemented delete/backspace handling in document lists around block …
oleq Feb 1, 2022
1656a9f
Added missing tests for document list integration with backspace/dele…
oleq Feb 1, 2022
519a807
Code refactoring.
oleq Feb 1, 2022
8d3e2fc
Merge branch 'ck/10812-document-list-editing' into ck/10878-document-…
oleq Feb 1, 2022
ac426c1
Code refactoring in tests
oleq Feb 1, 2022
7175091
Code cleanup.
niegowski Feb 1, 2022
fd08e37
Added post-fixing of the missing list properties attributes.
niegowski Feb 1, 2022
9c54b05
Code cleanup.
niegowski Feb 2, 2022
8e511a0
Added tests for DocumentListMerge command. Docs.
oleq Feb 2, 2022
39edfae
Code refactoring.
oleq Feb 2, 2022
62ce46e
Code refactoring.
oleq Feb 2, 2022
1765012
Tests: Improved the document list mocking test.
oleq Feb 2, 2022
fb02b68
Removed obsolete param from parse() document lists dev util.
oleq Feb 2, 2022
635ddbf
Code refactoring.
oleq Feb 2, 2022
f6a19d7
Made it possible to pass an element instance to the stringifyList() h…
oleq Feb 2, 2022
15a2bf9
Internal: Fixed license headers.
oleq Feb 2, 2022
2f096f0
Docs.
oleq Feb 2, 2022
03a59d9
Code refactoring in tests
oleq Feb 2, 2022
242be47
Code refactoring in tests
oleq Feb 2, 2022
d30f8e5
Apply suggestions from code review.
niegowski Feb 2, 2022
b9cedf5
Code refactoring.
oleq Feb 2, 2022
3b4d9d5
Merge pull request #11201 from ckeditor/ck/10878-document-list-backspace
niegowski Feb 2, 2022
029517a
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 2, 2022
d19b3e6
Fixed tests.
niegowski Feb 2, 2022
a1adfab
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 2, 2022
6b3c3ba
Fix tests.
niegowski Feb 2, 2022
f51c225
First implementation of tab integration and tab, tab+shift handling i…
CatStrategist Feb 3, 2022
9e86bd8
Added event context for tab key handling while table widget is selected.
niegowski Feb 3, 2022
ae884ef
Re-wrapping lists on the indentation change.
niegowski Feb 3, 2022
3bd4478
Adding tests.
niegowski Feb 6, 2022
dc221f9
Code cleaning.
niegowski Feb 6, 2022
4695246
Code cleaning.
niegowski Feb 6, 2022
4a7f57f
Merge branch 'ck/10294/reconversion' into ck/10812-document-list-editing
arkflpc Feb 7, 2022
6fafd82
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
arkflpc Feb 7, 2022
53599b0
Merge branch 'ck/10812-document-list-editing' into ck/10880-tab-key
CatStrategist Feb 7, 2022
bbac39b
Added DocumentListStyle command
arkflpc Feb 7, 2022
20fc76d
Added DocumentListStartCommand
arkflpc Feb 8, 2022
c63dac8
Converting to list and style application in single batch
arkflpc Feb 8, 2022
dfe7b36
Moved some checks out of listwalker
arkflpc Feb 8, 2022
6a84586
Code refactoring.
niegowski Feb 8, 2022
281f8bf
Pr fixes
CatStrategist Feb 9, 2022
b830e87
PR fixes
CatStrategist Feb 9, 2022
114bbe0
Merge branch 'ck/10880-tab-key' of github.com:ckeditor/ckeditor5 into…
CatStrategist Feb 9, 2022
c63648a
Fix after code-review
arkflpc Feb 9, 2022
ab4baf4
Apply review comment.
niegowski Feb 9, 2022
57bb1dc
Fix tests of features that started to listen to tabobserver instead o…
CatStrategist Feb 9, 2022
76f2f50
Fix after code-review
arkflpc Feb 9, 2022
3eb6716
Fix after code-review
arkflpc Feb 9, 2022
2631672
Reordered imports.
niegowski Feb 9, 2022
fe4e747
Fix after code-review
arkflpc Feb 9, 2022
33c3686
Merge pull request #11232 from ckeditor/ck/11166-document-list-style-…
niegowski Feb 9, 2022
b961f99
Merge branch 'ck/11065-document-list-properties' into ck/11166-docume…
arkflpc Feb 9, 2022
7c87177
Introduced $blockObject and $inlineObject in Schema. Made it easier t…
oleq Feb 9, 2022
f44ea13
Fix after merge
arkflpc Feb 9, 2022
09b1dcb
Tests: Added CodeBlockEditing integration tests with DocumentListEdit…
oleq Feb 9, 2022
4a1e509
Tests: Added tests for changes to base element types in model Schema.
oleq Feb 9, 2022
8a804b1
Updated horizontal-line tests which now inhertis from $blockObject in…
oleq Feb 9, 2022
d3d4da1
Updated html-embed tests which now inhertis from $blockObject in the …
oleq Feb 9, 2022
931710e
Updated image tests so now imageBlock inhertis from $blockObject in t…
oleq Feb 9, 2022
5e7832f
Updated media embed tests because media now inhertis from $blockObjec…
oleq Feb 9, 2022
b62318f
Updated page break tests because the element now inhertis from $block…
oleq Feb 9, 2022
fa62518
Updated table tests because the main element now inhertis from $block…
oleq Feb 9, 2022
99d688d
Added tests.
niegowski Feb 9, 2022
48c07b0
Added tests.
niegowski Feb 9, 2022
4f53064
Docs: human-oriented description expansion.
godai78 Feb 10, 2022
6903f8a
Docs: human-oriented description expansion.
godai78 Feb 10, 2022
43ea5d5
Docs: Updated Schema docs.
oleq Feb 10, 2022
4b79e9c
Added DocumentListStartCommand
arkflpc Feb 10, 2022
4b6e77f
Add manual test for document list properties
arkflpc Feb 10, 2022
6d75d82
Add manual test for document list properties
arkflpc Feb 10, 2022
035f5f6
CodeBlockEditing should disallow list* attributes when DocumentListEd…
oleq Feb 10, 2022
ba2b74e
Merge branch 'ck/10812-document-list-editing' into ck/11197-list-attr…
oleq Feb 10, 2022
ee51b75
Merge pull request #11250 from ckeditor/ck/11197-list-attributes
niegowski Feb 10, 2022
b3d6658
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 10, 2022
b212cac
Tests aligned after merge.
niegowski Feb 10, 2022
cf0e4fd
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 10, 2022
5166ee3
Code refactor - extracted isListItemBlock helper.
niegowski Feb 10, 2022
d17f314
Extracted list of base list attributes to a common const.
niegowski Feb 10, 2022
6a94cbf
Merge branch 'ck/11065-document-list-properties' into ck/11166-docume…
niegowski Feb 10, 2022
201e679
Added support for selected block widgets in a document list.
niegowski Feb 10, 2022
077e447
Added support for selected block widgets in a document list.
niegowski Feb 10, 2022
67762a0
Merge branch 'ck/10812-document-list-editing' into ck/11083-multicomm…
niegowski Feb 10, 2022
3ef86de
fix PR
CatStrategist Feb 10, 2022
b52250d
Fix PR
CatStrategist Feb 10, 2022
9441a10
Fix pr
CatStrategist Feb 10, 2022
5b3c3ca
Merge branch 'ck/11083-multicommand-with-priorities' into ck/10880-ta…
CatStrategist Feb 11, 2022
d3f2f21
Apply suggestions from code review.
niegowski Feb 11, 2022
4143f27
Docs fixes.
niegowski Feb 11, 2022
8b3b559
Document list properties: tests for selected block widgets
arkflpc Feb 14, 2022
64aa574
Merge pull request #11249 from ckeditor/ck/11166-document-list-start-…
niegowski Feb 15, 2022
6ae2416
Docs fixes.
niegowski Feb 16, 2022
ea499a3
Wording and docs.
Reinmar Feb 16, 2022
56be250
Fixed a typo.
Reinmar Feb 16, 2022
d1d203c
Documents list tab observers integration tests
CatStrategist Feb 16, 2022
fff94d3
Merge branch 'master' into ck/10812-document-list-editing
niegowski Feb 16, 2022
db1b775
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 16, 2022
31f09b8
Merge pull request #11181 from ckeditor/ck/11083-multicommand-with-pr…
Reinmar Feb 16, 2022
256cbdd
Merge branch 'ck/10812-document-list-editing' into ck/10880-tab-key
Reinmar Feb 16, 2022
34de71d
Simplify setting up listeners in tablekeyboard plugin and update docs…
CatStrategist Feb 16, 2022
147bc1e
Delete a code that was commented out and register the indentCodeBlock…
CatStrategist Feb 16, 2022
c3be58c
Update the tabobserver and fix passing wrong object to the DomEventData.
CatStrategist Feb 16, 2022
9805616
Add priorities to the indentList and the outdentList commands when re…
CatStrategist Feb 16, 2022
18aba9f
Add more tests to integration tests of the DocumentLists plugin.
CatStrategist Feb 16, 2022
851b5b3
Add tests to the TabObserver.
CatStrategist Feb 16, 2022
8bca270
Add minor adjustments to accessing variables.
CatStrategist Feb 16, 2022
65e5886
Add missing createSinonSandbox() calls that were omitted during creat…
CatStrategist Feb 17, 2022
5488430
Review fixes.
oleq Feb 17, 2022
0736e1c
Apply suggestions from code review.
oleq Feb 17, 2022
7ab1b7c
Docs.
oleq Feb 17, 2022
4de0417
Add missing mention of default ArrowKeysObserver in View docs.
CatStrategist Feb 18, 2022
aeaa38d
Delete redundant operation in TabObserver and add documentation.
CatStrategist Feb 18, 2022
cd9506f
Improve API docs for enterobserver.
CatStrategist Feb 18, 2022
c57084e
Imports reorder.
niegowski Feb 18, 2022
8088168
Add comments, fix and organize imports, fix API docs.
CatStrategist Feb 21, 2022
cf2cc86
Add missing ArrowKeysObserver in view tests.
CatStrategist Feb 21, 2022
29277b5
Add integration tests for outdenting block in a list.
CatStrategist Feb 21, 2022
f9c4f4b
Generic post-fixer for DocumentLists (impementation)
arkflpc Feb 21, 2022
ff4848b
Add more tests.
CatStrategist Feb 22, 2022
6742d7e
Merge branch 'ck/10880-tab-key' of github.com:ckeditor/ckeditor5 into…
CatStrategist Feb 22, 2022
f38eda7
Remove unused describes in tests.
CatStrategist Feb 22, 2022
379e75e
Generic post-fixer for DocumentLists (tests & fixes)
arkflpc Feb 22, 2022
861a5fe
Add more tests.
CatStrategist Feb 22, 2022
0d79394
Generic post-fixer for DocumentLists (test coverage)
arkflpc Feb 22, 2022
00f8853
Generic post-fixer for DocumentLists (more tests)
arkflpc Feb 22, 2022
7d2c2dd
Generic post-fixer for DocumentLists (removing paragraph between lists)
arkflpc Feb 23, 2022
dc28106
Review fixes.
niegowski Feb 23, 2022
acd4f77
Fix TabObserver test.
CatStrategist Feb 23, 2022
fd2f117
Fix tests formatting.
CatStrategist Feb 23, 2022
a4ccde1
Fix comment describing reasoning behind command execution priority.
CatStrategist Feb 23, 2022
68c6a65
Fix function api doc description.
CatStrategist Feb 23, 2022
49c8095
Fix variable names.
CatStrategist Feb 23, 2022
a84b730
Change Tab listener for old lists and add tests.
CatStrategist Feb 24, 2022
8c71916
Add checkbox in documentlist manual test to display borders.
CatStrategist Feb 24, 2022
83101fa
Apply review comment.
niegowski Feb 24, 2022
354827a
Merge pull request #11244 from ckeditor/ck/10880-tab-key
niegowski Feb 24, 2022
3348b80
Apply suggestions from code review
arkflpc Feb 24, 2022
3a7ab88
Generic post-fixer for DocumentLists (more tests)
arkflpc Feb 24, 2022
30c1f01
Merge branch 'master' into ck/10812-document-list-editing
niegowski Feb 24, 2022
51440d3
Generic post-fixer for DocumentLists (fixes after code review)
arkflpc Feb 24, 2022
11230de
Merge branch 'master' into ck/10812-document-list-editing.
CatStrategist Feb 24, 2022
57d92f5
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 24, 2022
5848160
Code cleaning.
niegowski Feb 24, 2022
7487cb6
Merge pull request #11329 from ckeditor/ck/11167-document-list-proper…
niegowski Feb 24, 2022
ef2d362
Add missing coverage tests for tablekeyboard.
CatStrategist Feb 25, 2022
74537c0
Merge branch 'ck/10812-document-list-editing' of github.com:ckeditor/…
CatStrategist Feb 25, 2022
6791dc2
Add missing tests for codeblock tab handler.
CatStrategist Feb 25, 2022
0de26c6
Merge branch 'ck/10812-document-list-editing' into ck/11065-document-…
niegowski Feb 27, 2022
04bfd90
Reset document list properties after indent
arkflpc Mar 2, 2022
08d3d29
Fix docs
arkflpc Mar 3, 2022
ec1cb19
Merge pull request #11380 from ckeditor/ck/11357-reset-list-propertie…
oleq Mar 3, 2022
ae53fd5
Review fixes.
niegowski Mar 7, 2022
02d3ca7
Fixed test names.
niegowski Mar 7, 2022
d7e6729
Docs fixes.
niegowski Mar 7, 2022
a37a9f8
Merge pull request #11099 from ckeditor/ck/11065-document-list-proper…
niegowski Mar 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/_snippets/framework/tutorials/inline-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ class PlaceholderEditing extends Plugin {

const placeholderView = viewWriter.createContainerElement( 'span', {
class: 'placeholder'
}, {
isAllowedInsideAttributeElement: true
} );

// Insert the placeholder name (as a text).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,6 @@ export default class PlaceholderEditing extends Plugin {

const placeholderView = viewWriter.createContainerElement( 'span', {
class: 'placeholder'
}, {
isAllowedInsideAttributeElement: true
} );

// Insert the placeholder name (as a text).
Expand Down Expand Up @@ -944,8 +942,6 @@ class PlaceholderEditing extends Plugin {

const placeholderView = viewWriter.createContainerElement( 'span', {
class: 'placeholder'
}, {
isAllowedInsideAttributeElement: true
} );

// Insert the placeholder name (as a text).
Expand Down
3 changes: 1 addition & 2 deletions packages/ckeditor5-block-quote/src/blockquoteediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ export default class BlockQuoteEditing extends Plugin {
editor.commands.add( 'blockQuote', new BlockQuoteCommand( editor ) );

schema.register( 'blockQuote', {
allowWhere: '$block',
allowContentOf: '$root'
inheritAllFrom: '$container'
} );

editor.conversion.elementToElement( { model: 'blockQuote', view: 'blockquote' } );
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-block-quote/tests/blockquoteediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ describe( 'BlockQuoteEditing', () => {
expect( model.schema.checkChild( [ '$root', 'blockQuote' ], 'foo' ) ).to.be.false;
} );

it( 'inherits attributes from $container', () => {
model.schema.extend( '$container', {
allowAttributes: 'foo'
} );

expect( model.schema.checkAttribute( 'blockQuote', 'foo' ) ).to.be.true;
} );

it( 'adds converters to the data pipeline', () => {
const data = '<blockquote><p>x</p></blockquote>';

Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-code-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@ckeditor/ckeditor5-editor-classic": "^32.0.0",
"@ckeditor/ckeditor5-image": "^32.0.0",
"@ckeditor/ckeditor5-indent": "^32.0.0",
"@ckeditor/ckeditor5-list": "^32.0.0",
"@ckeditor/ckeditor5-markdown-gfm": "^32.0.0",
"@ckeditor/ckeditor5-paragraph": "^32.0.0",
"@ckeditor/ckeditor5-theme-lark": "^32.0.0",
Expand Down
41 changes: 28 additions & 13 deletions packages/ckeditor5-code-block/src/codeblockediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class CodeBlockEditing extends Plugin {
const schema = editor.model.schema;
const model = editor.model;
const view = editor.editing.view;
const isDocumentListEditingLoaded = editor.plugins.has( 'DocumentListEditing' );

const normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions( editor );

Expand All @@ -97,19 +98,20 @@ export default class CodeBlockEditing extends Plugin {
editor.commands.add( 'indentCodeBlock', new IndentCodeBlockCommand( editor ) );
editor.commands.add( 'outdentCodeBlock', new OutdentCodeBlockCommand( editor ) );

const getCommandExecuter = commandName => {
return ( data, cancel ) => {
const command = this.editor.commands.get( commandName );
this.listenTo( view.document, 'tab', ( evt, data ) => {
const commandName = data.shiftKey ? 'outdentCodeBlock' : 'indentCodeBlock';
const command = editor.commands.get( commandName );

if ( command.isEnabled ) {
this.editor.execute( commandName );
cancel();
}
};
};
if ( !command.isEnabled ) {
return;
}

editor.keystrokes.set( 'Tab', getCommandExecuter( 'indentCodeBlock' ) );
editor.keystrokes.set( 'Shift+Tab', getCommandExecuter( 'outdentCodeBlock' ) );
editor.execute( commandName );

data.stopPropagation();
data.preventDefault();
evt.stop();
}, { context: 'pre' } );

schema.register( 'codeBlock', {
allowWhere: '$block',
Expand All @@ -118,8 +120,17 @@ export default class CodeBlockEditing extends Plugin {
allowAttributes: [ 'language' ]
} );

// Allow all list* attributes on `codeBlock` (integration with DocumentList).
// Disallow all attributes on $text inside `codeBlock`.
schema.addAttributeCheck( context => {
schema.addAttributeCheck( ( context, attributeName ) => {
const isDocumentListAttributeOnCodeBlock = context.endsWith( 'codeBlock' ) &&
attributeName.startsWith( 'list' ) &&
attributeName !== 'list';

if ( isDocumentListEditingLoaded && isDocumentListAttributeOnCodeBlock ) {
return true;
}

if ( context.endsWith( 'codeBlock $text' ) ) {
return false;
}
Expand Down Expand Up @@ -210,7 +221,11 @@ export default class CodeBlockEditing extends Plugin {
const outdent = commands.get( 'outdent' );

if ( indent ) {
indent.registerChildCommand( commands.get( 'indentCodeBlock' ) );
// Priority is highest due to integration with `IndentList` command of `List` plugin.
// If selection is in a code block we give priority to it. This way list item cannot be indented
// but if we would give priority to indenting list item then user would have to indent list item
// as much as possible and only then he could indent code block.
indent.registerChildCommand( commands.get( 'indentCodeBlock' ), { priority: 'highest' } );
}

if ( outdent ) {
Expand Down
71 changes: 70 additions & 1 deletion packages/ckeditor5-code-block/tests/codeblock-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import GFMDataProcessor from '@ckeditor/ckeditor5-markdown-gfm/src/gfmdataprocessor';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import ImageInlineEditing from '@ckeditor/ckeditor5-image/src/image/imageinlineediting';
import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import DocumentListEditing from '@ckeditor/ckeditor5-list/src/documentlist/documentlistediting';
import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';

import CodeBlockUI from '../src/codeblockui';
import CodeBlockEditing from '../src/codeblockediting';
Expand Down Expand Up @@ -154,4 +155,72 @@ describe( 'CodeBlock - integration', () => {
expect( getData( editor.model ) ).to.equal( '<codeBlock language="cs">[]</codeBlock>' );
} );
} );

describe( 'with DocumentListEditing', () => {
let editor, model;

describe( 'when DocumentListEditing is loaded', () => {
beforeEach( async () => {
editor = await ClassicTestEditor
.create( '', {
plugins: [ CodeBlockEditing, DocumentListEditing, Enter, Paragraph ]
} );

model = editor.model;
} );

afterEach( async () => {
await editor.destroy();
} );

it( 'should allow all attributes starting with list* in the schema', () => {
setData( model, '<codeBlock language="plaintext">[]foo</codeBlock>' );

const codeBlock = model.document.getRoot().getChild( 0 );

expect( model.schema.checkAttribute( codeBlock, 'listItemId' ), 'listItemId' ).to.be.true;
expect( model.schema.checkAttribute( codeBlock, 'listType' ), 'listType' ).to.be.true;
expect( model.schema.checkAttribute( codeBlock, 'listStart' ), 'listStart' ).to.be.true;
expect( model.schema.checkAttribute( codeBlock, 'listFoo' ), 'listFoo' ).to.be.true;
} );

it( 'should disallow attributes that do not start with "list" in the schema but include the sequence', () => {
setData( model, '<codeBlock language="plaintext">[]foo</codeBlock>' );

const codeBlock = model.document.getRoot().getChild( 0 );

expect( model.schema.checkAttribute( codeBlock, 'list' ), 'list' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'fooList' ), 'fooList' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'alist' ), 'alist' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'alistb' ), 'alistb' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'LISTbar' ), 'LISTbar' ).to.be.false;
} );
} );

describe( 'when DocumentListEditing is not loaded', () => {
beforeEach( async () => {
editor = await ClassicTestEditor
.create( '', {
plugins: [ CodeBlockEditing, Enter, Paragraph ]
} );

model = editor.model;
} );

afterEach( async () => {
await editor.destroy();
} );

it( 'should disallow all attributes starting with list* in the schema', () => {
setData( model, '<codeBlock language="plaintext">[]foo</codeBlock>' );

const codeBlock = model.document.getRoot().getChild( 0 );

expect( model.schema.checkAttribute( codeBlock, 'listItemId' ), 'listItemId' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'listType' ), 'listType' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'listStart' ), 'listStart' ).to.be.false;
expect( model.schema.checkAttribute( codeBlock, 'listFoo' ), 'listFoo' ).to.be.false;
} );
} );
} );
} );
Loading