How to use the roosterjs-editor-dom.Browser.isChrome function in roosterjs-editor-dom

To help you get started, we’ve selected a few roosterjs-editor-dom 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
editor.performAutoComplete(() => {
                let searcher = editor.getContentSearcherOfCursor();
                let textBeforeCursor = searcher.getSubStringBefore(3);
                let rangeToDelete = searcher.getRangeFromText(
                    textBeforeCursor,
                    true /*exactMatch*/
                );

                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-api / lib / utils / processList.ts View on Github external
export default function processList(editor: Editor, command: ValidProcessListDocumentCommands): Node {
    let clonedNode: Node;
    let relativeSelectionPath;
    if (Browser.isChrome && command == DocumentCommand.Outdent) {
        const parentLINode =  editor.getElementAtCursor('LI');
        if (parentLINode) {
            let currentRange = editor.getSelectionRange();
            if (
                currentRange.collapsed ||
                (
                    editor.getElementAtCursor('LI', currentRange.startContainer) == parentLINode &&
                    editor.getElementAtCursor('LI', currentRange.endContainer) == parentLINode
                )
            ) {
                relativeSelectionPath = getSelectionPath(parentLINode, currentRange);
                // Chrome has some bad behavior when outdenting
                // in order to work around this, we need to take steps to deep clone the current node
                // after the outdent, we'll replace the new LI with the cloned content.
                clonedNode =  parentLINode.cloneNode(true);
            }
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / ContentEditFeatures.ts View on Github external
export function getDefaultContentEditFeatures(): ContentEditFeatures {
    return {
        autoLink: true,
        indentWhenTab: true,
        outdentWhenShiftTab: true,
        outdentWhenBackspaceOnEmptyFirstLine: true,
        outdentWhenEnterOnEmptyLine: Browser.isIE,
        mergeInNewLineWhenBackspaceOnFirstChar: false,
        unquoteWhenBackspaceOnEmptyFirstLine: true,
        unquoteWhenEnterOnEmptyLine: true,
        autoBullet: true,
        tabInTable: true,
        upDownInTable: Browser.isChrome || Browser.isSafari,
        insertLineBeforeStructuredNodeFeature: false,
        defaultShortcut: true,
        unlinkWhenBackspaceAfterLink: false,
        noCycleCursorMove: Browser.isChrome,
        smartOrderedList: false,
        smartOrderedListStyles: ['lower-alpha', 'lower-roman', 'decimal'],
    };
}
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / ContentEditFeatures.ts View on Github external
return {
        autoLink: true,
        indentWhenTab: true,
        outdentWhenShiftTab: true,
        outdentWhenBackspaceOnEmptyFirstLine: true,
        outdentWhenEnterOnEmptyLine: Browser.isIE,
        mergeInNewLineWhenBackspaceOnFirstChar: false,
        unquoteWhenBackspaceOnEmptyFirstLine: true,
        unquoteWhenEnterOnEmptyLine: true,
        autoBullet: true,
        tabInTable: true,
        upDownInTable: Browser.isChrome || Browser.isSafari,
        insertLineBeforeStructuredNodeFeature: false,
        defaultShortcut: true,
        unlinkWhenBackspaceAfterLink: false,
        noCycleCursorMove: Browser.isChrome,
        smartOrderedList: false,
        smartOrderedListStyles: ['lower-alpha', 'lower-roman', 'decimal'],
    };
}
github microsoft / roosterjs / publish / samplesite / scripts / controls / sidePane / formatState / FormatStatePane.tsx View on Github external
className={
                                    format.headerLevel == 0 && styles.inactive
                                }>{`Header ${format.headerLevel}`}
                        
                    
                    
                        Undo
                        
                            {this.renderSpan(format.canUndo, 'Can Undo')}
                            {this.renderSpan(format.canRedo, 'Can Redo')}
                        
                    
                    
                        Browser
                        
                            {this.renderSpan(Browser.isChrome, 'Chrome')}
                            {this.renderSpan(Browser.isEdge, 'Edge')}
                            {this.renderSpan(Browser.isFirefox, 'Firefox')}
                            {this.renderSpan(Browser.isIE11OrGreater, 'IE10/11')}
                            {this.renderSpan(Browser.isIE, 'IE')}
                            {this.renderSpan(Browser.isIEOrEdge, 'IE/Edge')}
                            {this.renderSpan(Browser.isSafari, 'Safari')}
                            {this.renderSpan(Browser.isWebKit, 'Webkit')}
                        
                    
                    
                        OS
                        
                            {this.renderSpan(Browser.isMac, 'MacOS')}
                            {this.renderSpan(Browser.isWin, 'Windows')}