-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
3,592 additions
and
1,796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!doctype html> | ||
<html class="no-js" lang=""> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>shortcodes.js - JavaScript Front-end Shortcode Engine</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<link rel="icon" type="image/png" href=""> | ||
|
||
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700|IBM+Plex+Mono:400,600&display=swap" rel="stylesheet"> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism-tomorrow.min.css" rel="stylesheet" /> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css"/> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick-theme.css"/> | ||
|
||
<link rel="stylesheet" type="text/css" href="styles.css"> | ||
|
||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"> | ||
|
||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | ||
<!-- | ||
======================================================================== | ||
INITIALIZE SHORTCODES | ||
======================================================================== | ||
--> | ||
<script type="text/javascript" src="shortcodes.js"></script> | ||
<script type="text/javascript"> | ||
var shortcodes = new Shortcodes(); | ||
</script> | ||
</head> | ||
<body class="editor-active"> | ||
{% block content %} {% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"></script> | ||
<!-- initialize Quill WYSIWYG editor --> | ||
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script> | ||
<script type="text/javascript"> | ||
var toolbarOptions = [ | ||
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], | ||
['bold', 'italic', 'underline', 'strike'], // toggled buttons | ||
['blockquote', 'link', 'image'], | ||
[{ 'list': 'ordered'}, { 'list': 'bullet' }], | ||
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript | ||
[{'align': []}], | ||
['code-block'], | ||
['clean'] // remove formatting button | ||
]; | ||
var options = { | ||
bounds: '#editor .editor', | ||
modules: { | ||
toolbar: toolbarOptions | ||
}, | ||
theme: 'snow' | ||
}; | ||
var editor = new Quill('#editor .editor', options); | ||
|
||
editor.on('text-change', function(delta, oldDelta, source) { | ||
$('.code-button.active').parent().find('.code').stop(true).fadeOut(); | ||
$('.code-button.active').removeClass('active'); | ||
|
||
shortcodes.reinit($('#editor .ql-editor').clone(), function(){ | ||
// https://www.youtube.com/watch?v=qetW6R9Jxs4 | ||
}); | ||
}); | ||
</script> | ||
|
||
<!-- initialize other demo-only actions --> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
function codeButton(elem) { | ||
$('.code-button.active').not(elem).parent().find('.code').stop(true).fadeOut(); | ||
$('.code-button.active').not(elem).removeClass('active'); | ||
|
||
var $code = $(elem).parent().find('.code'); | ||
var $root = $(elem).closest('.shortcode-js'); | ||
|
||
if ($(elem).hasClass('active')) { | ||
$(elem).removeClass('active'); | ||
$code.stop(true).fadeOut(); | ||
} else { | ||
$(elem).addClass('active'); | ||
$code.css('max-height', $root.height() - 118); | ||
$code.css('height', 'calc(100vh - 118px)'); | ||
$code.stop(true).fadeIn(); | ||
} | ||
} | ||
$('body').on('click', '.code-button', function(e) { | ||
e.preventDefault(); | ||
codeButton(this); | ||
}); | ||
|
||
$('.sidebar .carret a, .toggle-editor').on('click', function(e) { | ||
e.preventDefault(); | ||
$('body').toggleClass('editor-active'); | ||
|
||
setTimeout(function(){ | ||
$(window).trigger('resize'); | ||
}, 250); | ||
}); | ||
|
||
if (window.innerWidth < 960) { | ||
$('body').removeClass('editor-active'); | ||
} | ||
|
||
$('body').on('click', 'a[target="_action"]', function(e) { | ||
e.preventDefault(); | ||
|
||
if ($(this).attr('href') === '#view-code') { | ||
codeButton($(this).closest('.shortcode-js').find('.code-button')); | ||
} else if ($(this).attr('href') === '#toggle-editor') { | ||
$('.sidebar .carret a').trigger('click'); | ||
} | ||
}); | ||
}); | ||
</script> | ||
|
||
<!-- | ||
======================================================================== | ||
EXECUTE SHORTCODES | ||
======================================================================== | ||
--> | ||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
shortcodes.execute($('#editor .ql-editor').clone(), function() { | ||
// https://www.youtube.com/watch?v=qetW6R9Jxs4 | ||
console.log(arguments); | ||
}); | ||
}); | ||
</script> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/prism.min.js"></script> | ||
|
||
|
||
<script>document.write('<script src="http://' | ||
+ (location.host || 'localhost').split(':')[0] | ||
+ ':35729/livereload.js?snipver=1"></' | ||
+ 'script>')</script> |
Oops, something went wrong.