Skip to content
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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

clepski
Copy link
Collaborator

@clepski clepski commented Nov 18, 2024

Changes

  • Add global styles accoring to the core API specs
  • Handle openenergytools edit events v2 (which are slighty different from open scd edit events v2)
  • Add material symbols

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

  • Should both material icons and material symbols (3 mb file) be loaded? Can we stick with just one?
  • Do we want to add the publisher plugin to the default list of plugins?

closes #1596

Copy link
Contributor

github-actions bot commented Nov 18, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://openscd.github.io/open-scd/pr-preview/pr-1598/
on branch gh-pages at 2024-11-18 13:45 UTC

Comment on lines 122 to 130
/**
* 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);
}

Copy link
Member

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 :/

Copy link
Collaborator Author

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;
Copy link
Member

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,
},

?

Copy link
Collaborator Author

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

@Sander3003
Copy link
Member

Sander3003 commented Nov 18, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Publisher plugin from transpower in open scd
3 participants