summaryrefslogtreecommitdiff
path: root/static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js
diff options
context:
space:
mode:
Diffstat (limited to 'static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js')
-rw-r--r--static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js b/static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js
new file mode 100644
index 0000000..b009e25
--- /dev/null
+++ b/static-files/journal/wymeditor/plugins/list/jquery.wymeditor.list.js
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2011 PolicyStat LLC.
+ * MIT licensed (MIT-license.txt)
+ *
+ * This plugin adds the ability to use tab and shift+tab to indent/outdent
+ * lists, mimicking a user's expected behavior when inside an editor.
+ *
+ * @author Wes Winham (winhamwr@gmail.com)
+ */
+
+function ListPlugin(options, wym) {
+ var listPlugin = this;
+ ListPlugin._options = jQuery.extend({}, options);
+ listPlugin._wym = wym;
+
+ listPlugin.init();
+}
+
+ListPlugin.prototype.init = function() {
+ var listPlugin = this;
+ listPlugin._wym.listPlugin = listPlugin;
+
+ listPlugin.bindEvents();
+};
+
+ListPlugin.prototype.bindEvents = function() {
+ var listPlugin = this,
+ wym = listPlugin._wym;
+
+ wym.keyboard.combokeys.bind(
+ "tab",
+ function () {
+ wym.indent();
+ return false;
+ }
+ );
+ wym.keyboard.combokeys.bind(
+ "shift+tab",
+ function () {
+ wym.outdent();
+ return false;
+ }
+ );
+};