Skip to content

General thoughts on a modern script editor webpart #480

@patmill

Description

@patmill

140 characters really isn't a sufficient amount of space to discuss the script editor webpart. It's an obvious thing to develop. The current implementation for classic pages is super popular and easy to bang out some code. I certainly have no problems with it in theory. In fact, it was the first webpart I created with SPFX drop 1.

It does present some interesting points for discussion. Why didn't we create and ship one ourselves? We figured a) someone would, because it's pretty straight forward and b) we think there is a better approach in the mid-to-long term.

As you mention - it's nice to do quick development prototyping. It's not really a great solution for something that authors can interact with. You basically give the "author" a render method. There's no configuration option given to an actual author for the most part (no real way to create a property pane), the persistence is code rather than data, and so forth (although I'm sure that if it was the only solution available that someone would find a way to incorporate both).

It's not (or at least shouldn't be) available for the noscript type sites (mysites, modern groups, etc.), so it's functionality is somewhat limited. On a related note, another issue is that if an admin decides to disable it, it disables all instances of the SEWP in the whole tenancy.

One thing we have considered as a sort of "bridge" between the worlds is a pseudo-script editor webpart where the code itself is stored in the manifest. This could give a streamlined development process (for a certain class of webpart where you don't need the full power of SPFX or its toolchain; and you wouldn't be able to use the full toolchain either). So the app package would simply contain a webpart component with a manfiest that embeds the render script in it. At runtime, the ModernScriptEditorWebpart executes, pulls the code from the manifest, and executes it. That would give some isolation as far as approval, monitoring, disabling and such, while still allowing for a simpler (in all senses of the word) development model.

You would likely lose the ability to do things like have property panes, bundling, webpack, and so forth, but again - for that class of webpart that doesn't need them - that's quite ok. The target audience of this is also likely to be a different class of developer - one who likely has no idea who the tenant admin is, so you would want to have a workflow that takes the code, packages it up, submits it to an admin for approval, allows you to ping them, and so forth.

If only we had infinite resources. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:discussionOpen discussion; nothing actionable at this time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions