How to use the roosterjs-editor-api.toggleBullet 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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / features / listFeatures.ts View on Github external
);

                if (rangeToDelete) {
                    rangeToDelete.deleteContents();
                }

                // If not explicitly insert br, Chrome/Safari/IE will operate on the previous line
                let tempBr = editor.getDocument().createElement('BR');
                if (Browser.isChrome || Browser.isSafari || Browser.isIE11OrGreater) {
                    editor.insertNode(tempBr);
                }

                if (textBeforeCursor.indexOf('1.') == 0) {
                    toggleNumbering(editor);
                } else {
                    toggleBullet(editor);
                }

                editor.deleteNode(tempBr);
            });
        });
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / autoBullet.ts View on Github external
rangeToDelete.deleteContents();
        }

        // If not explicitly insert br, Chrome will operate on the previous line
        if (browserData.isChrome) {
            let brNode = document.createElement('br');
            editor.insertNode(brNode, {
                position: ContentPosition.SelectionStart,
                updateCursor: true,
                replaceSelection: false,
                insertOnNewLine: false,
            });
        }

        if (identifier == '*' || identifier == '-') {
            toggleBullet(editor);
        } else if (identifier == '1.') {
            toggleNumbering(editor);
        }
    });
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / features / listFeatures.ts View on Github external
function toggleListAndPreventDefault(event: PluginKeyboardEvent, editor: Editor) {
    let listInfo = cacheGetListElement(event, editor);
    if (listInfo) {
        let listElement = listInfo[0];
        let tag = getTagOfNode(listElement);
        if (tag == 'UL') {
            toggleBullet(editor);
        } else if (tag == 'OL') {
            toggleNumbering(editor);
        }
        editor.focus();
        event.rawEvent.preventDefault();
    }
}
github microsoft / roosterjs / sample / scripts / initFormatBar.ts View on Github external
document.getElementById('bulletButton').addEventListener('click', function() {
        toggleBullet(getCurrentEditor());
    });