зеркало из https://github.com/mozilla/ubiquity.git
Bespin: 0.7.3
This commit is contained in:
Родитель
dac5641c5e
Коммит
09dcdf56ef
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,14 +7,11 @@
|
|||
<div id="bespin" style="width:100%;height:500px"></div>
|
||||
<script src="BespinEmbedded.compressed.js"></script>
|
||||
<script>
|
||||
if (!this.console) var {console} = Application;
|
||||
function onBespinLoad() {
|
||||
var node = document.getElementById("bespin");
|
||||
bespin = tiki.require("Embedded").useBespin(node, {
|
||||
syntax: "js",
|
||||
settings: {tabstop: 2},
|
||||
});
|
||||
parent.postMessage("bespin", "*");
|
||||
self.bespin = tiki.require("embedded").useBespin(
|
||||
document.getElementById("bespin"),
|
||||
{syntax: "js", settings: {tabstop: 2}});
|
||||
postMessage("bespin", "*");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -27,10 +27,12 @@ function changeEditor() {
|
|||
var $ediv = $("#editor-div").empty();
|
||||
if (bespin) {
|
||||
let [iframe] = $("<iframe/>", {
|
||||
src: "chrome://ubiquity/content/bespin.html",
|
||||
src: "resource://ubiquity/chrome/content/bespin.html",
|
||||
style: "width: 100%; height: 100%; border:0",
|
||||
}).appendTo($ediv);
|
||||
addEventListener("message", onBespin, false);
|
||||
Utils.listenOnce(iframe, "load", function onBespinFrameLoad(){
|
||||
this.contentWindow.addEventListener("message", onBespin, false);
|
||||
});
|
||||
}
|
||||
else {
|
||||
editor = document.createElement("textarea");
|
||||
|
@ -42,17 +44,18 @@ function changeEditor() {
|
|||
}
|
||||
}
|
||||
function onBespin(ev) {
|
||||
var [win] = frames;
|
||||
editor = (win.wrappedJSObject || win)[ev.data];
|
||||
var {source, data} = ev;
|
||||
editor = (source.wrappedJSObject || source)[data];
|
||||
editor.value = PrefCommands.getCode();
|
||||
editor.element.addEventListener("keyup", updateCode, false);
|
||||
editor.addEventListener("textChange", updateCode);
|
||||
focusEditor();
|
||||
}
|
||||
function focusEditor() {
|
||||
if ("focus" in editor) editor.focus();
|
||||
else {
|
||||
editor.getPath("pane.applicationView.centerView.textView").focus();
|
||||
editor.get("pane").becomeKeyPane();
|
||||
let {scrollX, scrollY} = self;
|
||||
editor.setFocus(true);
|
||||
scrollTo(scrollX, scrollY);
|
||||
}
|
||||
}
|
||||
function updateCode() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче