Customized menu
This commit is contained in:
parent
8fd66c7673
commit
a347637a8e
1 changed files with 31 additions and 9 deletions
|
|
@ -24,23 +24,45 @@
|
||||||
<div id="bubble-container"></div>
|
<div id="bubble-container"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="quill.min.js"></script>
|
<form><input type="hidden" name="md" id="md" />
|
||||||
|
<input id="btnSubmit" type="submit" value="Valider" class="ql-hidden"/></form>
|
||||||
|
<script type="text/javascript" src="quill.min.js"></script>
|
||||||
<script type="text/javascript" src="jquery.js"></script>
|
<script type="text/javascript" src="jquery.js"></script>
|
||||||
<script type="text/javascript" src="showdown.js"></script>
|
<script type="text/javascript" src="showdown.js"></script>
|
||||||
<script type="text/javascript" src="to-markdown.js"></script>
|
<script type="text/javascript" src="to-markdown.js"></script>
|
||||||
<script type="text/javascript" src="md-helpers.js"></script>
|
<script type="text/javascript" src="md-helpers.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var quill = new Quill('#bubble-container', {
|
var toolbarOptions = [
|
||||||
placeholder: 'Compose an epic...',
|
['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
||||||
|
['blockquote', 'code-block'],
|
||||||
|
|
||||||
|
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||||
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
|
||||||
|
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
|
||||||
|
|
||||||
|
['clean'] // remove formatting button
|
||||||
|
];
|
||||||
|
|
||||||
|
var quill = new Quill('#bubble-container', {
|
||||||
|
modules: {
|
||||||
|
toolbar: toolbarOptions
|
||||||
|
},
|
||||||
|
placeholder: 'Composez votre texte ...',
|
||||||
theme: 'bubble'
|
theme: 'bubble'
|
||||||
});
|
});
|
||||||
|
function getMD() {
|
||||||
function GetMD() {
|
return markdownize($('#bubble-container div.ql-editor').html())
|
||||||
return $("<div>"+markdownize($('#bubble-container div.ql-editor').html())+"</div>").text()
|
|
||||||
}
|
}
|
||||||
</script>
|
quill.on('text-change', function (delta, oldDelta, source)
|
||||||
|
{
|
||||||
|
if (source === "user") {
|
||||||
|
$('#md').val(getMD());
|
||||||
|
$('#btnSubmit').removeClass('ql-hidden');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue