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/epic/2973 document lists #11503

Merged
merged 441 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
441 commits
Select commit Hold shift + click to select a range
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
c894905
PoC WiP DocumentLists + GHS.
niegowski 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
3ace1fe
WiP.
niegowski 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
ad30c0b
WiP.
niegowski Feb 18, 2022
b89ad73
WiP.
niegowski Feb 20, 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
4b60aaa
WiP.
niegowski 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
1c105b7
WiP.
niegowski Feb 22, 2022
7d2c2dd
Generic post-fixer for DocumentLists (removing paragraph between lists)
arkflpc Feb 23, 2022
74260f8
Cleaning manual test.
niegowski 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
8cfb837
Merge branch 'ck/11065-document-list-properties' into ck/11284-docume…
niegowski Feb 27, 2022
6095208
WiP.
niegowski Feb 28, 2022
209a4d4
Moved down-cast conversion of list attributes to the single converter…
niegowski Mar 1, 2022
04bfd90
Reset document list properties after indent
arkflpc Mar 2, 2022
e751b65
Code cleaning.
niegowski Mar 2, 2022
47cffde
Added post-fixer for Document Lists in GHS.
niegowski Mar 2, 2022
c609e16
Code cleaning.
niegowski 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
5ad2f0f
Reverted handling of a list attributes (using attribute name prefix c…
niegowski Mar 3, 2022
829b34a
Reverted changes in downcast writer.
niegowski Mar 3, 2022
2face4c
Code cleaning.
niegowski Mar 3, 2022
4d1eda8
Revert "Reverted handling of a list attributes (using attribute name …
niegowski Mar 7, 2022
a174f29
Using registered strategies instead of attribute name prefix.
niegowski Mar 7, 2022
ae53fd5
Review fixes.
niegowski Mar 7, 2022
02d3ca7
Fixed test names.
niegowski Mar 7, 2022
d7e6729
Docs fixes.
niegowski Mar 7, 2022
a3f22be
Merge branch 'ck/11065-document-list-properties' into ck/11284-docume…
niegowski Mar 7, 2022
eb52d8d
WIP: Initial version of fix handling insertion of blocks to document …
CatStrategist Mar 7, 2022
e1973ff
Code cleaning.
niegowski Mar 7, 2022
406f00b
Updated docs.
niegowski Mar 7, 2022
58fe16d
Manual tests cleaning.
niegowski Mar 7, 2022
28c1e6d
Add more tests to changing image type and fix tests with deleting blo…
CatStrategist Mar 8, 2022
5a56385
Added basic tests for 100CC.
niegowski Mar 8, 2022
98c6c82
Change passing elements to copy attributes from to selection and make…
CatStrategist Mar 8, 2022
4b7281a
Create selection of insertion context element passed as option in ins…
CatStrategist Mar 8, 2022
1a65927
Initial version of insertBlock function - handling tables and changin…
CatStrategist Mar 9, 2022
1b8f202
Add a note to remove import later.
CatStrategist Mar 9, 2022
0276261
Finish PoC for insertObject() handling all the cases for document lis…
CatStrategist Mar 10, 2022
976bea3
Add more tests, handling setSelection in insertObject, move getAttrib…
CatStrategist Mar 15, 2022
46ae8c5
Remove unnecessary code.
CatStrategist Mar 15, 2022
0f99e6e
Fix tests.
CatStrategist Mar 15, 2022
9337275
Fixes for inserting content at higher indent.
CatStrategist Mar 16, 2022
5dd4a9c
GHS: DocumentListSupport - tests
arkflpc Mar 16, 2022
d3a5cd6
Code refactoring in progress.
niegowski Mar 16, 2022
299bb38
GHS: DocumentListSupport - indenting list
arkflpc Mar 17, 2022
ebc3465
Code refactoring.
niegowski Mar 17, 2022
ec7b4e6
Apply review comment.
niegowski Mar 22, 2022
c45f85d
Apply review comment.
niegowski Mar 22, 2022
a37a9f8
Merge pull request #11099 from ckeditor/ck/11065-document-list-proper…
niegowski Mar 22, 2022
3806505
Merge branch 'master' into ck/epic/2973-document-lists
niegowski Mar 22, 2022
c1c854d
Merge branch 'master' into ck/epic/2973-document-lists
niegowski Mar 22, 2022
afc12a9
Fixed license header.
niegowski Mar 22, 2022
ff38725
Merge branch 'master' into ck/epic/2973-document-lists
niegowski Mar 23, 2022
fbb5ece
Fix deleting widget which is a list item
arkflpc Mar 29, 2022
24f77dc
Merge pull request #11391 from ckeditor/ck/11284-document-list-ghs
arkflpc Mar 30, 2022
c8aeb96
Add tests.
Mar 30, 2022
832ecf5
GHS: tests for downcast in documentlist integration
arkflpc Mar 30, 2022
de7aeaa
Merge branch 'ck/epic/2973-document-lists' into ck/11198-make-sure-li…
Mar 30, 2022
9e7cde2
Add documentation.
Mar 30, 2022
0c50e19
Fix insertObject() test.
Mar 30, 2022
55479e3
Add tests and documentation to widget type around.
Mar 30, 2022
56584dd
Move setAllowedAttributes() to schema and fix tests.
Mar 30, 2022
7c5b536
Start writing API docs for insertObject().
Mar 30, 2022
7274d3a
Fix API docs.
Mar 30, 2022
fc56ba6
Docs: Documented insertObject().
oleq Mar 31, 2022
02779bb
Review fixes.
oleq Mar 31, 2022
98cf7b6
PR fixes.
Mar 31, 2022
c0e4b21
Merge branch 'ck/11198-make-sure-list-isnt-split' of github.com:ckedi…
Mar 31, 2022
d03fe12
Fix import and revert unnecessary changes to insert table command.
Mar 31, 2022
2561d47
Stub console warn in tests and make engine's findOptimalInsertionRang…
Apr 1, 2022
4faa809
Docs.
oleq Apr 1, 2022
38f0c8b
Merge pull request #11527 from ckeditor/ck/11346-fix-deleting-widget-…
oleq Apr 1, 2022
c528b67
Merge branch 'ck/epic/2973-document-lists' into ck/11198-make-sure-li…
Apr 1, 2022
ee8d2e7
Adjusted tests after mergin the epic branch.
oleq Apr 1, 2022
858d6f5
Merge pull request #11425 from ckeditor/ck/11198-make-sure-list-isnt-…
oleq Apr 1, 2022
c686546
Merge branch 'master' into ck/epic/2973-document-lists
oleq Apr 1, 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 @@ -195,8 +195,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": "^33.0.0",
"@ckeditor/ckeditor5-image": "^33.0.0",
"@ckeditor/ckeditor5-indent": "^33.0.0",
"@ckeditor/ckeditor5-list": "^33.0.0",
"@ckeditor/ckeditor5-markdown-gfm": "^33.0.0",
"@ckeditor/ckeditor5-paragraph": "^33.0.0",
"@ckeditor/ckeditor5-theme-lark": "^33.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