Spaces:
Runtime error
Runtime error
color picker
Browse files- app.py +1 -1
- rich-text-to-json-iframe.html +43 -1
app.py
CHANGED
@@ -348,7 +348,7 @@ def main():
|
|
348 |
None
|
349 |
],
|
350 |
[
|
351 |
-
'{"ops": [{"insert": "A pizza with pineapple, pepperoni, and"}, {"attributes": {"size": "70px"}, "insert": "mushroom"}, {"insert": " on the top, 4k, photorealistic"}]}',
|
352 |
'blurry, art, painting, rendering, drawing, sketch, ugly, duplicate, morbid, mutilated, mutated, deformed, disfigured low quality, worst quality',
|
353 |
512,
|
354 |
512,
|
|
|
348 |
None
|
349 |
],
|
350 |
[
|
351 |
+
'{"ops": [{"insert": "A pizza with pineapple, pepperoni, and "}, {"attributes": {"size": "70px"}, "insert": "mushroom"}, {"insert": " on the top, 4k, photorealistic"}]}',
|
352 |
'blurry, art, painting, rendering, drawing, sketch, ugly, duplicate, morbid, mutilated, mutated, deformed, disfigured low quality, worst quality',
|
353 |
512,
|
354 |
512,
|
rich-text-to-json-iframe.html
CHANGED
@@ -5,6 +5,8 @@
|
|
5 |
<title>Rich Text to JSON</title>
|
6 |
<link rel="stylesheet" href="https://cdn.quilljs.com/1.3.6/quill.snow.css">
|
7 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
|
|
|
|
8 |
<link rel="stylesheet"
|
9 |
href='https://fonts.googleapis.com/css?family=Mirza|Roboto|Slabo+27px|Sofia|Inconsolata|Ubuntu|Akronim|Monoton&display=swap'>
|
10 |
<style>
|
@@ -160,6 +162,21 @@
|
|
160 |
.ql-font-Monoton {
|
161 |
font-family: "Monoton";
|
162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
</style>
|
164 |
</head>
|
165 |
|
@@ -195,7 +212,9 @@
|
|
195 |
<button class="ql-underline"></button>
|
196 |
</span> -->
|
197 |
<span class="ql-formats">
|
198 |
-
<select class="ql-color"
|
|
|
|
|
199 |
<!-- <select class="ql-background"></select> -->
|
200 |
</span>
|
201 |
<!-- <span class="ql-formats">
|
@@ -234,6 +253,8 @@
|
|
234 |
<div id="editor-container" style="height:300px;"></div>
|
235 |
</div>
|
236 |
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
|
|
|
|
|
237 |
<script>
|
238 |
|
239 |
// Register the customs format with Quill
|
@@ -259,6 +280,27 @@
|
|
259 |
},
|
260 |
theme: 'snow'
|
261 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
quill.on('text-change', () => {
|
264 |
// keep qull data inside _data to communicate with Gradio
|
|
|
5 |
<title>Rich Text to JSON</title>
|
6 |
<link rel="stylesheet" href="https://cdn.quilljs.com/1.3.6/quill.snow.css">
|
7 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
8 |
+
<link rel="stylesheet" type="text/css"
|
9 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.css">
|
10 |
<link rel="stylesheet"
|
11 |
href='https://fonts.googleapis.com/css?family=Mirza|Roboto|Slabo+27px|Sofia|Inconsolata|Ubuntu|Akronim|Monoton&display=swap'>
|
12 |
<style>
|
|
|
162 |
.ql-font-Monoton {
|
163 |
font-family: "Monoton";
|
164 |
}
|
165 |
+
|
166 |
+
.ql-color .ql-picker-options [data-value=Color-Picker] {
|
167 |
+
background: none !important;
|
168 |
+
width: 100% !important;
|
169 |
+
height: 20px !important;
|
170 |
+
text-align: center;
|
171 |
+
}
|
172 |
+
|
173 |
+
.ql-color .ql-picker-options [data-value=Color-Picker]:before {
|
174 |
+
content: 'Color Picker';
|
175 |
+
}
|
176 |
+
|
177 |
+
.ql-color .ql-picker-options [data-value=Color-Picker]:hover {
|
178 |
+
border-color: transparent !important;
|
179 |
+
}
|
180 |
</style>
|
181 |
</head>
|
182 |
|
|
|
212 |
<button class="ql-underline"></button>
|
213 |
</span> -->
|
214 |
<span class="ql-formats">
|
215 |
+
<select class="ql-color">
|
216 |
+
<option value="Color-Picker"></option>
|
217 |
+
</select>
|
218 |
<!-- <select class="ql-background"></select> -->
|
219 |
</span>
|
220 |
<!-- <span class="ql-formats">
|
|
|
253 |
<div id="editor-container" style="height:300px;"></div>
|
254 |
</div>
|
255 |
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
|
256 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
257 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script>
|
258 |
<script>
|
259 |
|
260 |
// Register the customs format with Quill
|
|
|
280 |
},
|
281 |
theme: 'snow'
|
282 |
});
|
283 |
+
var toolbar = quill.getModule('toolbar');
|
284 |
+
$(toolbar.container).find('.ql-color').spectrum({
|
285 |
+
preferredFormat: "rgb",
|
286 |
+
showInput: true,
|
287 |
+
showInitial: true,
|
288 |
+
showPalette: true,
|
289 |
+
showSelectionPalette: true,
|
290 |
+
palette: [
|
291 |
+
["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"],
|
292 |
+
["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"],
|
293 |
+
["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
|
294 |
+
["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"],
|
295 |
+
["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"],
|
296 |
+
["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"],
|
297 |
+
["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"]
|
298 |
+
],
|
299 |
+
change: function (color) {
|
300 |
+
var value = color.toHexString();
|
301 |
+
quill.format('color', value);
|
302 |
+
}
|
303 |
+
});
|
304 |
|
305 |
quill.on('text-change', () => {
|
306 |
// keep qull data inside _data to communicate with Gradio
|