与 TinyMCE 的对话导致错误 12003
Dialog with TinyMCE causes error 12003
随着 Word (1611) 的最新更新,TinyMCE 对话框导致错误 12003:URL 语法无效。
根据Use the Dialog API原因是
The dialog box was directed to a URL with the HTTP protocol. HTTPS is required.
简单的例子是将下面的代码放在对话框中(奇怪的是它在面板中工作)。
更新代码
<!DOCTYPE html>
<html>
<head>
<title>Office.js with TinyMCE</title>
<meta charset="utf-8" />
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://cdn.tinymce.com/4/tinymce.min.js"></script>
<script type="text/javascript">
(function () {
"use strict";
// The initialize function must be run each time a new page is loaded.
Office.initialize = function (reason) {
$(document).ready(function () {
tinymce.init({ selector: 'textarea' });
});
};
})();
</script>
</head>
<body>
<textarea></textarea>
</body>
</html>
Edit1: 这只是 Windows 上的一个问题。在 Mac 上工作正常。
Edit2:打开对话框的代码
var url = 'https://' + location.host + '/dialog.html';
console.log('url: ' + url); // url: https://localhost:44341/dialog.html
Office.context.ui.displayDialogAsync(url, { height: 30, width: 20 });
12003 通常表示您的对话框中没有 https url。当调用 displayDialogAsync 时更有可能引发此问题,您在第一个参数中传递了 HTTP url。
对于您使用 TinyMCE 的 html 页面,我可以 copy-paste 整个 html 并在 Office 对话框中打开它。因此它不太可能与 tinyMCE 有关。
(您可以分享打开对话框的代码会很有帮助。)
此致
我们已经确定了问题。事实证明,我们正在阻止 javascript: URL 协议,该协议似乎在使用 TinyMCE 时被调用。我们正在努力修复。
随着 Word (1611) 的最新更新,TinyMCE 对话框导致错误 12003:URL 语法无效。
根据Use the Dialog API原因是
The dialog box was directed to a URL with the HTTP protocol. HTTPS is required.
简单的例子是将下面的代码放在对话框中(奇怪的是它在面板中工作)。
更新代码
<!DOCTYPE html>
<html>
<head>
<title>Office.js with TinyMCE</title>
<meta charset="utf-8" />
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://cdn.tinymce.com/4/tinymce.min.js"></script>
<script type="text/javascript">
(function () {
"use strict";
// The initialize function must be run each time a new page is loaded.
Office.initialize = function (reason) {
$(document).ready(function () {
tinymce.init({ selector: 'textarea' });
});
};
})();
</script>
</head>
<body>
<textarea></textarea>
</body>
</html>
Edit1: 这只是 Windows 上的一个问题。在 Mac 上工作正常。
Edit2:打开对话框的代码
var url = 'https://' + location.host + '/dialog.html';
console.log('url: ' + url); // url: https://localhost:44341/dialog.html
Office.context.ui.displayDialogAsync(url, { height: 30, width: 20 });
12003 通常表示您的对话框中没有 https url。当调用 displayDialogAsync 时更有可能引发此问题,您在第一个参数中传递了 HTTP url。
对于您使用 TinyMCE 的 html 页面,我可以 copy-paste 整个 html 并在 Office 对话框中打开它。因此它不太可能与 tinyMCE 有关。
(您可以分享打开对话框的代码会很有帮助。)
此致
我们已经确定了问题。事实证明,我们正在阻止 javascript: URL 协议,该协议似乎在使用 TinyMCE 时被调用。我们正在努力修复。