Skip to content

Reconfiguring the modules showing unexpected behavior #1040

@agupta1989

Description

@agupta1989

Hi,

I am using react-quill for my project. in one of the scenario, I need to remove some of the module based on some condition.

  const modules = useMemo(
    () => ({
      HashTagModule: enabledHashTagModule
        ? {
            loadHashTags,
            hashTagSuggestionRange,
            hashTagLabels,
          }
        : null,
      toolbar: {
        container: `#${toolbarId}`,
        handlers: {
          highlighter: highlighter,
          undo: undo,
          redo: redo,
        },
        history: {
          delay: 1000,
          maxStack: 500,
          userOnly: true,
        },
      },
      clipboard: {
        matchVisual: false,
      },
    }),
    [toolbarId, enabledHashTagModule]
  );

I have custom module called as hashTagModule. I want to register it only when its true. for initial render, when its true its working fine. but when user trying to toggle this feature off (enabledHashTagModule as false), the editor is misbehaving and doesn't show up the quill container / the editor. only toolbar is showing up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions