|
13 | 13 | * mediator.exec('format:list:cleanup', domElement); // Find all lists and clean them up |
14 | 14 | */ |
15 | 15 | import Module from '../core/Module'; |
16 | | -import commands from '../utils/commands'; |
17 | 16 | import DOM from '../utils/DOM'; |
18 | 17 |
|
19 | 18 | const ListFormatter = Module({ |
@@ -53,38 +52,41 @@ const ListFormatter = Module({ |
53 | 52 | switch (opts.style) { |
54 | 53 | case 'ordered': |
55 | 54 | toggle = mediator.get('selection:in:or:contains', ['OL']); |
56 | | - if (toggle) { |
57 | | - // this.prepListItemsForToggle(); |
58 | | - // while (mediator.get('canvas:selection:in:or:contains', ['OL'])) { |
59 | | - // commands.exec('outdent', null, canvasDoc); |
60 | | - // } |
61 | | - // commands.exec('insertOrderedList', null, canvasDoc); |
62 | | - // return; |
63 | | - } else if (mediator.get('selection:in:or:contains', ['UL'])) { |
64 | | - commands.exec('insertUnorderedList', null, canvasDoc); |
| 55 | + if (mediator.get('selection:in:or:contains', ['UL'])) { |
| 56 | + mediator.exec('commands:exec', { |
| 57 | + command: 'insertUnorderedList', |
| 58 | + contextDocument: canvasDoc |
| 59 | + }); |
65 | 60 | } |
66 | | - commands.exec('insertOrderedList', null, canvasDoc); |
| 61 | + mediator.exec('commands:exec', { |
| 62 | + command: 'insertOrderedList', |
| 63 | + contextDocument: canvasDoc |
| 64 | + }); |
67 | 65 | break; |
68 | 66 | case 'unordered': |
69 | 67 | toggle = mediator.get('selection:in:or:contains', ['UL']); |
70 | | - if (toggle) { |
71 | | - // this.prepListItemsForToggle(); |
72 | | - // while (mediator.get('canvas:selection:in:or:contains', ['UL'])) { |
73 | | - // commands.exec('outdent', null, canvasDoc); |
74 | | - // } |
75 | | - // commands.exec('insertUnorderedList', null, canvasDoc); |
76 | | - // return; |
77 | | - } |
78 | 68 | if (mediator.get('selection:in:or:contains', ['OL'])) { |
79 | | - commands.exec('insertOrderedList', null, canvasDoc); |
| 69 | + mediator.exec('commands:exec', { |
| 70 | + command: 'insertOrderedList', |
| 71 | + contextDocument: canvasDoc |
| 72 | + }); |
80 | 73 | } |
81 | | - commands.exec('insertUnorderedList', null, canvasDoc); |
| 74 | + mediator.exec('commands:exec', { |
| 75 | + command: 'insertUnorderedList', |
| 76 | + contextDocument: canvasDoc |
| 77 | + }); |
82 | 78 | break; |
83 | 79 | case 'outdent': |
84 | | - commands.exec('outdent', null, canvasDoc); |
| 80 | + mediator.exec('commands:exec', { |
| 81 | + command: 'outdent', |
| 82 | + contextDocument: canvasDoc |
| 83 | + }); |
85 | 84 | break; |
86 | 85 | case 'indent': |
87 | | - commands.exec('indent', null, canvasDoc); |
| 86 | + mediator.exec('commands:exec', { |
| 87 | + command: 'indent', |
| 88 | + contextDocument: canvasDoc |
| 89 | + }); |
88 | 90 | break; |
89 | 91 | } |
90 | 92 |
|
|
0 commit comments