在主要过程中,我创建了一个名为的窗口mainWindow.在按钮上单击,我创建一个新的browserWindow被调用notesWindow.
我想要做的就是从发送数据notesWindow到mainWindow
我所做的是使用IPC发送首先将数据发送notesWindow到主进程,检索主进程上的数据,然后将该数据发送到mainWindow,但mainWindow无法接收发送方事件.将数据发送到主进程工作正常,但从主进程到browserWindow似乎不起作用.
main.js
const ipcMain = require('electron').ipcMain;
ipcMain.on('notes', function(event, data) {
      console.log(data) // this properly shows the data
      event.sender.send('notes2', data);
});
Run Code Online (Sandbox Code Playgroud)
noteWindow.js
const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.send('notes', "new note");
Run Code Online (Sandbox Code Playgroud)
mainWindow.js
const ipcRenderer = require("electron").ipcRenderer;
ipcRenderer.on('notes2', function(event, data) {
    // this function never gets called
    console.log(data);
});
Run Code Online (Sandbox Code Playgroud)
谁能解释我做错了什么?提前致谢!
我创建了一个相当简单的手风琴块,它适用于基本文本。问题是我用于手风琴内容的控件是 RichText,它只允许基本格式,例如粗体。
如果我想创建一个无序列表和基本文本怎么办?我目前正在使用multiline: "p",但是如何添加其他元素以便我也可以在其中添加 UL 元素?
我能想到的只有两个想法,我不知道如何实施。第一个是扩展块工具栏BlockControls以包含额外的 UL 格式化程序,第二个是使用另一个元素而不是 RichText - 例如自由格式(可能已重命名为经典编辑器?) - 但我找不到任何文档这些。
这是我当前代码的示例:
属性
attributes: {
    title: {
        type: 'string',     
        selector: '.hd-accordion-title',
    },  
    content: {
        type: 'array',
        source: 'children',
        selector: '.hd-accordion-content',
    }
},
Run Code Online (Sandbox Code Playgroud)
编辑
edit: function( props ) {
        var title = props.attributes.title;     
        var content = props.attributes.content;
        function onChangeTitle(newTitle) {
            props.setAttributes({
                title: newTitle
            });
        }
        function onChangeContent(newContent) {
            props.setAttributes({
                content: newContent
            });
        }   
        return [
            (
                <div className={"hd-accordion"}>
                    <RichText
                        tagName="h3"
                        className= "hd-accordion-title"
                        value= { …Run Code Online (Sandbox Code Playgroud)