定义简单面板

    在插件的 package.json 文件中定义 panel 字段如下:

    扩展编辑器面板 中介绍的面板定义的区别在于,type 使用 simple,而 main 索引的是 html 文件而不是 javascript 文件。

    1. <html>
    2. <head>
    3. <title>Simple Panel Window</title>
    4. <style>
    5. body {
    6. margin: 10px;
    7. h1 {
    8. color: #f90
    9. }
    10. </style>
    11. </head>
    12. <button id="btn">Send Message</button>
    13. <script>
    14. let btn = document.getElementById('btn');
    15. btn.addEventListener('click', () => {
    16. Editor.log('on button clicked!');
    17. });
    18. </script>
    19. </html>

    在完成了上述操作后,我们就可以通过 激活我们的窗口。