forked from jaredreich/pell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (111 loc) · 4.4 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>pellqor</title>
<link rel="stylesheet" href="//cdn.centralis.world/css/fonts/segoe-ui/20220101/index.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; font-size: inherit; font-family: inherit; }
html { font-size: 15px; }
body { padding: 3rem; font-family: SegoeUI, sans-serif; font-size: 1.4rem; }
h1, h2, h3, p, ul, ol, table, figure { margin: 0 0 1rem 0; }
h1 { font-size: 200%; }
h2 { font-size: 180%; }
h3 { font-size: 160%; }
h4 { font-size: 140%; }
h5 { font-size: 120%; }
h6 { font-size: 100%; }
pre { font-family: monospace; }
button { margin: 0 0 1rem 0; background: transparent; border: .1rem solid #000; padding: 0 .5rem; border-radius: .25rem; }
a { text-decoration: none; border-bottom: .2rem solid; }
blockquote { padding: 0 0 0 1rem; }
table { border-spacing: 0; border-collapse: collapse; }
td, th { border: 1px solid #000; padding: 5px; }
.container { max-width: 1152px; margin: auto; }
.myEditor { border: .2rem solid #000; padding: 1rem; border-radius: .5rem; }
.pell-content { outline: 0; }
.pell-button-selected { background: #000; color: #FFF; }
#textOutput,
#htmlOutput { border: .2rem solid #000; padding: 1rem; border-radius: .5rem; }
</style>
</head>
<body>
<div class="container">
<h1>pellqor</h1>
<p>Pellqor is the extracted core of the <a href="https://github.com/jaredreich/pell" target="_blank">pell wysiwyg editor</a>, giving you a headless, super simple wysiwyg editor.</p>
<br>
<div class="myEditor">
<button id="myBoldButton" onclick="editor.action.bold()">Bold</button>
<button id="myItalicButton" onclick="editor.action.italic()">Italic</button>
<button id="myUnderlineButton" onclick="editor.action.underline()">Underline</button>
<button id="myStrikeButton" onclick="editor.action.strikethrough()">Strikethrough</button>
<button onclick="editor.action.justifyLeft()">Justify left</button>
<button onclick="editor.action.justifyCenter()">Justify center</button>
<button onclick="editor.action.justifyRight()">Justify right</button>
<button onclick="editor.action.justifyFull()">Justify full</button>
<button onclick="editor.action.indent()">Indent</button>
<button onclick="editor.action.outdent()">Outdent</button>
<button onclick="editor.action.subscript()">Subscript</button>
<button onclick="editor.action.superscript()">Superscript</button>
<button onclick="editor.action.heading2()">Heading2</button>
<button onclick="editor.action.paragraph()">Paragraph</button>
<button onclick="editor.action.quote()">Quote</button>
<button onclick="editor.action.orderedList()">Ordered List</button>
<button onclick="editor.action.unorderedList()">Unordered List</button>
<button onclick="editor.action.code()">Code</button>
<button onclick="editor.action.horizontalRule()">Horizontal Rule</button>
<button onclick="editor.action.link()">Link</button>
<button onclick="editor.action.unlink()">Unlink</button>
<button onclick="editor.action.image()">Image</button>
<button onclick="editor.action.undo()">Undo</button>
<button onclick="editor.action.redo()">Redo</button>
<button onclick="editor.action.removeFormat()">Remove Format</button>
<div id="editor">
<h2>This is a test</h2>
<p>Change some <b>text</b> here.</p>
<table>
<tr>
<td>Apple</td>
<td>Orange</td>
</tr>
<tr>
<td>Cherry</td>
<td>Banana</td>
</tr>
</table>
</div>
</div>
<br>
<div>
<h2>Text output:</h2>
<div id="textOutput"></div>
</div>
<br>
<div>
<h2>HTML output:</h2>
<pre id="htmlOutput"></pre>
</div>
</div>
<script type="module">
import pellqor from './pellqor.js';
window.editor = pellqor.init({
element: document.getElementById('editor'),
actions: {
test: {
result: (selection, cursor) => {
}
}
},
onChange: function(html) {
document.getElementById('textOutput').innerHTML = html;
document.getElementById('htmlOutput').textContent = html;
}
});
editor.watchState(document.getElementById('myBoldButton'), 'bold');
editor.watchState(document.getElementById('myItalicButton'), 'italic');
editor.watchState(document.getElementById('myUnderlineButton'), 'underline');
editor.watchState(document.getElementById('myStrikeButton'), 'strikethrough');
</script>
</body>
</html>