30 | | * CKEditor indent becomes scalable. New plugins can also listen on `indent|outdent` events, do custom job (different elements) and control UI interface states.Extracted from #10192: |
31 | | |
32 | | * #10192 introduces `p || li` as a `requiredContent` for '''indent''' plugin. |
33 | | * '''Indent''' is a dependency of the '''list''' plugin. |
34 | | |
35 | | The above are quick patches to let '''enterkey''' close lists correctly. The reasoning is as follows: |
36 | | |
37 | | 1. '''Enterkey''' depends on '''indent''' to close lists (it uses `outdent` command). |
38 | | 2. '''Indent''' has `requiredContent` of `p{margin-left}`. |
39 | | 3. ...so setting `config.allowedContent = 'p ul ol li'` disables '''indent''' (no `margin-left`) |
40 | | 4. ...and disables closing lists as well (1.) |
41 | | |
42 | | Although #10192 solves the issue, '''indent's''' `requiredContent = [ 'p{margin-left}', 'li' ]` brings some troubles. |
43 | | |
44 | | Since #10192, setting `config.allowedContent = 'p li'` enables `p` indentation without explicit `config.allowedContent = '...p{margin-left}...'`. This is why '''indent''' plugin must be smarter to consider ACF rules when enabling/disabling commands. This implies a major refactorization of '''indent's''' `refresh` and `exec` methods to handle several new cases. |
45 | | |
46 | | The main inconvenience is that list indentation and block indentation should be handled separately by '''list'''/'''indent''' and share the same button set. The idea is as follows: |
47 | | |
48 | | 1. Create separate commands: `indent|outdentList` and `indent|outdentBlock` in separate plugins ('''list''', '''indent'''). |
49 | | 2. Create "core" commands and events: `indent|outdent`. |
50 | | 3. Let the `indent|outdent` commands control toolbar buttons. |
51 | | 4. Clicking toolbar button would fire `indent|outdent` events which, passed or canceled by the listeners, would do the work. '''List''' and '''indent''' plugins would listen on `indent|outdent` events and decide (considering ACF) whether any action can be performed: |
52 | | * Action possible: do the action (exec indent|outdentList|Block), cancel the event. |
53 | | * Action impossible: just pass the event. |
54 | | 5. `indent|outdentList` and `indent|outdentBlock` would fire `indent|outdentRefresh` event which, handled by `indent|outdent` commands in core, would enable or disable them (+buttons). `indent|outdentRefresh` would basically provide information about `indent|outdent` states as seen from `indent|outdentList` and `indent|outdentBlock` commands. |
55 | | |
56 | | "Core" `indent|outdent` commands and events can be eventually delegated to a separate plugin (let's call it '''indentUi''') which would also create toolbar buttons. This will let us avoid redundant button invokation code in '''list''' and '''indent'''. This has also some other advantages: |
57 | | |
58 | | * With #8244, UI buttons might no longer be essential for indentation. |
59 | | * CKEditor indent becomes scalable. New plugins can also listen on `indent|outdent` events, do custom job (different elements) and control UI interface states. |
| 30 | * CKEditor indent becomes scalable. New plugins can also listen on `indent|outdent` events, do custom job and control UI interface states. |