| 231 | |
| 232 | // build block to insert |
| 233 | function build(string) { |
| 234 | openWith = prepare(clicked.openWith); |
| 235 | placeHolder = prepare(clicked.placeHolder); |
| 236 | replaceWith = prepare(clicked.replaceWith); |
| 237 | closeWith = prepare(clicked.closeWith); |
| 238 | if (replaceWith !== "") { |
| 239 | block = openWith + replaceWith + closeWith; |
| 240 | } else if (selection === '' && placeHolder !== '') { |
| 241 | block = openWith + placeHolder + closeWith; |
| 242 | } else { |
| 243 | block = openWith + (string||selection) + closeWith; |
| 244 | } |
| 245 | return { block:block, |
| 246 | openWith:openWith, |
| 247 | replaceWith:replaceWith, |
| 248 | placeHolder:placeHolder, |
| 249 | closeWith:closeWith |
| 250 | }; |
| 251 | } |
| 252 | |
| 253 | // define markup to insert |
| 254 | function markup(button) { |