Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending PlatePlugin with getOptions not extending properties (key, options) #3873

Closed
TrySpace opened this issue Dec 19, 2024 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@TrySpace
Copy link

TrySpace commented Dec 19, 2024

Description

Extending an existing plugin as described here is not extending the properties, and leaves only a copy.

Reproduction URL

No response

Reproduction steps

export const BaseMentionPlugin = createPlatePlugin<
  string,
  TriggerComboboxPluginOptions
>({
  key: 'base_mention',
  // @ts-ignore
  extendEditor: withTriggerCombobox,
  node: {
    isElement: true,
    isInline: true,
    isVoid: true,
  },
  options: {
    createComboboxInput,
  },
  plugins: [ComboboxInputPlugin],
})

export const RefMentionPlugin = BaseMentionPlugin.configure(
  ({ getOptions }) => ({
    key: ELEMENT_REF,
    options: {
      ...getOptions(),
      trigger: '@',
      triggerPreviousCharPattern: /^\s?$/,
      createComboboxInput,
    },
  })
)

export const SubMentionPlugin =
  RefMentionPlugin.extend<TriggerComboboxPluginOptions>(({ getOptions }) => ({
    key: ELEMENT_SUB,
    options: {
      ...getOptions(),
      trigger: ':',
      triggerPreviousCharPattern: /^\s?$/,
      createComboboxInput,
    },
  }))

Plate version

40.3.4

Slate React version

0.112.0

Screenshots

image

@TrySpace TrySpace added the bug Something isn't working label Dec 19, 2024
@udecode udecode locked and limited conversation to collaborators Dec 19, 2024
@zbeyens zbeyens converted this issue into discussion #3876 Dec 19, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant