forked from jspreadsheet/ce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
input caret to the end IE fix + jexcel as webcomponent
- Loading branch information
Showing
2 changed files
with
85 additions
and
25 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
class Jexcel extends HTMLElement { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
init(o) { | ||
// Shadow root | ||
const shadowRoot = this.attachShadow({mode: 'open'}); | ||
|
||
// Style | ||
const cssJexcel = document.createElement('link'); | ||
cssJexcel.rel = 'stylesheet'; | ||
cssJexcel.type = 'text/css' | ||
cssJexcel.href = 'jexcel.css'; | ||
shadowRoot.appendChild(cssJexcel); | ||
|
||
const cssJsuites = document.createElement('link'); | ||
cssJsuites.rel = 'stylesheet'; | ||
cssJsuites.type = 'text/css' | ||
cssJsuites.href = 'jsuites.css'; | ||
shadowRoot.appendChild(cssJsuites); | ||
|
||
// Jexcel container | ||
var container = document.createElement('div'); | ||
shadowRoot.appendChild(container); | ||
|
||
// Garantee all elements are rendered | ||
setTimeout(function() { | ||
// Parse JSON | ||
var config = JSON.parse(o.innerHTML); | ||
// Root | ||
config.root = shadowRoot; | ||
// Reset container | ||
o.innerHTML = ''; | ||
// Create jexcel element | ||
jexcel(container, config); | ||
}, 0); | ||
} | ||
|
||
connectedCallback() { | ||
this.init(this); | ||
} | ||
|
||
disconnectedCallback() { | ||
} | ||
|
||
attributeChangedCallback() { | ||
} | ||
} | ||
|
||
window.customElements.define('jexcel-spreadsheet', Jexcel); |