Why my plugin method not trigger?

hi,
I have a function that receive some text and invoke postMessage to trigger window.Asc.plugin.onExternalPluginMessage, like this:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="mobile-web-app-capable" content="yes" />
        <title>ONLYOFFICE</title>
        <link rel="icon" href="/css/img/word.ico" type="image/x-icon"/>
        <link rel="stylesheet" type="text/css" href="css/editor.css" />
        <script type="text/javascript" src="http://192.168.66.78/web-apps/apps/api/documents/api.js"></script>
        <script type="text/javascript">

            var docEditor;
            var config = ........;  // ignore config information

            initEditor();
            
            function initEditor()
            {
                if (config.editorConfig.user.name == "Anonymous") {
                    config.editorConfig.user.name = "";
                }

                config.width = "100%";
                config.height = "100%";

                сonnectEditor();
            }

            var сonnectEditor = function () {
                if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
                    && DocsAPI.DocEditor.version().split(".")[0] < 7) {
                    innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
                    return;
                }

                docEditor = new DocsAPI.DocEditor("iframeEditor", config);
            };

            function addText(value) {
                const msg = {
                    frameEditorId:"iframeEditor",
                    guid: "asc.{7470f8ef-bcb4-4f07-8887-6ebf973075cf}",
                    type: "onExternalPluginMessage",
                    data:{
                        text: value,
                        type: "insertText",
                    }
                };

                let frame = window.frames[0];
                frame.postMessage(JSON.stringify(msg), "*");
            };

        </script>
    </head>
    <body>
        <table style="width: 100%; height: 100%">
            <tr style="width: 100%; height: 100%">
                <td style="width: 250px; height: 100%">
                    <table  style="width: 250px; height: 100%;" border="1px">
                        <tr style="height: 140px">
                            <td style="width: 125px">
                                <span data-th-border="2px" onclick="addText(this.innerText)">this is a test message.</span>
                            </td>
                            <td style="width: 125px">
                                <span data-th-border="2px" onclick="addText(this.innerText)">hello world</span>
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 800px; height: 100%">
                    <div class="form">
                        <div id="iframeEditor"></div>
                    </div>
                </td>
            </tr>
        </table>
    </body>
</html>

my plugin code is :

(function(window, undefined) {
    window.Asc.plugin.init = function() {
        console.log("initialization");
    };
    window.Asc.plugin.onExternalPluginMessage = function(data) {
        console.log("onExternalPluginMessage===>>>", data);
        switch (data.type) {
            case "close": {
                this.executeCommand("close", "");
                break;
            }
            case "insertText": {
                window.Asc.plugin.executeMethod("InputText", [data.text, ""]);
                break;
            }
        }
    };
    window.Asc.plugin.button = function(id) {

    };
})(window, undefined);

Now , click the words in <span>, not trigger window.Asc.plugin.onExternalPluginMessage
Thank you for you help!

hi @milozhao

:eyes:
I can’t promise that I will get back to you with an answer soon, but I’ll try to understand your issue.