aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/toolbar.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/toolbar.js')
-rw-r--r--lib/scripts/toolbar.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js
index 1a152b1a7..48a4a4a7e 100644
--- a/lib/scripts/toolbar.js
+++ b/lib/scripts/toolbar.js
@@ -78,6 +78,40 @@ function tb_format(btn, props, edid) {
}
/**
+ * Button action for format buttons
+ *
+ * This works exactly as tb_format() except that, if multiple lines
+ * are selected, each line will be formatted seperately
+ *
+ * @param DOMElement btn Button element to add the action to
+ * @param array props Associative array of button properties
+ * @param string edid ID of the editor textarea
+ * @author Gabriel Birke <birke@d-scribe.de>
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function tb_formatln(btn, props, edid) {
+ var sample = props['title'];
+ if(props['sample']){
+ sample = props['sample'];
+ }
+ sample = fixtxt(sample);
+
+ var selection = getSelection($(edid));
+ if(selection.getLength()) sample = selection.getText();
+
+ props['open'] = fixtxt(props['open']);
+ props['close'] = fixtxt(props['close']);
+
+ sample = sample.split("\n").join(props['close']+"\n"+props['open']);
+ sample = props['open']+sample+props['close'];
+
+ pasteText(selection,sample,{nosel: true});
+
+ pickerClose();
+ return false;
+}
+
+/**
* Button action for insert buttons
*
* @param DOMElement btn Button element to add the action to