forked from JannisX11/blockbench-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_view.js
More file actions
58 lines (51 loc) · 1.2 KB
/
Copy pathcode_view.js
File metadata and controls
58 lines (51 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var codeViewVue;
(function() {
var openCodeViewAction;
var codeViewDialog;
Plugin.register('code_view', {
title: 'Code View',
icon: 'developer_mode',
author: 'Wither',
description: 'View the model you are currently editing in the raw format',
version: '1.0.1',
variant: 'both',
onload() {
codeViewDialog = new Dialog({
title: 'Code View',
id: 'code_view',
resizable: true,
width: 650,
component: {
components: {VuePrismEditor},
data: {
text: ''
},
methods: {
copyText() {
navigator.clipboard.writeText(this.text);
}
},
template: `
<div>
<vue-prism-editor id="code-view-output" v-model="text" language="json" style="height: 25em;" :line-numbers="true" />
<button @click="copyText()" style="width: 100%;">Copy</button>
</div>
`
}
});
openCodeViewAction = new Action('open_code_view', {
name: 'Open Code View',
description: '',
icon: 'developer_mode',
click() {
codeViewDialog.show();
codeViewDialog.content_vue.text = Format ? Format.codec.compile() : '';
}
})
MenuBar.addAction(openCodeViewAction, 'filter')
},
onunload() {
openCodeViewAction.delete();
}
});
})()