Add JavaScript extension point for comments
Plugins can register a JavaScript function that is invoked whenever a DOM element that represents a comment is created. This DOM element is passed as argument. This allows the plugin to manipulate the DOM element, e.g. it can insert images for emoticons or render Markdown. Change-Id: Ia4f689b0f39ec57ba6835fc4e6a0b32b11c26b07 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
Dave Borowitz
parent
023d79107f
commit
daefed068f
@@ -21,6 +21,7 @@ import com.google.gerrit.client.info.AccountPreferencesInfo;
|
||||
import com.google.gerrit.client.info.ServerInfo;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.Window;
|
||||
|
||||
@@ -296,6 +297,13 @@ public class ApiGlue {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void fireEvent(String event, Element e) {
|
||||
JsArray<JavaScriptObject> h = getEventHandlers(event);
|
||||
for (int i = 0; i < h.length(); i++) {
|
||||
invoke(h.get(i), e);
|
||||
}
|
||||
}
|
||||
|
||||
static final void fireEvent(String event, JavaScriptObject a, JavaScriptObject b) {
|
||||
JsArray<JavaScriptObject> h = getEventHandlers(event);
|
||||
for (int i = 0; i < h.length(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user