Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js |
— | — | @@ -36,26 +36,37 @@ |
37 | 37 | /** |
38 | 38 | * Mapping of symbolic names and nesting rules. |
39 | 39 | * |
40 | | - * Each rule is an object with a parents and children property. Each of these properties may contain |
41 | | - * one of two possible values: |
42 | | - * Array - List of allowed element types (if empty, no elements will be allowed) |
43 | | - * Null - Any element type is allowed (as long as the other element also allows it) |
| 40 | + * Each rule is an object with the follwing properties: |
| 41 | + * parents and children properties may contain one of two possible values: |
| 42 | + * {Array} List symbolic names of allowed element types (if empty, none will be allowed) |
| 43 | + * {Null} Any element type is allowed (as long as the other element also allows it) |
| 44 | + * droppable: |
| 45 | + * {Boolean} Whether the node can be dropped from it's parent (false for table cells) |
44 | 46 | * |
45 | 47 | * @example Paragraph rules |
46 | 48 | * { |
47 | 49 | * 'parents': null, |
48 | | - * 'children': [] |
| 50 | + * 'children': [], |
| 51 | + * 'droppable': true |
49 | 52 | * } |
50 | 53 | * @example List rules |
51 | 54 | * { |
52 | 55 | * 'parents': null, |
53 | | - * 'children': ['listItem'] |
| 56 | + * 'children': ['listItem'], |
| 57 | + * 'droppable': true |
54 | 58 | * } |
55 | 59 | * @example ListItem rules |
56 | 60 | * { |
57 | 61 | * 'parents': ['list'], |
58 | | - * 'children': [] |
| 62 | + * 'children': null, |
| 63 | + * 'droppable': true |
59 | 64 | * } |
| 65 | + * @example TableCell rules |
| 66 | + * { |
| 67 | + * 'parents': ['tableRow'], |
| 68 | + * 'children': null, |
| 69 | + * 'droppable': false |
| 70 | + * } |
60 | 71 | */ |
61 | 72 | es.DocumentModel.nodeRules = {}; |
62 | 73 | |
— | — | @@ -862,7 +873,8 @@ |
863 | 874 | /** |
864 | 875 | * Remove content data only, retaining structure |
865 | 876 | * |
866 | | - * TODO: Nodes that are completely covered should be dropped, not stripped |
| 877 | + * TODO: Nodes that are completely covered and are droppable should be dropped, not stripped |
| 878 | + * @see {es.DocumentModel.nodeRules} for obtaining the 'droppable' bit for a given node |
867 | 879 | * |
868 | 880 | * @param {es.Range} range Range of data to delete |
869 | 881 | * @param {es.Transaction} tx Transaction to push to |
Index: trunk/extensions/VisualEditor/modules/es/models/es.HeadingModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.heading = { |
33 | 33 | 'parents': null, |
34 | | - 'children': [] |
| 34 | + 'children': [], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.TableRowModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.listItem = { |
33 | 33 | 'parents': ['table'], |
34 | | - 'children': ['tableCell'] |
| 34 | + 'children': ['tableCell'], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.ParagraphModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.paragraph = { |
33 | 33 | 'parents': null, |
34 | | - 'children': [] |
| 34 | + 'children': [], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.PreModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.pre = { |
33 | 33 | 'parents': null, |
34 | | - 'children': [] |
| 34 | + 'children': [], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.TableCellModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.listItem = { |
33 | 33 | 'parents': ['tableRow'], |
34 | | - 'children': null |
| 34 | + 'children': null, |
| 35 | + 'droppable': false |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.TableModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.table = { |
33 | 33 | 'parents': null, |
34 | | - 'children': ['tableRow'] |
| 34 | + 'children': ['tableRow'], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.ListItemModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.listItem = { |
33 | 33 | 'parents': ['list'], |
34 | | - 'children': ['paragraph', 'table'] |
| 34 | + 'children': null, |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |
Index: trunk/extensions/VisualEditor/modules/es/models/es.ListModel.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | |
32 | 32 | es.DocumentModel.nodeRules.list = { |
33 | 33 | 'parents': null, |
34 | | - 'children': ['listItem'] |
| 34 | + 'children': ['listItem'], |
| 35 | + 'droppable': true |
35 | 36 | }; |
36 | 37 | |
37 | 38 | /* Inheritance */ |