File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,15 @@ export const officialPlugins = [
100
100
requireDoc : true ,
101
101
position : 'top'
102
102
} ,
103
+ {
104
+ name : 'Save project as...' ,
105
+ src : '/src/menu/CompasSaveAs.js' ,
106
+ icon : 'save' ,
107
+ default : true ,
108
+ kind : 'menu' ,
109
+ requireDoc : true ,
110
+ position : 'top'
111
+ } ,
103
112
{
104
113
name : 'Validate using OCL' ,
105
114
src : '/src/validators/CompasValidateSchema.js' ,
Original file line number Diff line number Diff line change
1
+ import { html , LitElement } from 'lit-element' ;
2
+ import { get } from "lit-translate" ;
3
+
4
+ import { newPendingStateEvent , newWizardEvent , Wizard , WizardInputElement } from '../foundation.js' ;
5
+
6
+ import CompasSaveElement from "../compas/CompasSave.js" ;
7
+ import { dispatchEventOnOpenScd } from "../compas/foundation.js" ;
8
+
9
+ import "../compas/CompasSave.js" ;
10
+
11
+ export default class CompasSaveMenuPlugin extends LitElement {
12
+ doc ! : XMLDocument ;
13
+ docName ! : string ;
14
+
15
+ private saveAsToCompasWizard ( ) : Wizard {
16
+ function saveToCompas ( ) {
17
+ return function ( inputs : WizardInputElement [ ] , wizard : Element ) {
18
+ const compasSave = < CompasSaveElement > wizard . shadowRoot ! . querySelector ( 'compas-save' )
19
+ if ( ! compasSave . valid ( ) ) {
20
+ return [ ] ;
21
+ }
22
+
23
+ dispatchEventOnOpenScd ( newPendingStateEvent ( compasSave . saveToCompas ( ) ) ) ;
24
+ return [ ] ;
25
+ } ;
26
+ }
27
+
28
+ return [
29
+ {
30
+ title : get ( 'compas.save.title' ) ,
31
+ primary : {
32
+ icon : 'save' ,
33
+ label : get ( 'save' ) ,
34
+ action : saveToCompas ( ) ,
35
+ } ,
36
+ content : [
37
+ html `< compas-save .doc ="${ this . doc } " .docName ="${ this . docName } ">
38
+ </ compas-save > `
39
+ ] ,
40
+ } ,
41
+ ] ;
42
+ }
43
+
44
+ async run ( ) : Promise < void > {
45
+ this . dispatchEvent ( newWizardEvent ( this . saveAsToCompasWizard ( ) ) ) ;
46
+ }
47
+ }
48
+
49
+
You can’t perform that action at this time.
0 commit comments