Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert_Button insertBefore not working on notebookbar #10090

Open
langziyang opened this issue Sep 22, 2024 · 1 comment
Open

Insert_Button insertBefore not working on notebookbar #10090

langziyang opened this issue Sep 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@langziyang
Copy link

<script>
        window.addEventListener('message', function (event) {
            receiveMessage(event)
        })

        function postMessage(msg) {
            document.getElementById("collabora-online-viewer").contentWindow.postMessage(JSON.stringify(msg), '*');
        }

        function postReady() {
            postMessage({MessageId: "Host_PostmessageReady"})
            addButton()
        }

        function addButton() {
            postMessage({
                MessageId: "Insert_Button",
                Values: {
                    id: "jinber",
                    imgurl: 'http://192.168.68.29:8005/logoRouter.png',
                    hint: 'JinberButton',
                    label: "JinberButton",
                    insertBefore: "inserthyperlink"
                }
            });
            postMessage({
                MessageId: "Remove_Button",
                Values: {
                    id: "about"
                }
            })
            postMessage({
                MessageId: "Action_ChangeUIMode",
                Values: {
                    // Mode:"classic",   // working,the custom button added before inserthyperlink
                    Mode: "notebookbar",  // notworking,the custom button alwary added after save
                }
            })
        }

        function receiveMessage(event) {
            try {
                let msg = JSON.parse(event.data);
                if (!msg) {
                    return;
                }
                switch (msg.MessageId) {
                    case "App_LoadingStatus":
                        if (msg.Values && msg.Values.Status === "Document_Loaded") {
                            postReady();
                        }
                        break;
                }
            } catch (e) {

            }
        }
    </script>

classic mode
image

notebookbar mode
image

@langziyang langziyang added bug Something isn't working unconfirmed labels Sep 22, 2024
@thebearon thebearon added enhancement New feature or request and removed bug Something isn't working unconfirmed labels Sep 29, 2024
@thebearon
Copy link
Contributor

Indeed, currently Insert_Button does not work on the tabbed bar (notebookbar), it is a missing feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants