Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

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.