-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.html
113 lines (87 loc) · 2.2 KB
/
ui.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--Header-->
<h1>Change text</h1>
<!--Asks user for a key word-->
<label for='headline-input'>
Select font size
<select class="js-example-basic-single" name="state">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
</label>
<label for='headline-input'>
Headline
<input required id="headline-input" type="text" placeholder="Headline" />
</label>
<label for='description-input'>
Description
<input required id="description-input" type="text" placeholder="Description" />
</label>
<label for='phone-input'>
Phone
<input required id="phone-input" type="text" placeholder="Phone" />
</label>
<label for='address-input'>
Address
<input required id="keyword-input" type="text" placeholder="Address" />
</label>
<label for='email-input'>
Email
<input required id="email-input" type="text" placeholder="Email" />
</label>
<div>
<button id="change">Change</button>
</div>
<div class="message" id="messageArea"></div>
<style>
body {
font-family: sans-serif;
}
p {
color: #777777;
}
label {
margin-top: 20px;
display: flex;
flex-direction: column;
margin-bottom: 10px;
width: 75%;
font-weight: 600;
}
input {
font-size: 14px;
margin-top: 3px;
border-style: none;
border-bottom-style: solid;
outline: none;
font-weight: 600;
}
button {
margin-top: 20px;
padding: 10px;
font-weight: 700;
}
</style>
<script>
import { getFonts } from 'font-list'
getFonts()
.then(fonts => {
console.log(fonts)
})
.catch(err => {
console.log(err)
})
const headlineInput = document.getElementById('headline-input');
const changeButton = document.getElementById('change');
const messageArea = document.getElementById("messageArea");
changeButton.addEventListener('click', async () => {
const headline = headlineInput.value;
if (headline.trim() === "") {
showMessage("Please enter both text name and new text content.");
return;
}
parent.postMessage({ pluginMessage: { type: 'changeText', data: { headline } } }, '*');
});
function showMessage(message) {
messageArea.textContent = message;
}
</script>