-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add import of pb-tify in pb-tify demo codepen
- Loading branch information
1 parent
4f09858
commit 2ff755b
Showing
2 changed files
with
17 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ const codePenEndpoint = "https://teipublisher.com/exist/apps/tei-publisher"; | |
|
||
/** | ||
* Viewer for demo code. | ||
* | ||
* | ||
* @customElement pb-demo-snippet | ||
* @polymer | ||
* @appliesMixin pbMixin | ||
|
@@ -28,7 +28,10 @@ export class PbDemoSnippet extends LitElement { | |
}, | ||
_editCodeLabel: { | ||
type: String | ||
} | ||
}, | ||
_requirePbTify: { | ||
type: Boolean | ||
}, | ||
}; | ||
} | ||
|
||
|
@@ -37,10 +40,12 @@ export class PbDemoSnippet extends LitElement { | |
this.title = 'TEI Publisher Webcomponents Example'; | ||
this.code = 'Loading ...'; | ||
this._showCodeLabel = 'demo.showCode.show'; | ||
this._requirePbTify = false; | ||
} | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
this._requirePbTify = !!this.getAttribute('require-pb-tify'); | ||
const template = this.querySelector('template'); | ||
this.code = PbDemoSnippet.removeIndent(template.innerHTML); | ||
this.code = this.code.replace(/\s*<style[\s\S]*>[\s\S]*?<\/style>\s*/g, ''); | ||
|
@@ -75,22 +80,28 @@ body { | |
} | ||
${PbDemoSnippet.removeIndent(css)}`; | ||
|
||
const cpHtml = ` | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>${ this.title}</title> | ||
<title>${this.title}</title> | ||
<script src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-loader.js"></script> | ||
<script type="module" src="https://unpkg.com/@teipublisher/pb-components@latest/dist/pb-components-bundle.js"></script> | ||
<script type="module" src="https://unpkg.com/@teipublisher/pb-components@latest/dist/pb-leaflet-map.js"></script> | ||
</head> | ||
<body> | ||
${ cpCode} | ||
${cpCode} | ||
</body> | ||
${ | ||
this._requirePbTify | ||
? '<script type="module" src="https://unpkg.com/@teipublisher/pb-components@latest/dist/pb-tify.js"></script>' | ||
: '' | ||
} | ||
</html>`; | ||
|
||
const cpOptions = { | ||
|