Merge "Add CodeMirrorDoc and the code folding addon."
This commit is contained in:
commit
42248a08a6
@ -25,4 +25,8 @@ public interface Addons extends ClientBundle {
|
||||
@Source("selection/mark-selection.js")
|
||||
@DoNotEmbed
|
||||
DataResource mark_selection();
|
||||
|
||||
@Source("fold/foldcode.js")
|
||||
@DoNotEmbed
|
||||
DataResource foldcode();
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ public class CodeMirror extends JavaScriptObject {
|
||||
this.addLineWidget(line, node, options);
|
||||
}-*/;
|
||||
|
||||
public final native CodeMirrorDoc getDoc() /*-{
|
||||
return this.getDoc();
|
||||
}-*/;
|
||||
|
||||
public final native void scrollTo(int x, int y) /*-{
|
||||
this.scrollTo(x, y);
|
||||
}-*/;
|
||||
|
33
gerrit-gwtui/src/main/java/net/codemirror/lib/CodeMirrorDoc.java
vendored
Normal file
33
gerrit-gwtui/src/main/java/net/codemirror/lib/CodeMirrorDoc.java
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2013 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package net.codemirror.lib;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
/** The Doc object representing the content in a CodeMirror */
|
||||
public class CodeMirrorDoc extends JavaScriptObject {
|
||||
|
||||
public final native void replaceRange(String replacement,
|
||||
LineCharacter from, LineCharacter to) /*-{
|
||||
this.replaceRange(replacement, from, to);
|
||||
}-*/;
|
||||
|
||||
public final native void insertText(String insertion, LineCharacter at) /*-{
|
||||
this.replaceRange(insertion, at);
|
||||
}-*/;
|
||||
|
||||
protected CodeMirrorDoc() {
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ class Loader {
|
||||
public void onSuccess(Void result) {}
|
||||
}));
|
||||
injectScript(Addons.I.mark_selection().getSafeUri(), group.add(cb));
|
||||
injectScript(Addons.I.foldcode().getSafeUri(), group.add(cb));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user