}
};
-Manager.prototype.command = function(command, meta) {
+Manager.prototype.toggleList = function(toggle) {
var selection = window.getSelection(),
node1 = $(selection.anchorNode).parent()[0],
node2 = $(selection.focusNode).parent()[0],
element1 = this.canvas.getDocumentElement(node1),
element2 = this.canvas.getDocumentElement(node2);
- if(command === 'createList') {
+ if(toggle) {
this.canvas.list.create({element1: element1, element2: element2});
- } else if(command === 'unwrap-node') {
+ } else {
+ if(this.canvas.list.areItemsOfTheSameList({element1: element1, element2: element2})) {
+ this.canvas.list.extractItems({element1: element1, element2: element2, merge: false});
+ }
+ }
+};
+
+Manager.prototype.command = function(command, meta) {
+ var selection = window.getSelection(),
+ node1 = $(selection.anchorNode).parent()[0],
+ node2 = $(selection.focusNode).parent()[0],
+ element1 = this.canvas.getDocumentElement(node1),
+ element2 = this.canvas.getDocumentElement(node2);
+ if(command === 'unwrap-node') {
// this.canvas.nodeUnwrap({node: canvasNode.create(pos.parentNode)});
// this.sandbox.publish('contentChanged');
if(this.canvas.list.areItemsOfTheSameList({element1: element1, element2: element2})) {
this.canvas.list.extractItems({element1: element1, element2: element2});
}
+ } else if(command === 'wrap-node') {
+ if(this.canvas.list.areItemsOfTheSameList({element1: element1, element2: element2})) {
+ this.canvas.list.create({element1: element1, element2: element2});
+ }
}
};
</div>
<div class="rng-module-documentToolbar-toolbarGroup">
<button data-btn="unwrap-node" data-btn-type="cmd" class="btn btn-mini"><i class="icon-arrow-up"></i></button>
+ <button data-btn="wrap-node" data-btn-type="cmd" class="btn btn-mini"><i class="icon-arrow-down"></i></button>
</div>
<div class="rng-module-documentToolbar-toolbarGroup">
<button data-btn="grid" data-btn-type="toggle" class="btn btn-mini"><i class="icon-th-large"></i></button>
<button data-btn="tags" data-btn-type="toggle" class="btn btn-mini"><i class="icon-tag"></i></button>
</div>
<div class="rng-module-documentToolbar-toolbarGroup">
- <button data-btn="createList" data-btn-type="cmd" data-meta="bullets" class="btn btn-mini"><i class="icon-list"></i></button>
+ <button data-btn="list" data-btn-type="toggle" data-meta="bullets" class="btn btn-mini"><i class="icon-list"></i></button>
<button data-btn="createList" data-btn-type="cmd" data-meta="enum" class="btn btn-mini"><i class="icon-th-list"></i></button>
</div>
<div style="clear: both;"></div>
toggleGrid: function(toggle) {
sandbox.getModule('documentCanvas').toggleGrid(toggle);
},
+ toggleList: function(toggle) {
+ sandbox.getModule('documentCanvas').toggleList(toggle);
+ },
newNodeRequested: function(wlxmlTag, wlxmlClass) {
sandbox.getModule('documentCanvas').insertNewNode(wlxmlTag, wlxmlClass);
},