-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
279 lines (243 loc) · 10.8 KB
/
index.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CodeBedder - simplest code editor on the web</title>
<meta name="description" content="An HTML web component that makes it easy to add code editing to any website" />
<meta property="og:url" content="https://codebedder.netlify.app/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="CodeBedder - simplest code editor on the web" />
<meta property="og:description" content="An HTML web component that makes it easy to add code editing to any website" />
<meta property="og:image" content="https://codebedder.netlify.app/screenshot.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="codebedder.netlify.app" />
<meta property="twitter:url" content="https://codebedder.netlify.app/" />
<meta name="twitter:title" content="CodeBedder - simplest code editor on the web" />
<meta name="twitter:description" content="An HTML web component that makes it easy to add code editing to any website" />
<meta name="twitter:image" content="https://codebedder.netlify.app/screenshot.png" />
<link rel="icon" type="image/svg+xml" href="logo.svg" />
<link rel="mask-icon" href="logo.svg" color="#8e44ad" />
<meta name="theme-color" content="#8e44ad" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Bungee&family=Sofia+Sans&display=swap"
rel="stylesheet"
/>
<link href="style.css" rel="stylesheet" />
<link href="prism.css" rel="stylesheet" />
</head>
<body>
<script>
// Prevent FOUC
document.body.style.opacity = 0;
document.addEventListener('DOMContentLoaded', () => {
document.body.style.opacity = 1;
});
</script>
<header>
<div class="logo">
<img src="logo.svg" alt="CodeBedder logo" aria-hidden="true" />
<div
class="title"
data-subtitle="simplest code editor on the web"
>
Code<br />Bedder
</div>
</div>
<nav>
<a href="#why" data-title="Why you might want to use CodeBedder (or not)">🤔 Why</a>
<a href="#try" data-title="See apps built with CodeBedder">👀 Try</a>
<a href="#diy" data-title="How to add CodeBedder to your website">🔧 DIY</a>
<a href="#buy" data-title="Need help? We offer consulting services!">🫰 Buy</a>
</nav>
</header>
<section>
<!-- prettier-ignore -->
<code-bedder id="editor" data-language="html" onhighlight="Prism.highlightElement(this)"><html> <head> <link href="https://fonts.googleapis.com/css2?family=Bungee" rel="stylesheet" type="text/css"> <style type="text/css"> body { font-family: Bungee, sans-serif; background-color: #8e44ad; color: #ffffff; display: flex; justify-content: center; align-items: center; } h1 { max-width: 60%; font-size: 8vw; line-height: 1; text-align: center; } </style> </head> <body> <h1>Hello World 🤗</h1> </body> </html></code-bedder>
<iframe
id="preview"
title="Live preview of the code entered in the CodeBedder editor"
></iframe>
</section>
<section>
<h2 id="why">Why you might want this</h2>
<p>
Sometimes your website needs a simple code editor that is easier on the
eyes than a text box, yet quick to set up and pleasant enough for light
editing work.
</p>
<p>
Whether you have <i>code samples</i> on your blog for people to play with, a
CMS where employees want to <i>edit email templates</i>, or a billion-dollar
app where customers want to <i>edit CSV files</i> they uploaded,
</p>
<p>CodeBedder can help everyone code - better.</p>
<ul>
<li>
<b>Lightweight</b> - <i>1.54KB</i> gzipped, then add syntax
highlighting with a library like
<a href="https://prismjs.com/#supported-languages" target="_blank">
PrismJS
</a>
</li>
<li>
<b>Use anywhere</b> - an HTML web component that is easy to integrate
with any website
</li>
<li>
<b>Highlight anything</b> - specify any language supported by syntax
highlighting libraries
</li>
</ul>
<h2>Why not?</h2>
<p>
You might need something more advanced. This is a really simple code
editor. You can't change indentation with <i>Tab/Shift+Tab</i>, or
automatically insert spaces when you hit <i>Enter</i>.
</p>
<p>
Need more full-featured code editing? We can help you make the right
pick!
<br />
<a href="#buy">Contact us</a> for consulting.
</p>
<h2 id="try">Try it online</h2>
Apps built with CodeBedder:
<ul>
<li><a href="https://emaily-templates.netlify.app" target="_blank">eMaily</a> - a demo HTML/MJML editor with live preview and data templating</li>
<li>This website - yes, go play with the <a href="#editor">editor</a> if you haven't yet!</li>
</ul>
<h2 id="diy">Want to add it to your website?</h2>
<p>
Download
<a href="codebedder.js" target="_blank">codebedder.js</a>,
<a href="prism.js" target="_blank">prism.js</a>, and
<a href="prism.css" target="_blank">prism.css</a>, or create a
<a href="https://prismjs.com/download.html" target="_blank">
custom build of PrismJS
</a>
to support languages other than HTML/CSS/JavaScript. For an HTML editor
use the script as follows:
</p>
<!-- prettier-ignore -->
<pre><code class="language-html"><html> <head> <link href="prism.css" rel="stylesheet" /> </head> <body> <code-bedder data-language="html" onhighlight="Prism.highlightElement(this)">YOUR_ESCAPED_HTML_CODE_HERE</code-bedder> <script src="prism.js"></script> <script src="codebedder.js"></script> </body> </html></code></pre>
<p><i>Psst, you can also check out the source code for this page.</i></p>
</section>
<section>
<h2 id="buy">Need more guidance?</h2>
<p>This library is <b>free to use</b> however you like.</p>
<p>
If you need help integrating code editing into your website, we also
offer the following consulting service packages:
</p>
<dl>
<div style="flex: 2">
<dt>🌱 Mini</dt>
<dd data-price="$200">
We'll help you set up a CodeBedder editor for <b>HTML</b> with
<b>instant preview</b> in <b>one page</b> on your website.
<p>
Suitable for light editing of content like code samples or
templates loaded from a database.
</p>
</dd>
</div>
<div style="flex: 3">
<dt>🌵 Plus</dt>
<dd data-price="$500">
We'll help you set up a CodeBedder editor for
<b>any language</b> with a <b>custom preview</b> in up to
<b>3 pages</b> on your website.
<p>Example integrations:</p>
<ul>
<li><b>Templating libraries</b> like Handlebars or Mustache</li>
<li><b>MJML</b> - for writing responsive email templates</li>
<li><b>PHP</b> - editing and previewing a .php script</li>
</ul>
</dd>
</div>
<div style="flex: 2">
<dt>🌷 Xtra</dt>
<dd data-price="$???">
Got <b>many pages</b> in need of a code editor? Need a
<b>more advanced</b> preview functionality?
<p>Or some <b>custom feature</b> you're missing from CodeBedder?</p>
<p>Reach out to us to get an offer!</p>
</dd>
</div>
</dl>
<button
type="button"
onclick="document.querySelector('dialog').showModal()"
aria-label="contact us"
>
✉️ Contact us
</button>
<dialog
onclick="if (event.target === this) this.close()"
onclose="
if (this.returnValue === 'submit') {
this.returnValue = '';
fetch('/', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams(new FormData(document.forms.contact)).toString(),
}).then(() => {
window.alert(`Message sent! We'll get back to you as soon as we can.`);
}).catch((error) => {
window.alert(error.toString());
});
}
"
>
<form name="contact" method="dialog" netlify>
<button
type="button"
aria-label="close"
onclick="this.closest('dialog').close()"
>
×
</button>
<input type="email" name="email" aria-label="Email" placeholder="Email" required />
<textarea
name="text"
aria-label="Text"
placeholder="Tell us more about your use case"
required
></textarea>
<div class="toolbar">
<button
type="button"
onclick="this.closest('dialog').close()"
value="cancel"
>
Cancel
</button>
<button
type="submit"
value="submit"
onclick="
if (!document.forms.contact.checkValidity()) {
['email', 'text'].forEach((name) => {
document.forms.contact[name].setAttribute('data-dirty', true)
});
}
"
>
Send
</button>
</div>
</form>
</dialog>
</section>
<footer>
made with 💻 by
<a href="https://twitter.com/vdsabev" target="_blank">@vdsabev</a>
</footer>
<script src="prism.js"></script>
<script src="codebedder.js"></script>
<script src="index.js"></script>
</body>
</html>