-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: 1596 Enable transpower publisher plugin #1598
base: main
Are you sure you want to change the base?
Conversation
|
/** | ||
* This is a compatibility fix for plugins based on open enegery tools edit events | ||
* beause their edit event look slightly different, | ||
* see https://github.com/OpenEnergyTools/open-scd-core/blob/main/foundation/edit-event-v1.ts for details | ||
*/ | ||
if (isOpenEnergyEditEvent(event)) { | ||
event = convertOpenEnergyEditEventToEditEvent(event); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we rather adjust the events in open energy tools' distribution so that they adhere to the API definition? This really does feel good :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for the edit event previous to v3 there is no API definition. Once we switch to the edit API v3, the events will be aligned again, so this is only a temporary fix.
|
||
function convertOpenEnergyEditEventToEditEvent(event: CustomEvent<unknown>): EditEvent { | ||
const eventDetail = event.detail as Edit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we change the object from:
detail: {
...
}
to
detail: {
edit: edit,
initiator: initiator,
},
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In open scd the event look like this
{
...
detail: {
edit: edit,
initiator: initiator
}
}
and in openenergytools like this
{
...
detail: edit
}
So we wrap the edit in an object and add the initiator
Should both material icons and material symbols (3 mb file) be loaded? Can we stick with just one? Yes if it is a small fix, otherwise, keep both Do we want to add the publisher plugin to the default list of plugins? No, it is not a OpenSCD organisation plug-in I'm happy with whatever the community decides (only my view, no hard requirement) |
Changes
Demo
Add custom edtior plugin in https://openscd.github.io/open-scd/pr-preview/pr-1598/
with https://danyill.github.io/scl-editor/plugins/oscd-publisher/oscd-publisher.js
Up for discussion
closes #1596