How to add Ordered and Unordered list to buttonbar?

DreytiDreyti New
edited June 2014 in Vanilla 2.0 - 2.8

Hi, all! Need help with button bar! I have added 2 buttons for Ordered and Unordered list in buttonBar. Also write yhis code to buttonbar.js

case 'orderedlist':
  $(TextArea).surroundSelectedText('[list=1]', '\n[/list]', 'select');
  var tagListItem = '\n[*] ';
  var selection = '\n' + $(TextArea).getSelection().text;
  selection = selection.replace(/(\r\n|\n|\r)/gm, tagListItem);
  $(TextArea).replaceSelectedText(selection, 'collapseToEnd');
  break;

case 'unorderedlist':
  $(TextArea).surroundSelectedText('[list]', '\n[/list]', 'select');
  var tagListItem = '\n[*] ';
  var selection = '\n' + $(TextArea).getSelection().text;
  selection = selection.replace(/(\r\n|\n|\r)/gm, tagListItem);
  $(TextArea).replaceSelectedText(selection, 'collapseToEnd');
  break;

But buttons didn't work. Anyone knows how to make them work?

Comments

Sign In or Register to comment.