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

chore: allow editor plugins to render without doc #1530

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/openscd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@openscd/core": "*"
},
"scripts": {
"clean": "rimraf build",
"clean": "rimraf dist",
"lint:eslint": "eslint --ext .ts,.html . --ignore-path .gitignore",
"format:eslint": "eslint --ext .ts,.html . --fix --ignore-path .gitignore",
"lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --check --ignore-path .gitignore",
Expand Down
19 changes: 8 additions & 11 deletions packages/openscd/src/addons/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,14 @@ export class OscdLayout extends LitElement {

/** Renders the enabled editor plugins and a tab bar to switch between them*/
protected renderContent(): TemplateResult {
return html`
${this.doc
? html`<mwc-tab-bar
@MDCTabBar:activated=${(e: CustomEvent) =>
(this.activeTab = e.detail.index)}
>
${this.editors.map(this.renderEditorTab)}
</mwc-tab-bar>
${this.editors[this.activeTab]?.content? this.editors[this.activeTab].content: ``}`
: ``}
`;
const activePlugin = this.editors[this.activeTab];
return html`<mwc-tab-bar
@MDCTabBar:activated=${(e: CustomEvent) =>
(this.activeTab = e.detail.index)}
>
${this.editors.filter(p=> !p.requireDoc || this.doc).map(this.renderEditorTab)}
</mwc-tab-bar>
${activePlugin && (!activePlugin.requireDoc || this.doc)? this.editors[this.activeTab].content: ``}`;
}

/** Renders the landing buttons (open project and new project)*/
Expand Down
14 changes: 14 additions & 0 deletions packages/openscd/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,111 @@ export const officialPlugins = [
icon: 'developer_board',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: 'Substation',
src: '/plugins/src/editors/Substation.js',
icon: 'margin',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: 'Single Line Diagram',
src: '/plugins/src/editors/SingleLineDiagram.js',
icon: 'edit',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Message Binding (GOOSE)',
src: '/plugins/src/editors/GooseSubscriberMessageBinding.js',
icon: 'link',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Data Binding (GOOSE)',
src: '/plugins/src/editors/GooseSubscriberDataBinding.js',
icon: 'link',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Later Binding (GOOSE)',
src: '/plugins/src/editors/GooseSubscriberLaterBinding.js',
icon: 'link',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Message Binding (SMV)',
src: '/plugins/src/editors/SMVSubscriberMessageBinding.js',
icon: 'link',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Data Binding (SMV)',
src: '/plugins/src/editors/SMVSubscriberDataBinding.js',
icon: 'link',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Subscriber Later Binding (SMV)',
src: '/plugins/src/editors/SMVSubscriberLaterBinding.js',
icon: 'link',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: 'Communication',
src: '/plugins/src/editors/Communication.js',
icon: 'settings_ethernet',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: '104',
src: '/plugins/src/editors/Protocol104.js',
icon: 'settings_ethernet',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Templates',
src: '/plugins/src/editors/Templates.js',
icon: 'copy_all',
default: true,
kind: 'editor',
requireDoc: true,
},
{
name: 'Publisher',
src: '/plugins/src/editors/Publisher.js',
icon: 'publish',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Cleanup',
src: '/plugins/src/editors/Cleanup.js',
icon: 'cleaning_services',
default: false,
kind: 'editor',
requireDoc: true,
},
{
name: 'Open project',
Expand Down
Loading