forked from slab/quill
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Peter Soots
committed
May 31, 2018
1 parent
223db76
commit 1cee540
Showing
6 changed files
with
105 additions
and
16 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
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
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
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,59 @@ | ||
<!-- head --> | ||
|
||
|
||
<!-- head --> | ||
<template id="shadow-contents"> | ||
<link rel="stylesheet" href="{{site.katex}}/katex.min.css"> | ||
<link rel="stylesheet" href="{{site.highlightjs}}/styles/monokai-sublime.min.css"> | ||
<link rel="stylesheet" href="{{site.cdn}}{{site.version}}/quill.snow.css"> | ||
<style> | ||
.standalone-container { | ||
margin: 50px auto; | ||
max-width: 720px; | ||
} | ||
#snow-container { | ||
height: 350px; | ||
} | ||
</style> | ||
<div class="standalone-container"> | ||
<div id="snow-container"></div> | ||
</div> | ||
</template> | ||
<p>I'm a text thing that's outside</p> | ||
<quill-editor></quill-editor> | ||
|
||
<!-- script --> | ||
<script src="{{site.katex}}/katex.min.js"></script> | ||
<script src="{{site.highlightjs}}/highlight.min.js"></script> | ||
<script src="{{site.cdn}}{{site.version}}/{{site.quill}}"></script> | ||
<script> | ||
let shadowContents = document.getElementById('shadow-contents').innerHTML | ||
|
||
class Editor extends HTMLElement { | ||
constructor () { | ||
super() | ||
this.wrapper = this.createInnerDocument() | ||
this.quill = this.createEditor() | ||
} | ||
|
||
createInnerDocument () { | ||
let shadow = this.attachShadow({ mode: 'open' }) | ||
let shadowContainer = document.createElement('div') | ||
shadowContainer.innerHTML = shadowContents | ||
shadow.appendChild(shadowContainer) | ||
return shadowContainer | ||
} | ||
|
||
createEditor () { | ||
let container = this.wrapper.querySelector('#snow-container') | ||
return new Quill(container, { | ||
placeholder: 'Compose an epic...', | ||
theme: 'snow' | ||
}) | ||
} | ||
} | ||
|
||
window.customElements.define('quill-editor', Editor) | ||
|
||
</script> | ||
<!-- script --> |
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,7 @@ | ||
--- | ||
layout: standalone | ||
title: Snow Theme under Shadow DOM | ||
permalink: /standalone/shadow/ | ||
--- | ||
|
||
{% include standalone/shadow.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