protected getInnerEditorPropsOverrides()

in src/plugin/fieldViews/NestedElementFieldView.ts [159:187]


  protected getInnerEditorPropsOverrides(outerView: EditorView): EditorProps {
    return {
      /**
       * HANDLERS
       * we need to 'forward' events to the outer editor to ensure plugins etc. receive the events
       */

      handleClick: (view, pos, event) =>
        outerView.someProp("handleClick", (f) =>
          f(
            // we pass the outer view here rather than inner view,
            // so the correct 'state' is available to the final destination handler (e.g. plugin)
            outerView,
            pos,
            event
          )
        ),
      handleKeyDown: (view, event) =>
        outerView.someProp(
          "handleKeyDown",
          (f) => event.key !== "Enter" && f(outerView, event)
        ),
      handleKeyPress: (view, event) =>
        outerView.someProp(
          "handleKeyPress",
          (f) => event.key !== "Enter" && f(outerView, event)
        ),
    };
  }