You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugin-api.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
An **OpenSCD plugin** is a [custom element](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#implementing_a_custom_element) that has been registered in the global [`customElements`](https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements) registry under some tag name. OpenSCD core renders an element with that tag name into the app. The component may optionally provide a `run()` method for OpenSCD core to call in order to trigger an action.
10
10
11
11
The **OpenSCD core API** describes the ways in which:
12
+
12
13
- OpenSCD core communicates relevant data to the plugins,
13
14
- plugins communicate user intent to OpenSCD core, and
14
15
- OpenSCD sets CSS fonts and colors for plugins.
@@ -17,14 +18,13 @@ The **OpenSCD core API** describes the ways in which:
17
18
18
19
OpenSCD core communicates the data necessary for editing SCL documents by setting the following [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) on the plugin's [DOM Element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement):
19
20
20
-
21
21
```typescript
22
22
exportdefaultclassMyPluginextendsHTMLElement {
23
23
editor:Transactor<EditV2>;
24
24
docs:Record<string, XMLDocument> = {}; // all loaded documents
25
25
doc?:XMLDocument; // the document currently being edited
26
26
docName?:string; // the current doc's name
27
-
docVersion:unknown; //current doc's state indicator
27
+
docsState:unknown; //changes value when the document is modified or documents are added/removed.
28
28
locale:string='en'; // the end user's chosen locale
29
29
}
30
30
```
@@ -46,8 +46,9 @@ The name of the `XMLDocument` currently being edited.
46
46
47
47
The `XMLDocument` currently being edited.
48
48
49
-
### `docVersion`
50
-
A change in this property's value indicates a change to the `doc`.
49
+
### `docsState`
50
+
51
+
A value which changes with edits to the current document AND when documents are opened or closed.
0 commit comments