How to use the roosterjs-editor-api.insertTable function in roosterjs-editor-api

To help you get started, we’ve selected a few roosterjs-editor-api examples, based on popular ways it is used in public projects.

github microsoft / roosterjs / sample / scripts / initFormatBar.ts View on Github external
document.getElementById('insertTable').addEventListener('click', function() {
        let columns = Math.min(parseInt(window.prompt('How many columns?')), 10);
        let rows = Math.min(parseInt(window.prompt('How many rows?')), 10);
        if (columns > 0 && rows > 0) {
            insertTable(getCurrentEditor(), columns, rows);
        }
    });
github microsoft / roosterjs / publish / samplesite / scripts / controls / sidePane / tableOptions / TableOptionsPlugin.ts View on Github external
private onInsertTable = (cols: number, rows: number) => {
        insertTable(this.editor, cols, rows);
    };
}
github microsoft / roosterjs / publish / samplesite / scripts / controls / ribbon / renderTableOptions.tsx View on Github external
private onInsertTable = () => {
        this.props.onDismiss();

        let cols = parseInt(this.cols.current.value);
        let rows = parseInt(this.rows.current.value);
        if (cols > 0 && cols <= 10 && rows > 0 && rows <= 10) {
            insertTable(this.props.editor, cols, rows);
        }
    };