BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/core/LexicalMutations.ts

Summary

Maintainability
C
1 day
Test Coverage

Function $flushMutations has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function $flushMutations(
  editor: LexicalEditor,
  mutations: Array<MutationRecord>,
  observer: MutationObserver,
): void {
Severity: Major
Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 5 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                  if (correctDOM === null) {
                    continue;
                  }
    Severity: Major
    Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  for (let s = 0; s < removedDOMsLength; s++) {
                    const removedDOM = removedDOMs[s];
      
                    if (
                      (removedDOM.nodeName === 'BR' &&
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (currentDOM == null) {
                        targetDOM.appendChild(correctDOM);
                        currentDOM = correctDOM;
                      } else if (currentDOM !== correctDOM) {
                        targetDOM.replaceChild(correctDOM, currentDOM);
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if (
                        parentDOM != null &&
                        addedDOM !== blockCursorElement &&
                        node === null &&
                        (addedDOM.nodeName !== 'BR' ||
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (removedDOMsLength !== unremovedBRs) {
                          if (targetDOM === rootElement) {
                            targetNode = internalGetRoot(currentEditorState);
                          }
            
            
            Severity: Major
            Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status