1

GWTGoogle ドキュメントにサイドバーとして埋め込みたい。単純なjqueryWeb ページの場合、すべて正常に動作しますが、最小の GWT アプリを埋め込むと表示されません。GWT アプリを最小限に減らしました。

public class TemplateBuilder implements EntryPoint {
    public void onModuleLoad() {
        Window.alert("hello world");
    }
}

この GWT アプリケーションを次のように含めます。

code.gs で

function showSidebar() {
  var htmlOutput = HtmlService.createHtmlOutputFromFile("sidebar.html").setTitle("Template Builder").setWidth(350);
  htmlOutput.setSandboxMode(HtmlService.SandboxMode.NATIVE);
  DocumentApp.getUi().showSidebar(htmlOutput);
}

sidebar.html で

<html>
  <head>
    <script src="http://remoteserver/templatebuilder.nocache.js"></script>
  </head>
  <body>
  <div id="globalStats" />
  </body>
</html>

前述のように、HTML ファイルに jquery を含め、jquery ステートメントでリモート スクリプトを呼び出すことは、このアプローチでうまく機能します。

現在、Google ドキュメントで webapp を実行しています。javascript と HTML は CAJA-sanitizedです。ここで読んだ内容から理解できます: https://developers.google.com/apps-script/guides/html/restrictions。次に、にSANDBOX mode設定できる があります NATIVE or EMULATED。両方試しました。

setSandboxMode() メソッドを使用して、Caja の 2 つのバージョンから選択できます。NATIVE モードは、EMULATED モードよりも制限が少なく、通常は高速に実行されます。対照的に、EMULATED モードは、ECMAScript 5 strict モードをサポートしていない古いブラウザー、特に Internet Explorer 9 で動作する可能性が高くなります (Internet Explorer 8 以前を含む非常に古いブラウザーは通常、HTML サービスと互換性がありません)。

とにかく、何も表示されず、以下のログから、エラーは次のとおりです。

オブジェクト [object Object] にはメソッド 'replace' がありません

サイドバーに埋め込むために、アプリケーション ウィジェットの一部を再利用できれば素晴らしいと思います....

誰か光を当てることができますか??

どうも

参考までに、コンソール出力:

SES initialization ses-single-frame.opt.js?debug=1:46
 Problem ignored by configuration (Unsafe spec violation): Array.prototype.push does not throw on a frozen array ses-single-frame.opt.js?debug=1:43
 Problem ignored by configuration (Unsafe spec violation): Extending an array can modify read-only array length ses-single-frame.opt.js?debug=1:43
 Problem ignored by configuration (Unsafe spec violation): SyntaxErrors aren't always early ses-single-frame.opt.js?debug=1:43
 Problem ignored by configuration (Unsafe spec violation): Array.prototype.unshift ignores sealing ses-single-frame.opt.js?debug=1:43
 Problem ignored by configuration (Unsafe spec violation): Array.prototype.splice ignores sealing ses-single-frame.opt.js?debug=1:43
 Problem ignored by configuration (Unsafe spec violation): Array.prototype.shift ignores sealing ses-single-frame.opt.js?debug=1:43
 Repaired: Non-deletable RegExp statics are a global communication channel ses-single-frame.opt.js?debug=1:43
 Repaired: Date.prototype is a global communication channel ses-single-frame.opt.js?debug=1:43
 Not repaired: Eval breaks masking of named functions in non-strict code ses-single-frame.opt.js?debug=1:43
 Repaired: Array.prototype.push ignores sealing ses-single-frame.opt.js?debug=1:43
 Repair skipped: Array.prototype.push does not throw on a frozen array ses-single-frame.opt.js?debug=1:43
 Repaired: Array.prototype.push ignores frozen ses-single-frame.opt.js?debug=1:43
 Repaired: Freezing an array does not make .length immutable ses-single-frame.opt.js?debug=1:43
 Not repaired: Extending an array can modify read-only array length ses-single-frame.opt.js?debug=1:43
 Not repaired: [[ThrowTypeError]] has normal function properties ses-single-frame.opt.js?debug=1:43
 Not repaired: SyntaxErrors aren't always early ses-single-frame.opt.js?debug=1:43
 Repaired unsafely: Array.prototype.unshift ignores sealing ses-single-frame.opt.js?debug=1:43
 Repaired: Array.prototype.unshift ignores freezing ses-single-frame.opt.js?debug=1:43
 Repaired unsafely: Array.prototype.splice ignores sealing ses-single-frame.opt.js?debug=1:43
 Repaired: Array.prototype.splice ignores freezing ses-single-frame.opt.js?debug=1:43
 Repaired unsafely: Array.prototype.shift ignores sealing ses-single-frame.opt.js?debug=1:43
 Repaired: Array.prototype.shift ignores freezing ses-single-frame.opt.js?debug=1:43
 Repaired: Array methods as functions operate on global object ses-single-frame.opt.js?debug=1:43
 Max Severity: Safe spec violation(1). ses-single-frame.opt.js?debug=1:43
 440 Apparently fine ses-single-frame.opt.js?debug=1:43
 10 Deleted ses-single-frame.opt.js?debug=1:43
 1 Skipped ses-single-frame.opt.js?debug=1:43
 Max Severity: Safe spec violation(1). ses-single-frame.opt.js?debug=1:43
 initSES succeeded. ses-single-frame.opt.js?debug=1:43

サンドボックス モード: ネイティブ 904833574-maestro_htmlapp_bin_maestro_htmlapp.js?lib=MK7wi1l9-fBV4ffZJJ9h74zcqOPkxWgv_:192

オブジェクト [object Object] にはメソッド「replace」がありません 904833574-maestro_htmlapp_bin_maestro_htmlapp.js?lib=MK7wi1l9-fBV4ffZJJ9h74zcqOPkxWgv_:66

Kp904833574-maestro_htmlapp_bin_maestro_htmlapp.js?lib=MK7wi1l9-fBV4ffZJJ9h74zcqOPkxWgv_:66
applyFunctionses-single-frame.opt.js?debug=1:1454
tamingNullAdviceses-single-frame.opt.js?debug=1:1338
applyFeralFunctionses-single-frame.opt.js?debug=1:1320
applyFeralFunctionses-single-frame.opt.js?debug=1:1347
tses-single-frame.opt.js?debug=1:1386
plugin_dispatchEventses-single-frame.opt.js?debug=1:1308
wrapperses-single-frame.opt.js?debug=1:1085
dispatchEventses-single-frame.opt.js?debug=1:781
(anonymous function)ses-single-frame.opt.js?debug=1:1090
_SubConfidence.amplifyses-single-frame.opt.js?debug=1:840
(anonymous function)ses-single-frame.opt.js?debug=1:1090
amplifierMethodses-single-frame.opt.js?debug=1:838
dispatchToListenersses-single-frame.opt.js?debug=1:1268
(anonymous function)ses-single-frame.opt.js?debug=1:1268
(anonymous function)ses-single-frame.opt.js?debug=1:620
execDelayedScriptsses-single-frame.opt.js?debug=1:622
signalLoadedses-single-frame.opt.js?debug=1:620
(anonymous function)ses-single-frame.opt.js?debug=1:1476
fulfilledses-single-frame.opt.js?debug=1:1419
doneses-single-frame.opt.js?debug=1:1427
fulfilledses-single-frame.opt.js?debug=1:1419
(anonymous function)ses-single-frame.opt.js?debug=1:1421
runses-single-frame.opt.js?debug=1:1420
4

1 に答える 1