Flexible plugins configuration #18

Closed
Xheldon wants to merge 1 commit from patch-1 into master
Xheldon commented 2020-08-07 05:32:20 +02:00 (Migrated from github.com)

The reason to do so:

  1. plugins's order is important(influence the invoke order of transactions, events, etc)
  2. when need to disable some plugin in first loading by some config, there is no way to do it

So is the way below is more flexible plugins configuration?

let isAndroid = true; // some config pass by useragent or something else;
let somePlugin = xxx;
let state = EditorState.create({
  schema,
  props,
  plugins: [
    isAndroid ? somePlugin : null,
    otherPlugin
  ]
});
The reason to do so: 1. plugins's order is important(influence the invoke order of transactions, events, etc) 2. when need to disable some plugin in first loading by some config, there is no way to do it So is the way below is more flexible plugins configuration? ```js let isAndroid = true; // some config pass by useragent or something else; let somePlugin = xxx; let state = EditorState.create({ schema, props, plugins: [ isAndroid ? somePlugin : null, otherPlugin ] }); ```
marijnh commented 2020-08-07 07:44:57 +02:00 (Migrated from github.com)

How about something like plugins: [...isAndroid: [somePlugin] : [], ...otherPlugins]?

How about something like `plugins: [...isAndroid: [somePlugin] : [], ...otherPlugins]`?
Xheldon commented 2020-08-07 08:21:39 +02:00 (Migrated from github.com)

Is also a solution, but not intuitive though 😂😂😂

Is also a solution, but not intuitive though 😂😂😂
marijnh commented 2020-08-07 15:46:30 +02:00 (Migrated from github.com)

What's "intuitive" is always hard to argue, but I prefer the simpler types of the current way it works.

What's "intuitive" is always hard to argue, but I prefer the simpler types of the current way it works.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-state!18
No description provided.