aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etherpad/src/plugins/twitterStyleTags/main.js5
-rw-r--r--etherpad/src/plugins/twitterStyleTags/static/js/main.js26
2 files changed, 25 insertions, 6 deletions
diff --git a/etherpad/src/plugins/twitterStyleTags/main.js b/etherpad/src/plugins/twitterStyleTags/main.js
index 686c863..f6dd3bf 100644
--- a/etherpad/src/plugins/twitterStyleTags/main.js
+++ b/etherpad/src/plugins/twitterStyleTags/main.js
@@ -3,11 +3,12 @@ import("plugins.twitterStyleTags.hooks");
import("plugins.twitterStyleTags.static.js.main");
function init() {
- this.hooks = ['handlePath'];
+ this.hooks = ['handlePath', 'aceGetFilterStack', 'aceCreateDomLine'];
this.client = new main.init();
this.description = 'Twitter-style tags';
this.handlePath = hooks.handlePath;
- this.aceGetFilterStack = hooks.aceGetFilterStack;
+ this.aceGetFilterStack = main.aceGetFilterStack;
+ this.aceCreateDomLine = main.aceCreateDomLine;
this.install = install;
this.uninstall = uninstall;
diff --git a/etherpad/src/plugins/twitterStyleTags/static/js/main.js b/etherpad/src/plugins/twitterStyleTags/static/js/main.js
index 96be013..eae0c4f 100644
--- a/etherpad/src/plugins/twitterStyleTags/static/js/main.js
+++ b/etherpad/src/plugins/twitterStyleTags/static/js/main.js
@@ -1,10 +1,28 @@
function init() {
- this.hooks = ['aceGetFilterStack'];
- this.aceGetFilterStack = aceGetFilterStack;
+ this.hooks = ['aceGetFilterStack', 'aceCreateDomLine'];
+ this.aceGetFilterStack = aceGetFilterStack;
+ this.aceCreateDomLine = aceCreateDomLine;
}
-function aceGetFilterStack() {
- console.log('aceGetFilterStack');
+function aceGetFilterStack(args) {
+ return [args.linestylefilter.getRegexpFilter(
+ new RegExp("#[^,#!\\s][^,#!\\s]*", "g"), 'padtag')];
+}
+
+function aceCreateDomLine(args) {
+ if (args.cls.indexOf('padtag') < 0)
+ return;
+
+ var href;
+ cls = args.cls.replace(/(^| )padtag:(\S+)/g, function(x0, space, padtag) {
+ href = '/ep/tag/?query=' + padtag.substring(1);
+ return space + "padtag padtag_" + padtag.substring(1);
+ });
+
+ return [{
+ cls: cls,
+ extraOpenTags: '<a href="' + href.replace(/\"/g, '&quot;') + '">',
+ extraCloseTags: '</a>'}];
}
/* used on the client side only */