How to use the roosterjs-editor-types.Indentation.Increase function in roosterjs-editor-types

To help you get started, we’ve selected a few roosterjs-editor-types 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-api / lib / format / setIndentation.ts View on Github external
export default function setIndentation(editor: Editor, indentation: Indentation) {
    let command: DocumentCommand.Indent | DocumentCommand.Outdent =
        indentation == Indentation.Increase ? DocumentCommand.Indent : DocumentCommand.Outdent;
    editor.addUndoSnapshot(() => {
        editor.focus();
        let listNode = editor.getElementAtCursor('OL,UL');
        let newNode: Node;

        if (listNode) {
            // There is already list node, setIndentation() will increase/decrease the list level,
            // so we need to process the list when change indentation
            newNode = processList(editor, command);
        } else {
            // No existing list node, browser will create <blockquote> node for indentation.
            // We need to set top and bottom margin to 0 to avoid unnecessary spaces
            editor.getDocument().execCommand(command, false, null);
            editor.queryElements('BLOCKQUOTE', QueryScope.OnSelection, node =&gt; {
                newNode = newNode || node;
                node.style.marginTop = '0px';
</blockquote>
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / features / listFeatures.ts View on Github external
handleEvent: (event, editor) => {
        setIndentation(editor, Indentation.Increase);
        event.rawEvent.preventDefault();
    },
};
github microsoft / roosterjs / sample / scripts / initFormatBar.ts View on Github external
document.getElementById('indentButton').addEventListener('click', function() {
        setIndentation(getCurrentEditor(), Indentation.Increase);
    });
github microsoft / roosterjs-react / packages / roosterjs-react-command-bar / lib / utils / OutOfBoxCommandBarButtons.tsx View on Github external
        handleChange: (editor: Editor, props: RoosterCommandBarProps) => (props.disableListWorkaround ? setNonCompatIndentation : setIndentation)(editor, Indentation.Increase)
    },