-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathollow.html
More file actions
165 lines (148 loc) · 4.08 KB
/
Copy pathollow.html
File metadata and controls
165 lines (148 loc) · 4.08 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OllowEditor</title>
<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=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="ollow.css">
<style>
body {
margin: 0;
background: #f3f5f7;
color: #191c1e;
font-family: "Work Sans", sans-serif;
}
main {
width: min(100%, 1100px);
margin: 0 auto;
padding: 32px 24px 48px;
}
h1 {
margin: 0 0 8px;
font-family: "Newsreader", serif;
font-size: 40px;
line-height: 1.1;
}
p {
color: #4b5563;
line-height: 1.7;
}
.demo-stack {
display: grid;
gap: 24px;
margin-top: 24px;
}
.demo-card {
border: 1px solid #d9dde3;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
padding: 20px;
}
.demo-card h2 {
margin: 0 0 10px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0;
color: #6b7280;
}
.demo-grid {
display: grid;
gap: 24px;
}
@media (max-width: 768px) {
main {
padding: 24px 16px 32px;
}
h1 {
font-size: 34px;
}
}
@media (max-width: 480px) {
main {
padding: 18px 10px 24px;
}
h1 {
font-size: 28px;
}
}
.demo-submit {
appearance: none;
border: 0;
border-radius: 6px;
background: #111827;
color: #ffffff;
padding: 11px 16px;
font: inherit;
font-size: 14px;
font-weight: 600;
cursor: pointer;
}
.demo-source {
white-space: pre-wrap;
word-break: break-word;
color: #111827;
font-size: 14px;
line-height: 1.7;
}
</style>
</head>
<body>
<main>
<h1>Ollow Editor</h1>
<p>This page shows the reusable editor bound to a normal textarea. Submit is intercepted only to print the synced HTML below.</p>
<div class="demo-stack">
<form id="demo-form" class="demo-grid">
<textarea id="story_body" name="body" data-nw-editor data-theme="auto" data-persist-theme="true" data-autosave-delay="1200">
<h2>Economic Repercussions in the Eurozone</h2>
<p>The recent policy shifts in the capital have sent ripples through international markets.</p>
<blockquote><p>Markets reacted with cautious optimism.</p></blockquote>
<ul><li>First verified point</li><li>Second verified point</li></ul>
</textarea>
</form>
</div>
</main>
<script src="https://unpkg.com/mammoth@1.8.0/mammoth.browser.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="ollow.js"></script>
<script>
OllowEditor.registerPlugin("alertBox", function(editor, options) {
const label = options.label || "Alert";
editor.addSanitizerRule({
classes: ["ollow-alert-box"]
});
editor.addToolbarButton({
name: "alertBox",
label: label,
icon: "alert-box",
group: "blocks",
title: "Insert alert box",
onClick() {
editor.insertHTML('<section class="ollow-alert-box"><p>Alert text</p></section>');
}
});
});
NationWireEditor.initAll(document, {
persistTheme: true,
docx: {
enabled: true
},
plugins: {
alertBox: {
label: "Alert"
}
}
});
const output = document.getElementById("submitted-html");
document.getElementById("demo-form").addEventListener("submit", (event) => {
event.preventDefault();
const bodyEditor = NationWireEditor.get("#story_body");
bodyEditor.sync();
output.textContent = document.getElementById("story_body").value;
});
</script>
</body>
</html>