This commit is contained in:
satyr 2010-04-30 06:23:01 +09:00
Родитель dac5641c5e
Коммит 09dcdf56ef
4 изменённых файлов: 830 добавлений и 833 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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() {