Load TinyMCE as chrome to avoid NoScript blockage

This commit is contained in:
Dan Stillman 2008-10-27 16:39:18 +00:00
parent 11b05a5a41
commit 8070a22d08
5 changed files with 16 additions and 16 deletions

View file

@ -249,17 +249,14 @@
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var uri = ios.newURI("chrome://zotero/content/tinymce/" + htmlFile + ".html", null, null);
var chromeReg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].
getService(Components.interfaces.nsIChromeRegistry);
var fileURI = chromeReg.convertChromeURL(uri);
Zotero.debug("Loading " + fileURI.spec);
Zotero.debug("Loading " + uri.spec);
// Register handler for deferred setting of content
var self = this;
var listener = function() {
self._iframe.removeEventListener("DOMContentLoaded", listener, false);
var editor = self._iframe.contentWindow.wrappedJSObject.tinyMCE.get("tinymce");
var editor = self._iframe.contentWindow.tinyMCE.get("tinymce");
editor.onInit.add(function() {
self._editor = editor;
@ -269,13 +266,12 @@
});
if (self._eventHandler) {
self._iframe.contentWindow.wrappedJSObject.handleEvent = self._eventHandler;
self._iframe.contentWindow.handleEvent = self._eventHandler;
}
};
this._iframe.addEventListener("DOMContentLoaded", listener, false);
Zotero.debug("Loading " + fileURI.spec);
this._iframe.webNavigation.loadURI(fileURI.spec,
this._iframe.webNavigation.loadURI(uri.spec,
Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
]]>
</body>
@ -284,7 +280,7 @@
</implementation>
<content>
<xul:iframe flex="1" anonid="rt-view" class="rt-view" type="content"
<xul:iframe flex="1" anonid="rt-view" class="rt-view"
xbl:inherits="onfocus,onblur,flex,width,height,hidden"
style="overflow: hidden"/>
</content>

View file

@ -26,7 +26,7 @@ html, body {
// General options
mode : "none",
theme : "advanced",
content_css : "../../../skin/default/zotero/tinymce/integration-content.css",
content_css : "chrome://zotero/skin/tinymce/integration-content.css",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,|,sub,sup,|,removeformat",

View file

@ -2,14 +2,14 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TinyMCE</title>
<link type="text/css" rel="stylesheet" href="../../../skin/default/zotero/tinymce/note-ui.css"/>
<link type="text/css" rel="stylesheet" href="chrome://zotero/skin/tinymce/note-ui.css"/>
<script type="text/javascript" src="tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "none",
theme : "advanced",
content_css : "../../../skin/default/zotero/tinymce/note-content.css",
content_css : "chrome://zotero/skin/tinymce/note-content.css",
button_tile_map : true,
language : "en", // TODO: localize
entity_encoding : "raw",

View file

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TinyMCE</title>
<link type="text/css" rel="stylesheet" href="../../../skin/default/zotero/tinymce/note-ui.css"/>
<link type="text/css" rel="stylesheet" href="chrome://zotero/skin/tinymce/note-ui.css"/>
<style>
table.mceLayout > tbody > tr.mceLast {
top: 0;
@ -14,7 +14,7 @@ table.mceLayout > tbody > tr.mceLast {
// General options
mode : "none",
theme : "advanced",
content_css : "../../../skin/default/zotero/tinymce/note-content.css",
content_css : "chrome://zotero/skin/tinymce/note-content.css",
button_tile_map : true,
language : "en", // TODO: localize
entity_encoding : "raw",

View file

@ -6311,8 +6311,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
// User already specified a document.domain value
if (document.domain && lo.hostname != document.domain)
tinymce.relaxedDomain = document.domain;
// try/catch added by Dan S./Zotero
try {
if (document.domain && lo.hostname != document.domain)
tinymce.relaxedDomain = document.domain;
}
catch (e) {}
// Setup document domain if tinymce is loaded from other domain
if (!tinymce.relaxedDomain && tinymce.EditorManager.baseURI.host != lo.hostname && lo.hostname)